diff options
| author | Andrew Reidmeyer <[email protected]> | 2017-03-15 09:28:59 -0600 |
|---|---|---|
| committer | Andrew Reidmeyer <[email protected]> | 2017-03-15 09:28:59 -0600 |
| commit | f5f6a899903a309f1fc93b31c0297fc7b3b5cf46 (patch) | |
| tree | ed3dece338b579d5b51af494b2d543fb46c43fa3 /demo/DemoApp/mesh.h | |
| download | flow-1.0.0.tar.xz flow-1.0.0.zip | |
Initial 1.0.0 binary releasev1.0.0
Diffstat (limited to 'demo/DemoApp/mesh.h')
| -rw-r--r-- | demo/DemoApp/mesh.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/demo/DemoApp/mesh.h b/demo/DemoApp/mesh.h new file mode 100644 index 0000000..9861bac --- /dev/null +++ b/demo/DemoApp/mesh.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include <DirectXMath.h> + +#define MESH_API extern "C" __declspec(dllexport) + +/// ****************** Mesh Context Public ******************************* + +typedef unsigned int MeshUint; +typedef unsigned char MeshUint8; + +struct MeshContext; + +struct MeshContextDesc; + +MESH_API MeshContext* MeshContextCreate(const MeshContextDesc* desc); + +MESH_API void MeshContextUpdate(MeshContext* context, const MeshContextDesc* desc); + +MESH_API void MeshContextRelease(MeshContext* context); + +/// ****************** Mesh Interface Public ********************** + +struct Mesh; + +enum MeshRenderMode +{ + MESH_RENDER_SOLID = 0 +}; + +struct MeshDrawParams +{ + MeshUint renderMode; + DirectX::XMMATRIX projection; + DirectX::XMMATRIX view; + DirectX::XMMATRIX model; +}; + +struct MeshData +{ + MeshUint numVertices; + float* positions; + MeshUint positionStride; + float* normals; + MeshUint normalStride; + + MeshUint numIndices; + MeshUint* indices; + + float boundsMin[3]; + float boundsMax[3]; +}; + +MESH_API Mesh* MeshCreate(MeshContext* context); + +MESH_API void MeshLoadFromFile(Mesh* mesh, const char* filename); + +MESH_API void MeshGetData(Mesh* mesh, MeshData* data); + +MESH_API void MeshDraw(Mesh* mesh, const MeshDrawParams* params); + +MESH_API void MeshRelease(Mesh* mesh); + +/// ****************** Mesh Context Implementation ******************************* + +struct MeshVertex +{ + float x, y, z; + float nx, ny, nz; +}; + +struct MeshIndexBuffer; +struct MeshVertexBuffer; + +MESH_API MeshIndexBuffer* MeshIndexBufferCreate(MeshContext* context, MeshUint* indices, MeshUint numIndices); + +MESH_API void MeshIndexBufferRelease(MeshIndexBuffer* buffer); + +MESH_API MeshVertexBuffer* MeshVertexBufferCreate(MeshContext* context, MeshVertex* vertices, MeshUint numVertices); + +MESH_API void MeshVertexBufferRelease(MeshVertexBuffer* buffer); + +struct MeshContextDrawParams +{ + const MeshDrawParams* params; + MeshIndexBuffer* indexBuffer; + MeshVertexBuffer* vertexBuffer; +}; + +MESH_API void MeshContextDraw(MeshContext* context, const MeshContextDrawParams* params);
\ No newline at end of file |