goat3d

view src/goat3d_impl.h @ 47:498ca7ac7047

- placed all the implementation stuff in the g3dimpl namespace - added animation stuff to the public API - started writing animation saving/loading
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 28 Dec 2013 06:47:39 +0200
parents a5c5cec3cb88
children fa5c52ea9d59
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 namespace g3dimpl {
15 extern int goat_log_level;
17 #if __cplusplus >= 201103L
18 #define MOVE(x) std::move(x)
19 #else
20 #define MOVE(x) x
21 #endif
23 #define VECDATA(type, data, num) \
24 MOVE(std::vector<type>((type*)(data), (type*)(data) + (num)))
26 std::string goat3d_clean_filename(const char *str);
29 class Scene {
30 private:
31 std::string name;
32 Vector3 ambient;
34 std::vector<Material*> materials;
35 std::vector<Mesh*> meshes;
36 std::vector<Light*> lights;
37 std::vector<Camera*> cameras;
38 std::vector<Node*> nodes;
40 public:
41 Scene();
42 ~Scene();
44 void clear();
46 void set_name(const char *name);
47 const char *get_name() const;
49 void set_ambient(const Vector3 &amb);
50 const Vector3 &get_ambient() const;
52 void add_material(Material *mat);
53 Material *get_material(int idx) const;
54 Material *get_material(const char *name) const;
55 int get_material_count() const;
57 void add_mesh(Mesh *mesh);
58 Mesh *get_mesh(int idx) const;
59 Mesh *get_mesh(const char *name) const;
60 int get_mesh_count() const;
62 void add_light(Light *light);
63 Light *get_light(int idx) const;
64 Light *get_light(const char *name) const;
65 int get_light_count() const;
67 void add_camera(Camera *cam);
68 Camera *get_camera(int idx) const;
69 Camera *get_camera(const char *name) const;
70 int get_camera_count() const;
72 void add_node(Node *node);
73 Node *get_node(int idx) const;
74 Node *get_node(const char *name) const;
75 int get_node_count() const;
77 bool load(goat3d_io *io);
78 bool save(goat3d_io *io) const;
80 bool loadxml(goat3d_io *io);
81 bool savexml(goat3d_io *io) const;
83 bool load_anim(goat3d_io *io);
84 bool save_anim(const XFormNode *node, goat3d_io *io) const;
86 bool load_anim_xml(goat3d_io *io);
87 bool save_anim_xml(const XFormNode *node, goat3d_io *io) const;
88 };
90 void io_fprintf(goat3d_io *io, const char *fmt, ...);
91 void io_vfprintf(goat3d_io *io, const char *fmt, va_list ap);
93 } // namespace g3dimpl
95 #endif // GOAT3D_IMPL_H_