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

Method GetPerObjectData

trinity/Eve/EveTransform.cpp:49–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49Tr2PerObjectData* EveTransform::GetPerObjectData( ITriRenderBatchAccumulator* accumulator )
50{
51 EveBasicPerObjectData* data = accumulator->Allocate<EveBasicPerObjectData>();
52
53 if( !data )
54 {
55 return NULL;
56 }
57
58 // column_major for shaders
59 data->m_world = Transpose( m_worldTransform );
60 // column_major for shaders
61 data->m_worldLast = Transpose( m_lastWorldTransform );
62 // attention: need the transposed, but shader also needs column_major, so it is transpose(transpose(m)) == m
63 if( !Inverse( data->m_worldInverse, data->m_world ) )
64 {
65 // ok, so a complete row is 0.f -> find it and "fix" it
66 Matrix wm = data->m_world;
67 if( wm._11 == 0.f && wm._12 == 0.f && wm._13 == 0.f )
68 wm._11 = 0.1f;
69 else if( wm._21 == 0.f && wm._22 == 0.f && wm._23 == 0.f )
70 wm._22 = 0.1f;
71 else if( wm._31 == 0.f && wm._32 == 0.f && wm._33 == 0.f )
72 wm._33 = 0.1f;
73 data->m_worldInverse = Inverse( wm );
74 }
75
76 return data;
77}
78
79void EveTransform::Update( const EveUpdateContext& updateContext )
80{

Callers 6

RenderMethod · 0.45
RenderRenderablesMethod · 0.45
PerformPickingMethod · 0.45
RunQueryMethod · 0.45

Calls 1

TransposeFunction · 0.85

Tested by

no test coverage detected