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

Method PushTranslation

trinity/Sprite2d/Tr2Sprite2dScene.cpp:386–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386void Tr2Sprite2dScene::PushTranslation( const Vector2& t )
387{
388 //CCP_STATS_ZONE( __FUNCTION__ );
389
390 TransformStackEntry entry;
391 entry.isTranslationOnlySet = true;
392
393 if( m_transformStack->empty() )
394 {
395 entry.translation = t;
396 entry.isTranslationOnly = true;
397 }
398 else
399 {
400 const TransformStackEntry& top = m_transformStack->back();
401 if( top.isTranslationOnly )
402 {
403 entry.translation = t + top.translation;
404 entry.isTranslationOnly = true;
405 }
406 else
407 {
408 const Matrix& parent = m_transformStack->back().transform;
409
410 Matrix transform = TranslationMatrix( t.x, t.y, 0.0f );
411 entry.transform = transform * parent;
412
413 entry.isTranslationOnly = false;
414 }
415 }
416
417 m_transformStack->push_back( entry );
418}
419
420void Tr2Sprite2dScene::PopTranslation()
421{

Callers 8

GatherSpritesMethod · 0.80
PickPointMethod · 0.80
GatherSpritesHelperMethod · 0.80
GatherSpritesMethod · 0.80
PickPointMethod · 0.80
GatherSpritesMethod · 0.80
PickPointMethod · 0.80
GatherSpritesMethod · 0.80

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected