MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / Init

Method Init

SampleFramework11/v1.02/Graphics/Skybox.cpp:27–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void SkyCache::Init(Float3 sunDirection, Float3 groundAlbedo, float turbidity)
28{
29 sunDirection.y = Saturate(sunDirection.y);
30 sunDirection = Float3::Normalize(sunDirection);
31 turbidity = Clamp(turbidity, 1.0f, 32.0f);
32 groundAlbedo = Saturate(groundAlbedo);
33
34 if(StateR != nullptr && sunDirection == SunDirection
35 && groundAlbedo == Albedo && turbidity == Turbidity)
36 return;
37
38 Shutdown();
39
40 float thetaS = AngleBetween(sunDirection, Float3(0, 1, 0));
41 float elevation = Pi_2 - thetaS;
42 StateR = arhosek_rgb_skymodelstate_alloc_init(turbidity, groundAlbedo.x, elevation);
43 StateG = arhosek_rgb_skymodelstate_alloc_init(turbidity, groundAlbedo.y, elevation);
44 StateB = arhosek_rgb_skymodelstate_alloc_init(turbidity, groundAlbedo.z, elevation);
45
46 Albedo = groundAlbedo;
47 Elevation = elevation;
48 SunDirection = sunDirection;
49 Turbidity = turbidity;
50}
51
52void SkyCache::Shutdown()
53{

Callers 2

GetTextureDataFunction · 0.45
RenderSkyMethod · 0.45

Calls 5

SaturateFunction · 0.85
ClampFunction · 0.85
AngleBetweenFunction · 0.85
Float3Class · 0.85

Tested by

no test coverage detected