OpenBarnyard
 
Loading...
Searching...
No Matches
TTextureFactory.h
Go to the documentation of this file.
1#pragma once
3
4#include "Toshi/TNodeList.h"
5#include "Render/TResource.h"
6
8
9class TTexture;
10class T2Texture;
11
13{
14public:
16
17public:
18 class NameEntry : public TNodeList<NameEntry>::TNode
19 {
20 public:
21 constexpr static TUINT32 MAX_TEXTURENAMELEN = 50;
22
23 public:
24 NameEntry( const TCHAR* a_szName, TTexture* a_pTexture );
25 ~NameEntry();
26
27 const TCHAR* GetName() const { return m_szName; }
28 TTexture* GetTexture() { return m_pTexture; }
29
30 private:
31 TCHAR m_szName[ MAX_TEXTURENAMELEN ];
32 TTexture* m_pTexture;
33 };
34
35 constexpr static TUINT32 NUM_LISTS = 1024;
36
37public:
38 TTextureFactory() = default;
40
41 virtual void Dump() const;
42 virtual TTexture* CreateTextureFromFile( const TCHAR* a_szFilePath, TUINT32 a_eTextureFlags ) = 0;
43 virtual TTexture* CreateTextureFromMemory( void* a_pData, TUINT a_uiDataSize, TUINT a_eTextureFlags, TUINT a_uiWidth, TUINT a_uiHeight ) = 0;
44 virtual TTexture* CreateEx( void* a_pData, TUINT a_uiDataSize, TUINT a_uiWidth, TUINT a_uiHeight, TUINT a_uiMipLevels, TTEXTURERESOURCEFORMAT a_eFormat, TUINT a_uiMipMapFlags ) = 0;
45 virtual TTexture* CreateFromT2Texture( T2Texture* a_pTexture ) = 0;
46
48
49 TTexture* FindTexture( const TCHAR* a_szName ) const;
50 NameEntry* RegisterTexture( const TCHAR* a_szName, TTexture* a_pTexture );
51 void DeregisterTexture( TTexture* a_pTexture );
52
53 static TUINT32 HashName( const TCHAR* a_szName );
54
55private:
57};
58
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
unsigned int TUINT
Definition Typedefs.h:8
char TCHAR
Definition Typedefs.h:20
uint32_t TUINT32
Definition Typedefs.h:13
TNodeList< NameEntry > * GetList(TUINT a_uiList)
virtual TTexture * CreateTextureFromMemory(void *a_pData, TUINT a_uiDataSize, TUINT a_eTextureFlags, TUINT a_uiWidth, TUINT a_uiHeight)=0
TTextureFactory()=default
virtual TTexture * CreateEx(void *a_pData, TUINT a_uiDataSize, TUINT a_uiWidth, TUINT a_uiHeight, TUINT a_uiMipLevels, TTEXTURERESOURCEFORMAT a_eFormat, TUINT a_uiMipMapFlags)=0
virtual TTexture * CreateFromT2Texture(T2Texture *a_pTexture)=0
NameEntry * RegisterTexture(const TCHAR *a_szName, TTexture *a_pTexture)
virtual void Dump() const
void DeregisterTexture(TTexture *a_pTexture)
virtual TTexture * CreateTextureFromFile(const TCHAR *a_szFilePath, TUINT32 a_eTextureFlags)=0
TDECLARE_CLASS(TTextureFactory, TResource)
TTexture * FindTexture(const TCHAR *a_szName) const
static TUINT32 HashName(const TCHAR *a_szName)
static constexpr TUINT32 NUM_LISTS
static constexpr TUINT32 MAX_TEXTURENAMELEN
const TCHAR * GetName() const
NameEntry(const TCHAR *a_szName, TTexture *a_pTexture)
constexpr TNode()
Definition TNodeList.h:15