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

Method GatherSprites

trinity/Sprite2d/Tr2Sprite2dFrame.cpp:84–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84void Tr2Sprite2dFrame::GatherSprites( Tr2Sprite2dScene* renderer )
85{
86 if( !m_display )
87 {
88 return;
89 }
90
91 if( m_isDirty )
92 {
93 if( !ValidateAndSetTextures( renderer ) )
94 {
95 return;
96 }
97
98 if( m_spriteEffect == TR2_SFX_BLUR || m_spriteEffect == TR2_SFX_GLOW )
99 {
100 // don't support these atm
101 return;
102 }
103
104 renderer->SetSpriteEffect( m_spriteEffect );
105 renderer->SetTileMode( 0 );
106
107 float srcWidth = m_texturePrimary->GetSrcWidth();
108 float srcHeight = m_texturePrimary->GetSrcHeight();
109
110 if( srcWidth == 0.0f )
111 {
112 srcWidth = float( m_texturePrimary->GetWidth() );
113 }
114 if( srcHeight == 0.0f )
115 {
116 srcHeight = float( m_texturePrimary->GetHeight() );
117 }
118
119 if( srcWidth < m_cornerSize * 2 )
120 {
121 return;
122 }
123
124 if( srcHeight < m_cornerSize * 2 )
125 {
126 return;
127 }
128
129 Tr2Sprite2dVertexBase srcVertices[16 * 3];
130
131 if( m_shadowOffset.x != 0.0f || m_shadowOffset.y != 0.0f )
132 {
133 SetShadowRenderState( renderer );
134 PrepareVertices( &srcVertices[0], srcWidth, srcHeight, m_shadowOffset, Vector2( 1, 1 ) );
135 renderer->PrepareTriangleVerts( &m_vertices[0], &srcVertices[0], sizeof( Tr2Sprite2dVertexBase ), 16 );
136 }
137
138
139 SetRegularRenderState( renderer );
140 renderer->SetDepth( m_depth );
141 PrepareVertices( &srcVertices[16], srcWidth, srcHeight, Vector2( 0, 0 ), Vector2( 1, 1 ) );

Callers

nothing calls this directly

Calls 9

SetSpriteEffectMethod · 0.80
SetTileModeMethod · 0.80
GetSrcWidthMethod · 0.80
GetSrcHeightMethod · 0.80
PrepareTriangleVertsMethod · 0.80
RenderTriangleVertsMethod · 0.80
GetWidthMethod · 0.45
GetHeightMethod · 0.45
SetDepthMethod · 0.45

Tested by

no test coverage detected