MCPcopy Create free account
hub / github.com/carbonengine/trinity / OnPrepareResources

Method OnPrepareResources

trinity/Tr2CurveLineSet.cpp:78–109  ·  view source on GitHub ↗

------------------------------------------------------------- Description: Implements Tr2DeviceResource method. Creates vertex buffer and vertex declaration. -------------------------------------------------------------

Source from the content-addressed store, hash-verified

76// and vertex declaration.
77// -------------------------------------------------------------
78bool Tr2CurveLineSet::OnPrepareResources()
79{
80 // create vertex decl
81 if( m_vertexDeclHandle == Tr2EffectStateManager::UNINITIALIZED_DECLARATION )
82 {
83 static Tr2VertexDefinition s_curveLineDataVertexDecl;
84 if( s_curveLineDataVertexDecl.empty() )
85 {
86 Tr2VertexDefinition& tvd = s_curveLineDataVertexDecl;
87
88 tvd.Add( tvd.FLOAT32_3, tvd.POSITION );
89
90 tvd.Add( tvd.FLOAT32_4, tvd.TEXCOORD, 0 );
91 tvd.Add( tvd.FLOAT32_4, tvd.TEXCOORD, 1 );
92 tvd.Add( tvd.FLOAT32_3, tvd.TEXCOORD, 2 );
93 tvd.Add( tvd.FLOAT32_3, tvd.TEXCOORD, 3 );
94
95 tvd.Add( tvd.UBYTE_4_NORM, tvd.COLOR, 0 );
96 tvd.Add( tvd.UBYTE_4_NORM, tvd.COLOR, 1 );
97 tvd.Add( tvd.UBYTE_4_NORM, tvd.COLOR, 2 );
98 }
99
100 m_vertexDeclHandle = Tr2EffectStateManager::GetVertexDeclarationHandle( s_curveLineDataVertexDecl );
101 if( m_vertexDeclHandle == Tr2EffectStateManager::UNINITIALIZED_DECLARATION )
102 {
103 return false;
104 }
105 }
106
107 // always fill it (this will also create a vertexbuffer)
108 return FillVertexBuffer();
109}
110
111// -------------------------------------------------------------
112// Description:

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected