PeriDyno 1.2.1
Loading...
Searching...
No Matches
SkinInfo.h
Go to the documentation of this file.
1
2#pragma once
3#include <vector>
4#include <memory>
5#include <string>
6#include "Vector.h"
7
8#include "OBase.h"
9#include "Module.h"
11
12#include "Field/Canvas.h"
13
14namespace dyno {
15
16 class SkinInfo : public OBase
17 {
18
19 public:
20
22
24 {
25 this->clear();
26 };
27
28 void pushBack_Data(const std::vector<Vec4f>& Weight_0,
29 const std::vector<Vec4f>& Weight_1,
30 const std::vector<Vec4f>& ID_0,
31 const std::vector<Vec4f>& ID_1,
32 std::vector<Vec4f>* Weight_2 = nullptr,
33 std::vector<Vec4f>* ID_2 = nullptr
34 )
35 {
36 skinNum++;
37
40 V_jointID_0.resize(skinNum);
41 V_jointID_1.resize(skinNum);
42
43 this->V_jointWeight_0[skinNum-1].assign(Weight_0);
44 this->V_jointWeight_1[skinNum - 1].assign(Weight_1);
45 this->V_jointID_0[skinNum - 1].assign(ID_0);
46 this->V_jointID_1[skinNum - 1].assign(ID_1);
47
48 if (Weight_2 && ID_2)
49 {
51 V_jointID_2.resize(skinNum);
52 this->V_jointWeight_2[skinNum - 1].assign(*Weight_2);
53 this->V_jointID_2[skinNum - 1].assign(*ID_2);
54 }
55 }
56
57 void clear()
58 {
59 for (size_t i = 0; i < skinNum; i++)
60 {
61 V_jointWeight_0[i].clear();
62 V_jointWeight_1[i].clear();
63 if(!V_jointWeight_2.empty())
64 V_jointWeight_2[i].clear();
65
66 V_jointID_0[i].clear();
67 V_jointID_1[i].clear();
68 if (!V_jointID_2.empty())
69 V_jointID_2[i].clear();
70
71 }
72
73 skinNum = 0;
74
75 V_jointWeight_0.clear();
76 V_jointWeight_1.clear();
77 V_jointWeight_2.clear();
78
79 V_jointID_0.clear();
80 V_jointID_1.clear();
81 V_jointID_2.clear();
82
83
84 skin_VerticeRange.clear();
85 }
86
87 int size() { return skinNum; };
88
89 bool isEmpty()
90 {
91 if (skinNum == 0 || mesh == NULL || initialPosition.isEmpty() || initialNormal.isEmpty())
92 return true;
93 }
94
95 std::vector<DArray<Vec4f>> V_jointWeight_0;
96 std::vector<DArray<Vec4f>> V_jointWeight_1;
97 std::vector<DArray<Vec4f>> V_jointWeight_2;
98
99 std::vector<DArray<Vec4f>> V_jointID_0;
100 std::vector<DArray<Vec4f>> V_jointID_1;
101 std::vector<DArray<Vec4f>> V_jointID_2;
102
103 std::map<int, Vec2u> skin_VerticeRange;
104
105 std::shared_ptr<TextureMesh> mesh = NULL;
106
108
110
111
112 private:
113
114 int skinNum = 0;
115
116
117 };
118
119
120}
121
std::vector< DArray< Vec4f > > V_jointWeight_1
Definition SkinInfo.h:96
std::vector< DArray< Vec4f > > V_jointWeight_0
Definition SkinInfo.h:95
bool isEmpty()
Definition SkinInfo.h:89
DArray< Vec3f > initialNormal
Definition SkinInfo.h:109
void pushBack_Data(const std::vector< Vec4f > &Weight_0, const std::vector< Vec4f > &Weight_1, const std::vector< Vec4f > &ID_0, const std::vector< Vec4f > &ID_1, std::vector< Vec4f > *Weight_2=nullptr, std::vector< Vec4f > *ID_2=nullptr)
Definition SkinInfo.h:28
std::vector< DArray< Vec4f > > V_jointID_0
Definition SkinInfo.h:99
void clear()
Definition SkinInfo.h:57
std::vector< DArray< Vec4f > > V_jointID_2
Definition SkinInfo.h:101
std::vector< DArray< Vec4f > > V_jointWeight_2
Definition SkinInfo.h:97
std::shared_ptr< TextureMesh > mesh
Definition SkinInfo.h:105
std::vector< DArray< Vec4f > > V_jointID_1
Definition SkinInfo.h:100
DArray< Vec3f > initialPosition
Definition SkinInfo.h:107
std::map< int, Vec2u > skin_VerticeRange
Definition SkinInfo.h:103
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array< T, DeviceType::GPU > DArray
Definition Array.inl:89