Subversion Repositories gelsvn

Rev

Rev 136 | Rev 338 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 136 Rev 178
Line 1... Line 1...
1
#ifndef __MINI_MESH_H
1
#ifndef __MINI_MESH_H
2
#define __MINI_MESH_H
2
#define __MINI_MESH_H
3
 
3
 
4
#include "IndexedFaceSet.h"
4
#include "IndexedFaceSet.h"
5
#include "Material.h"
5
#include "Material.h"
6
#include "Texmap.h"
-
 
7
 
6
 
8
namespace Geometry
7
namespace Geometry
9
{
8
{
10
 
9
 
11
 
10
 
12
	/** \brief A Triangle Mesh struct. 
11
	/** \brief A Triangle Mesh struct. 
13
 
12
 
14
	    This struct contains three indexed face sets,
13
	    This struct contains three indexed face sets, one for geometry,
15
			one for geometry, textures, and normals. It also contains a vector
14
			textures, and normals. It also contains a vector of materials and a
16
			of materials and a vector of texture maps.
15
			vector of texture maps.
17
 
16
 
18
			A number of functions are defined allowing for rendering of the
17
			A number of functions are defined allowing for rendering of the triangle
19
			triangle mesh. */
18
			mesh. */
20
	struct TriMesh 
19
	struct TriMesh 
21
	{
20
	{
22
		// ------- DATA -------
21
		// ------- DATA -------
23
 
22
 
24
		/// Name of model
23
		/// Name of model
Line 40... Line 39...
40
		std::vector<int> tex_idx;
39
		std::vector<int> tex_idx;
41
 
40
 
42
		/// Vector of materials
41
		/// Vector of materials
43
		std::vector<Material> materials;
42
		std::vector<Material> materials;
44
 
43
 
45
		/// Vector of texture maps.
-
 
46
		std::vector<Texmap> texmaps;
-
 
47
 
-
 
48
		// -------- FUNCTIONS -----------
44
		// -------- FUNCTIONS -----------
49
 
45
 
50
		/// Get an axis aligned bounding box for the model.
46
		/// Get an axis aligned bounding box for the model.
51
		void get_bbox(CGLA::Vec3f& p0, CGLA::Vec3f& p7) const;
47
		void get_bbox(CGLA::Vec3f& p0, CGLA::Vec3f& p7) const;
52
 
48
 
Line 60... Line 56...
60
		}
56
		}
61
		
57
		
62
		/// Find a material from its name
58
		/// Find a material from its name
63
		int find_material(const std::string&) const;
59
		int find_material(const std::string&) const;
64
 
60
 
65
		/// Find a texture map from its name
-
 
66
		int find_texmap(const std::string&) const;
-
 
67
		
-
 
68
		/// Compute normals for the mesh. Does not check if there are normals.
61
		/// Compute normals for the mesh. Does not check if there are normals.
69
		void compute_normals();
62
		void compute_normals();
70
 
63
 
71
		/// Initialize textures
-
 
72
		void gl_init_textures();
-
 
73
 
-
 
74
		/// Use material corresponding to idx
-
 
75
		void TriMesh::gl_set_material(size_t idx);
-
 
76
		
-
 
77
		/// Draw the mesh using OpenGL.
-
 
78
		void gl_draw();
-
 
79
	};
64
	};
80
 
65
 
81
 
66
 
82
}
67
}
83
#endif
68
#endif