vertexBufferRoot.h

00001 /*  
00002  *  Copyright (c) 2007, Tobias Wolf <twolf@access.unizh.ch>
00003  *                2009, Stefan Eilemann <eile@equalizergraphics.com>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *  
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 
00020 #ifndef MESH_VERTEXBUFFERROOT_H
00021 #define MESH_VERTEXBUFFERROOT_H
00022 
00023 
00024 #include "vertexBufferNode.h"
00025 #include "vertexBufferData.h"
00026 
00027 
00028 namespace mesh 
00029 {
00030     
00031     
00032     /*  The class for kd-tree root nodes.  */
00033     class VertexBufferRoot : public VertexBufferNode
00034     {
00035     public:
00036         VertexBufferRoot() : VertexBufferNode(), _invertFaces(false) {}
00037 
00038         virtual void render( VertexBufferState& state ) const;
00039         
00040         void beginRendering( VertexBufferState& state ) const;
00041         void endRendering( VertexBufferState& state ) const;
00042         
00043         void setupTree( VertexData& data );
00044         bool writeToFile( const std::string& filename );
00045         bool readFromFile( const std::string& filename );
00046         bool hasColors() const { return _data.colors.size() > 0; }
00047 
00048         void useInvertedFaces() { _invertFaces = true; }
00049 
00050         const std::string& getName() const { return _name; }
00051 
00052     protected:
00053         virtual void toStream( std::ostream& os );
00054         virtual void fromMemory( char* start );
00055         
00056     private:
00057         bool _constructFromPly( const std::string& filename );
00058         bool _readBinary( const std::string& filename );
00059         
00060         VertexBufferData _data;
00061         bool             _invertFaces;
00062         std::string      _name;
00063 
00064         friend class eqPly::VertexBufferDist;
00065     };
00066     
00067     
00068 }
00069 
00070 
00071 #endif // MESH_VERTEXBUFFERROOT_H
Generated on Mon Aug 10 18:58:41 2009 for Equalizer 0.9 by  doxygen 1.5.8