1 #ifndef AWFUL_SCENEGRAPH_RENDERCONTEXT_H_
2 #define AWFUL_SCENEGRAPH_RENDERCONTEXT_H_
12 namespace awful
{ namespace scenegraph
17 class RenderContext
: public RefCounted
20 RenderContext( const Pointer
< ViewPort
>& pViewPort
);
22 void addDrawable( const Pointer
< Drawable
>& pDrawable_
)
24 MaterialKey
key( pDrawable_
->getpMaterial() );
25 m_RenderMap
[ key
].push_back( pDrawable_
);
28 void addText( const Pointer
< Text
>& pText_
, float z
)
30 m_TextMap
.insert( std::make_pair( z
, pText_
) );
33 void addToRenderList() const
35 ms_RenderList
.push_front( ConstPointer
< RenderContext
>( this ) );
38 static void RenderAll();
39 static void ClearAll();
42 const Pointer
< ViewPort
>& getpViewPort() const { return m_pViewPort
; }
43 void setpViewPort( const Pointer
< ViewPort
>& x
) { m_pViewPort
= x
; }
48 typedef std::list
< ConstPointer
< RenderContext
> > ContextList
;
49 static ContextList ms_RenderList
;
53 MaterialKey( Material
* pMaterial_
) : pMaterial( pMaterial_
) {}
55 ConstPointer
< Material
> pMaterial
;
57 bool operator==( const MaterialKey
& b
) const
59 return *pMaterial
== *b
.pMaterial
;
62 bool operator<( const MaterialKey
& b
) const
64 return *pMaterial
< *b
.pMaterial
;
69 Pointer
< ViewPort
> m_pViewPort
;
71 typedef std::list
< ConstPointer
< Drawable
> > Bucket
;
72 typedef std::map
< MaterialKey
, Bucket
> RenderMap
;
73 RenderMap m_RenderMap
;
75 typedef std::multimap
< float, ConstPointer
< Text
> > TextMap
;