summary refs log tree commit diff
path: root/src/Models.h
blob: 7929887a7c9858a4e01119be73e22a87c56f8679 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef _MODELS_H_
#define _MODELS_H_

#include <GL/gl.h>

#include "Quaternions.h"
#include "Constants.h"

#define MAX_TEXTURED_TRIANGLES 400

struct TexturedTriangle {
	short vertex[3];
	float r,g,b;
};

struct Model {
	short vertexNum, TriangleNum;

	XYZ vertex[MAX_TEXTURED_TRIANGLES * 3];
	XYZ normals[MAX_TEXTURED_TRIANGLES];
	TexturedTriangle Triangles[MAX_TEXTURED_TRIANGLES];
	GLfloat vArray[MAX_TEXTURED_TRIANGLES * 27];

	XYZ boundingspherecenter;
	float boundingsphereradius;
	int LineCheck(XYZ, XYZ, XYZ*);
	int LineCheck2(XYZ, XYZ, XYZ*, XYZ, float);

	void UpdateVertexArray();
	void load(const char*);
	void save(const char*);
	void CalculateNormals();
	void draw();
	void draw(float r,float g,float b);
};

#endif