Object.cpp 15.9 KB
Newer Older
1
#include "Object.h"
Anakin's avatar
Anakin committed
2
#include <iostream>
3
4
5
6
7


/////////////////////////////////////////////////////////////////////////
// public constructor/destructor

Anakin's avatar
Anakin committed
8
Object::Object(const char* path)
9
{
Anakin's avatar
Anakin committed
10
	// open file
11
	fsMesh.open(path, std::ios::in | std::ios::binary);
12

Anakin's avatar
Anakin committed
13
14
	if (!fsMesh.is_open())
		throw std::invalid_argument(std::string("file not found: ") += path);
15

16
17
	// jump to file size information
	fsMesh.seekg(4);
18

19
20
	std::uint32_t tempFileSize;
	std::list<ChunkHeader*> tempMainChunks;
21

22
23
24
	// get all chunks under HEDR
	fsMesh.read(reinterpret_cast<char*>(&tempFileSize), sizeof(tempFileSize));
	loadChunks(tempMainChunks, fsMesh.tellg(), tempFileSize);
25

Anakin's avatar
Anakin committed
26
	// evaluate HEDR subchunks (= find MSH2)
27
	for (std::list<ChunkHeader*>::iterator it = tempMainChunks.begin(); it != tempMainChunks.end(); it++)
28
	{
29
		if (!strcmp("MSH2", (*it)->name))
30
		{
Anakin's avatar
Anakin committed
31
			// get all subchunks
32
33
			std::list<ChunkHeader*> tempMsh2Chunks;
			loadChunks(tempMsh2Chunks, (*it)->position, (*it)->size);
Anakin's avatar
Anakin committed
34

35
36
37
38
39
			// evaluate MSH2 subchunks
			analyseMsh2Chunks(tempMsh2Chunks);

			// clean up
			while (!tempMsh2Chunks.empty())
Anakin's avatar
Anakin committed
40
			{
41
42
				ChunkHeader* tempCursor = tempMsh2Chunks.front();
				tempMsh2Chunks.pop_front();
Anakin's avatar
Anakin committed
43
44
				delete tempCursor;
			}
45
			continue;
46
47
		}
	}
48

49
50
51
52
53
54
55
56
	// clean up
	while (!tempMainChunks.empty())
	{
		ChunkHeader* tempCursor = tempMainChunks.front();
		tempMainChunks.pop_front();
		delete tempCursor;
	}

57
58
59
60
61
62
63
64
	// close file
	fsMesh.close();
}

Object::~Object()
{
	//delete Chunk list;	
}
65
66


67
68
/////////////////////////////////////////////////////////////////////////
// private functions
69

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
void Object::setModlDefault(Modl * model)
{
	model->name = "";
	model->parent = "";
	model->type = null;
	model->renderFlags = -1;
	model->tran.scale[0] = 0;
	model->tran.scale[1] = 0;
	model->tran.scale[2] = 0;
	model->tran.rotation[0] = 0;
	model->tran.rotation[1] = 0;
	model->tran.rotation[2] = 0;
	model->tran.rotation[3] = 0;
	model->tran.translation[0] = 0;
	model->tran.translation[1] = 0;
	model->tran.translation[2] = 0;
	model->swci.type = -1;
	model->swci.data1 = -1;
	model->swci.data2 = -1;
	model->swci.data3 = -1;
	model->texture = "";
	model->vertex = NULL;
	model->uv = NULL;
	model->mesh = NULL;
Anakin's avatar
Anakin committed
94
	model->meshSize = 0;
95
96
}

Anakin's avatar
Anakin committed
97
void Object::loadChunks(std::list<ChunkHeader*>& destination, std::streampos start, const std::uint32_t end)
98
{
99
	// jump to first chunk
100
	fsMesh.seekg(start);
101

Anakin's avatar
Anakin committed
102
103
	do
	{
Anakin's avatar
Anakin committed
104
		ChunkHeader* tempHeader = new ChunkHeader();
105

106
107
108
		fsMesh.read(reinterpret_cast<char*>(&tempHeader->name[0]), sizeof(tempHeader->name) - 1);
		fsMesh.read(reinterpret_cast<char*>(&tempHeader->size), sizeof(tempHeader->size));
		tempHeader->position = fsMesh.tellg();
109

110
		destination.push_back(tempHeader);
111

112
		fsMesh.seekg(tempHeader->size, std::ios_base::cur);
113

114
115
		// reached end
		if (fsMesh.tellg() - start == end)
Anakin's avatar
Anakin committed
116
			break;
117
118
119
120
121
122
123
124
125
126

		// error. Maybe the size information is corrupted
		if (!fsMesh.good())
		{
			std::cout << "WARNING: corrupted file. Trying to continue" << std::endl;
			fsMesh.clear();
			break;
		}

	} while (true);
127
128

	std::cout << "got all chunks, totaly found: " << destination.size() << std::endl;
Anakin's avatar
Anakin committed
129

130
131
}

