summaryrefslogtreecommitdiffstats
path: root/AssetLoader
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-07-20 19:47:37 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-07-20 19:47:37 +0000
commit0b6d98ea31b231a98f0d44e511df222e07444b09 (patch)
tree37854f94612df48a74c69de49d6f7d638e7cf911 /AssetLoader
parentAdded DXSDK Mesh Loader (diff)
downloadDiligentTools-0b6d98ea31b231a98f0d44e511df222e07444b09.tar.gz
DiligentTools-0b6d98ea31b231a98f0d44e511df222e07444b09.zip
DXSDK Mesh loader: implemented GPU resource initialization
Diffstat (limited to 'AssetLoader')
-rw-r--r--AssetLoader/interface/DXSDKMeshLoader.h148
-rw-r--r--AssetLoader/src/DXSDKMeshLoader.cpp280
2 files changed, 243 insertions, 185 deletions
diff --git a/AssetLoader/interface/DXSDKMeshLoader.h b/AssetLoader/interface/DXSDKMeshLoader.h
index 310e47e..18ecf93 100644
--- a/AssetLoader/interface/DXSDKMeshLoader.h
+++ b/AssetLoader/interface/DXSDKMeshLoader.h
@@ -26,10 +26,13 @@
#include <vector>
#include "../../../DiligentCore/Primitives/interface/BasicTypes.h"
-#include "../../../DiligentCore/Common/interface/BasicMath.h"
+#include "../../../DiligentCore/Graphics/GraphicsEngine/interface/RenderDevice.h"
+#include "../../../DiligentCore/Graphics/GraphicsEngine/interface/DeviceContext.h"
#include "../../../DiligentCore/Graphics/GraphicsEngine/interface/Buffer.h"
#include "../../../DiligentCore/Graphics/GraphicsEngine/interface/Texture.h"
#include "../../../DiligentCore/Graphics/GraphicsEngine/interface/TextureView.h"
+#include "../../../DiligentCore/Common/interface/BasicMath.h"
+#include "../../../DiligentCore/Common/interface/RefCntAutoPtr.h"
namespace Diligent
{
@@ -217,35 +220,34 @@ struct DXSDKMESH_MATERIAL
union
{
Uint64 Force64_1; //Force the union to 64bits
- ITexture* pDiffuseTexture;
+ ITexture* pDiffuseTexture = nullptr;
};
union
{
Uint64 Force64_2; //Force the union to 64bits
- ITexture* pNormalTexture;
+ ITexture* pNormalTexture = nullptr;
};
union
{
Uint64 Force64_3; //Force the union to 64bits
- ITexture* pSpecularTexture;
+ ITexture* pSpecularTexture = nullptr;
};
union
{
Uint64 Force64_4; //Force the union to 64bits
- ITextureView* pDiffuseRV;
+ ITextureView* pDiffuseRV = nullptr;
};
union
{
Uint64 Force64_5; //Force the union to 64bits
- ITextureView* pNormalRV;
+ ITextureView* pNormalRV = nullptr;
};
union
{
Uint64 Force64_6; //Force the union to 64bits
- ITextureView* pSpecularRV;
+ ITextureView* pSpecularRV = nullptr;
};
-
};
struct SDKANIMATION_FILE_HEADER
@@ -284,18 +286,84 @@ struct SDKANIMATION_FRAME_DATA
//--------------------------------------------------------------------------------------
class DXSDKMesh
{
-private:
- Uint32 m_NumOutstandingResources = 0;
- bool m_bLoading = false;
- std::vector<Uint8*> m_MappedPointers;
+public:
+ virtual ~DXSDKMesh();
+
+ bool Create( const Char* szFileName );
+ bool Create( Uint8* pData, Uint32 DataUint8s );
+ void LoadGPUResources(const Char* ResourceDirectory, IRenderDevice* pDevice, IDeviceContext* pDeviceCtx);
+ void Destroy();
+
+ //Helpers
+ static PRIMITIVE_TOPOLOGY GetPrimitiveType( DXSDKMESH_PRIMITIVE_TYPE PrimType );
+ VALUE_TYPE GetIBFormat( Uint32 iMesh ) const;
+ DXSDKMESH_INDEX_TYPE GetIndexType( Uint32 iMesh ) const
+ {
+ return ( DXSDKMESH_INDEX_TYPE ) m_pIndexBufferArray[m_pMeshArray[ iMesh ].IndexBuffer].IndexType;
+ }
+
+ Uint32 GetNumMeshes() const { return m_pMeshHeader ? m_pMeshHeader->NumMeshes : 0;}
+ Uint32 GetNumMaterials()const { return m_pMeshHeader ? m_pMeshHeader->NumMaterials : 0;}
+ Uint32 GetNumVBs() const { return m_pMeshHeader ? m_pMeshHeader->NumVertexBuffers : 0;}
+ Uint32 GetNumIBs() const { return m_pMeshHeader ? m_pMeshHeader->NumIndexBuffers : 0;}
+
+ const Uint8* GetRawVerticesAt( Uint32 iVB ) const {return m_ppVertices[iVB];}
+ const Uint8* GetRawIndicesAt( Uint32 iIB ) const {return m_ppIndices[iIB]; }
+ const DXSDKMESH_MATERIAL& GetMaterial( Uint32 iMaterial )const {return m_pMaterialArray[ iMaterial ];}
+
+ const DXSDKMESH_MESH& GetMesh( Uint32 iMesh ) const { return m_pMeshArray[ iMesh ];}
+ Uint32 GetNumSubsets( Uint32 iMesh ) const { return m_pMeshArray[ iMesh ].NumSubsets; }
+ const DXSDKMESH_SUBSET& GetSubset( Uint32 iMesh, Uint32 iSubset ) const
+ {
+ return m_pSubsetArray[ m_pMeshArray[ iMesh ].pSubsets[iSubset] ];
+ }
+
+ Uint32 GetMeshVertexStride( Uint32 iMesh, Uint32 iVB ) const
+ {
+ return ( Uint32 )m_pVertexBufferArray[ m_pMeshArray[ iMesh ].VertexBuffers[iVB] ].StrideUint8s;
+ }
+
+ Uint64 GetNumMeshVertices( Uint32 iMesh, Uint32 iVB ) const
+ {
+ return m_pVertexBufferArray[ m_pMeshArray[ iMesh ].VertexBuffers[iVB] ].NumVertices;
+ }
+
+ Uint64 GetNumMeshIndices( Uint32 iMesh ) const
+ {
+ return m_pIndexBufferArray[ m_pMeshArray[ iMesh ].IndexBuffer ].NumIndices;
+ }
+
+ IBuffer* GetMeshVertexBuffer(Uint32 iMesh, Uint32 iVB)
+ {
+ return m_VertexBuffers[m_pMeshArray[ iMesh ].VertexBuffers[iVB]];
+ }
+
+ IBuffer* GetMeshIndexBuffer(Uint32 iMesh)
+ {
+ return m_IndexBuffers[ m_pMeshArray[ iMesh ].IndexBuffer];
+ }
+
+ const DXSDKMESH_VERTEX_ELEMENT* VBElements( Uint32 iVB ) const { return m_pVertexBufferArray[0].Decl; }
+
+ //Uint32 GetNumFrames();
+ //DXSDKMESH_FRAME* GetFrame( Uint32 iFrame );
+ //DXSDKMESH_FRAME* FindFrame( char* pszName );
protected:
+ bool CreateFromFile( const char* szFileName );
+
+ bool CreateFromMemory( Uint8* pData,
+ Uint32 DataUint8s );
+
//These are the pointers to the two chunks of data loaded in from the mesh file
std::vector<Uint8> m_StaticMeshData;
- Uint8* m_pAnimationData = nullptr;
+ //Uint8* m_pAnimationData = nullptr;
std::vector<Uint8*> m_ppVertices;
std::vector<Uint8*> m_ppIndices;
+ std::vector<RefCntAutoPtr<IBuffer>> m_VertexBuffers;
+ std::vector<RefCntAutoPtr<IBuffer>> m_IndexBuffers;
+
//General mesh info
DXSDKMESH_HEADER* m_pMeshHeader = nullptr;
DXSDKMESH_VERTEX_BUFFER_HEADER* m_pVertexBufferArray = nullptr;
@@ -306,57 +374,15 @@ protected:
DXSDKMESH_MATERIAL* m_pMaterialArray = nullptr;
// Adjacency information (not part of the m_pStaticMeshData, so it must be created and destroyed separately )
- DXSDKMESH_INDEX_BUFFER_HEADER* m_pAdjacencyIndexBufferArray = nullptr;
+ //DXSDKMESH_INDEX_BUFFER_HEADER* m_pAdjacencyIndexBufferArray = nullptr;
//Animation (TODO: Add ability to load/track multiple animation sets)
- SDKANIMATION_FILE_HEADER* m_pAnimationHeader = nullptr;
- SDKANIMATION_FRAME_DATA* m_pAnimationFrameData = nullptr;
- float4x4* m_pBindPoseFrameMatrices = nullptr;
- float4x4* m_pTransformedFrameMatrices = nullptr;
- float4x4* m_pWorldPoseFrameMatrices = nullptr;
+ //SDKANIMATION_FILE_HEADER* m_pAnimationHeader = nullptr;
+ //SDKANIMATION_FRAME_DATA* m_pAnimationFrameData = nullptr;
+ //float4x4* m_pBindPoseFrameMatrices = nullptr;
+ //float4x4* m_pTransformedFrameMatrices = nullptr;
+ //float4x4* m_pWorldPoseFrameMatrices = nullptr;
-protected:
- virtual bool CreateFromFile( const char* szFileName,
- bool bCreateAdjacencyIndices);
-
- virtual bool CreateFromMemory( Uint8* pData,
- Uint32 DataUint8s,
- bool bCreateAdjacencyIndices,
- bool bCopyStatic );
-public:
- virtual ~DXSDKMesh();
-
- virtual bool Create( const Char* szFileName, bool bCreateAdjacencyIndices = false );
- virtual bool Create( Uint8* pData, Uint32 DataUint8s,
- bool bCreateAdjacencyIndices = false, bool bCopyStatic = false );
- virtual void Destroy();
-
-
- //Helpers (D3D11 specific)
- static PRIMITIVE_TOPOLOGY GetPrimitiveType( DXSDKMESH_PRIMITIVE_TYPE PrimType );
- VALUE_TYPE GetIBFormat( Uint32 iMesh );
- DXSDKMESH_INDEX_TYPE GetIndexType( Uint32 iMesh );
-
- //Helpers (general)
- Uint32 GetNumMeshes();
- Uint32 GetNumMaterials();
- Uint32 GetNumVBs();
- Uint32 GetNumIBs();
-
- Uint8* GetRawVerticesAt( Uint32 iVB );
- Uint8* GetRawIndicesAt( Uint32 iIB );
- DXSDKMESH_MATERIAL* GetMaterial( Uint32 iMaterial );
- DXSDKMESH_MESH* GetMesh( Uint32 iMesh );
- Uint32 GetNumSubsets( Uint32 iMesh );
- DXSDKMESH_SUBSET* GetSubset( Uint32 iMesh, Uint32 iSubset );
- Uint32 GetVertexStride( Uint32 iMesh, Uint32 iVB );
- Uint32 GetNumFrames();
- DXSDKMESH_FRAME* GetFrame( Uint32 iFrame );
- DXSDKMESH_FRAME* FindFrame( char* pszName );
- Uint64 GetNumVertices( Uint32 iMesh, Uint32 iVB );
- Uint64 GetNumIndices( Uint32 iMesh );
-
- const DXSDKMESH_VERTEX_ELEMENT* VBElements( Uint32 iVB ) { return m_pVertexBufferArray[0].Decl; }
};
} \ No newline at end of file
diff --git a/AssetLoader/src/DXSDKMeshLoader.cpp b/AssetLoader/src/DXSDKMeshLoader.cpp
index e25b782..bc4b521 100644
--- a/AssetLoader/src/DXSDKMeshLoader.cpp
+++ b/AssetLoader/src/DXSDKMeshLoader.cpp
@@ -21,17 +21,22 @@
* of the possibility of such damages.
*/
+#include <string>
+#include <sstream>
+
#include "DXSDKMeshLoader.h"
#include "DataBlobImpl.h"
#include "RefCntAutoPtr.h"
#include "FileWrapper.h"
+#include "TextureUtilities.h"
+#include "GraphicsAccessories.h"
namespace Diligent
{
//--------------------------------------------------------------------------------------
-bool DXSDKMesh::CreateFromFile( const char* szFileName, bool bCreateAdjacencyIndices)
+bool DXSDKMesh::CreateFromFile( const char* szFileName )
{
FileWrapper File;
File.Open(FileOpenAttribs{szFileName});
@@ -47,22 +52,15 @@ bool DXSDKMesh::CreateFromFile( const char* szFileName, bool bCreateAdjacencyInd
File.Close();
auto res = CreateFromMemory( reinterpret_cast<Uint8*>(pFileData->GetDataPtr()),
- static_cast<Uint32>(pFileData->GetSize()),
- bCreateAdjacencyIndices,
- false);
+ static_cast<Uint32>(pFileData->GetSize()));
return res;
}
bool DXSDKMesh::CreateFromMemory( Uint8* pData,
- Uint32 DataUint8s,
- bool bCreateAdjacencyIndices,
- bool bCopyStatic )
+ Uint32 DataUint8s )
{
- // Set outstanding resources to zero
- m_NumOutstandingResources = 0;
-
m_StaticMeshData.resize(DataUint8s);
memcpy(m_StaticMeshData.data(), pData, DataUint8s);
@@ -76,6 +74,17 @@ bool DXSDKMesh::CreateFromMemory( Uint8* pData,
m_pFrameArray = reinterpret_cast<DXSDKMESH_FRAME*> (pStaticMeshData + m_pMeshHeader->FrameDataOffset);
m_pMaterialArray = reinterpret_cast<DXSDKMESH_MATERIAL*> (pStaticMeshData + m_pMeshHeader->MaterialDataOffset);
+ for( Uint32 i = 0; i < m_pMeshHeader->NumMaterials; i++ )
+ {
+ auto& Mat = m_pMaterialArray[i];
+ Mat.pDiffuseTexture = nullptr;
+ Mat.pNormalTexture = nullptr;
+ Mat.pSpecularTexture = nullptr;
+ Mat.pDiffuseRV = nullptr;
+ Mat.pNormalRV = nullptr;
+ Mat.pSpecularRV = nullptr;
+ }
+
// Setup subsets
for( Uint32 i = 0; i < m_pMeshHeader->NumMeshes; i++ )
{
@@ -91,7 +100,7 @@ bool DXSDKMesh::CreateFromMemory( Uint8* pData,
}
// Setup buffer data pointer
- Uint8* pBufferData = pData + m_pMeshHeader->HeaderSize + m_pMeshHeader->NonBufferDataSize;
+ Uint8* pBufferData = m_StaticMeshData.data() + m_pMeshHeader->HeaderSize + m_pMeshHeader->NonBufferDataSize;
// Get the start of the buffer data
Uint64 BufferDataStart = m_pMeshHeader->HeaderSize + m_pMeshHeader->NonBufferDataSize;
@@ -100,26 +109,115 @@ bool DXSDKMesh::CreateFromMemory( Uint8* pData,
m_ppVertices.resize(m_pMeshHeader->NumVertexBuffers);
for( Uint32 i = 0; i < m_pMeshHeader->NumVertexBuffers; i++ )
{
- Uint8* pVertices = NULL;
- pVertices = reinterpret_cast<Uint8*>(pBufferData + ( m_pVertexBufferArray[i].DataOffset - BufferDataStart));
-
- m_ppVertices[i] = pVertices;
+ m_ppVertices[i] = reinterpret_cast<Uint8*>(pBufferData + ( m_pVertexBufferArray[i].DataOffset - BufferDataStart));
}
// Create IBs
m_ppIndices.resize(m_pMeshHeader->NumIndexBuffers);
for( Uint32 i = 0; i < m_pMeshHeader->NumIndexBuffers; i++ )
{
- Uint8* pIndices = NULL;
- pIndices = ( Uint8* )( pBufferData + ( m_pIndexBufferArray[i].DataOffset - BufferDataStart ) );
-
- m_ppIndices[i] = pIndices;
+ m_ppIndices[i] = reinterpret_cast<Uint8*>( pBufferData + ( m_pIndexBufferArray[i].DataOffset - BufferDataStart ) );
}
return true;
}
-//#define MAX_D3D11_VERTEX_STREAMS D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
+static void LoadTexture(IRenderDevice* pDevice,
+ const Char* ResourceDirectory,
+ const Char* Name,
+ bool IsSRGB,
+ ITexture** ppTexture,
+ ITextureView** ppSRV,
+ std::vector<StateTransitionDesc>& Barriers)
+{
+ std::string FullPath = ResourceDirectory;
+ if (!FullPath.empty() && FullPath.back() != FileSystem::GetSlashSymbol())
+ FullPath.push_back(FileSystem::GetSlashSymbol());
+ FullPath.append(Name);
+ if (FileSystem::FileExists(FullPath.c_str()))
+ {
+ TextureLoadInfo LoadInfo;
+ LoadInfo.IsSRGB = IsSRGB;
+ CreateTextureFromFile(FullPath.c_str(), LoadInfo, pDevice, ppTexture);
+ if (*ppTexture != nullptr)
+ {
+ *ppSRV = (*ppTexture)->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE);
+ (*ppSRV)->AddRef();
+ }
+ else
+ {
+ LOG_ERROR("Failed to load texture ", Name);
+ }
+ Barriers.emplace_back(*ppTexture, RESOURCE_STATE_UNKNOWN, RESOURCE_STATE_SHADER_RESOURCE, true);
+ }
+}
+
+void DXSDKMesh::LoadGPUResources(const Char* ResourceDirectory, IRenderDevice* pDevice, IDeviceContext* pDeviceCtx)
+{
+ std::vector<StateTransitionDesc> Barriers;
+ for( Uint32 i = 0; i < m_pMeshHeader->NumMaterials; i++ )
+ {
+ auto& Mat = m_pMaterialArray[i];
+ if (Mat.DiffuseTexture[0] != 0)
+ {
+ LoadTexture(pDevice, ResourceDirectory, Mat.DiffuseTexture, true, &Mat.pDiffuseTexture, &Mat.pDiffuseRV, Barriers);
+ }
+
+ if (Mat.NormalTexture[0] != 0)
+ {
+ LoadTexture(pDevice, ResourceDirectory, Mat.NormalTexture, false, &Mat.pNormalTexture, &Mat.pNormalRV, Barriers);
+ }
+
+ if (Mat.SpecularTexture[0] != 0)
+ {
+ LoadTexture(pDevice, ResourceDirectory, Mat.SpecularTexture, false, &Mat.pSpecularTexture, &Mat.pSpecularRV, Barriers);
+ }
+ }
+
+ m_VertexBuffers.resize(m_pMeshHeader->NumVertexBuffers);
+ for( Uint32 i = 0; i < m_pMeshHeader->NumVertexBuffers; i++ )
+ {
+ const auto& VBArr = m_pVertexBufferArray[i];
+
+ std::stringstream ss;
+ ss << "DXSDK Mesh vertex buffer #" << i;
+ std::string VBName = ss.str();
+ BufferDesc VBDesc;
+ VBDesc.Name = VBName.c_str();
+ VBDesc.Usage = USAGE_STATIC;
+ VBDesc.uiSizeInBytes = static_cast<Uint32>(VBArr.NumVertices * VBArr.StrideUint8s);
+ VBDesc.BindFlags = BIND_VERTEX_BUFFER;
+
+ BufferData InitData{GetRawVerticesAt(i), static_cast<Uint32>(VBArr.SizeUint8s)};
+ pDevice->CreateBuffer(VBDesc, &InitData, &m_VertexBuffers[i]);
+
+ Barriers.emplace_back(m_VertexBuffers[i], RESOURCE_STATE_UNKNOWN, RESOURCE_STATE_VERTEX_BUFFER, true);
+ }
+
+ // Create IBs
+ m_IndexBuffers.resize(m_pMeshHeader->NumIndexBuffers);
+ for( Uint32 i = 0; i < m_pMeshHeader->NumIndexBuffers; i++ )
+ {
+ const auto& IBArr = m_pIndexBufferArray[i];
+
+ std::stringstream ss;
+ ss << "DXSDK Mesh index buffer #" << i;
+ std::string IBName = ss.str();
+
+ BufferDesc IBDesc;
+ IBDesc.Name = IBName.c_str();
+ IBDesc.Usage = USAGE_STATIC;
+ IBDesc.uiSizeInBytes = static_cast<Uint32>(IBArr.NumIndices * (IBArr.IndexType == IT_16BIT ? 2 : 4));
+ IBDesc.BindFlags = BIND_INDEX_BUFFER;
+
+ BufferData InitData{GetRawIndicesAt(i), static_cast<Uint32>(IBArr.SizeUint8s)};
+ pDevice->CreateBuffer(IBDesc, &InitData, &m_IndexBuffers[i]);
+
+ Barriers.emplace_back(m_IndexBuffers[i], RESOURCE_STATE_UNKNOWN, RESOURCE_STATE_INDEX_BUFFER, true);
+ }
+
+ pDeviceCtx->TransitionResourceStates(static_cast<Uint32>(Barriers.size()), Barriers.data());
+}
//--------------------------------------------------------------------------------------
DXSDKMesh::~DXSDKMesh()
@@ -128,27 +226,53 @@ DXSDKMesh::~DXSDKMesh()
}
//--------------------------------------------------------------------------------------
-bool DXSDKMesh::Create( const Char* szFileName, bool bCreateAdjacencyIndices )
+bool DXSDKMesh::Create( const Char* szFileName )
{
- return CreateFromFile( szFileName, bCreateAdjacencyIndices );
+ return CreateFromFile( szFileName );
}
//--------------------------------------------------------------------------------------
-bool DXSDKMesh::Create( Uint8* pData, Uint32 DataUint8s, bool bCreateAdjacencyIndices, bool bCopyStatic)
+bool DXSDKMesh::Create( Uint8* pData, Uint32 DataUint8s )
{
- return CreateFromMemory( pData, DataUint8s, bCreateAdjacencyIndices, bCopyStatic );
+ return CreateFromMemory( pData, DataUint8s );
}
//--------------------------------------------------------------------------------------
void DXSDKMesh::Destroy()
{
- delete[] m_pAdjacencyIndexBufferArray; m_pAdjacencyIndexBufferArray = nullptr;
+ for( Uint32 i = 0; i < m_pMeshHeader->NumMaterials; i++ )
+ {
+ auto& Mat = m_pMaterialArray[i];
+ if (Mat.pDiffuseTexture)
+ Mat.pDiffuseTexture->Release();
+
+ if (Mat.pNormalTexture)
+ Mat.pNormalTexture->Release();
+
+ if (Mat.pSpecularTexture)
+ Mat.pSpecularTexture->Release();
+
+ if (Mat.pDiffuseRV)
+ Mat.pDiffuseRV->Release();
+
+ if (Mat.pNormalRV)
+ Mat.pNormalRV->Release();
+
+ if (Mat.pSpecularRV)
+ Mat.pSpecularRV->Release();
+ }
+
+ m_VertexBuffers.clear();
+ m_IndexBuffers.clear();
m_StaticMeshData.clear();
- delete[] m_pAnimationData; m_pAnimationData = nullptr;
- delete[] m_pBindPoseFrameMatrices; m_pBindPoseFrameMatrices = nullptr;
- delete[] m_pTransformedFrameMatrices; m_pTransformedFrameMatrices = nullptr;
- delete[] m_pWorldPoseFrameMatrices; m_pWorldPoseFrameMatrices = nullptr;
+
+ //delete[] m_pAdjacencyIndexBufferArray; m_pAdjacencyIndexBufferArray = nullptr;
+
+ //delete[] m_pAnimationData; m_pAnimationData = nullptr;
+ //delete[] m_pBindPoseFrameMatrices; m_pBindPoseFrameMatrices = nullptr;
+ //delete[] m_pTransformedFrameMatrices; m_pTransformedFrameMatrices = nullptr;
+ //delete[] m_pWorldPoseFrameMatrices; m_pWorldPoseFrameMatrices = nullptr;
m_ppVertices.clear();
m_ppIndices.clear();
@@ -161,8 +285,8 @@ void DXSDKMesh::Destroy()
m_pFrameArray = nullptr;
m_pMaterialArray = nullptr;
- m_pAnimationHeader = nullptr;
- m_pAnimationFrameData = nullptr;
+ //m_pAnimationHeader = nullptr;
+ //m_pAnimationFrameData = nullptr;
}
@@ -209,7 +333,7 @@ PRIMITIVE_TOPOLOGY DXSDKMesh::GetPrimitiveType( DXSDKMESH_PRIMITIVE_TYPE PrimTyp
}
//--------------------------------------------------------------------------------------
-VALUE_TYPE DXSDKMesh::GetIBFormat( Uint32 iMesh )
+VALUE_TYPE DXSDKMesh::GetIBFormat( Uint32 iMesh )const
{
switch( m_pIndexBufferArray[ m_pMeshArray[ iMesh ].IndexBuffer ].IndexType )
{
@@ -223,96 +347,4 @@ VALUE_TYPE DXSDKMesh::GetIBFormat( Uint32 iMesh )
}
}
-//--------------------------------------------------------------------------------------
-Uint32 DXSDKMesh::GetNumMeshes()
-{
- if( !m_pMeshHeader )
- return 0;
- return m_pMeshHeader->NumMeshes;
-}
-
-//--------------------------------------------------------------------------------------
-Uint32 DXSDKMesh::GetNumMaterials()
-{
- if( !m_pMeshHeader )
- return 0;
- return m_pMeshHeader->NumMaterials;
-}
-
-//--------------------------------------------------------------------------------------
-Uint32 DXSDKMesh::GetNumVBs()
-{
- if( !m_pMeshHeader )
- return 0;
- return m_pMeshHeader->NumVertexBuffers;
-}
-
-//--------------------------------------------------------------------------------------
-Uint32 DXSDKMesh::GetNumIBs()
-{
- if( !m_pMeshHeader )
- return 0;
- return m_pMeshHeader->NumIndexBuffers;
-}
-
-//--------------------------------------------------------------------------------------
-Uint8* DXSDKMesh::GetRawVerticesAt( Uint32 iVB )
-{
- return m_ppVertices[iVB];
-}
-
-//--------------------------------------------------------------------------------------
-Uint8* DXSDKMesh::GetRawIndicesAt( Uint32 iIB )
-{
- return m_ppIndices[iIB];
-}
-
-//--------------------------------------------------------------------------------------
-DXSDKMESH_MATERIAL* DXSDKMesh::GetMaterial( Uint32 iMaterial )
-{
- return &m_pMaterialArray[ iMaterial ];
-}
-
-//--------------------------------------------------------------------------------------
-DXSDKMESH_MESH* DXSDKMesh::GetMesh( Uint32 iMesh )
-{
- return &m_pMeshArray[ iMesh ];
-}
-
-//--------------------------------------------------------------------------------------
-Uint32 DXSDKMesh::GetNumSubsets( Uint32 iMesh )
-{
- return m_pMeshArray[ iMesh ].NumSubsets;
-}
-
-//--------------------------------------------------------------------------------------
-DXSDKMESH_SUBSET* DXSDKMesh::GetSubset( Uint32 iMesh, Uint32 iSubset )
-{
- return &m_pSubsetArray[ m_pMeshArray[ iMesh ].pSubsets[iSubset] ];
-}
-
-//--------------------------------------------------------------------------------------
-Uint32 DXSDKMesh::GetVertexStride( Uint32 iMesh, Uint32 iVB )
-{
- return ( Uint32 )m_pVertexBufferArray[ m_pMeshArray[ iMesh ].VertexBuffers[iVB] ].StrideUint8s;
-}
-
-//--------------------------------------------------------------------------------------
-Uint64 DXSDKMesh::GetNumVertices( Uint32 iMesh, Uint32 iVB )
-{
- return m_pVertexBufferArray[ m_pMeshArray[ iMesh ].VertexBuffers[iVB] ].NumVertices;
-}
-
-//--------------------------------------------------------------------------------------
-Uint64 DXSDKMesh::GetNumIndices( Uint32 iMesh )
-{
- return m_pIndexBufferArray[ m_pMeshArray[ iMesh ].IndexBuffer ].NumIndices;
-}
-
-DXSDKMESH_INDEX_TYPE DXSDKMesh::GetIndexType( Uint32 iMesh )
-{
- return ( DXSDKMESH_INDEX_TYPE ) m_pIndexBufferArray[m_pMeshArray[ iMesh ].IndexBuffer].IndexType;
-}
-
-
} \ No newline at end of file