diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/public/matsys_controls/proceduraltexturepanel.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/public/matsys_controls/proceduraltexturepanel.h')
| -rw-r--r-- | mp/src/public/matsys_controls/proceduraltexturepanel.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/mp/src/public/matsys_controls/proceduraltexturepanel.h b/mp/src/public/matsys_controls/proceduraltexturepanel.h new file mode 100644 index 00000000..d6d0998d --- /dev/null +++ b/mp/src/public/matsys_controls/proceduraltexturepanel.h @@ -0,0 +1,92 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef PROCEDURALTEXTUREPANEL_H
+#define PROCEDURALTEXTUREPANEL_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "materialsystem/itexture.h"
+#include "materialsystem/MaterialSystemUtil.h"
+#include "vgui_controls/EditablePanel.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+struct BGRA8888_t;
+
+
+//-----------------------------------------------------------------------------
+//
+// Procedural texture image panel
+//
+//-----------------------------------------------------------------------------
+class CProceduralTexturePanel : public vgui::EditablePanel, public ITextureRegenerator
+{
+ DECLARE_CLASS_SIMPLE( CProceduralTexturePanel, vgui::EditablePanel );
+
+public:
+ // constructor
+ CProceduralTexturePanel( vgui::Panel *pParent, const char *pName );
+ ~CProceduralTexturePanel();
+
+ // Methods of ITextureRegenerator
+ virtual void Release() {}
+ virtual void RegenerateTextureBits( ITexture *pTexture, IVTFTexture *pVTFTexture, Rect_t *pRect );
+
+ // initialization, shutdown
+ virtual bool Init( int nWidth, int nHeight, bool bAllocateImageBuffer );
+ virtual void Shutdown();
+
+ // Returns the image buffer + dimensions
+ BGRA8888_t *GetImageBuffer();
+ int GetImageWidth() const;
+ int GetImageHeight() const;
+
+ // Redownloads the procedural texture
+ void DownloadTexture();
+
+ // Sets the rectangle to paint. Use null to fill the entire panel
+ void SetPaintRect( const Rect_t *pPaintRect = NULL );
+
+ // Sets the texcoords to use with the procedural texture
+ void SetTextureSubRect( const Rect_t &subRect );
+
+ // Maintain proportions when drawing
+ void MaintainProportions( bool bEnable );
+
+ virtual void Paint( void );
+ virtual void PaintBackground( void ) {}
+
+private:
+ void CleanUp();
+
+protected:
+ // Image buffer
+ BGRA8888_t *m_pImageBuffer;
+ int m_nWidth;
+ int m_nHeight;
+
+ // Paint rectangle
+ Rect_t m_PaintRect;
+
+ // Texture coordinate rectangle
+ Rect_t m_TextureSubRect;
+
+ CTextureReference m_ProceduralTexture;
+ CMaterialReference m_ProceduralMaterial;
+
+ int m_nTextureID;
+ bool m_bMaintainProportions;
+ bool m_bUsePaintRect;
+};
+
+
+#endif // PROCEDURALTEXTUREPANEL_H
|