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

Method AddLight

trinity/Lights/Tr2Light.cpp:119–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void Tr2Light::AddLight( Tr2LightManager& lightManager, CXMMATRIX transform, float scale, const Float4x3* bones, size_t boneCount )
120{
121 if( m_isDynamic )
122 {
123 this->Update();
124 }
125
126 if( !Tr2LightManager::AreLightFlagsValid( m_lightData.flags ) )
127 {
128 return;
129 }
130
131 SetBoneMatrix( bones, boneCount );
132 XMMATRIX lightTransform = XMMatrixMultiply( m_boneTransform, transform );
133 LightFeatures features;
134 features.parentBrightness = m_brightnessMultiplier;
135 features.parentScale = scale;
136
137 features.profileIndex = m_lightProfile ? m_lightProfile->GetTextureIndex() + 1 : 0;
138
139 if( m_type == Tr2Light::POINT_LIGHT )
140 {
141 auto data = m_lightData.AsPerPointLightData( lightTransform, features, lightManager.GetCurrentSpaceSceneShadowQuality() );
142 lightManager.AddLight( data );
143 }
144 else if( m_type == Tr2Light::SPOT_LIGHT )
145 {
146 auto data = m_lightData.AsPerSpotLightData( lightTransform, features, lightManager.GetCurrentSpaceSceneShadowQuality() );
147 lightManager.AddLight( data );
148 }
149}
150
151
152void Tr2Light::GetLight( Vector3& position, float& radius, Color& color )

Callers

nothing calls this directly

Calls 5

UpdateMethod · 0.95
GetTextureIndexMethod · 0.80
AsPerPointLightDataMethod · 0.80
AsPerSpotLightDataMethod · 0.80

Tested by

no test coverage detected