00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Reality Rift Studios * 00003 * http://www.realityrift.com - mattias@realityrift.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef neo_scene_abt_builder_h 00022 #define neo_scene_abt_builder_h 00023 00029 #include "../../core/platform.h" 00030 00031 #if NEO_ENABLE_SCENE_ABT 00032 00033 #include "../../core/singleton.h" 00034 #include "../geometry.h" 00035 #include "scene.h" 00036 00037 namespace neo { 00038 namespace scene { 00039 namespace abt { 00040 00042 00045 class Builder : public core::Singleton< Builder > 00046 { 00047 public: 00048 00050 00055 Scene* partition( const std::string& name, unsigned int rid, core::Array< Geometry* >& geometries ); 00056 00057 protected: 00058 00059 Builder(); 00060 virtual ~Builder(); 00061 00062 bool terminate( core::Array< Geometry* >& geometries ); 00063 void partitionToNode( Node* p_node, core::Array< Geometry* >& geometries, int depth ); 00064 unsigned int rebuildBoxes( Node* p_node, unsigned int depth, unsigned int* p_numNodes ); 00065 00067 unsigned int _maxPrimitives; 00068 00070 unsigned int _maxPrimitivesAddPerBatch; 00071 00073 unsigned int _maxTreeDepth; 00074 00076 bool _stripify; 00077 00078 // Final vertex buffers 00079 core::Array< render::VertexBufferPtr > _vertexBuffers; 00080 00082 core::Array< Geometry* > _geometries; 00083 00084 friend class core::Singleton< Builder >; 00085 }; 00086 00087 } 00088 } 00089 } 00090 00091 #endif 00092 00093 #endif
1.5.1