OPTPiX SpriteStudio SDK
Loading...
Searching...
No Matches
ssplayer_mesh.h
Go to the documentation of this file.
1#pragma once
2#ifndef __SSPLAYER_MESH__
3#define __SSPLAYER_MESH__
4
5#include <memory>
6
7namespace spritestudio6
8{
9class ISSTexture;
10
11enum
12{
15};
17{
20
23
25
27 float lengthtotal; //temp
28
29 int getBoneNum() { return bindBoneNum; }
30
31 void Cleanup()
32 {
33 bindBoneNum = 0;
34 lengthtotal = 0.0f;
35
36 for(int i=0; i<SSMESHPART_BONEMAX; i++)
37 {
38 weight[i] = 0;
39 weight_f[i] = 0.0f;
40
41 bone[i] = nullptr;
42 offset[i] = SsVector3(0, 0, 0);
43
44 length[i] = 0.0f;
45 }
46 }
47};
48
50{
51public:
52
53
54 std::unique_ptr<std::vector<float>> vertices; //[3 * 10];///< 座標
55 std::unique_ptr<std::vector<float>> colors; //[4 * 10]; ///< カラー
56 std::unique_ptr<std::vector<float>> weightColors; //[4 * 10]; ///< ウェイト色分けカラー
57 std::unique_ptr<std::vector<float>> uvs; //[2 * 10]; ///< UV
58 std::unique_ptr<std::vector<unsigned short>> indices;
62 std::unique_ptr<std::vector<float>> draw_vertices; //[3 * 10];///< 座標
63
64 std::unique_ptr<std::vector<float>> offset_world_vertices; // 描画に使われるデフォームアトリビュート
65
66 //ツール用テンポラリワーク [editer]
67 std::unique_ptr<std::vector<SsVector2>> vertices_outer;
68 std::unique_ptr<std::vector<SsVector2>> update_vertices_outer;
70
71public:
72 std::unique_ptr<std::vector<StBoneWeight>> bindBoneInfo;
73
77
78 //テンポラリ [editor]
79 bool isBind;
80
81
82public:
84 isBind(false), targetCell(0)
85 , bindBoneInfo()
86 , weightColors()
89 , myPartState(0)
90 , vertices(), colors(), uvs(), indices()
93 {
94 }
95
96
98 isBind(false), targetCell(0)
99 , weightColors()
100 , bindBoneInfo()
102 , draw_vertices()
103 , vertices(), colors(), uvs(), indices()
106 {
107 myPartState = s;
108 }
109
111 {
112 Cleanup();
113 }
114
115 void Cleanup();
116 void makeMesh();
117
118 int getVertexNum() { return ver_size; }
120 if (index > getVertexNum())return 0;
121 std::vector<StBoneWeight>& bindBoneInfoRaw = *(bindBoneInfo.get());
122 return &bindBoneInfoRaw[index];
123 }
124
125 void updateTransformMesh(); //再生時用 (バインドされたボーンに沿って変形を行う)
126
127 //デフォーム関連
129 void setOffsetWorldVertices(int index, const SsVector3 & v);
131
132/*
133 void renderVertex();
134 void renderMesh(float alpha, bool renderTexture);
135 void renderBoneWeightColor(float alpha, bool renderTexture);
136 void update_matrix(float * matrix); //バインド前(セットアップモード用のマトリクスアップデート)
137
138 void calcVerticesPos(SsAnimeState* state);
139 SsVector3 getWorldVertexPoint(int index) { return calc_world_vertices[index]; }
140*/
141// Editer用
142// void verticesWeightColorCalc();
143// void draw_world_vertices();
144// void draw_world_vertices_once(int index, SsFColor c);
145// int isTouchVertex(float mx, float my);
146// bool isInPoint(float x, float y);
147// void bindBoneSmoth(std::vector<SsPartState*>& list);
148
149};
150
151
152
153class SsPart;
154class SsMeshPart;
155//class SsAnimeState;
156
158{
159private:
160 void modelLoad();
161
162public:
164
165 std::vector<SsPartState*> meshList;
166 std::vector<SsPartState*> animeboneList;
167 std::vector<SsPartState*> jointList;
168
169public:
171 virtual ~SsMeshAnimator() {}
172
174
175 void update();
176 void makeMeshBoneList();
177 void copyToSsMeshPart(SsMeshBind* src, SsMeshPart* dst, std::map<int, SsPartState*> boneIdxList);
178
179
180};
181
182
183
184} // namespace spritestudio6
185
186#endif
Definition IsshTexture.h:49
Definition ssplayer_animedecode.h:44
パーツに使用される画素の矩形範囲を示した構造です。
Definition ssloader_ssce.h:14
void setAnimeDecoder(SsAnimeDecoder *s)
Definition ssplayer_mesh.cpp:347
SsAnimeDecoder * bindAnime
Definition ssplayer_mesh.h:163
std::vector< SsPartState * > jointList
Definition ssplayer_mesh.h:167
void makeMeshBoneList()
Definition ssplayer_mesh.cpp:353
SsMeshAnimator()
Definition ssplayer_mesh.cpp:342
void update()
Definition ssplayer_mesh.cpp:384
std::vector< SsPartState * > animeboneList
Definition ssplayer_mesh.h:166
std::vector< SsPartState * > meshList
Definition ssplayer_mesh.h:165
void copyToSsMeshPart(SsMeshBind *src, SsMeshPart *dst, std::map< int, SsPartState * > boneIdxList)
Definition ssplayer_mesh.cpp:399
virtual ~SsMeshAnimator()
Definition ssplayer_mesh.h:171
Definition ssloader_ssae.h:235
Definition ssplayer_mesh.h:50
int getVertexNum()
Definition ssplayer_mesh.h:118
void makeMesh()
Definition ssplayer_mesh.cpp:16
std::unique_ptr< std::vector< StBoneWeight > > bindBoneInfo
Definition ssplayer_mesh.h:72
std::unique_ptr< std::vector< float > > offset_world_vertices
Definition ssplayer_mesh.h:64
SsPartState * myPartState
Definition ssplayer_mesh.h:76
int indices_num
Definition ssplayer_mesh.h:59
std::unique_ptr< std::vector< float > > uvs
Definition ssplayer_mesh.h:57
int ver_size
Definition ssplayer_mesh.h:61
SsCell * targetCell
Definition ssplayer_mesh.h:74
void updateTransformMesh()
Definition ssplayer_mesh.cpp:148
int tri_size
Definition ssplayer_mesh.h:60
void setOffsetWorldVertices(int index, const SsVector3 &v)
Definition ssplayer_mesh.cpp:293
SsMeshPart()
Definition ssplayer_mesh.h:83
SsMeshPart(SsPartState *s)
Definition ssplayer_mesh.h:97
size_t outter_vertexnum
Definition ssplayer_mesh.h:69
SsVector3 getOffsetWorldVerticesFromKey(int index)
Definition ssplayer_mesh.cpp:255
void Cleanup()
Definition ssplayer_mesh.cpp:126
~SsMeshPart()
Definition ssplayer_mesh.h:110
StBoneWeight * getVerticesWeightInfo(int index)
Definition ssplayer_mesh.h:119
std::unique_ptr< std::vector< unsigned short > > indices
Definition ssplayer_mesh.h:58
std::unique_ptr< std::vector< float > > colors
Definition ssplayer_mesh.h:55
std::unique_ptr< std::vector< SsVector2 > > update_vertices_outer
Definition ssplayer_mesh.h:68
std::unique_ptr< std::vector< float > > vertices
Definition ssplayer_mesh.h:54
ISSTexture * targetTexture
Definition ssplayer_mesh.h:75
std::unique_ptr< std::vector< float > > weightColors
Definition ssplayer_mesh.h:56
std::unique_ptr< std::vector< float > > draw_vertices
Definition ssplayer_mesh.h:62
bool isBind
Definition ssplayer_mesh.h:79
std::unique_ptr< std::vector< SsVector2 > > vertices_outer
Definition ssplayer_mesh.h:67
SsVector2 getOffsetLocalVertices(int index)
Definition ssplayer_mesh.cpp:303
GLenum src
Definition glad.h:4176
GLdouble v
Definition glad.h:2712
GLenum GLenum dst
Definition glad.h:4176
GLuint index
Definition glad.h:3345
GLdouble s
Definition glad.h:3009
Definition ISsEffectRender.h:5
@ SSMESHPART_CHECKRANGE
Definition ssplayer_mesh.h:14
@ SSMESHPART_BONEMAX
Definition ssplayer_mesh.h:13
SsPoint2 SsVector2
Definition sstypes.h:198
SsPoint3 SsVector3
Definition sstypes.h:199
パーツの状態を保持するクラスです。
Definition ssplayer_PartState.h:23
Definition ssplayer_mesh.h:17
void Cleanup()
Definition ssplayer_mesh.h:31
float lengthtotal
Definition ssplayer_mesh.h:27
int weight[SSMESHPART_BONEMAX]
Definition ssplayer_mesh.h:18
float weight_f[SSMESHPART_BONEMAX]
Definition ssplayer_mesh.h:19
int getBoneNum()
Definition ssplayer_mesh.h:29
SsVector3 offset[SSMESHPART_BONEMAX]
Definition ssplayer_mesh.h:22
int bindBoneNum
Definition ssplayer_mesh.h:24
float length[SSMESHPART_BONEMAX]
Definition ssplayer_mesh.h:26
SsPartState * bone[SSMESHPART_BONEMAX]
Definition ssplayer_mesh.h:21