goat3d

annotate 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
rev   line source
nuclear@0 1 #ifndef GOAT3D_IMPL_H_
nuclear@0 2 #define GOAT3D_IMPL_H_
nuclear@0 3
nuclear@0 4 #include <string>
nuclear@1 5 #include <vmath/vmath.h>
nuclear@0 6 #include "goat3d.h"
nuclear@0 7 #include "mesh.h"
nuclear@0 8 #include "light.h"
nuclear@0 9 #include "camera.h"
nuclear@0 10 #include "material.h"
nuclear@12 11 #include "node.h"
nuclear@0 12
nuclear@15 13 extern int goat_log_level;
nuclear@15 14
nuclear@19 15 #if __cplusplus >= 201103L
nuclear@19 16 #define MOVE(x) std::move(x)
nuclear@19 17 #else
nuclear@19 18 #define MOVE(x) x
nuclear@19 19 #endif
nuclear@19 20
nuclear@19 21 #define VECDATA(type, data, num) \
nuclear@19 22 MOVE(std::vector<type>((type*)(data), (type*)(data) + (num)))
nuclear@19 23
nuclear@40 24 std::string goat3d_clean_filename(const char *str);
nuclear@40 25
nuclear@19 26
nuclear@0 27 class Scene {
nuclear@0 28 private:
nuclear@0 29 std::string name;
nuclear@0 30 Vector3 ambient;
nuclear@0 31
nuclear@0 32 std::vector<Material*> materials;
nuclear@0 33 std::vector<Mesh*> meshes;
nuclear@0 34 std::vector<Light*> lights;
nuclear@0 35 std::vector<Camera*> cameras;
nuclear@12 36 std::vector<Node*> nodes;
nuclear@0 37
nuclear@0 38 public:
nuclear@0 39 Scene();
nuclear@0 40 ~Scene();
nuclear@0 41
nuclear@0 42 void clear();
nuclear@0 43
nuclear@0 44 void set_name(const char *name);
nuclear@0 45 const char *get_name() const;
nuclear@0 46
nuclear@0 47 void set_ambient(const Vector3 &amb);
nuclear@0 48 const Vector3 &get_ambient() const;
nuclear@0 49
nuclear@0 50 void add_material(Material *mat);
nuclear@0 51 Material *get_material(int idx) const;
nuclear@0 52 Material *get_material(const char *name) const;
nuclear@9 53 int get_material_count() const;
nuclear@0 54
nuclear@0 55 void add_mesh(Mesh *mesh);
nuclear@0 56 Mesh *get_mesh(int idx) const;
nuclear@0 57 Mesh *get_mesh(const char *name) const;
nuclear@9 58 int get_mesh_count() const;
nuclear@0 59
nuclear@0 60 void add_light(Light *light);
nuclear@0 61 Light *get_light(int idx) const;
nuclear@0 62 Light *get_light(const char *name) const;
nuclear@9 63 int get_light_count() const;
nuclear@0 64
nuclear@0 65 void add_camera(Camera *cam);
nuclear@0 66 Camera *get_camera(int idx) const;
nuclear@0 67 Camera *get_camera(const char *name) const;
nuclear@9 68 int get_camera_count() const;
nuclear@0 69
nuclear@0 70 void add_node(Node *node);
nuclear@0 71 Node *get_node(int idx) const;
nuclear@0 72 Node *get_node(const char *name) const;
nuclear@9 73 int get_node_count() const;
nuclear@0 74
nuclear@0 75 bool load(goat3d_io *io);
nuclear@0 76 bool save(goat3d_io *io) const;
nuclear@14 77
nuclear@14 78 bool loadxml(goat3d_io *io);
nuclear@14 79 bool savexml(goat3d_io *io) const;
nuclear@0 80 };
nuclear@0 81
nuclear@14 82 void io_fprintf(goat3d_io *io, const char *fmt, ...);
nuclear@14 83 void io_vfprintf(goat3d_io *io, const char *fmt, va_list ap);
nuclear@0 84
nuclear@0 85 #endif // GOAT3D_IMPL_H_