-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd42076
commit 15e8af7
Showing
17 changed files
with
472 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include "TResource.h" | ||
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
class TOSHI_EXPORT TNullResource : public TResource | ||
{ | ||
DECLARE_DYNAMIC(TNullResource) | ||
}; | ||
|
||
TOSHI_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#include "TKernel/TObject.h" | ||
#include "TKernel/TKernelInterface.h" | ||
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
class TRenderInterface; | ||
|
||
class TOSHI_EXPORT TRenderContext | ||
{ | ||
private: | ||
TRenderInterface* m_pRenderInterface; // 0x4 | ||
}; | ||
|
||
TOSHI_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#pragma once | ||
|
||
#include "TKernel/TObject.h" | ||
#include "TKernel/TKernelInterface.h" | ||
#include "TRenderContext.h" | ||
#include "TResource.h" | ||
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
class TOSHI_EXPORT TRenderInterface : public TObject | ||
{ | ||
DECLARE_DYNAMIC(TRenderInterface) | ||
|
||
enum FLAG | ||
{ | ||
FLAG_DIRTY = BITFIELD(0), | ||
FLAG_FOG = BITFIELD(1), | ||
FLAG_HAS_MODELWORLDMATRIX = BITFIELD(2), | ||
FLAG_HAS_VIEWWORLDMATRIX = BITFIELD(3), | ||
FLAG_UNK3 = BITFIELD(4), | ||
FLAG_UNK4 = BITFIELD(5), | ||
FLAG_HAS_WORLDPLANES = BITFIELD(6), | ||
FLAG_UNK6 = BITFIELD(7), | ||
FLAG_DIRTY_WORLDMODELMATRIX = BITFIELD(8), | ||
FLAG_DIRTY_VIEWMODELMATRIX = BITFIELD(9), | ||
}; | ||
|
||
enum SYSRESOURCES | ||
{ | ||
SYSRESOURCE_VFACTORIES = 0, | ||
SYSRESOURCE_VFSYSSVNDUV1 = 1, | ||
SYSRESOURCE_VFSKIN = 2, | ||
SYSRESOURCE_VFUNK1 = 3, | ||
SYSRESOURCE_VFUNK2 = 4, | ||
SYSRESOURCE_IFACTORIES = 5, | ||
SYSRESOURCE_IFSYS = 6, | ||
SYSRESOURCE_SHADERS = 7, | ||
SYSRESOURCE_SHSYS = 8, | ||
SYSRESOURCE_SHSKIN = 9, | ||
SYSRESOURCE_SHUNK1 = 10, | ||
SYSRESOURCE_SHLINE = 11, | ||
SYSRESOURCE_STORAGE = 12, | ||
SYSRESOURCE_MESHES = 13, | ||
SYSRESOURCE_TEXTURES = 14, | ||
SYSRESOURCE_SOUNDS = 15, | ||
SYSRESOURCE_GFX = 16, | ||
SYSRESOURCE_SCENE = 17, | ||
SYSRESOURCE_TEXTUREFACTORY = 18, | ||
SYSRESOURCES_NUMOF = 19 | ||
}; | ||
|
||
public: | ||
|
||
TRenderInterface(); | ||
|
||
virtual TBOOL Create(TKernelInterface* pKernelInterface); | ||
|
||
protected: | ||
|
||
virtual TBOOL CreateSystemResources(); | ||
|
||
public: | ||
|
||
TResource* CreateResource(const TClass* a_pClass, TPCCHAR a_szResName, TResource* a_pResource); | ||
|
||
TResource* GetSystemResource(SYSRESOURCES a_SystemResource) | ||
{ | ||
TASSERT(a_SystemResource < TRenderInterface::SYSRESOURCES_NUMOF); | ||
TASSERT(m_aSysResources[a_SystemResource]!=TNULL); | ||
return m_aSysResources[a_SystemResource]; | ||
} | ||
|
||
TRenderContext* SetCurrentRenderContext(TRenderContext* a_pRenderContext) | ||
{ | ||
TRenderContext* pLastRenderContext = m_pCurrentRenderContext; | ||
m_pCurrentRenderContext = a_pRenderContext; | ||
return pLastRenderContext; | ||
} | ||
|
||
TBOOL IsCreated() { return m_bIsCreated; } | ||
|
||
private: | ||
|
||
static TRenderInterface* s_Interface; | ||
|
||
TBOOL m_bIsCreated; // 0x9 | ||
TRenderContext* m_pCurrentRenderContext; // 0x1C | ||
TRenderContext* m_pDefaultRenderContext; // 0x20 | ||
TKernelInterface* m_pKernel; // 0x24 | ||
TResource* m_aSysResources[SYSRESOURCES_NUMOF]; // 0x28 | ||
TINT m_iResourceCount; // 0x124 | ||
TNodeTree<TResource> m_Resources; // 0x128 | ||
}; | ||
|
||
TOSHI_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#pragma once | ||
|
||
#include "TKernel/TObject.h" | ||
#include "TRenderInterface.h" | ||
#include "TKernel/TNodeList.h" | ||
#include "TKernel/TSystemTools.h" | ||
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
class TTextureResource; | ||
|
||
class TOSHI_EXPORT TTextureFactory : public TResource | ||
{ | ||
DECLARE_DYNAMIC(TTextureFactory) | ||
|
||
public: | ||
class NameEntry : public TNodeList<NameEntry>::TNode | ||
{ | ||
public: | ||
NameEntry(TPCCHAR a_szName, TTextureResource* a_pTexture) | ||
{ | ||
m_pTexture = a_pTexture; | ||
|
||
if (TSystem::StringLength(a_szName) < MAX_TEXTURENAMELEN) { | ||
TSystem::StringCopy(m_szName, a_szName, MAX_TEXTURENAMELEN); | ||
} | ||
else { | ||
TASSERT(1 < MAX_TEXTURENAMELEN); | ||
*m_szName = '\0'; | ||
} | ||
} | ||
~NameEntry() | ||
{ | ||
TASSERT(IsLinked()==TFALSE); | ||
} | ||
|
||
TPCCHAR GetName() const { return m_szName; } | ||
TTextureResource* GetTexture() { return m_pTexture; } | ||
|
||
private: | ||
|
||
static constexpr TUINT32 MAX_TEXTURENAMELEN = 50; | ||
|
||
TCHAR m_szName[MAX_TEXTURENAMELEN]; | ||
TTextureResource* m_pTexture; | ||
}; | ||
|
||
public: | ||
|
||
static TTextureFactory* TOSHI_API CreateHAL(TRenderInterface* a_pRenderer, TPCCHAR a_szName, TResource* a_pResource) | ||
{ | ||
return (TTextureFactory*)a_pRenderer->CreateResource(TClass::Find("TTextureFactoryHAL", TNULL), a_szName, a_pResource); | ||
} | ||
|
||
protected: | ||
|
||
TUINT HashName(TPCCHAR a_szName); | ||
|
||
TTextureFactory::NameEntry* RegisterTexture(TPCCHAR a_szName, TTextureResource* a_pResource); | ||
|
||
private: | ||
|
||
static constexpr TUINT32 NUM_LISTS = 1024; | ||
|
||
TNodeList<NameEntry> m_aLists[NUM_LISTS]; | ||
}; | ||
|
||
TOSHI_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
#pragma once | ||
|
||
#include "TKernel/TDebug.h" | ||
#include "TTextureFactory.h" | ||
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
class TOSHI_EXPORT TTextureResource | ||
{ | ||
|
||
friend class TTextureFactory; | ||
|
||
public: | ||
|
||
TTextureFactory::NameEntry* GetNameEntry() { return m_pNameEntry; } | ||
|
||
private: | ||
TTextureFactory::NameEntry* m_pNameEntry; | ||
}; | ||
|
||
TOSHI_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#pragma once | ||
#include "TResource.h" | ||
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
struct TVertexStreamFormat | ||
{ | ||
TUSHORT m_uiUnk = 0; | ||
TUSHORT m_uiVertexSize = 0; | ||
TUINT m_Unk = 0; | ||
}; | ||
|
||
class TVertexFactoryFormat | ||
{ | ||
public: | ||
static constexpr TUINT MAX_NUM_STREAMS = 8; | ||
|
||
TUINT m_uiNumStreams = 0; | ||
TVertexStreamFormat m_aStreamFormats[MAX_NUM_STREAMS]; | ||
|
||
TUINT GetNumStreams() const { return m_uiNumStreams; } | ||
}; | ||
|
||
class TVertexPoolResourceInterface; | ||
|
||
class TOSHI_EXPORT TVertexFactoryResourceInterface : public TResource | ||
{ | ||
DECLARE_DYNAMIC(TVertexFactoryResourceInterface) | ||
public: | ||
TVertexFactoryResourceInterface(); | ||
|
||
virtual TBOOL Create(TVertexFactoryFormat* a_pVertexFormat, TUSHORT a_uiMaxStaticVertices, TUINT a_uiFlags); | ||
virtual TVertexPoolResourceInterface* CreatePool(TUSHORT a_usMaxStaticVertices, TUINT a_uiFlags); | ||
|
||
TVertexFactoryFormat* GetVertexFormat() { return &m_oVertexFormat; } | ||
TUSHORT GetMaxStaticVertices() { return m_usMaxStaticVertices; } | ||
TUINT GetFlags() { return m_uiFlags; } | ||
|
||
private: | ||
TUINT m_uiNumCreatedVertexPools; // 0x30 | ||
TVertexFactoryFormat m_oVertexFormat; // 0x34 | ||
TUINT m_usMaxStaticVertices; // 0x78 | ||
TUINT m_uiFlags; // 0x7C | ||
}; | ||
|
||
TOSHI_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include "TRender/TResource.h" | ||
#include "TRender/TTextureResource.h" | ||
|
||
TOSHI_NAMESPACE_BEGIN | ||
|
||
class TOSHI_EXPORT TTextureFactoryHAL | ||
{ | ||
public: | ||
|
||
virtual TTextureResource* CreateEx(TPVOID); | ||
|
||
}; | ||
|
||
TOSHI_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "TNullResource.h" | ||
|
||
TOSHI_NAMESPACE_USING | ||
|
||
IMPLEMENT_DYNAMIC(TNullResource, TResource) |
Oops, something went wrong.