]>
Dogcows Code - chaz/yoink/blob - src/moof/mesh.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
12 #ifndef _MOOF_MESH_HH_
13 #define _MOOF_MESH_HH_
17 * Defines classes for loading and manipulating meshes.
22 #include <boost/noncopyable.hpp>
23 #include <boost/shared_ptr.hpp>
25 #include <moof/drawable.hh>
26 #include <moof/image.hh>
27 #include <moof/math.hh>
28 #include <moof/resource.hh>
34 class mesh
: public boost::noncopyable
, public drawable
38 explicit mesh(const std::string
& path
);
40 void draw(scalar alpha
= SCALAR(0.0)) const;
45 material(const std::string
& id
) :
59 //typedef vector3 triangle[3];
60 //typedef vector2 triangle_uv[3];
61 //typedef vector3 quad[4];
62 //typedef vector2 quad_uv[4];
67 //vector3& operator [] (int i) { return verts[i]; }
68 //const vector3& operator [] (int i) const { return verts[i]; }
74 //vector2& operator [] (int i) { return verts[i]; }
75 //const vector2& operator [] (int i) const { return verts[i]; }
82 //vector3& operator [] (int i) { return verts[i]; }
83 //const vector3& operator [] (int i) const { return verts[i]; }
90 //vector2& operator [] (int i) { return verts[i]; }
91 //const vector2& operator [] (int i) const { return verts[i]; }
95 void set_material(int index
) const;
96 void set_material(const material
& material
) const;
98 struct material_group
: public drawable
102 std::vector
<unsigned> triangles
;
103 std::vector
<vector2
> triangles_uv
;
105 std::vector
<unsigned> quads
;
106 std::vector
<vector2
> quads_uv
;
109 void draw(scalar alpha
= SCALAR(0.0)) const;
114 typedef boost::shared_ptr
<object
> object_ptr
;
119 texrep(SCALAR(1.0), SCALAR(1.0)) {}
121 static object_ptr
alloc()
123 return object_ptr(new object
);
127 void draw(const mesh
& mesh
, scalar alpha
= SCALAR(0.0)) const;
134 image_handle texture
;
137 std::vector
<vector3
> verts
;
138 std::vector
<material_group
> faces
;
140 std::vector
<object_ptr
> kids
;
147 void import(std::istream
& stream
);
149 std::vector
<material
> materials_
;
150 std::vector
<object_ptr
> objects_
;
153 typedef resource_handle
<mesh
> mesh_handle
;
158 #endif // _MOOF_MESH_HH_
This page took 0.038362 seconds and 5 git commands to generate.