PeriDyno 1.2.1
Loading...
Searching...
No Matches
TextureMesh.h
Go to the documentation of this file.
1
16
17#pragma once
18
21#include "TriangleSet.h"
22
23
24namespace dyno
25{
26 // simple PBR material model
27 class Material : public Object
28 {
29 public:
31 ~Material() override {
32 texColor.clear();
33 texBump.clear();
34 };
35
36 public:
37
38 Vec3f baseColor = { 0.8f, 0.8f, 0.8f };
39
40 float metallic = 0.0f;
41 float roughness = 1.0f;
42 float alpha = 1.0f;
43
45
47 float bumpScale = 1.f;
48 };
49
70
72 {
73 public:
75 ~TextureMesh() override;
76
81
82 std::vector<std::shared_ptr<Shape>>& shapes() { return mShapes; }
83 std::vector<std::shared_ptr<Material>>& materials() { return mMaterials; }
84
85 void merge(const std::shared_ptr<TextureMesh>& texMesh01, const std::shared_ptr<TextureMesh>& texMesh02);
86
87 void clear();
88
90
92
93 std::vector<Vec3f> updateTexMeshBoundingBox();
94
95 template<typename Vec3f>
97 DArray<Vec3f>& pAttribute,
98 DArray<Vec3f>& vAttribute,
99 DArrayList<int>& contactList
100 );
101
102 private:
107
108 std::vector<std::shared_ptr<Material>> mMaterials;
109 std::vector<std::shared_ptr<Shape>> mShapes;
110 };
111};
DArray2D< Vec4f > texColor
Definition TextureMesh.h:44
DArray2D< Vec4f > texBump
Definition TextureMesh.h:46
~Material() override
Definition TextureMesh.h:31
Transform3f boundingTransform
Definition TextureMesh.h:65
~Shape() override
Definition TextureMesh.h:54
DArray< TopologyModule::Triangle > texCoordIndex
Definition TextureMesh.h:62
DArray< TopologyModule::Triangle > normalIndex
Definition TextureMesh.h:61
std::shared_ptr< Material > material
Definition TextureMesh.h:67
DArray< TopologyModule::Triangle > vertexIndex
Definition TextureMesh.h:60
TAlignedBox3D< Real > boundingBox
Definition TextureMesh.h:64
DArray< uint > & shapeIds()
Definition TextureMesh.h:80
DArray< Vec2f > & texCoords()
Definition TextureMesh.h:79
DArray< Vec2f > mTexCoords
DArray< Vec3f > & vertices()
Definition TextureMesh.h:77
void safeConvert2TriangleSet(TriangleSet< DataType3f > &triangleSet)
void convert2TriangleSet(TriangleSet< DataType3f > &triangleSet)
std::vector< std::shared_ptr< Material > > & materials()
Definition TextureMesh.h:83
void merge(const std::shared_ptr< TextureMesh > &texMesh01, const std::shared_ptr< TextureMesh > &texMesh02)
std::vector< Vec3f > updateTexMeshBoundingBox()
DArray< uint > mShapeIds
std::vector< std::shared_ptr< Shape > > & shapes()
Definition TextureMesh.h:82
DArray< Vec3f > & normals()
Definition TextureMesh.h:78
void transPoint2Vertices(DArray< Vec3f > &pAttribute, DArray< Vec3f > &vAttribute, DArrayList< int > &contactList)
DArray< Vec3f > mNormals
std::vector< std::shared_ptr< Material > > mMaterials
~TextureMesh() override
std::vector< std::shared_ptr< Shape > > mShapes
DArray< Vec3f > mVertices
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array< T, DeviceType::GPU > DArray
Definition Array.inl:89
Array2D< T, DeviceType::GPU > DArray2D
Definition Array2D.inl:90
Transform< float, 3 > Transform3f
ArrayList< ElementType, DeviceType::GPU > DArrayList
Definition ArrayList.inl:83
Vector< float, 3 > Vec3f
Definition Vector3D.h:93