goat3d

annotate src/goat3d_impl.h @ 74:ab66cdabf6f2

loading scene files (no vis yet)
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 06 May 2014 13:26:52 +0300
parents 99715321ad6d
children 76dea247f75c
rev   line source
nuclear@54 1 /*
nuclear@54 2 goat3d - 3D scene, character, and animation file format library.
nuclear@54 3 Copyright (C) 2013-2014 John Tsiombikas <nuclear@member.fsf.org>
nuclear@54 4
nuclear@54 5 This program is free software: you can redistribute it and/or modify
nuclear@54 6 it under the terms of the GNU Lesser General Public License as published by
nuclear@54 7 the Free Software Foundation, either version 3 of the License, or
nuclear@54 8 (at your option) any later version.
nuclear@54 9
nuclear@54 10 This program is distributed in the hope that it will be useful,
nuclear@54 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
nuclear@54 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nuclear@54 13 GNU Lesser General Public License for more details.
nuclear@54 14
nuclear@54 15 You should have received a copy of the GNU Lesser General Public License
nuclear@54 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
nuclear@54 17 */
nuclear@0 18 #ifndef GOAT3D_IMPL_H_
nuclear@0 19 #define GOAT3D_IMPL_H_
nuclear@0 20
nuclear@0 21 #include <string>
nuclear@1 22 #include <vmath/vmath.h>
nuclear@0 23 #include "goat3d.h"
nuclear@0 24 #include "mesh.h"
nuclear@0 25 #include "light.h"
nuclear@0 26 #include "camera.h"
nuclear@0 27 #include "material.h"
nuclear@12 28 #include "node.h"
nuclear@0 29
nuclear@47 30 namespace g3dimpl {
nuclear@74 31 class Scene;
nuclear@74 32 }
nuclear@74 33
nuclear@74 34 struct goat3d {
nuclear@74 35 g3dimpl::Scene *scn;
nuclear@74 36 unsigned int flags;
nuclear@74 37 char *search_path;
nuclear@74 38 };
nuclear@74 39
nuclear@74 40
nuclear@74 41 namespace g3dimpl {
nuclear@47 42
nuclear@15 43 extern int goat_log_level;
nuclear@15 44
nuclear@19 45 #if __cplusplus >= 201103L
nuclear@19 46 #define MOVE(x) std::move(x)
nuclear@19 47 #else
nuclear@19 48 #define MOVE(x) x
nuclear@19 49 #endif
nuclear@19 50
nuclear@19 51 #define VECDATA(type, data, num) \
nuclear@19 52 MOVE(std::vector<type>((type*)(data), (type*)(data) + (num)))
nuclear@19 53
nuclear@51 54 std::string clean_filename(const char *str);
nuclear@40 55
nuclear@19 56
nuclear@0 57 class Scene {
nuclear@0 58 private:
nuclear@0 59 std::string name;
nuclear@0 60 Vector3 ambient;
nuclear@0 61
nuclear@0 62 std::vector<Material*> materials;
nuclear@0 63 std::vector<Mesh*> meshes;
nuclear@0 64 std::vector<Light*> lights;
nuclear@0 65 std::vector<Camera*> cameras;
nuclear@12 66 std::vector<Node*> nodes;
nuclear@0 67
nuclear@0 68 public:
nuclear@74 69 goat3d *goat;
nuclear@74 70
nuclear@0 71 Scene();
nuclear@0 72 ~Scene();
nuclear@0 73
nuclear@0 74 void clear();
nuclear@0 75
nuclear@0 76 void set_name(const char *name);
nuclear@0 77 const char *get_name() const;
nuclear@0 78
nuclear@0 79 void set_ambient(const Vector3 &amb);
nuclear@0 80 const Vector3 &get_ambient() const;
nuclear@0 81
nuclear@0 82 void add_material(Material *mat);
nuclear@0 83 Material *get_material(int idx) const;
nuclear@0 84 Material *get_material(const char *name) const;
nuclear@9 85 int get_material_count() const;
nuclear@0 86
nuclear@0 87 void add_mesh(Mesh *mesh);
nuclear@0 88 Mesh *get_mesh(int idx) const;
nuclear@0 89 Mesh *get_mesh(const char *name) const;
nuclear@9 90 int get_mesh_count() const;
nuclear@0 91
nuclear@0 92 void add_light(Light *light);
nuclear@0 93 Light *get_light(int idx) const;
nuclear@0 94 Light *get_light(const char *name) const;
nuclear@9 95 int get_light_count() const;
nuclear@0 96
nuclear@0 97 void add_camera(Camera *cam);
nuclear@0 98 Camera *get_camera(int idx) const;
nuclear@0 99 Camera *get_camera(const char *name) const;
nuclear@9 100 int get_camera_count() const;
nuclear@0 101
nuclear@0 102 void add_node(Node *node);
nuclear@0 103 Node *get_node(int idx) const;
nuclear@0 104 Node *get_node(const char *name) const;
nuclear@9 105 int get_node_count() const;
nuclear@0 106
nuclear@0 107 bool load(goat3d_io *io);
nuclear@0 108 bool save(goat3d_io *io) const;
nuclear@14 109
nuclear@14 110 bool loadxml(goat3d_io *io);
nuclear@14 111 bool savexml(goat3d_io *io) const;
nuclear@47 112
nuclear@47 113 bool load_anim(goat3d_io *io);
nuclear@55 114 bool save_anim(goat3d_io *io) const;
nuclear@47 115
nuclear@47 116 bool load_anim_xml(goat3d_io *io);
nuclear@55 117 bool save_anim_xml(goat3d_io *io) const;
nuclear@0 118 };
nuclear@0 119
nuclear@14 120 void io_fprintf(goat3d_io *io, const char *fmt, ...);
nuclear@14 121 void io_vfprintf(goat3d_io *io, const char *fmt, va_list ap);
nuclear@0 122
nuclear@47 123 } // namespace g3dimpl
nuclear@47 124
nuclear@0 125 #endif // GOAT3D_IMPL_H_