Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.9 KiB

  1. //====== Copyright � 1996-2003, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef VTFPREVIEWPANEL_H
  7. #define VTFPREVIEWPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/Panel.h"
  12. #include "tier1/utlstring.h"
  13. #include "materialsystem/MaterialSystemUtil.h"
  14. #include "mathlib/vector.h"
  15. //-----------------------------------------------------------------------------
  16. // Forward declarations
  17. //-----------------------------------------------------------------------------
  18. //-----------------------------------------------------------------------------
  19. //
  20. // VTF Preview panel
  21. //
  22. //-----------------------------------------------------------------------------
  23. class CVTFPreviewPanel : public vgui::Panel
  24. {
  25. DECLARE_CLASS_SIMPLE( CVTFPreviewPanel, vgui::Panel );
  26. public:
  27. // constructor
  28. CVTFPreviewPanel( vgui::Panel *pParent, const char *pName );
  29. void SetVTF( const char *pFullPath, bool bLoadImmediately = true );
  30. void SetTwoVTFs( const char *pFullPath, const char *pSecondFullPath );
  31. const char *GetVTF() const;
  32. const char *GetSecondVTF() const;
  33. // Paints the texture
  34. virtual void Paint( void );
  35. private:
  36. void PaintNormalMapTexture( void );
  37. void PaintCubeTexture( void );
  38. void PaintStandardTexture( void );
  39. void PaintVolumeTexture( void );
  40. // Set up a projection matrix for a 90 degree fov
  41. void SetupProjectionMatrix( int nWidth, int nHeight );
  42. // Sets the camera to look at the the thing we're spinning around
  43. void LookAt( const Vector &vecLookAt, float flRadius );
  44. // Draw a sphere
  45. void RenderSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi );
  46. CUtlString m_VTFName;
  47. CUtlString m_SecondVTFName;
  48. CTextureReference m_PreviewTexture;
  49. CTextureReference m_SecondPreviewTexture;
  50. CMaterialReference m_PreviewMaterial;
  51. int m_nTextureID;
  52. Vector m_vecCameraDirection;
  53. float m_flLastRotationTime;
  54. };
  55. #endif // VTFPREVIEWPANEL_H