summaryrefslogtreecommitdiff
path: root/hammer/texture.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 /hammer/texture.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'hammer/texture.h')
-rw-r--r--hammer/texture.h155
1 files changed, 155 insertions, 0 deletions
diff --git a/hammer/texture.h b/hammer/texture.h
new file mode 100644
index 0000000..cf7b865
--- /dev/null
+++ b/hammer/texture.h
@@ -0,0 +1,155 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Simple texture object used for sprites. Handed to the renderer
+// for binding. May become a general purpose texture object.
+//
+//=============================================================================//
+
+#ifndef TEXTURE_H
+#define TEXTURE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "IEditorTexture.h"
+
+
+enum
+{
+ TEXTURE_HAS_ALPHA = 0x01
+};
+
+
+class CTexture : public IEditorTexture
+{
+ public:
+
+ CTexture( void );
+ virtual ~CTexture( void );
+
+ bool Allocate( int nWidth, int nHeight, int nFlags );
+
+ void Draw(CDC *pDC, RECT &rect, int iFontHeight, int iIconHeight, DrawTexData_t &DrawTexData);
+
+ inline void *GetImageDataPtr( void )
+ {
+ return( m_pImageData );
+ }
+
+ const char *GetFileName(void) const;
+
+ inline const char *GetName(void) const
+ {
+ return(m_szName);
+ }
+ int GetShortName(char *pszName) const;
+
+ int GetKeywords(char *pszKeywords) const;
+
+ int GetImageDataRGB( void *pData = NULL );
+ int GetImageDataRGBA( void *pData = NULL );
+
+ inline int GetImageWidth( void ) const
+ {
+ return( m_nWidth );
+ }
+
+ inline int GetImageHeight( void ) const
+ {
+ return( m_nHeight );
+ }
+
+ inline int GetWidth( void ) const
+ {
+ return( m_nWidth );
+ }
+
+ inline int GetHeight( void ) const
+ {
+ return( m_nHeight );
+ }
+
+ inline float GetDecalScale( void ) const
+ {
+ return( 1.0f );
+ }
+
+ inline CPalette *GetPalette( void ) const
+ {
+ return( NULL );
+ }
+
+ inline int GetSurfaceAttributes( void ) const
+ {
+ return(0);
+ }
+
+ inline int GetSurfaceContents(void ) const
+ {
+ return(0);
+ }
+
+ inline int GetSurfaceValue( void ) const
+ {
+ return(0);
+ }
+
+ inline TEXTUREFORMAT GetTextureFormat( void ) const
+ {
+ return(tfSprite);
+ }
+
+ inline int GetTextureID( void ) const
+ {
+ return( m_nTextureID );
+ }
+
+ inline bool HasAlpha( void ) const
+ {
+ return( m_bHasAlpha );
+ }
+
+ inline bool HasData( void ) const
+ {
+ return( m_pImageData != NULL );
+ }
+
+ inline bool HasPalette( void ) const
+ {
+ return( false );
+ }
+
+ inline bool IsDummy( void ) const
+ {
+ return(( m_nWidth == 0) || ( m_nHeight == 0) || ( m_pImageData == NULL ));
+ }
+
+ bool Load( void );
+
+ inline bool IsLoaded() const
+ {
+ return true;
+ }
+
+ inline void SetTextureID( int nTextureID )
+ {
+ m_nTextureID = nTextureID;
+ }
+
+ protected:
+
+ int m_nTextureID; // Uniquely identifies this texture in all 3D renderers.
+
+ int m_nWidth;
+ int m_nHeight;
+
+ bool m_bHasAlpha;
+
+ char m_szName[MAX_PATH];
+
+ void *m_pImageData;
+};
+
+
+#endif // TEXTURE_H