aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/externals/extensions/include/nvsimplemesh
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/externals/extensions/include/nvsimplemesh
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'APEX_1.4/externals/extensions/include/nvsimplemesh')
-rw-r--r--APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleMesh.h55
-rw-r--r--APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleMeshLoader.h30
-rw-r--r--APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleRawMesh.h54
3 files changed, 139 insertions, 0 deletions
diff --git a/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleMesh.h b/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleMesh.h
new file mode 100644
index 00000000..debb6adf
--- /dev/null
+++ b/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleMesh.h
@@ -0,0 +1,55 @@
+// TAGRELEASE: PUBLIC
+#pragma once
+#include <DirectXMath.h>
+
+class NvSimpleRawMesh;
+class NvSimpleMeshLoader;
+
+class NvSimpleMesh
+{
+public:
+ NvSimpleMesh();
+
+ HRESULT Initialize(ID3D11Device *pd3dDevice,NvSimpleRawMesh *pRawMesh);
+ HRESULT InitializeWithInputLayout(ID3D11Device *pd3dDevice,NvSimpleRawMesh *pRawMesh,BYTE*pIAsig, SIZE_T pIAsigSize);
+ HRESULT CreateInputLayout(ID3D11Device *pd3dDevice,BYTE*pIAsig, SIZE_T pIAsigSize);
+ void Release();
+
+ void SetupDraw(ID3D11DeviceContext *pd3dContext, int iDiffuseTexSlot=-1, int iNormalsTexSlot=-1);
+ void Draw(ID3D11DeviceContext *pd3dContext);
+ void DrawInstanced(ID3D11DeviceContext *pd3dContext, int iNumInstances);
+
+ UINT iNumVertices;
+ UINT iNumIndices;
+ DXGI_FORMAT IndexFormat;
+ UINT VertexStride;
+
+ DirectX::XMFLOAT3 Extents;
+ DirectX::XMFLOAT3 Center;
+
+ ID3D11InputLayout *pInputLayout;
+
+ ID3D11Buffer *pVB;
+ ID3D11Buffer *pIB;
+ ID3D11Texture2D *pDiffuseTexture;
+ ID3D11ShaderResourceView *pDiffuseSRV;
+ ID3D11Texture2D *pNormalsTexture;
+ ID3D11ShaderResourceView *pNormalsSRV;
+ char szName[260];
+};
+
+class NvAggregateSimpleMesh
+{
+public:
+ NvAggregateSimpleMesh();
+ ~NvAggregateSimpleMesh();
+
+ HRESULT Initialize(ID3D11Device *pd3dDevice,NvSimpleMeshLoader *pMeshLoader);
+ HRESULT InitializeWithInputLayout(ID3D11Device *pd3dDevice,NvSimpleMeshLoader *pMeshLoader,BYTE*pIAsig, SIZE_T pIAsigSize);
+ void Release();
+
+ void Draw(ID3D11DeviceContext *pd3dContext, int iDiffuseTexSlot=-1, int iNormalsTexSlot=-1);
+
+ int NumSimpleMeshes;
+ NvSimpleMesh *pSimpleMeshes;
+}; \ No newline at end of file
diff --git a/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleMeshLoader.h b/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleMeshLoader.h
new file mode 100644
index 00000000..e3820594
--- /dev/null
+++ b/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleMeshLoader.h
@@ -0,0 +1,30 @@
+// TAGRELEASE: PUBLIC
+#pragma once
+#include <string>
+#include <DirectXMath.h>
+
+struct aiScene;
+struct aiNode;
+
+class NvSimpleRawMesh;
+
+/*
+ Allow loading of various mesh file formats and then simple extraction of various vertex/index streams
+*/
+class NvSimpleMeshLoader
+{
+public:
+
+ NvSimpleMeshLoader();
+ ~NvSimpleMeshLoader();
+
+ bool LoadFile(LPWSTR szFilename);
+ void XM_CALLCONV RecurseAddMeshes(const aiScene *scene, aiNode*pNode, DirectX::FXMMATRIX parentCompositeTransformD3D, bool bFlattenTransforms);
+
+ int NumMeshes;
+ NvSimpleRawMesh *pMeshes;
+
+protected:
+
+ std::string mediaPath;
+};
diff --git a/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleRawMesh.h b/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleRawMesh.h
new file mode 100644
index 00000000..abdc382c
--- /dev/null
+++ b/APEX_1.4/externals/extensions/include/nvsimplemesh/NvSimpleRawMesh.h
@@ -0,0 +1,54 @@
+// TAGRELEASE: PUBLIC
+#pragma once
+
+class NvSimpleRawMesh
+{
+public:
+
+ class Vertex
+ {
+ public:
+ float Position[3];
+ float Normal[3];
+ float UV[2];
+ float Tangent[3];
+ };
+
+ NvSimpleRawMesh();
+ ~NvSimpleRawMesh();
+
+ UINT GetIndexSize();
+ INT GetVertexStride();
+ INT GetNumVertices();
+ INT GetNumIndices();
+
+ Vertex* GetVertices();
+ BYTE* GetRawVertices();
+ BYTE* GetRawIndices();
+
+ float* GetExtents() {return m_extents;}
+ float* GetCenter() {return m_center;}
+
+ static HRESULT TryGuessFilename(WCHAR *szDestBuffer,WCHAR *szMeshFilename, WCHAR *szGuessSuffix);
+ ID3D11Texture2D *CreateD3D11DiffuseTextureFor(ID3D11Device *pd3dDevice);
+ ID3D11Texture2D *CreateD3D11NormalsTextureFor(ID3D11Device *pd3dDevice);
+ ID3D11Buffer *CreateD3D11IndexBufferFor(ID3D11Device *pd3dDevice);
+ ID3D11Buffer *CreateD3D11VertexBufferFor(ID3D11Device *pd3dDevice);
+
+ Vertex *m_pVertexData;
+ BYTE *m_pIndexData;
+ UINT m_iNumVertices;
+ UINT m_iNumIndices;
+ UINT m_IndexSize;
+
+ float m_extents[3];
+ float m_center[3];
+
+ WCHAR m_szMeshFilename[MAX_PATH];
+ WCHAR m_szDiffuseTexture[MAX_PATH];
+ WCHAR m_szNormalTexture[MAX_PATH];
+
+ // Utils to wrap making d3d11 render buffers from a loader mesh
+ static const D3D11_INPUT_ELEMENT_DESC D3D11InputElements[];
+ static const int D3D11ElementsSize;
+}; \ No newline at end of file