My Project
Texture.h
1 #pragma once
2 #include "TerrainCommon.h"
3 #include "Terrain.h"
4 namespace ParaEngine
5 {
6  struct TextureEntity;
7 }
8 namespace ParaTerrain
9 {
10  using namespace ParaEngine;
12 
19  class Texture
20  {
21  public:
33  Texture(const uint8 * pBuffer, int width, int height, int stride, int borderSize, bool bClamp, bool useCompression, bool useAlpha = false);
47  Texture(const uint8 * pBuffer, int width, int height, int stride, int borderSize, bool bClamp, bool useCompression, int bytesPerPixel, int textureFormat);
48 
50  Texture(TextureEntity* pEntity);
51 
54  Texture();
55 
57  ~Texture();
59 
62  DeviceTexturePtr_type UploadTexture();
64 
67  void UnloadTexture();
70  uint8 *GetBuffer();
72  int GetWidth();
74  int GetHeight();
76  void SetWidth(int nWidth);
77 
79 
83  void SetSharedIndex(int index);
85 
88  int GetSharedIndex();
90 
93  void SetFilename(const char *szFilename);
96  const char *GetFilename();
98 
100  void FlipVertical();
102 
104  void FlipHorizontal();
106  bool IsBound();
108  int GetBitsPerPixel();
109  int GetBytesPerPixel();
111  bool IsClamped();
113  bool UseCompression();
115  int GetBorderSize();
117  int GetFormat();
119 
124  void SetBufferPersistent(bool persist);
126 
129  static void SetDefaultTextureFormat(int GLTextureFormat);
131 
134  static void SetAlphaTextureFormat(int GLTextureFormat);
136 
139  static void SetRgbaTextureFormat(int GLTextureFormat);
141 
144  static void SetCompressedTextureFormat(int GLTextureFormat);
146  TextureEntity* GetTextureEntity();
149  bool SetTextureEntity(TextureEntity* texture);
150 
152  DeviceTexturePtr_type GetDevicePointer();
153  bool IsEqual(ParaEngine::TextureEntity* pEntity);
154  private:
155  void Init(const uint8 * pBuffer, int width, int height, int stride, int borderSize, bool bClamp, bool useCompression, bool useAlpha = false);
156  uint8 *m_pBuffer;
157  int m_nWidth;
158  int m_nHeight;
159  int m_RowLength;
160  int m_BorderSize;
161  bool m_UseCompression:1;
162  bool m_bClamp:1;
163  bool m_BufferPersistent:1;
164  bool m_bIsParaEngineEntity:1;
165  ref_ptr<TextureEntity> m_TextureID;
166  int m_SharedIndex;
167  char *m_szFilename;
168  int m_BytesPerPixel;
169  int m_TextureFormat;
170  static int m_DefaultTextureFormat;
171  static int m_CompressedTextureFormat;
172  static int m_AlphaTextureFormat;
173  static int m_RgbaTextureFormat;
174 
175  friend class DetailTexture;
176  };
177 }
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
Definition: SceneObject.h:15
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: mdx.h:48
The ref_ptr class template stores a pointer to a dynamically allocated (AssetEntity|CRefCounted|BaseA...
Definition: PERefPtr.h:13
A DetailTexture is a "layer" that can be painted onto to put texture "splats" on a terrain surface...
Definition: DetailTexture.h:23