Implemented cylinder shape, also fixed the coordinate system (again). I fucking hate...
[fail.git] / scenegraph / Geometry.h
blob830512440b65005f0a1b7029ff49c81c78617fd1
1 #ifndef AWFUL_SCENEGRAPH_GEOMETRY_H_
2 #define AWFUL_SCENEGRAPH_GEOMETRY_H_
4 #include "core/core.h"
5 #include "Primitive.h"
6 #include "IndexBuffer.h"
7 #include "VertexBuffer.h"
8 #include <vector>
10 namespace awful { namespace scenegraph
12 class Geometry : public Serializable
14 public:
15 Geometry( Pointer< VertexBuffer > pVertices, Pointer< IndexBuffer > pIndices ) :
16 m_pVertexBuffer( pVertices ),
17 m_pIndexBuffer( pIndices )
21 Geometry( const Serialization_tag& ) {}
23 const Pointer< VertexBuffer >& getpVertexBuffer() const { return m_pVertexBuffer; }
24 void setpVertexBuffer( const Pointer< VertexBuffer >& x ) { m_pVertexBuffer = x; }
26 const Pointer< IndexBuffer >& getpIndexBuffer() const { return m_pIndexBuffer; }
27 void setpIndexBuffer( const Pointer< IndexBuffer >& x ) { m_pIndexBuffer = x; }
29 void addPrimitive( const Primitive& Prim )
31 m_Primitives.push_back( Prim );
34 void addPrimitive( enum Primitive::e_Type Type_, uint32_t Start_, uint32_t Count_ )
36 addPrimitive( Primitive( Type_, Start_, Count_ ) );
39 void render() const
41 m_pIndexBuffer->bind();
42 m_pVertexBuffer->renderSetup();
43 std::vector< Primitive >::const_iterator it;
44 for( it = m_Primitives.begin(); it != m_Primitives.end(); ++it )
45 it->render();
48 private:
49 template< class C, typename T > friend struct awful::attribute_traits;
50 Pointer< VertexBuffer > m_pVertexBuffer;
51 Pointer< IndexBuffer > m_pIndexBuffer;
52 std::vector< Primitive > m_Primitives;
56 #endif