nuclear@54: /* nuclear@54: goat3d - 3D scene, character, and animation file format library. nuclear@54: Copyright (C) 2013-2014 John Tsiombikas nuclear@54: nuclear@54: This program is free software: you can redistribute it and/or modify nuclear@54: it under the terms of the GNU Lesser General Public License as published by nuclear@54: the Free Software Foundation, either version 3 of the License, or nuclear@54: (at your option) any later version. nuclear@54: nuclear@54: This program is distributed in the hope that it will be useful, nuclear@54: but WITHOUT ANY WARRANTY; without even the implied warranty of nuclear@54: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nuclear@54: GNU Lesser General Public License for more details. nuclear@54: nuclear@54: You should have received a copy of the GNU Lesser General Public License nuclear@54: along with this program. If not, see . nuclear@54: */ nuclear@0: #ifndef GOAT3D_IMPL_H_ nuclear@0: #define GOAT3D_IMPL_H_ nuclear@0: nuclear@0: #include nuclear@1: #include nuclear@0: #include "goat3d.h" nuclear@0: #include "mesh.h" nuclear@0: #include "light.h" nuclear@0: #include "camera.h" nuclear@0: #include "material.h" nuclear@12: #include "node.h" nuclear@75: #include "aabox.h" nuclear@0: nuclear@47: namespace g3dimpl { nuclear@74: class Scene; nuclear@74: } nuclear@74: nuclear@74: struct goat3d { nuclear@74: g3dimpl::Scene *scn; nuclear@74: unsigned int flags; nuclear@74: char *search_path; nuclear@74: }; nuclear@74: nuclear@74: nuclear@74: namespace g3dimpl { nuclear@47: nuclear@15: extern int goat_log_level; nuclear@15: nuclear@19: #if __cplusplus >= 201103L nuclear@19: #define MOVE(x) std::move(x) nuclear@19: #else nuclear@19: #define MOVE(x) x nuclear@19: #endif nuclear@19: nuclear@19: #define VECDATA(type, data, num) \ nuclear@19: MOVE(std::vector((type*)(data), (type*)(data) + (num))) nuclear@19: nuclear@51: std::string clean_filename(const char *str); nuclear@40: nuclear@19: nuclear@0: class Scene { nuclear@0: private: nuclear@0: std::string name; nuclear@0: Vector3 ambient; nuclear@0: nuclear@0: std::vector materials; nuclear@0: std::vector meshes; nuclear@0: std::vector lights; nuclear@0: std::vector cameras; nuclear@12: std::vector nodes; nuclear@0: nuclear@75: mutable AABox bbox; nuclear@75: mutable bool bbox_valid; nuclear@75: nuclear@0: public: nuclear@74: goat3d *goat; nuclear@74: nuclear@0: Scene(); nuclear@0: ~Scene(); nuclear@0: nuclear@0: void clear(); nuclear@0: nuclear@0: void set_name(const char *name); nuclear@0: const char *get_name() const; nuclear@0: nuclear@0: void set_ambient(const Vector3 &amb); nuclear@0: const Vector3 &get_ambient() const; nuclear@0: nuclear@0: void add_material(Material *mat); nuclear@0: Material *get_material(int idx) const; nuclear@0: Material *get_material(const char *name) const; nuclear@9: int get_material_count() const; nuclear@0: nuclear@0: void add_mesh(Mesh *mesh); nuclear@0: Mesh *get_mesh(int idx) const; nuclear@0: Mesh *get_mesh(const char *name) const; nuclear@9: int get_mesh_count() const; nuclear@0: nuclear@0: void add_light(Light *light); nuclear@0: Light *get_light(int idx) const; nuclear@0: Light *get_light(const char *name) const; nuclear@9: int get_light_count() const; nuclear@0: nuclear@0: void add_camera(Camera *cam); nuclear@0: Camera *get_camera(int idx) const; nuclear@0: Camera *get_camera(const char *name) const; nuclear@9: int get_camera_count() const; nuclear@0: nuclear@0: void add_node(Node *node); nuclear@0: Node *get_node(int idx) const; nuclear@0: Node *get_node(const char *name) const; nuclear@9: int get_node_count() const; nuclear@0: nuclear@75: const AABox &get_bounds() const; nuclear@75: nuclear@0: bool load(goat3d_io *io); nuclear@0: bool save(goat3d_io *io) const; nuclear@14: nuclear@14: bool loadxml(goat3d_io *io); nuclear@14: bool savexml(goat3d_io *io) const; nuclear@47: nuclear@47: bool load_anim(goat3d_io *io); nuclear@55: bool save_anim(goat3d_io *io) const; nuclear@47: nuclear@47: bool load_anim_xml(goat3d_io *io); nuclear@55: bool save_anim_xml(goat3d_io *io) const; nuclear@0: }; nuclear@0: nuclear@14: void io_fprintf(goat3d_io *io, const char *fmt, ...); nuclear@14: void io_vfprintf(goat3d_io *io, const char *fmt, va_list ap); nuclear@0: nuclear@47: } // namespace g3dimpl nuclear@47: nuclear@0: #endif // GOAT3D_IMPL_H_