132
133
134
135
136
137
void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
{
	for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
	{
		if (!strcmp("MATL", (*it)->name))
		{
138
139
140
141
142
			// "useless" information how many MATD follow
			fsMesh.seekg((*it)->position);
			std::uint32_t tempMatdCount;
			fsMesh.read(reinterpret_cast<char*>(&tempMatdCount), sizeof(std::uint32_t));

Anakin's avatar
Anakin committed
143
144
			// get all MATD from MATL list
			std::list<ChunkHeader*> tempMatlChunks;
145
			loadChunks(tempMatlChunks, fsMesh.tellg(), (*it)->size - 4);
Anakin's avatar
Anakin committed
146
147
148
149
150
151
152
153
154
155
156
157

			// evaluate MATL subchunks
			for (std::list<ChunkHeader*>::iterator it = tempMatlChunks.begin(); it != tempMatlChunks.end(); it++)
			{
				// This shouldn't be anything else than MATD
				if (!strcmp("MATD", (*it)->name))
				{
					// get all subchunks from MATD
					std::list<ChunkHeader*> tempMatdChunks;
					loadChunks(tempMatdChunks, (*it)->position, (*it)->size);

					// analyse MATD subchunks
Anakin's avatar
Anakin committed
158
					analyseMatdChunks(tempMatdChunks);
Anakin's avatar
Anakin committed
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176

					// clean up
					while (!tempMatdChunks.empty())
					{
						ChunkHeader* tempCursor = tempMatdChunks.front();
						tempMatdChunks.pop_front();
						delete tempCursor;
					}
				}
			}

			// clean up
			while (!tempMatlChunks.empty())
			{
				ChunkHeader* tempCursor = tempMatlChunks.front();
				tempMatlChunks.pop_front();
				delete tempCursor;
			}
177
178
179
180
181
182

			continue;
		}

		if (!strcmp("MODL", (*it)->name))
		{
Anakin's avatar
Anakin committed
183
184
185
186

			Modl* tempModl = new Modl;
			setModlDefault(tempModl);

187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
			// get all subchunks
			std::list<ChunkHeader*> tempChunks;
			loadChunks(tempChunks, (*it)->position, (*it)->size);

			// evaluate MODL subchunks
			analyseModlChunks(tempModl, tempChunks);

			//clean up
			while (!tempChunks.empty())
			{
				ChunkHeader* tempCursor = tempChunks.front();
				tempChunks.pop_front();
				delete tempCursor;
			}

Anakin's avatar
Anakin committed
202
203
204
			// save Model data
			lModls.push_back(tempModl);

Anakin's avatar
Anakin committed
205
206
207
208
			continue;
		}
	}
}
209

