Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // C++ Interface: mesh
- //
- // Description:
- //
- //
- // Author: Juan Linietsky <reduz@codenix.com>, (C) 2006
- //
- // Copyright: See COPYING file that comes with this distribution
- //
- //
- #ifndef SCENEMESH_H
- #define SCENEMESH_H
- #include "node.h"
- #include "resource/resource.h"
- #include "memory/mem_vector.h"
- #include "scene/visual_node.h"
- #include "scene/scene_store.h"
- /**
- @author Juan Linietsky <reduz@codenix.com>
- */
- class MeshNode : public VisualNode {
- public:
- enum VolumeMode {
- VOLUME_STATIC, // default, for objects that either wont rotate/move that much, or need good culling precision
- VOLUME_ANY_ORIENTATION, // best used for objects that can rotate in any axis
- };
- /**
- * Some platforms benefit from optimizing the geometry specifically for them.
- * Mesh optimization is done upon loading by the MeshNodeStore class.
- * Mesh nodes can hint wether on how they want to be optimized.
- *
- */
- enum OptimizationHintType {
- OPTIMIZE_NONE, /** Don't perform any optimization, unless the platform requires it */
- OPTIMIZE_REALTIME, /** Optimize after loading, optionally */
- OPTIMIZE_FROM_CACHE, /** The scene provides a cache to load the optimization from */
- };
- private:
- VolumeMode volume_mode;
- RID mesh;
- RID skeleton; //in case it uses a skeleton
- RID material_override;
- AABB static_volume;
- OptimizationHintType optimization_hint;
- String optimized_cache_file;
- void render(const RenderData& p_render_data);
- public:
- AABB get_static_volume();
- NodeType get_type() const {return TYPE_MESH;};
- void set_mesh(RID p_mesh);
- void set_skeleton(RID p_skeleton);
- RID get_mesh();
- RID get_skeleton();
- void set_volume_mode(VolumeMode p_volume_mode);
- VolumeMode get_volume_mode();
- void set_material_override(RID p_mat);
- void regenerate_volume(); ///< This function is pretty slow, dont be calling it constantly please. This will just regenerate the AABB volume.
- void set_scene_main(SceneMain* p_scene_main);
- void get_optimization_hint(OptimizationHintType p_type);
- void get_optimized_cache_file(String p_file);
- OptimizationHintType get_optimization_hint();
- String get_optimized_cache_file();
- virtual Error get_polygon_shapes(List< MemVector<Face3> > &p_dst);
- MeshNode(VolumeMode p_volume_mode=VOLUME_ANY_ORIENTATION);
- ~MeshNode();
- };
- class StaticMeshNode : public MeshNode {
- public:
- StaticMeshNode() : MeshNode( VOLUME_STATIC ) {}
- };
- class MeshNodeStore : public NodeStore {
- public:
- virtual bool handles_node(Node *p_node);
- virtual String get_node_string();
- virtual bool load(TreeLoader *p_tree,Node *p_node); ///< Returns false if load was succesful, true if node was unrecognized
- virtual bool save(TreeSaver*p_tree,Node *p_node); ///< Returns false if save
- virtual Node* create_node() { return memnew(MeshNode); } ///< create a node of the type it handles
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement