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