00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef NVBLASTAUTHORINGMESHIMPL_H
00029 #define NVBLASTAUTHORINGMESHIMPL_H
00030
00031 #include "NvBlastExtAuthoringMesh.h"
00032 #include <PxBounds3.h>
00033 #include <vector>
00034 #include <map>
00035 #include <set>
00036
00037 namespace Nv
00038 {
00039 namespace Blast
00040 {
00041
00045 class MeshImpl : public Mesh
00046 {
00047 public:
00048
00058 MeshImpl(const NvcVec3* position, const NvcVec3* normals, const NvcVec2* uv, uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount);
00059
00069 MeshImpl(const Vertex* vertices, const Edge* edges, const Facet* facets, uint32_t posCount, uint32_t edgesCount, uint32_t facetsCount);
00070
00071 MeshImpl(const Vertex* vertices, uint32_t count);
00072
00073 MeshImpl(const Vertex* vertices, uint32_t count, uint32_t* indices, uint32_t indexCount, void* materials, uint32_t materialStride);
00074
00075 ~MeshImpl();
00076
00077 virtual void release() override;
00078
00082 bool isValid() const override;
00083
00087 Vertex* getVerticesWritable() override;
00088
00092 Edge* getEdgesWritable() override;
00093
00097 Facet* getFacetsBufferWritable() override;
00098
00102 const Vertex* getVertices() const override;
00103
00107 const Edge* getEdges() const override;
00108
00112 const Facet* getFacetsBuffer() const override;
00113
00117 Facet* getFacetWritable(int32_t facet) override;
00118
00122 const Facet* getFacet(int32_t facet) const override;
00123
00127 uint32_t getEdgesCount() const override;
00128
00132 uint32_t getVerticesCount() const override;
00133
00137 uint32_t getFacetCount() const override;
00138
00139
00143 const NvcBounds3& getBoundingBox() const override;
00144
00148 NvcBounds3& getBoundingBoxWritable() override;
00149
00153 void recalculateBoundingBox() override;
00154
00159 float getMeshVolume() override;
00160
00161
00165 void setMaterialId(const int32_t* materialIds) override;
00166
00170 void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) override;
00171
00175 void setSmoothingGroup(const int32_t* smoothingGroups) override;
00176
00180 virtual void calcPerFacetBounds() override;
00181
00185 virtual const NvcBounds3* getFacetBound(uint32_t index) const override;
00186
00187 private:
00188 std::vector<Vertex> mVertices;
00189 std::vector<Edge> mEdges;
00190 std::vector<Facet> mFacets;
00191 physx::PxBounds3 mBounds;
00192 std::vector<physx::PxBounds3> mPerFacetBounds;
00193 };
00194
00195 }
00196 }
00197
00198
00199 #endif // ifndef NVBLASTAUTHORINGMESHIMPL_H