summaryrefslogtreecommitdiff
path: root/public/matsys_controls/vtfpreviewpanel.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/matsys_controls/vtfpreviewpanel.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'public/matsys_controls/vtfpreviewpanel.h')
-rw-r--r--public/matsys_controls/vtfpreviewpanel.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/public/matsys_controls/vtfpreviewpanel.h b/public/matsys_controls/vtfpreviewpanel.h
new file mode 100644
index 0000000..7fdccbc
--- /dev/null
+++ b/public/matsys_controls/vtfpreviewpanel.h
@@ -0,0 +1,70 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef VTFPREVIEWPANEL_H
+#define VTFPREVIEWPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "vgui_controls/Panel.h"
+#include "tier1/utlstring.h"
+#include "materialsystem/MaterialSystemUtil.h"
+#include "mathlib/vector.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+
+
+//-----------------------------------------------------------------------------
+//
+// VTF Preview panel
+//
+//-----------------------------------------------------------------------------
+class CVTFPreviewPanel : public vgui::Panel
+{
+ DECLARE_CLASS_SIMPLE( CVTFPreviewPanel, vgui::Panel );
+
+public:
+ // constructor
+ CVTFPreviewPanel( vgui::Panel *pParent, const char *pName );
+ virtual ~CVTFPreviewPanel();
+
+ void SetVTF( const char *pFullPath, bool bLoadImmediately = true );
+ const char *GetVTF() const;
+
+ // Paints the texture
+ virtual void Paint( void );
+
+private:
+ void PaintNormalMapTexture( void );
+ void PaintCubeTexture( void );
+ void PaintStandardTexture( void );
+ void PaintVolumeTexture( void );
+
+ // Set up a projection matrix for a 90 degree fov
+ void SetupProjectionMatrix( int nWidth, int nHeight );
+
+ // Sets the camera to look at the the thing we're spinning around
+ void LookAt( const Vector &vecLookAt, float flRadius );
+
+ // Draw a sphere
+ void RenderSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi );
+
+ CUtlString m_VTFName;
+ CTextureReference m_PreviewTexture;
+ CMaterialReference m_PreviewMaterial;
+ int m_nTextureID;
+ Vector m_vecCameraDirection;
+ float m_flLastRotationTime;
+};
+
+
+#endif // VTFPREVIEWPANEL_H \ No newline at end of file