1 #ifndef AWFUL_SCENEGRAPH_RENDERCONTEXT_H_
2 #define AWFUL_SCENEGRAPH_RENDERCONTEXT_H_
11 namespace awful
{ namespace scenegraph
15 class RenderContext
: public RefCounted
18 RenderContext( const Pointer
< ViewPort
>& pViewPort
) :
19 m_pViewPort( pViewPort
)
23 void addGeometry( Pointer
< Drawable
> pDrawable_
)
25 MaterialKey
key( pDrawable_
->getpMaterial() );
26 m_RenderMap
[ key
].push_back( pDrawable_
);
29 void addToRenderList() const
31 ms_RenderList
.push_front( ConstPointer
< RenderContext
>( this ) );
34 static void RenderAll();
35 static void ClearAll();
38 const Pointer
< ViewPort
>& getpViewPort() const { return m_pViewPort
; }
39 void setpViewPort( const Pointer
< ViewPort
>& x
) { m_pViewPort
= x
; }
44 typedef std::list
< ConstPointer
< RenderContext
> > ContextList
;
45 static ContextList ms_RenderList
;
49 MaterialKey( Material
* pMaterial_
) : pMaterial( pMaterial_
) {}
51 ConstPointer
< Material
> pMaterial
;
53 bool operator==( const MaterialKey
& b
) const
55 return *pMaterial
== *b
.pMaterial
;
58 bool operator<( const MaterialKey
& b
) const
60 return *pMaterial
< *b
.pMaterial
;
65 Pointer
< ViewPort
> m_pViewPort
;
67 typedef std::list
< ConstPointer
< Drawable
> > Bucket
;
68 typedef std::map
< MaterialKey
, Bucket
> RenderMap
;
69 RenderMap m_RenderMap
;