MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Draw

Method Draw

Source/Engine/Level/Actors/SpotLight.cpp:131–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void SpotLight::Draw(RenderContext& renderContext)
132{
133 float brightness = ComputeBrightness();
134 AdjustBrightness(renderContext.View, brightness);
135 Float3 position;
136 const float radius = GetScaledRadius();
137 const float outerConeAngle = GetOuterConeAngle();
138 if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::SpotLights)
139 && EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer)
140 && brightness > ZeroTolerance
141 && radius > ZeroTolerance
142 && outerConeAngle > ZeroTolerance
143 && CheckViewDistance(renderContext.View.Position, renderContext.View.Origin, position, brightness))
144 {
145 RenderSpotLightData data;
146 data.Position = position;
147 data.MinRoughness = MinRoughness;
148 data.ShadowsDistance = ShadowsDistance;
149 data.Color = Color.ToFloat3() * (Color.A * brightness);
150 data.ShadowsStrength = ShadowsStrength;
151 data.Direction = _direction;
152 data.ShadowsFadeDistance = ShadowsFadeDistance;
153 data.ShadowsNormalOffsetScale = ShadowsNormalOffsetScale;
154 data.ShadowsDepthBias = ShadowsDepthBias;
155 data.ShadowsSharpness = ShadowsSharpness;
156 data.VolumetricScatteringIntensity = VolumetricScatteringIntensity;
157 data.CastVolumetricShadow = CastVolumetricShadow;
158 data.ShadowsUpdateRate = ShadowsUpdateRate;
159 data.ShadowsUpdateRateAtDistance = ShadowsUpdateRateAtDistance;
160 data.ShadowFrame = _invalidateShadowFrame;
161 data.ShadowsResolution = (int32)ShadowsResolution;
162 data.ShadowsMode = ShadowsMode;
163 data.Radius = radius;
164 data.FallOffExponent = FallOffExponent;
165 data.UseInverseSquaredFalloff = UseInverseSquaredFalloff;
166 data.SourceRadius = SourceRadius;
167 data.CosOuterCone = _cosOuterCone;
168 data.InvCosConeDifference = _invCosConeDifference;
169 data.ContactShadowsLength = ContactShadowsLength;
170 data.IndirectLightingIntensity = IndirectLightingIntensity;
171 data.IESTexture = IESTexture ? IESTexture->GetTexture() : nullptr;
172 Float3::Transform(Float3::Up, GetOrientation(), data.UpVector);
173 data.OuterConeAngle = outerConeAngle;
174 data.StaticFlags = GetStaticFlags();
175 data.ID = GetID();
176 data.ScreenSize = Math::Min(1.0f, Math::Sqrt(RenderTools::ComputeBoundsScreenRadiusSquared(position, (float)_sphere.Radius, renderContext.View)));
177 renderContext.List->SpotLights.Add(data);
178 }
179}
180
181#if USE_EDITOR
182

Callers

nothing calls this directly

Calls 13

GetOuterConeAngleFunction · 0.85
EnumHasAnyFlagsFunction · 0.85
CheckViewDistanceFunction · 0.85
GetOrientationFunction · 0.85
GetStaticFlagsFunction · 0.85
GetIDFunction · 0.85
GetTextureMethod · 0.80
TransformClass · 0.50
MinFunction · 0.50
SqrtFunction · 0.50
ToFloat3Method · 0.45

Tested by

no test coverage detected