]>
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.
24 #include <boost/noncopyable.hpp>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/weak_ptr.hpp>
28 #include <moof/entity.hh>
29 #include <moof/image.hh>
30 #include <moof/math.hh>
31 #include <moof/resource.hh>
40 class mesh
: public boost::noncopyable
, public entity
44 explicit mesh(const std::string
& path
);
46 void draw(scalar alpha
= SCALAR(0.0)) const;
51 material(const std::string
& id
) :
65 void set_material(int index
) const;
66 void set_material(const material
& material
) const;
70 std::vector
<unsigned> triangles
;
71 std::vector
<vector2
> triangles_uv
;
76 typedef boost::shared_ptr
<object
> object_ptr
;
77 typedef boost::weak_ptr
<object
> object_weakptr
;
81 object(const mesh
& m
) :
83 texrep(SCALAR(1.0), SCALAR(1.0)) {}
85 static object_ptr
alloc(const mesh
& m
)
87 return object_ptr(new object(m
));
90 void draw(scalar alpha
= SCALAR(0.0), bool recurse
= true) const;
93 const moof::mesh
& mesh
;
102 std::vector
<vector3
> verts
;
103 std::vector
<material_group
> faces
;
105 std::vector
<object_ptr
> kids
;
106 std::map
<std::string
,object_ptr
> kids_byname
;
107 object_weakptr parent
;
111 object_ptr
operator [] (unsigned index
) const
113 return objects_
[index
];
118 * Import script bindings for the mesh class.
120 * \param The name of the namespace to import to.
122 static void import(script
& script
, const std::string
& nspace
= "");
127 void import(std::istream
& stream
);
129 std::vector
<material
> materials_
;
130 std::vector
<object_ptr
> objects_
;
133 typedef resource_handle
<mesh
> mesh_handle
;
138 #endif // _MOOF_MESH_HH_
This page took 0.04758 seconds and 4 git commands to generate.