goat3d

view src/goat3d_impl.h @ 40:a5c5cec3cb88

- added mesh attribute and face append functions - added Int4 constructor - continued the blender exporter - fixed a bug in clean_filename which made it produce unterminated strings - renamed clean_filename to goat3d_clean_filename and made it extern - added call to goat3d_clean_filename in the mesh XML export code to cleanup ctm filenames
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 13 Oct 2013 10:14:19 +0300
parents b35427826b60
children 498ca7ac7047
line source
1 #ifndef GOAT3D_IMPL_H_
2 #define GOAT3D_IMPL_H_
4 #include <string>
5 #include <vmath/vmath.h>
6 #include "goat3d.h"
7 #include "mesh.h"
8 #include "light.h"
9 #include "camera.h"
10 #include "material.h"
11 #include "node.h"
13 extern int goat_log_level;
15 #if __cplusplus >= 201103L
16 #define MOVE(x) std::move(x)
17 #else
18 #define MOVE(x) x
19 #endif
21 #define VECDATA(type, data, num) \
22 MOVE(std::vector<type>((type*)(data), (type*)(data) + (num)))
24 std::string goat3d_clean_filename(const char *str);
27 class Scene {
28 private:
29 std::string name;
30 Vector3 ambient;
32 std::vector<Material*> materials;
33 std::vector<Mesh*> meshes;
34 std::vector<Light*> lights;
35 std::vector<Camera*> cameras;
36 std::vector<Node*> nodes;
38 public:
39 Scene();
40 ~Scene();
42 void clear();
44 void set_name(const char *name);
45 const char *get_name() const;
47 void set_ambient(const Vector3 &amb);
48 const Vector3 &get_ambient() const;
50 void add_material(Material *mat);
51 Material *get_material(int idx) const;
52 Material *get_material(const char *name) const;
53 int get_material_count() const;
55 void add_mesh(Mesh *mesh);
56 Mesh *get_mesh(int idx) const;
57 Mesh *get_mesh(const char *name) const;
58 int get_mesh_count() const;
60 void add_light(Light *light);
61 Light *get_light(int idx) const;
62 Light *get_light(const char *name) const;
63 int get_light_count() const;
65 void add_camera(Camera *cam);
66 Camera *get_camera(int idx) const;
67 Camera *get_camera(const char *name) const;
68 int get_camera_count() const;
70 void add_node(Node *node);
71 Node *get_node(int idx) const;
72 Node *get_node(const char *name) const;
73 int get_node_count() const;
75 bool load(goat3d_io *io);
76 bool save(goat3d_io *io) const;
78 bool loadxml(goat3d_io *io);
79 bool savexml(goat3d_io *io) const;
80 };
82 void io_fprintf(goat3d_io *io, const char *fmt, ...);
83 void io_vfprintf(goat3d_io *io, const char *fmt, va_list ap);
85 #endif // GOAT3D_IMPL_H_