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

Method Draw

Source/Engine/Level/Actors/PointLight.cpp:82–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void PointLight::Draw(RenderContext& renderContext)
83{
84 float brightness = ComputeBrightness();
85 AdjustBrightness(renderContext.View, brightness);
86 Float3 position;
87 const float radius = GetScaledRadius();
88 if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::PointLights)
89 && EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer)
90 && brightness > ZeroTolerance
91 && radius > ZeroTolerance
92 && CheckViewDistance(renderContext.View.Position, renderContext.View.Origin, position, brightness))
93 {
94 RenderPointLightData data;
95 data.Position = position;
96 data.MinRoughness = MinRoughness;
97 data.ShadowsDistance = ShadowsDistance;
98 data.Color = Color.ToFloat3() * (Color.A * brightness);
99 data.ShadowsStrength = ShadowsStrength;
100 data.Direction = _direction;
101 data.ShadowsFadeDistance = ShadowsFadeDistance;
102 data.ShadowsNormalOffsetScale = ShadowsNormalOffsetScale;
103 data.ShadowsDepthBias = ShadowsDepthBias;
104 data.ShadowsSharpness = ShadowsSharpness;
105 data.VolumetricScatteringIntensity = VolumetricScatteringIntensity;
106 data.CastVolumetricShadow = CastVolumetricShadow;
107 data.ShadowsUpdateRate = ShadowsUpdateRate;
108 data.ShadowsUpdateRateAtDistance = ShadowsUpdateRateAtDistance;
109 data.ShadowFrame = _invalidateShadowFrame;
110 data.ShadowsResolution = (int32)ShadowsResolution;
111 data.ShadowsMode = ShadowsMode;
112 data.Radius = radius;
113 data.FallOffExponent = FallOffExponent;
114 data.UseInverseSquaredFalloff = UseInverseSquaredFalloff;
115 data.SourceRadius = SourceRadius;
116 data.SourceLength = SourceLength;
117 data.ContactShadowsLength = ContactShadowsLength;
118 data.IndirectLightingIntensity = IndirectLightingIntensity;
119 data.IESTexture = IESTexture ? IESTexture->GetTexture() : nullptr;
120 data.StaticFlags = GetStaticFlags();
121 data.ID = GetID();
122 data.ScreenSize = Math::Min(1.0f, Math::Sqrt(RenderTools::ComputeBoundsScreenRadiusSquared(position, (float)_sphere.Radius, renderContext.View)));
123 renderContext.List->PointLights.Add(data);
124 }
125}
126
127#if USE_EDITOR
128

Callers

nothing calls this directly

Calls 10

EnumHasAnyFlagsFunction · 0.85
CheckViewDistanceFunction · 0.85
GetStaticFlagsFunction · 0.85
GetIDFunction · 0.85
GetTextureMethod · 0.80
MinFunction · 0.50
SqrtFunction · 0.50
ToFloat3Method · 0.45
AddMethod · 0.45

Tested by

no test coverage detected