Most everything is built as shared libraries now except services.
[fail.git] / include / scenegraph / Geometry.h
blob9fa357d78f57769731550eb3bbe99ce8ed3e2c93
1 #ifndef AWFUL_SCENEGRAPH_GEOMETRY_H_
2 #define AWFUL_SCENEGRAPH_GEOMETRY_H_
4 #include "core/core.h"
5 #include "scenegraph/scenegraph_export.h"
6 #include "Primitive.h"
7 #include "IndexBuffer.h"
8 #include "VertexBuffer.h"
9 #include <vector>
11 namespace awful { namespace scenegraph
13 class AWSCENEGRAPH_EXPORT Geometry : public Serializable
15 public:
16 Geometry( Pointer< VertexBuffer > pVertices, Pointer< IndexBuffer > pIndices );
17 Geometry( const Serialization_tag& );
19 const Pointer< VertexBuffer >& getpVertexBuffer() const { return m_pVertexBuffer; }
20 void setpVertexBuffer( const Pointer< VertexBuffer >& x ) { m_pVertexBuffer = x; }
22 const Pointer< IndexBuffer >& getpIndexBuffer() const { return m_pIndexBuffer; }
23 void setpIndexBuffer( const Pointer< IndexBuffer >& x ) { m_pIndexBuffer = x; }
25 void addPrimitive( const Primitive& Prim )
27 m_Primitives.push_back( Prim );
30 void addPrimitive( enum Primitive::e_Type Type_, uint32_t Start_, uint32_t Count_ )
32 addPrimitive( Primitive( Type_, Start_, Count_ ) );
35 void render() const
37 m_pIndexBuffer->bind();
38 m_pVertexBuffer->renderSetup();
39 std::vector< Primitive >::const_iterator it;
40 for( it = m_Primitives.begin(); it != m_Primitives.end(); ++it )
41 it->render();
44 private:
45 template< class C, typename T > friend struct awful::attribute_traits;
46 Pointer< VertexBuffer > m_pVertexBuffer;
47 Pointer< IndexBuffer > m_pIndexBuffer;
48 std::vector< Primitive > m_Primitives;
52 #endif