vertexBufferLeaf.h

00001 /*  
00002     vertexBufferLeaf.h
00003     Copyright (c) 2007, Tobias Wolf <twolf@access.unizh.ch>
00004     Copyright (c) 2008, Stefan Eilemann <eile@equalizergraphics.com>
00005   *
00006  * This library is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License version 2.1 as published
00008  * by the Free Software Foundation.
00009  *  
00010  * This library is distributed in the hope that it will be useful, but WITHOUT
00011  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00013  * details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this library; if not, write to the Free Software Foundation, Inc.,
00017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018   
00019     
00020     Header file of the VertexBufferLeaf class.
00021 */
00022 
00023 
00024 #ifndef MESH_VERTEXBUFFERLEAF_H
00025 #define MESH_VERTEXBUFFERLEAF_H
00026 
00027 
00028 #include "vertexBufferBase.h"
00029 
00030 
00031 namespace mesh 
00032 {
00033     /*  The class for kd-tree leaf nodes.  */
00034     class VertexBufferLeaf : public VertexBufferBase
00035     {
00036     public:
00037         VertexBufferLeaf( VertexBufferData& data )
00038             : _globalData( data ), _vertexStart( 0 ),
00039               _indexStart( 0 ), _indexLength( 0 ) {}
00040         virtual ~VertexBufferLeaf() {}
00041         
00042         virtual void render( VertexBufferState& state ) const;
00043         virtual Index getNumberOfVertices() const { return _indexLength; }
00044         
00045     protected:
00046         virtual void toStream( std::ostream& os );
00047         virtual void fromMemory( char** addr, VertexBufferData& globalData );
00048         
00049         virtual void setupTree( VertexData& data, const Index start,
00050                                 const Index length, const Axis axis,
00051                                 const size_t depth,
00052                                 VertexBufferData& globalData );
00053         virtual const BoundingSphere& updateBoundingSphere();
00054         virtual void updateRange();
00055         
00056     private:
00057         void setupRendering( VertexBufferState& state, GLuint* data ) const;
00058         void renderImmediate( VertexBufferState& state ) const;
00059         void renderDisplayList( VertexBufferState& state ) const;
00060         void renderBufferObject( VertexBufferState& state ) const;
00061         
00062         VertexBufferData&   _globalData;
00063         Index               _vertexStart;
00064         ShortIndex          _vertexLength;
00065         Index               _indexStart;
00066         Index               _indexLength;
00067         friend class eqPly::VertexBufferDist;
00068     };
00069     
00070     
00071 }
00072 
00073 
00074 #endif // MESH_VERTEXBUFFERLEAF_H
Generated on Mon Aug 10 18:58:41 2009 for Equalizer 0.9 by  doxygen 1.5.8