1 | #include "GeoMesh.h"
|
---|
2 |
|
---|
3 | using namespace Geometry;
|
---|
4 | using namespace std;
|
---|
5 |
|
---|
6 | //----------------------------------------------------------------------------
|
---|
7 | Mesh::Mesh():
|
---|
8 | mVertexBuffer(0), mSubMeshCount(0), mSubMesh(0)
|
---|
9 | {
|
---|
10 | }
|
---|
11 |
|
---|
12 | Mesh::~Mesh()
|
---|
13 | {
|
---|
14 | delete[] mSubMesh;
|
---|
15 | delete mVertexBuffer;
|
---|
16 | }
|
---|
17 |
|
---|
18 |
|
---|
19 | Mesh::Mesh(const Mesh &objmesh)
|
---|
20 | {
|
---|
21 | // constructor copia
|
---|
22 | mVertexBuffer=new VertexBuffer();
|
---|
23 | mSubMeshCount=objmesh.mSubMeshCount;
|
---|
24 | mSubMesh = new Geometry::SubMesh[objmesh.mSubMeshCount];
|
---|
25 | for(size_t i=0;i<objmesh.mSubMeshCount;i++)
|
---|
26 | {
|
---|
27 | mSubMesh[i].mSharedVertexBuffer=false;
|
---|
28 | mSubMesh[i].mVertexBuffer = new Geometry::VertexBuffer();
|
---|
29 | mSubMesh[i].mVertexBuffer->mPosition = new Geometry::Vector3[objmesh.mSubMesh[i].mVertexBuffer->mVertexCount];
|
---|
30 | mSubMesh[i].mVertexBuffer->mNormal = new Geometry::Vector3[objmesh.mSubMesh[i].mVertexBuffer->mVertexCount];
|
---|
31 | mSubMesh[i].mVertexBuffer->mTexCoords = new Geometry::Vector2[objmesh.mSubMesh[i].mVertexBuffer->mVertexCount];
|
---|
32 | mSubMesh[i].mVertexBuffer->mVertexCount = objmesh.mSubMesh[i].mVertexBuffer->mVertexCount;
|
---|
33 | mSubMesh[i].mVertexBuffer->mVertexInfo = objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo;
|
---|
34 | mSubMesh[i].mType = objmesh.mSubMesh[i].mType;
|
---|
35 |
|
---|
36 | // De momento con esto se parte de un geomesh con vértices compartidos y se obtiene un geomesh sin vértices
|
---|
37 | // compartidos. Los vértices se replican en cada uno de los submeshes.
|
---|
38 | // HAY QUE CAMBIARLO.
|
---|
39 | if(objmesh.mSubMesh[i].mSharedVertexBuffer == true)
|
---|
40 | {
|
---|
41 | for(size_t s=0;s<objmesh.mSubMesh[i].mVertexBuffer->mVertexCount;s++)
|
---|
42 | {
|
---|
43 | //Copiamos mPosition
|
---|
44 | if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_POSITION)
|
---|
45 | {
|
---|
46 | mSubMesh[i].mVertexBuffer->mPosition[s].x = objmesh.mVertexBuffer->mPosition[s].x;
|
---|
47 | mSubMesh[i].mVertexBuffer->mPosition[s].y = objmesh.mVertexBuffer->mPosition[s].y;
|
---|
48 | mSubMesh[i].mVertexBuffer->mPosition[s].z = objmesh.mVertexBuffer->mPosition[s].z;
|
---|
49 | }
|
---|
50 | //Copiamos mNormal
|
---|
51 | if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
|
---|
52 | {
|
---|
53 | mSubMesh[i].mVertexBuffer->mNormal[s].x = objmesh.mVertexBuffer->mNormal[s].x;
|
---|
54 | mSubMesh[i].mVertexBuffer->mNormal[s].y = objmesh.mVertexBuffer->mNormal[s].y;
|
---|
55 | mSubMesh[i].mVertexBuffer->mNormal[s].z = objmesh.mVertexBuffer->mNormal[s].z;
|
---|
56 | }
|
---|
57 |
|
---|
58 | //Copiamos mTexCoords
|
---|
59 | if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
|
---|
60 | {
|
---|
61 | mSubMesh[i].mVertexBuffer->mTexCoords[s].x = objmesh.mVertexBuffer->mTexCoords[s].x;
|
---|
62 | mSubMesh[i].mVertexBuffer->mTexCoords[s].y = objmesh.mVertexBuffer->mTexCoords[s].y;
|
---|
63 | }
|
---|
64 | }
|
---|
65 | objmesh.mSubMesh[i].mSharedVertexBuffer = false;
|
---|
66 | }
|
---|
67 | else
|
---|
68 | {
|
---|
69 | for(size_t s=0;s<objmesh.mSubMesh[i].mVertexBuffer->mVertexCount;s++)
|
---|
70 | {
|
---|
71 | //Copiamos mPosition
|
---|
72 | if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_POSITION)
|
---|
73 | {
|
---|
74 | mSubMesh[i].mVertexBuffer->mPosition[s].x = objmesh.mSubMesh[i].mVertexBuffer->mPosition[s].x;
|
---|
75 | mSubMesh[i].mVertexBuffer->mPosition[s].y = objmesh.mSubMesh[i].mVertexBuffer->mPosition[s].y;
|
---|
76 | mSubMesh[i].mVertexBuffer->mPosition[s].z = objmesh.mSubMesh[i].mVertexBuffer->mPosition[s].z;
|
---|
77 | }
|
---|
78 | //Copiamos mNormal
|
---|
79 | if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
|
---|
80 | {
|
---|
81 | mSubMesh[i].mVertexBuffer->mNormal[s].x = objmesh.mSubMesh[i].mVertexBuffer->mNormal[s].x;
|
---|
82 | mSubMesh[i].mVertexBuffer->mNormal[s].y = objmesh.mSubMesh[i].mVertexBuffer->mNormal[s].y;
|
---|
83 | mSubMesh[i].mVertexBuffer->mNormal[s].z = objmesh.mSubMesh[i].mVertexBuffer->mNormal[s].z;
|
---|
84 | }
|
---|
85 |
|
---|
86 | //Copiamos mTexCoords
|
---|
87 | if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
|
---|
88 | {
|
---|
89 | mSubMesh[i].mVertexBuffer->mTexCoords[s].x = objmesh.mSubMesh[i].mVertexBuffer->mTexCoords[s].x;
|
---|
90 | mSubMesh[i].mVertexBuffer->mTexCoords[s].y = objmesh.mSubMesh[i].mVertexBuffer->mTexCoords[s].y;
|
---|
91 | }
|
---|
92 | }
|
---|
93 |
|
---|
94 | }
|
---|
95 | // Copiar los indices
|
---|
96 | mSubMesh[i].mIndexCount=objmesh.mSubMesh[i].mIndexCount;
|
---|
97 | mSubMesh[i].mIndex = new Index[mSubMesh[i].mIndexCount];
|
---|
98 | memcpy(mSubMesh[i].mIndex,objmesh.mSubMesh[i].mIndex,objmesh.mSubMesh[i].mIndexCount*sizeof(Geometry::Index));
|
---|
99 |
|
---|
100 | // Copiar las tiras
|
---|
101 | // TENER EN CUENTA SI ES UN MESH DE TIRAS O LISTA DE TRIANGULOS
|
---|
102 | __w64 int Desp=0; // desplazamiento entre posiciones de memoria.
|
---|
103 | mSubMesh[i].mStripCount=objmesh.mSubMesh[i].mStripCount;
|
---|
104 | if (objmesh.mSubMesh[i].mStripCount>0)
|
---|
105 | {
|
---|
106 | mSubMesh[i].mStrip = new Index*[objmesh.mSubMesh[i].mStripCount];
|
---|
107 |
|
---|
108 | Desp= &(mSubMesh[i].mIndex[0]) - &(objmesh.mSubMesh[i].mIndex[0]);
|
---|
109 | for (size_t j=0;j<objmesh.mSubMesh[i].mStripCount;j++)
|
---|
110 | {
|
---|
111 | mSubMesh[i].mStrip[j]=objmesh.mSubMesh[i].mStrip[j] + Desp;
|
---|
112 | }
|
---|
113 | }
|
---|
114 | }
|
---|
115 | }
|
---|
116 |
|
---|
117 | Mesh &Mesh::operator =(const Geometry::Mesh &objmesh)
|
---|
118 | {
|
---|
119 | // Operador de asignación
|
---|
120 | bool copiados = false; // indica si los vértices compartidos han sido copiados
|
---|
121 | mVertexBuffer = new VertexBuffer();
|
---|
122 | mSubMeshCount = objmesh.mSubMeshCount;
|
---|
123 | mSubMesh = new Geometry::SubMesh[objmesh.mSubMeshCount];
|
---|
124 |
|
---|
125 | for(size_t i = 0; i < objmesh.mSubMeshCount; i++)
|
---|
126 | {
|
---|
127 | // Debug.
|
---|
128 | /*
|
---|
129 | cout << "VertexCount["
|
---|
130 | << i
|
---|
131 | << "]: "
|
---|
132 | << objmesh.mSubMesh[i].mVertexBuffer->mVertexCount
|
---|
133 | << endl;
|
---|
134 | */
|
---|
135 | //--------------------------------------------------------------------------------------------
|
---|
136 |
|
---|
137 | mSubMesh[i].mSharedVertexBuffer = objmesh.mSubMesh[i].mSharedVertexBuffer; //.false;
|
---|
138 | mSubMesh[i].mVertexBuffer = new Geometry::VertexBuffer();
|
---|
139 | mSubMesh[i].mVertexBuffer->mPosition = new Geometry::Vector3[objmesh.mSubMesh[i].mVertexBuffer->mVertexCount];
|
---|
140 | mSubMesh[i].mVertexBuffer->mNormal = new Geometry::Vector3[objmesh.mSubMesh[i].mVertexBuffer->mVertexCount];
|
---|
141 | mSubMesh[i].mVertexBuffer->mTexCoords = new Geometry::Vector2[objmesh.mSubMesh[i].mVertexBuffer->mVertexCount];
|
---|
142 | mSubMesh[i].mVertexBuffer->mVertexCount = objmesh.mSubMesh[i].mVertexBuffer->mVertexCount;
|
---|
143 | mSubMesh[i].mVertexBuffer->mVertexInfo = objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo;
|
---|
144 | mSubMesh[i].mType = objmesh.mSubMesh[i].mType;
|
---|
145 |
|
---|
146 | if (objmesh.mSubMesh[i].mSharedVertexBuffer && !copiados)
|
---|
147 | {
|
---|
148 | mVertexBuffer = mSubMesh[i].mVertexBuffer;
|
---|
149 | copiados = true;
|
---|
150 | }
|
---|
151 |
|
---|
152 | for(size_t s = 0; s < objmesh.mSubMesh[i].mVertexBuffer->mVertexCount; s++)
|
---|
153 | {
|
---|
154 | //Copiamos mPosition
|
---|
155 | //if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_POSITION)
|
---|
156 | //{
|
---|
157 | mSubMesh[i].mVertexBuffer->mPosition[s].x = objmesh.mSubMesh[i].mVertexBuffer->mPosition[s].x;
|
---|
158 | mSubMesh[i].mVertexBuffer->mPosition[s].y = objmesh.mSubMesh[i].mVertexBuffer->mPosition[s].y;
|
---|
159 | mSubMesh[i].mVertexBuffer->mPosition[s].z = objmesh.mSubMesh[i].mVertexBuffer->mPosition[s].z;
|
---|
160 | //}
|
---|
161 | //Copiamos mNormal
|
---|
162 | if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
|
---|
163 | {
|
---|
164 | mSubMesh[i].mVertexBuffer->mNormal[s].x = objmesh.mSubMesh[i].mVertexBuffer->mNormal[s].x;
|
---|
165 | mSubMesh[i].mVertexBuffer->mNormal[s].y = objmesh.mSubMesh[i].mVertexBuffer->mNormal[s].y;
|
---|
166 | mSubMesh[i].mVertexBuffer->mNormal[s].z = objmesh.mSubMesh[i].mVertexBuffer->mNormal[s].z;
|
---|
167 | }
|
---|
168 |
|
---|
169 | //Copiamos mTexCoords
|
---|
170 | if (objmesh.mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
|
---|
171 | {
|
---|
172 | mSubMesh[i].mVertexBuffer->mTexCoords[s].x = objmesh.mSubMesh[i].mVertexBuffer->mTexCoords[s].x;
|
---|
173 | mSubMesh[i].mVertexBuffer->mTexCoords[s].y = objmesh.mSubMesh[i].mVertexBuffer->mTexCoords[s].y;
|
---|
174 | }
|
---|
175 | }
|
---|
176 |
|
---|
177 | // Copiar los indices
|
---|
178 | mSubMesh[i].mIndexCount = objmesh.mSubMesh[i].mIndexCount;
|
---|
179 | mSubMesh[i].mIndex = new Index[mSubMesh[i].mIndexCount];
|
---|
180 |
|
---|
181 | memcpy(mSubMesh[i].mIndex,objmesh.mSubMesh[i].mIndex,objmesh.mSubMesh[i].mIndexCount*sizeof(Geometry::Index));
|
---|
182 |
|
---|
183 | // Copiar las tiras
|
---|
184 | __w64 Desp = 0; // desplazamiento entre posiciones de memoria.
|
---|
185 | mSubMesh[i].mStripCount = objmesh.mSubMesh[i].mStripCount;
|
---|
186 |
|
---|
187 | if (objmesh.mSubMesh[i].mStripCount>0)
|
---|
188 | {
|
---|
189 | mSubMesh[i].mStrip = new Index*[objmesh.mSubMesh[i].mStripCount];
|
---|
190 | Desp = &(mSubMesh[i].mIndex[0]) - &(objmesh.mSubMesh[i].mIndex[0]);
|
---|
191 |
|
---|
192 | for (size_t j = 0; j < objmesh.mSubMesh[i].mStripCount; j++)
|
---|
193 | {
|
---|
194 | mSubMesh[i].mStrip[j] = objmesh.mSubMesh[i].mStrip[j] + Desp;
|
---|
195 | }
|
---|
196 | }
|
---|
197 |
|
---|
198 | //OSCAR
|
---|
199 | //Copio los bones
|
---|
200 | if (!objmesh.mSubMesh[i].mBones.empty())
|
---|
201 | {
|
---|
202 | for (int j = 0; j < objmesh.mSubMesh[i].mBones.size(); j++)
|
---|
203 | {
|
---|
204 | mSubMesh[i].mBones.push_back(objmesh.mSubMesh[i].mBones[j]);
|
---|
205 | }
|
---|
206 | }
|
---|
207 | }
|
---|
208 |
|
---|
209 | //OSCAR
|
---|
210 | //Copio el nombre del esqueleto
|
---|
211 | if (objmesh.hasSkeleton)
|
---|
212 | {
|
---|
213 | hasSkeleton = true;
|
---|
214 |
|
---|
215 | strcpy(mSkeletonName,objmesh.mSkeletonName);
|
---|
216 | }
|
---|
217 |
|
---|
218 | //OSCAR
|
---|
219 | //Copio los bones
|
---|
220 | if (!objmesh.mBones.empty())
|
---|
221 | {
|
---|
222 | for (int j = 0; j < objmesh.mBones.size(); j++)
|
---|
223 | {
|
---|
224 | mBones.push_back(objmesh.mBones[j]);
|
---|
225 | }
|
---|
226 | }
|
---|
227 |
|
---|
228 | return *this;
|
---|
229 | }
|
---|
230 |
|
---|
231 | void Mesh::Load(Serializer &s)
|
---|
232 | {
|
---|
233 | bool sharedVertexBuffer = false;
|
---|
234 |
|
---|
235 | //Clear Data
|
---|
236 | delete[] mSubMesh; mSubMesh = 0;
|
---|
237 | delete mVertexBuffer; mVertexBuffer = 0;
|
---|
238 | mSubMeshCount = 0;
|
---|
239 |
|
---|
240 | s.ReadArray(&sharedVertexBuffer,1);
|
---|
241 | if (sharedVertexBuffer)
|
---|
242 | {
|
---|
243 | mVertexBuffer = new VertexBuffer;
|
---|
244 | mVertexBuffer->Load(s);
|
---|
245 | }
|
---|
246 | s.ReadArray(&mSubMeshCount,1);
|
---|
247 | mSubMesh = new SubMesh[mSubMeshCount];
|
---|
248 | for(size_t i = 0; i < mSubMeshCount; ++i)
|
---|
249 | {
|
---|
250 | mSubMesh[i].Load(s);
|
---|
251 | if (mSubMesh[i].mSharedVertexBuffer && sharedVertexBuffer)
|
---|
252 | {
|
---|
253 | mSubMesh[i].mVertexBuffer = mVertexBuffer;
|
---|
254 | }
|
---|
255 | }
|
---|
256 | }
|
---|
257 |
|
---|
258 | void Mesh::Save(Serializer &s)
|
---|
259 | {
|
---|
260 | bool sharedVertexBuffer = (mVertexBuffer != 0);
|
---|
261 | s.WriteArray(&sharedVertexBuffer, 1);
|
---|
262 | if (sharedVertexBuffer)
|
---|
263 | {
|
---|
264 | mVertexBuffer->Save(s);
|
---|
265 | }
|
---|
266 | s.WriteArray(&mSubMeshCount,1);
|
---|
267 | for(size_t i = 0; i < mSubMeshCount; ++i)
|
---|
268 | {
|
---|
269 | mSubMesh[i].Save(s);
|
---|
270 | }
|
---|
271 | }
|
---|
272 |
|
---|
273 | // 26-12-2005
|
---|
274 | void Mesh::exportToOBJ(char *nomfich)
|
---|
275 | {
|
---|
276 | // Genera un fichero obj con vértices, triángulos
|
---|
277 |
|
---|
278 | std::ofstream obj(nomfich);
|
---|
279 | obj << "begin" << std::endl;
|
---|
280 | // Vértices
|
---|
281 | for (size_t i=0; i<this->mSubMeshCount; i++)
|
---|
282 | {
|
---|
283 | for (size_t j=0; j<this->mSubMesh[i].mVertexBuffer->mVertexCount; j++)
|
---|
284 | {
|
---|
285 | obj << "v " << this->mSubMesh[i].mVertexBuffer->mPosition[j].x << " " <<
|
---|
286 | this->mSubMesh[i].mVertexBuffer->mPosition[j].y << " " <<
|
---|
287 | this->mSubMesh[i].mVertexBuffer->mPosition[j].z << " " << std::endl;
|
---|
288 | }
|
---|
289 | }
|
---|
290 |
|
---|
291 |
|
---|
292 | // Caras
|
---|
293 | for (size_t i=0; i<this->mSubMeshCount; i++)
|
---|
294 | {
|
---|
295 | for (size_t j=0; j<this->mSubMesh[i].mIndexCount; j=j+3)
|
---|
296 | {
|
---|
297 | obj << "f " << this->mSubMesh[i].mIndex[j]+1 << " " <<
|
---|
298 | this->mSubMesh[i].mIndex[j+1]+1 << " " <<
|
---|
299 | this->mSubMesh[i].mIndex[j+2]+1 << std::endl;
|
---|
300 | }
|
---|
301 | }
|
---|
302 |
|
---|
303 | obj << "end" << std::endl;
|
---|
304 | obj.close();
|
---|
305 | }
|
---|
306 |
|
---|
307 | // 26-12-2005
|
---|
308 | Geometry::Mesh *Mesh::toSharedVertex()
|
---|
309 | {
|
---|
310 |
|
---|
311 | // Move all vertex to the shared vertex buffer.
|
---|
312 | Geometry::Mesh *mesh = new Geometry::Mesh();
|
---|
313 |
|
---|
314 | if (this->mSubMesh[0].mSharedVertexBuffer)
|
---|
315 | {
|
---|
316 | *mesh = *this;
|
---|
317 | return mesh;
|
---|
318 | }
|
---|
319 |
|
---|
320 | mesh->mVertexBuffer=new VertexBuffer();
|
---|
321 | mesh->mSubMeshCount = this->mSubMeshCount;
|
---|
322 | // Reserva memoria para los submeshes
|
---|
323 | mesh->mSubMesh = new Geometry::SubMesh[this->mSubMeshCount];
|
---|
324 |
|
---|
325 | // construcción de los submeshes
|
---|
326 | long int acumVerts=0;
|
---|
327 | for (size_t i=0; i<mesh->mSubMeshCount; i++)
|
---|
328 | {
|
---|
329 | mesh->mSubMesh[i].mSharedVertexBuffer=true;
|
---|
330 | mesh->mSubMesh[i].mVertexBuffer=mesh->mVertexBuffer;
|
---|
331 | mesh->mSubMesh[i].mStripCount=0;
|
---|
332 | mesh->mSubMesh[i].mStrip=NULL;
|
---|
333 |
|
---|
334 | // copiar los índices
|
---|
335 | mesh->mSubMesh[i].mIndexCount=this->mSubMesh[i].mIndexCount;
|
---|
336 | mesh->mSubMesh[i].mIndex=new Geometry::Index[this->mSubMesh[i].mIndexCount];
|
---|
337 |
|
---|
338 | for (size_t j=0; j< this->mSubMesh[i].mIndexCount; j++)
|
---|
339 | {
|
---|
340 | mesh->mSubMesh[i].mIndex[j] = this->mSubMesh[i].mIndex[j]+acumVerts;
|
---|
341 | }
|
---|
342 |
|
---|
343 | acumVerts += this->mSubMesh[i].mVertexBuffer->mVertexCount;
|
---|
344 |
|
---|
345 | // Copiar las tiras
|
---|
346 | int Desp=0; // desplazamiento entre posiciones de memoria.
|
---|
347 | mesh->mSubMesh[i].mStripCount=this->mSubMesh[i].mStripCount;
|
---|
348 | if (this->mSubMesh[i].mStripCount>0)
|
---|
349 | {
|
---|
350 | mesh->mSubMesh[i].mStrip = new Index*[this->mSubMesh[i].mStripCount];
|
---|
351 |
|
---|
352 | Desp= &(mesh->mSubMesh[i].mIndex[0]) - &(this->mSubMesh[i].mIndex[0]);
|
---|
353 | for (size_t j=0;j<this->mSubMesh[i].mStripCount;j++)
|
---|
354 | {
|
---|
355 | mesh->mSubMesh[i].mStrip[j]=this->mSubMesh[i].mStrip[j] + Desp;
|
---|
356 | }
|
---|
357 | }
|
---|
358 | }
|
---|
359 |
|
---|
360 | mesh->mVertexBuffer->mVertexCount=acumVerts;
|
---|
361 | mesh->mVertexBuffer->mVertexInfo=this->mSubMesh[0].mVertexBuffer->mVertexInfo;
|
---|
362 | mesh->mVertexBuffer->mPosition=new Geometry::Vector3[mesh->mVertexBuffer->mVertexCount];
|
---|
363 | mesh->mVertexBuffer->mNormal=new Geometry::Vector3[mesh->mVertexBuffer->mVertexCount];
|
---|
364 | mesh->mVertexBuffer->mTexCoords=new Geometry::Vector2[mesh->mVertexBuffer->mVertexCount];
|
---|
365 |
|
---|
366 | // copiar los vértices
|
---|
367 | acumVerts=0;
|
---|
368 | size_t newIndex;
|
---|
369 | for (size_t i=0; i<this->mSubMeshCount; i++)
|
---|
370 | {
|
---|
371 | for(size_t j=0;j<this->mSubMesh[i].mVertexBuffer->mVertexCount;j++)
|
---|
372 | {
|
---|
373 | newIndex=acumVerts+j;
|
---|
374 | mesh->mVertexBuffer->mPosition[newIndex].x=this->mSubMesh[i].mVertexBuffer->mPosition[j].x;
|
---|
375 | mesh->mVertexBuffer->mPosition[newIndex].y=this->mSubMesh[i].mVertexBuffer->mPosition[j].y;
|
---|
376 | mesh->mVertexBuffer->mPosition[newIndex].z=this->mSubMesh[i].mVertexBuffer->mPosition[j].z;
|
---|
377 |
|
---|
378 | mesh->mVertexBuffer->mNormal[newIndex].x=this->mSubMesh[i].mVertexBuffer->mNormal[j].x;
|
---|
379 | mesh->mVertexBuffer->mNormal[newIndex].y=this->mSubMesh[i].mVertexBuffer->mNormal[j].y;
|
---|
380 | mesh->mVertexBuffer->mNormal[newIndex].z=this->mSubMesh[i].mVertexBuffer->mNormal[j].z;
|
---|
381 |
|
---|
382 | mesh->mVertexBuffer->mTexCoords[newIndex].x=this->mSubMesh[i].mVertexBuffer->mTexCoords[j].x;
|
---|
383 | mesh->mVertexBuffer->mTexCoords[newIndex].y=this->mSubMesh[i].mVertexBuffer->mTexCoords[j].y;
|
---|
384 | }
|
---|
385 | acumVerts+=this->mSubMesh[i].mVertexBuffer->mVertexCount;
|
---|
386 | }
|
---|
387 |
|
---|
388 | return mesh;
|
---|
389 | }
|
---|
390 |
|
---|