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

Method GatherSprites

trinity/Sprite2d/Tr2Sprite2dStretchVertical.cpp:49–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void Tr2Sprite2dStretchVertical::GatherSprites( Tr2Sprite2dScene* renderer )
50{
51 if( !m_display )
52 {
53 return;
54 }
55
56 if( m_isDirty )
57 {
58 if( !ValidateAndSetTextures( renderer ) )
59 {
60 return;
61 }
62
63 if( m_spriteEffect == TR2_SFX_BLUR || m_spriteEffect == TR2_SFX_GLOW )
64 {
65 // don't support these atm
66 return;
67 }
68
69 renderer->SetSpriteEffect( m_spriteEffect );
70 renderer->SetTileMode( 0 );
71
72 float srcHeight = m_texturePrimary->GetSrcHeight();
73 if( srcHeight == 0.0f )
74 {
75 srcHeight = float( m_texturePrimary->GetHeight() );
76 }
77
78 Tr2Sprite2dVertexBase vertices[8 * 3];
79
80 if( m_shadowOffset.x != 0.0f || m_shadowOffset.y != 0.0f )
81 {
82 SetShadowRenderState( renderer );
83 PrepareVertices( &vertices[0], srcHeight, m_shadowOffset, Vector2( 1, 1 ) );
84 renderer->PrepareTriangleVerts( &m_vertices[0], &vertices[0], sizeof( Tr2Sprite2dVertexBase ), 8 );
85 }
86
87 SetRegularRenderState( renderer );
88 PrepareVertices( &vertices[8], srcHeight, Vector2( 0, 0 ), Vector2( 1, 1 ) );
89 renderer->PrepareTriangleVerts( &m_vertices[8], &vertices[8], sizeof( Tr2Sprite2dVertexBase ), 8 );
90
91 if( ( m_glowFactor != 0.0f ) || ( m_glowExpand != 0.0f ) )
92 {
93 float offset2 = m_glowExpand + m_glowExpand;
94
95 SetGlowRenderState( renderer );
96 PrepareVertices( &vertices[16], srcHeight, Vector2( -m_glowExpand, -m_glowExpand ), Vector2( 1 + offset2 / m_displayWidth, 1 + offset2 / m_displayHeight ) );
97 renderer->PrepareTriangleVerts( &m_vertices[16], &vertices[16], sizeof( Tr2Sprite2dVertexBase ), 8 );
98 }
99
100 if( m_spriteEffect < TR2_SFX_TWO_TEXTURES && ( m_spriteEffect != TR2_SFX_BLUR ) && ( m_spriteEffect != TR2_SFX_GLOW ) )
101 {
102 for( int i = 0; i < 8 * 3; ++i )
103 {
104 m_vertices[i].texCoord[1].x = m_saturation;
105 m_vertices[i].texCoord[1].y = m_effectOpacity;
106 }

Callers

nothing calls this directly

Calls 8

SetSpriteEffectMethod · 0.80
SetTileModeMethod · 0.80
GetSrcHeightMethod · 0.80
PrepareTriangleVertsMethod · 0.80
PushTranslationMethod · 0.80
RenderTriangleVertsMethod · 0.80
PopTranslationMethod · 0.80
GetHeightMethod · 0.45

Tested by

no test coverage detected