PeriDyno 1.0.0
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 for (size_t i = 0; i < skinNum; i++)
26 {
27 V_jointWeight_0[i].clear();
28 V_jointWeight_1[i].clear();
29 V_jointID_0[i].clear();
30 V_jointID_1[i].clear();
31 }
32 V_jointWeight_0.clear();
33 V_jointWeight_1.clear();
34 V_jointID_0.clear();
35 V_jointID_1.clear();
36
37 for (auto it : skin_VerticeRange)
38 {
39 it.second.clear();
40 }
41 skin_VerticeRange.clear();
42 };
43
44 void pushBack_Data(const std::vector<Vec4f>& Weight_0,
45 const std::vector<Vec4f>& Weight_1,
46 const std::vector<Vec4f>& ID_0,
47 const std::vector<Vec4f>& ID_1
48 )
49 {
50 skinNum++;
51
54 V_jointID_0.resize(skinNum);
55 V_jointID_1.resize(skinNum);
56
57 this->V_jointWeight_0[skinNum-1].assign(Weight_0);
58 this->V_jointWeight_1[skinNum - 1].assign(Weight_1);
59 this->V_jointID_0[skinNum - 1].assign(ID_0);
60 this->V_jointID_1[skinNum - 1].assign(ID_1);
61 }
62
64 {
65 for (size_t i = 0; i < skinNum; i++)
66 {
67 V_jointWeight_0[i].clear();
68 V_jointWeight_1[i].clear();
69 V_jointID_0[i].clear();
70 V_jointID_1[i].clear();
71 }
72
73 skinNum = 0;
74
75 V_jointWeight_0.clear();
76 V_jointWeight_1.clear();
77 V_jointID_0.clear();
78 V_jointID_1.clear();
79
80 for (auto it : skin_VerticeRange)
81 {
82 it.second.clear();
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
97 std::vector<DArray<Vec4f>> V_jointWeight_1;
98
99 std::vector<DArray<Vec4f>> V_jointID_0;
100
101 std::vector<DArray<Vec4f>> V_jointID_1;
102
103 std::map<int, std::vector<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
std::vector< DArray< Vec4f > > V_jointWeight_1
Definition SkinInfo.h:97
std::vector< DArray< Vec4f > > V_jointWeight_0
Definition SkinInfo.h:95
bool isEmpty()
Definition SkinInfo.h:89
std::map< int, std::vector< Vec2u > > skin_VerticeRange
Definition SkinInfo.h:103
DArray< Vec3f > initialNormal
Definition SkinInfo.h:109
std::vector< DArray< Vec4f > > V_jointID_0
Definition SkinInfo.h:99
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)
Definition SkinInfo.h:44
void clearSkinInfo()
Definition SkinInfo.h:63
std::shared_ptr< TextureMesh > mesh
Definition SkinInfo.h:105
std::vector< DArray< Vec4f > > V_jointID_1
Definition SkinInfo.h:101
DArray< Vec3f > initialPosition
Definition SkinInfo.h:107
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array< T, DeviceType::GPU > DArray
Definition Array.inl:89