Anakin's avatar
Anakin committed
210
void Object::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
Anakin's avatar
Anakin committed
211
212
213
214
215
216
217
218
219
220
221
222
{
	for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
	{
		//TX1D, TX2D, TX3D
		if (!strcmp("TX0D", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
			char* buffer = new char[(*it)->size + 1];
			*buffer = { 0 };
			fsMesh.read(buffer, (*it)->size);
			vTextures.push_back(buffer);
			delete buffer;
223
224
225
226
227
			continue;
		}
	}
}

Anakin's avatar
Anakin committed
228
229
230
231
232
233
234
235
236
237
void Object::analyseModlChunks(Modl* dataDestination, std::list<ChunkHeader*>& chunkList)
{
	for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
	{
		if (!strcmp("MTYP", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
			std::uint32_t tempType;
			fsMesh.read(reinterpret_cast<char*>(&tempType), sizeof(tempType));
			dataDestination->type = (Mtyp)tempType;
Anakin's avatar
Anakin committed
238
			continue;
Anakin's avatar
Anakin committed
239
240
241
242
243
		}

		if (!strcmp("PRNT", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
244
			char* buffer = new char[(*it)->size];
Anakin's avatar
Anakin committed
245
			*buffer = { 0 };
246
247
248
			fsMesh.read(buffer, (*it)->size); 
			dataDestination->parent = buffer;
			delete buffer;
Anakin's avatar
Anakin committed
249
			continue;
Anakin's avatar
Anakin committed
250
251
252
253
254
		}

		if (!strcmp("NAME", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
255
			char* buffer = new char[(*it)->size];
Anakin's avatar
Anakin committed
256
			*buffer = { 0 };
257
258
			fsMesh.read(buffer, (*it)->size);
			dataDestination->name = buffer;
259
			delete buffer;
Anakin's avatar
Anakin committed
260
			continue;
Anakin's avatar
Anakin committed
261
262
263
264
265
266
		}

		if (!strcmp("FLGS", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->renderFlags), sizeof(dataDestination->renderFlags));
Anakin's avatar
Anakin committed
267
			continue;
Anakin's avatar
Anakin committed
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
		}

		if (!strcmp("TRAN", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.scale[0]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.scale[1]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.scale[2]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.rotation[0]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.rotation[1]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.rotation[2]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.rotation[3]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.translation[0]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.translation[1]), sizeof(float));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->tran.translation[2]), sizeof(float));
Anakin's avatar
Anakin committed
283
			continue;
Anakin's avatar
Anakin committed
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
		}

		if (!strcmp("GEOM", (*it)->name))
		{
			// get all subchunks
			std::list<ChunkHeader*> tempGeomChunks;
			loadChunks(tempGeomChunks, (*it)->position, (*it)->size);

			// evaluate GEOM subchunks
			analyseGeomChunks(dataDestination, tempGeomChunks);

			// clean up
			while (!tempGeomChunks.empty())
			{
				ChunkHeader* tempCursor = tempGeomChunks.front();
				tempGeomChunks.pop_front();
				delete tempCursor;
			}
Anakin's avatar
Anakin committed
302
303

			continue;
Anakin's avatar
Anakin committed
304
305
306
307
308
309
310
311
312
		}

		if (!strcmp("SWCI", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->swci.type), sizeof(dataDestination->swci.type));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->swci.data1), sizeof(dataDestination->swci.data1));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->swci.data2), sizeof(dataDestination->swci.data2));
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->swci.data3), sizeof(dataDestination->swci.data3));
Anakin's avatar
Anakin committed
313
			continue;
Anakin's avatar
Anakin committed
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
		}
	}

}

void Object::analyseGeomChunks(Modl * dataDestination, std::list<ChunkHeader*>& chunkList)
{

	for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
	{
		if (!strcmp("SEGM", (*it)->name))
		{
			// get all subchunks
			std::list<ChunkHeader*> tempSegmChunks;
			loadChunks(tempSegmChunks, (*it)->position, (*it)->size);

			// evaluate SEGM subchunks
			analyseSegmChunks(dataDestination, tempSegmChunks);

			// clean up
			while (!tempSegmChunks.empty())
			{
				ChunkHeader* tempCursor = tempSegmChunks.front();
				tempSegmChunks.pop_front();
				delete tempCursor;
			}
Anakin's avatar
Anakin committed
340
			continue;
Anakin's avatar
Anakin committed
341
		}
Anakin's avatar
Anakin committed
342
343
		
		if (!strcmp("CLTH", (*it)->name))
Anakin's avatar
Anakin committed
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
		{
			// get all subchunks
			std::list<ChunkHeader*> tempClthChunks;
			loadChunks(tempClthChunks, (*it)->position, (*it)->size);

			// evaluate CLTH subchunks
			analyseClthChunks(dataDestination, tempClthChunks);

			// clean up
			while (!tempClthChunks.empty())
			{
				ChunkHeader* tempCursor = tempClthChunks.front();
				tempClthChunks.pop_front();
				delete tempCursor;
			}
Anakin's avatar
Anakin committed
359
			continue;
Anakin's avatar
Anakin committed
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
		}
	}

}

