1
/***************************************************************************
2
* Copyright (C) 2006 by Frederic MARTIN *
3
* martin-frederic@users.sourceforge.net *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
21
#ifndef CLIGHT_WAVE_OBJECT_H
22
#define CLIGHT_WAVE_OBJECT_H
30
int *pointIndex; // List of point indexes.
31
int totalPoints; // Total points of this poly.
32
int surfaceIndex; // Index into surface array.
33
CVector4 normal; // This poly's normal.
39
float red, green, blue; // Color of surface.
40
char name[40]; // Name of surface.
44
class CLightWaveObject
47
CLightWaveObject(); // Contructor.
48
~CLightWaveObject(); // Destructor.
50
bool LoadModel(char *filename); // Load a model into this class.
51
void Shutdown(); // Release all resources.
54
bool ReadShortFromFile(FILE *fp, unsigned short &value); // Read a short from a file.
55
bool ReadIntFromFile(FILE *fp, int &value); // Read a int from a file.
56
bool ReadFloatFromFile(FILE *fp, float &value); // Read a float from a file.
57
bool ReadSubChunkFromFile(FILE *fp, char *buffer,
58
unsigned short &val); // Read a sub chunk from file.
60
bool LoadTags(FILE *fp); // Load all tags.
61
bool LoadSurfaces(FILE *fp); // Load all surfaces.
62
int AddPolygon(FILE * fp); // Add a polygon to the list.
63
bool FindChunk(FILE *fp, const char *chunk); // Searches for a chunk.
64
bool FindNextChunk(FILE *fp, const char *chunk); // Searches for a chunk.
66
void CalculateNormals(); // Calculate all polygon normals.
69
CVector4 *m_vertices; // List of vertex points.
70
CVector4 *m_normals; // List of normals
71
stPolygon *m_polygons; // List of polygons.
72
stSurface *m_surfaces; // List of surfaces.
74
int m_totalPoints; // Total num of vertex points.
75
int m_totalPolygons; // Total num of polygons.
76
int m_totalSurfaces; // Total num of surfaces.