00001 #include <cinttypes> 00002 #include <map> 00003 #include <set> 00004 #include <vector> 00005 #include "NvBlastExtAuthoringTypes.h" 00006 00007 namespace physx 00008 { 00009 class PxVec3; 00010 }; 00011 00012 namespace Nv 00013 { 00014 namespace Blast 00015 { 00016 00017 class Mesh; 00018 00031 void setCuttingBox(const physx::PxVec3& point, const physx::PxVec3& normal, Mesh* mesh, float size, int64_t id); 00039 Mesh* getCuttingBox(const physx::PxVec3& point, const physx::PxVec3& normal, float size, int64_t id, int32_t interiorMaterialId); 00040 00046 Mesh* getBigBox(const physx::PxVec3& point, float size, int32_t interiorMaterialId); 00047 00061 Mesh* getNoisyCuttingBoxPair(const physx::PxVec3& point, const physx::PxVec3& normal, float size, float jaggedPlaneSize, physx::PxVec3 resolution, int64_t id, float amplitude, float frequency, int32_t octaves, int32_t seed, int32_t interiorMaterialId); 00062 00063 00068 void inverseNormalAndIndices(Mesh* mesh); 00069 00070 struct CmpVec 00071 { 00072 bool operator()(const physx::PxVec3& v1, const physx::PxVec3& v2) const; 00073 }; 00074 00075 typedef std::map<physx::PxVec3, std::map<uint32_t, uint32_t>, CmpVec> PointMap; 00076 00077 struct SharedFace 00078 { 00079 SharedFace() {} 00080 SharedFace(uint32_t inW, uint32_t inH, int64_t inUD, int32_t inMatId) : w(inW), h(inH), f(Facet( 0, 3, inUD, inMatId )) 00081 { 00082 vertices.reserve((w + 1) * (h + 1)); 00083 } 00084 uint32_t w, h; 00085 Facet f; 00086 std::vector<Nv::Blast::Vertex> vertices; 00087 std::vector<Nv::Blast::Edge> edges; 00088 std::vector<Nv::Blast::Facet> facets; 00089 }; 00090 00091 struct CmpSharedFace 00092 { 00093 bool operator()(const std::pair<physx::PxVec3, physx::PxVec3>& pv1, const std::pair<physx::PxVec3, physx::PxVec3>& pv2) const; 00094 }; 00095 00096 typedef std::map<std::pair<physx::PxVec3, physx::PxVec3>, SharedFace, CmpSharedFace> SharedFacesMap; 00097 00098 struct CutoutConfiguration; 00099 00100 void buildCuttingConeFaces(const CutoutConfiguration& conf, const std::vector<std::vector<physx::PxVec3>>& points, 00101 float heightBot, float heightTop, float conicityBot, float conicityTop, 00102 int64_t& id, int32_t seed, int32_t interiorMaterialId, SharedFacesMap& sharedFacesMap); 00103 00119 Mesh* getCuttingCone(const CutoutConfiguration& conf, 00120 const std::vector<physx::PxVec3>& points, const std::set<int32_t>& smoothingGroups, 00121 float heightBot, float heightTop, float conicityBot, float conicityTop, 00122 int64_t& id, int32_t seed, int32_t interiorMaterialId, const SharedFacesMap& sharedFacesMap, bool inverseNormals = false); 00123 00124 }; 00125 };