void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>& chunkList)
{
	for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
	{
		if (!strcmp("SHDW", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
			/* shadow mesh geometry

			long int - 4 - number of vertex positions
			float[3][] - 12 each - vertex positions (XYZ)
			long int - 4 - number of edges
			short int[4][] - 8 each - edge the following 4 entries from one edge
			> short int - 2 - vertex index of this edge, referes to the vertex list
			> short int - 2 - Reference into an edge. Defines the target vertex (the local edge vertex of the referenced edge) to which the edge should be dran from the local vertex
			> short int - 2 - Second reference into an edge. In all example .msh files I've seen this always refers to the same vertex as the first edge reference
			> short int - 2 - MAX_VALUE of short integers (65535). Indicates the end of this edge
			*/
Anakin's avatar
Anakin committed
383
			continue;
Anakin's avatar
Anakin committed
384
385
386
387
388
		}

		if (!strcmp("MATI", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
Anakin's avatar
Anakin committed
389
390
			std::uint32_t tempIndex;
			fsMesh.read(reinterpret_cast<char*>(&tempIndex), sizeof(tempIndex));
391
			if (vTextures.size() <= tempIndex)
Anakin's avatar
Anakin committed
392
393
394
395
396
			{
				std::cout << "warning texture index <" << tempIndex << "> unknown" << std::endl;
				dataDestination->texture = "";
				continue;
			}
397
			dataDestination->texture = vTextures[tempIndex];
Anakin's avatar
Anakin committed
398
			continue;
Anakin's avatar
Anakin committed
399
400
401
402
		}

		if (!strcmp("POSL", (*it)->name))
		{
403
			readVertex(dataDestination, (*it)->position);
Anakin's avatar
Anakin committed
404
			continue;
Anakin's avatar
Anakin committed
405
406
407
408
409
410
411
412
		}

		if (!strcmp("NRML", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
			// List of normals
			// long int - 4 - number of normal vectores stored in this list
			// float[3][] - 12 each - UVW vector for each vertex
Anakin's avatar
Anakin committed
413
			continue;
Anakin's avatar
Anakin committed
414
415
416
417
		}

		if (!strcmp("UV0L", (*it)->name))
		{
418
			readUV(dataDestination, (*it)->position);
Anakin's avatar
Anakin committed
419
			continue;
Anakin's avatar
Anakin committed
420
421
422
423
424
		}

		if (!strcmp("STRP", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
Anakin's avatar
Anakin committed
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449

			fsMesh.seekg((*it)->position);
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->meshSize), sizeof(dataDestination->meshSize));

			dataDestination->mesh = new std::uint32_t[dataDestination->meshSize * 3];

			for (unsigned int i = 0; i < dataDestination->meshSize; i += 3)
			{
				std::uint16_t tempValue[3];
				fsMesh.read(reinterpret_cast<char*>(&tempValue[0]), sizeof(std::uint16_t));
				fsMesh.read(reinterpret_cast<char*>(&tempValue[1]), sizeof(std::uint16_t));
				fsMesh.read(reinterpret_cast<char*>(&tempValue[2]), sizeof(std::uint16_t));

				if (!(tempValue[0] >> 15 && tempValue[1] >> 15 && !(tempValue[2] >> 15)))
					throw std::invalid_argument("invalid file. go and triangulate!");

				tempValue[0] = (std::uint16_t(tempValue[0] << 1) >> 1);
				tempValue[1] = (std::uint16_t(tempValue[1] << 1) >> 1);

				dataDestination->mesh[i] = (std::uint32_t)tempValue[0];
				dataDestination->mesh[i + 1] = (std::uint32_t)tempValue[1];
				dataDestination->mesh[i + 2] = (std::uint32_t)tempValue[2];
			}

			continue;
Anakin's avatar
Anakin committed
450
451
452
453
454
455
456
457
458
459
460
		}
	}
}

void Object::analyseClthChunks(Modl * dataDestination, std::list<ChunkHeader*>& chunkList)
{
	for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
	{
		if (!strcmp("CTEX", (*it)->name))
		{
			fsMesh.seekg((*it)->position);
461
			char* buffer = new char[(*it)->size];
Anakin's avatar
Anakin committed
462
			*buffer = { 0 };
463
464
			fsMesh.read(buffer, (*it)->size);
			dataDestination->texture = buffer;
465
			delete buffer;
Anakin's avatar
Anakin committed
466
			continue;
Anakin's avatar
Anakin committed
467
468
469
		}

		if (!strcmp("CPOS", (*it)->name))
Anakin's avatar
Anakin committed
470
		{
471
			readVertex(dataDestination, (*it)->position);
Anakin's avatar
Anakin committed
472
473
			continue;
		}
Anakin's avatar
Anakin committed
474
475

		if (!strcmp("CUV0", (*it)->name))
Anakin's avatar
Anakin committed
476
		{
477
			readUV(dataDestination, (*it)->position);
Anakin's avatar
Anakin committed
478
479
			continue;
		}
Anakin's avatar
Anakin committed
480
481

		if (!strcmp("CMSH", (*it)->name))
Anakin's avatar
Anakin committed
482
483
484
485
486
487
488
489
490
491
492
493
494
495
		{
			fsMesh.seekg((*it)->position);
			fsMesh.read(reinterpret_cast<char*>(&dataDestination->meshSize), sizeof(dataDestination->meshSize));

			dataDestination->mesh = new std::uint32_t[dataDestination->meshSize * 3];

			for (unsigned int i = 0; i < dataDestination->meshSize; i += 3)
			{
				fsMesh.read(reinterpret_cast<char*>(&dataDestination->mesh[i]), sizeof(std::uint32_t));
				fsMesh.read(reinterpret_cast<char*>(&dataDestination->mesh[i + 1]), sizeof(std::uint32_t));
				fsMesh.read(reinterpret_cast<char*>(&dataDestination->mesh[i + 2]), sizeof(std::uint32_t));
			}
			continue;
		}
496
497
498
499
500
501
502
503
504
505
506
507
	}

}

void Object::readVertex(Modl* dataDestination, std::streampos position)
{
	std::uint32_t tempSize;
	fsMesh.seekg(position);
	fsMesh.read(reinterpret_cast<char*>(&tempSize), sizeof(tempSize));

	dataDestination->vertex = new float[tempSize * 3];

Anakin's avatar
Anakin committed
508
	for (unsigned int i = 0; i < tempSize * 3; i += 3)
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
	{
		fsMesh.read(reinterpret_cast<char*>(&dataDestination->vertex[i]), sizeof(float));
		fsMesh.read(reinterpret_cast<char*>(&dataDestination->vertex[i + 1]), sizeof(float));
		fsMesh.read(reinterpret_cast<char*>(&dataDestination->vertex[i + 2]), sizeof(float));
	}
}

void Object::readUV(Modl* dataDestination, std::streampos position)
{
	std::uint32_t tempSize;
	fsMesh.seekg(position);
	fsMesh.read(reinterpret_cast<char*>(&tempSize), sizeof(tempSize));

	dataDestination->uv = new float[tempSize * 2];

Anakin's avatar
Anakin committed
524
	for (unsigned int i = 0; i < tempSize * 2; i += 2)
525
526
527
528
	{
		fsMesh.read(reinterpret_cast<char*>(&dataDestination->uv[i]), sizeof(float));
		fsMesh.read(reinterpret_cast<char*>(&dataDestination->uv[i + 1]), sizeof(float));
	}
Anakin's avatar
Anakin committed
529
530
}

531

Anakin's avatar
Anakin committed
532
533
/////////////////////////////////////////////////////////////////////////
// public getter
534

535
536
537
538
539
540
std::vector<GLfloat> Object::getVertex() const
{
	std::vector<GLfloat> tempData;

	for (std::list<Modl*>::const_iterator it = lModls.begin(); it != lModls.end(); it++)
	{
Anakin's avatar
Anakin committed
541
		for (unsigned int i = 0; i < (*it)->meshSize; i++)
542
		{
Anakin's avatar
Anakin committed
543
544
545
			tempData.push_back((GLfloat)(*it)->vertex[(*it)->mesh[i] * 3]);
			tempData.push_back((GLfloat)(*it)->vertex[(*it)->mesh[i] * 3 + 1]);
			tempData.push_back((GLfloat)(*it)->vertex[(*it)->mesh[i] * 3 + 2]);
546
547
548
549
550
551
552
553
554
555
556
		}
	}

	return tempData;
}

std::vector<GLfloat> Object::getUV() const
{
	std::vector<GLfloat> tempData;

	for (std::list<Modl*>::const_iterator it = lModls.begin(); it != lModls.end(); it++)
Anakin's avatar
Anakin committed
557
558
	{
		if ((*it)->uv == NULL)
Anakin's avatar
Anakin committed
559
560
561
		{
			for (unsigned int i = 0; i < (*it)->meshSize; i++)
				tempData.push_back(1.0);
Anakin's avatar
Anakin committed
562
			continue;
Anakin's avatar
Anakin committed
563
564
		}
		for (unsigned int i = 0; i < (*it)->meshSize; i++)
Anakin's avatar
Anakin committed
565
		{
Anakin's avatar
Anakin committed
566
567
			tempData.push_back((GLfloat)(*it)->uv[(*it)->mesh[i] * 2]);
			tempData.push_back((GLfloat)(*it)->uv[(*it)->mesh[i] * 2 + 1]);
Anakin's avatar
Anakin committed
568
569
		}
	}
570
571
572

	return tempData;
}
573

574
575
576
577
578
579
580
581
582
583
std::list<std::string> Object::getTexture() const
{
	std::list<std::string> tempData;

	for (std::list<Modl*>::const_iterator it = lModls.begin(); it != lModls.end(); it++)
		tempData.push_back((*it)->texture);

	return tempData;
}

584
585
586
587

/////////////////////////////////////////////////////////////////////////
// public functions