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

Function SampleCache

Source/Engine/ShadowsOfMordor/Builder.Hemispheres.cpp:12–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace
11{
12 void SampleCache(ShadowsOfMordor::GenerateHemispheresData& data, int32 texelX, int32 texelY, Float3& outPosition, Float3& outNormal)
13 {
14 const auto mipDataPositions = data.PositionsData.GetData(0, 0);
15#if CACHE_POSITIONS_FORMAT == HEMISPHERES_FORMAT_R32G32B32A32
16 outPosition = Float3(mipDataPositions->Get<Float4>(texelX, texelY));
17#elif CACHE_POSITIONS_FORMAT == HEMISPHERES_FORMAT_R16G16B16A16
18 outPosition = mipDataPositions->Get<Half4>(texelX, texelY).ToFloat3();
19#else
20#error "Unknown format."
21#endif
22
23 const auto mipDataNormals = data.NormalsData.GetData(0, 0);
24#if CACHE_NORMALS_FORMAT == HEMISPHERES_FORMAT_R32G32B32A32
25 outNormal = Float3(mipDataNormals->Get<Float4>(texelX, texelY));
26#elif CACHE_NORMALS_FORMAT == HEMISPHERES_FORMAT_R16G16B16A16
27 outNormal = mipDataNormals->Get<Half4>(texelX, texelY).ToFloat3();
28#else
29#error "Unknown format."
30#endif
31 }
32
33 void RejectTexel(ShadowsOfMordor::GenerateHemispheresData& data, int32 texelX, int32 texelY)
34 {

Callers 1

generateHemispheresMethod · 0.85

Calls 3

Float3Class · 0.85
GetDataMethod · 0.45
ToFloat3Method · 0.45

Tested by

no test coverage detected