浏览代码
Merge branch 'master' into Branch_Batching2
Merge branch 'master' into Branch_Batching2
# Conflicts: # ProjectSettings/ProjectVersion.txt/Branch_Batching2
Arnaud Carre
7 年前
当前提交
4fcf88bb
共有 64 个文件被更改,包括 1838 次插入 和 1103 次删除
-
2Assets/GraphicsTests/Framework/Editor/TestFramework.cs
-
2Assets/ScriptableRenderPipeline/Core/Shadow/Shadow.cs
-
2Assets/ScriptableRenderPipeline/Core/Shadow/ShadowBase.cs.hlsl
-
71Assets/ScriptableRenderPipeline/Core/TextureCache.cs
-
11Assets/ScriptableRenderPipeline/Fptl/FptlLighting.cs
-
10Assets/ScriptableRenderPipeline/Fptl/LightingConvexHullUtils.hlsl
-
16Assets/ScriptableRenderPipeline/Fptl/LightingTemplate.hlsl
-
24Assets/ScriptableRenderPipeline/Fptl/LightingUtils.hlsl
-
4Assets/ScriptableRenderPipeline/Fptl/ShadowDispatch.hlsl
-
26Assets/ScriptableRenderPipeline/Fptl/lightlistbuild-bigtile.compute
-
26Assets/ScriptableRenderPipeline/Fptl/lightlistbuild-clustered.compute
-
17Assets/ScriptableRenderPipeline/Fptl/lightlistbuild.compute
-
11Assets/ScriptableRenderPipeline/Fptl/scrbound.compute
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData/HDAdditionalLightData.cs
-
47Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs
-
11Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs.hlsl
-
39Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.hlsl
-
124Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugFullScreen.shader
-
40Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewTiles.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/LightingDebugPanel.cs
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
-
231Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs.hlsl
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/ShadowDispatch.hlsl
-
331Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
-
16Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs.hlsl
-
65Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl
-
14Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/builddispatchindirect.compute
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/lightlistbuild.compute
-
7Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/materialflags.compute
-
68Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/shadeopaque.compute
-
22Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs.hlsl
-
538Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl
-
16Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader
-
20Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs
-
43Assets/ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/CameraMotionVectors.shader
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassForward.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassVelocity.hlsl
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl
-
15Assets/ScriptableRenderPipeline/HDRenderPipeline/Utilities.cs
-
3Assets/ScriptableRenderPipeline/ShaderLibrary/AreaLighting.hlsl
-
6Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl
-
16Assets/ScriptableRenderPipeline/ShaderLibrary/Packing.hlsl
-
12Assets/ScriptableRenderPipeline/ShaderLibrary/Shadow/Shadow.hlsl
-
78Assets/ScriptableRenderPipeline/ShaderLibrary/Shadow/ShadowAlgorithms.hlsl
-
10Assets/ScriptableRenderPipeline/ShaderLibrary/Shadow/ShadowAlgorithmsCustom.hlsl
-
2Assets/ScriptableRenderPipeline/ShaderLibrary/Shadow/ShadowMoments.hlsl
-
195Assets/TestScenes/HDTest/BasicProfiling.unity
-
287Assets/TestScenes/HDTest/CascadedShadowsTest.unity
-
2ProjectSettings/ProjectVersion.txt
-
2README.md
-
248Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitReference.hlsl
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitReference.hlsl.meta
-
58Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CopyStencilBuffer.shader
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CopyStencilBuffer.shader.meta
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SSSProfile/Resources.meta
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Resources.meta
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/FeatureFlags.hlsl.meta
-
39Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/FeatureFlags.hlsl
287
Assets/TestScenes/HDTest/CascadedShadowsTest.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
m_EditorVersion: 2017.2.0b1 |
|||
m_EditorVersion: 2017.3.0a2 |
|
|||
//----------------------------------------------------------------------------- |
|||
// EvaluateBSDF_Line - Reference |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
void IntegrateBSDF_LineRef(float3 V, float3 positionWS, |
|||
PreLightData preLightData, LightData lightData, BSDFData bsdfData, |
|||
out float3 diffuseLighting, out float3 specularLighting, |
|||
int sampleCount = 128) |
|||
{ |
|||
diffuseLighting = float3(0.0, 0.0, 0.0); |
|||
specularLighting = float3(0.0, 0.0, 0.0); |
|||
|
|||
const float len = lightData.size.x; |
|||
const float3 T = lightData.right; |
|||
const float3 P1 = lightData.positionWS - T * (0.5 * len); |
|||
const float dt = len * rcp(sampleCount); |
|||
const float off = 0.5 * dt; |
|||
|
|||
// Uniformly sample the line segment with the Pdf = 1 / len. |
|||
const float invPdf = len; |
|||
|
|||
for (int i = 0; i < sampleCount; ++i) |
|||
{ |
|||
// Place the sample in the middle of the interval. |
|||
float t = off + i * dt; |
|||
float3 sPos = P1 + t * T; |
|||
float3 unL = sPos - positionWS; |
|||
float dist2 = dot(unL, unL); |
|||
float3 L = normalize(unL); |
|||
float sinLT = length(cross(L, T)); |
|||
float NdotL = saturate(dot(bsdfData.normalWS, L)); |
|||
|
|||
if (NdotL > 0) |
|||
{ |
|||
float3 lightDiff, lightSpec; |
|||
|
|||
BSDF(V, L, positionWS, preLightData, bsdfData, lightDiff, lightSpec); |
|||
|
|||
diffuseLighting += lightDiff * (sinLT / dist2 * NdotL); |
|||
specularLighting += lightSpec * (sinLT / dist2 * NdotL); |
|||
} |
|||
} |
|||
|
|||
// The factor of 2 is due to the fact: Integral{0, 2 PI}{max(0, cos(x))dx} = 2. |
|||
float normFactor = 2.0 * invPdf * rcp(sampleCount); |
|||
|
|||
diffuseLighting *= normFactor * lightData.diffuseScale * lightData.color; |
|||
specularLighting *= normFactor * lightData.specularScale * lightData.color; |
|||
} |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// EvaluateBSDF_Area - Reference |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
void IntegrateBSDF_AreaRef(float3 V, float3 positionWS, |
|||
PreLightData preLightData, LightData lightData, BSDFData bsdfData, |
|||
out float3 diffuseLighting, out float3 specularLighting, |
|||
uint sampleCount = 512) |
|||
{ |
|||
// Add some jittering on Hammersley2d |
|||
float2 randNum = InitRandom(V.xy * 0.5 + 0.5); |
|||
|
|||
diffuseLighting = float3(0.0, 0.0, 0.0); |
|||
specularLighting = float3(0.0, 0.0, 0.0); |
|||
|
|||
for (uint i = 0; i < sampleCount; ++i) |
|||
{ |
|||
float3 P = float3(0.0, 0.0, 0.0); // Sample light point. Random point on the light shape in local space. |
|||
float3 Ns = float3(0.0, 0.0, 0.0); // Unit surface normal at P |
|||
float lightPdf = 0.0; // Pdf of the light sample |
|||
|
|||
float2 u = Hammersley2d(i, sampleCount); |
|||
u = frac(u + randNum); |
|||
|
|||
// Lights in Unity point backward. |
|||
float4x4 localToWorld = float4x4(float4(lightData.right, 0.0), float4(lightData.up, 0.0), float4(-lightData.forward, 0.0), float4(lightData.positionWS, 1.0)); |
|||
|
|||
switch (lightData.lightType) |
|||
{ |
|||
case GPULIGHTTYPE_SPHERE: |
|||
SampleSphere(u, localToWorld, lightData.size.x, lightPdf, P, Ns); |
|||
break; |
|||
case GPULIGHTTYPE_HEMISPHERE: |
|||
SampleHemisphere(u, localToWorld, lightData.size.x, lightPdf, P, Ns); |
|||
break; |
|||
case GPULIGHTTYPE_CYLINDER: |
|||
SampleCylinder(u, localToWorld, lightData.size.x, lightData.size.y, lightPdf, P, Ns); |
|||
break; |
|||
case GPULIGHTTYPE_RECTANGLE: |
|||
SampleRectangle(u, localToWorld, lightData.size.x, lightData.size.y, lightPdf, P, Ns); |
|||
break; |
|||
case GPULIGHTTYPE_DISK: |
|||
SampleDisk(u, localToWorld, lightData.size.x, lightPdf, P, Ns); |
|||
break; |
|||
// case GPULIGHTTYPE_LINE: handled by a separate function. |
|||
} |
|||
|
|||
// Get distance |
|||
float3 unL = P - positionWS; |
|||
float sqrDist = dot(unL, unL); |
|||
float3 L = normalize(unL); |
|||
|
|||
// Cosine of the angle between the light direction and the normal of the light's surface. |
|||
float cosLNs = saturate(dot(-L, Ns)); |
|||
|
|||
// We calculate area reference light with the area integral rather than the solid angle one. |
|||
float illuminance = cosLNs * saturate(dot(bsdfData.normalWS, L)) / (sqrDist * lightPdf); |
|||
|
|||
float3 localDiffuseLighting = float3(0.0, 0.0, 0.0); |
|||
float3 localSpecularLighting = float3(0.0, 0.0, 0.0); |
|||
|
|||
if (illuminance > 0.0) |
|||
{ |
|||
BSDF(V, L, positionWS, preLightData, bsdfData, localDiffuseLighting, localSpecularLighting); |
|||
localDiffuseLighting *= lightData.color * illuminance * lightData.diffuseScale; |
|||
localSpecularLighting *= lightData.color * illuminance * lightData.specularScale; |
|||
} |
|||
|
|||
diffuseLighting += localDiffuseLighting; |
|||
specularLighting += localSpecularLighting; |
|||
} |
|||
|
|||
diffuseLighting /= float(sampleCount); |
|||
specularLighting /= float(sampleCount); |
|||
} |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// EvaluateBSDF_Env - Reference |
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
// Ref: Moving Frostbite to PBR (Appendix A) |
|||
float3 IntegrateLambertIBLRef(LightLoopContext lightLoopContext, |
|||
float3 V, EnvLightData lightData, BSDFData bsdfData, |
|||
uint sampleCount = 4096) |
|||
{ |
|||
float3x3 localToWorld = float3x3(bsdfData.tangentWS, bsdfData.bitangentWS, bsdfData.normalWS); |
|||
float3 acc = float3(0.0, 0.0, 0.0); |
|||
|
|||
// Add some jittering on Hammersley2d |
|||
float2 randNum = InitRandom(V.xy * 0.5 + 0.5); |
|||
|
|||
for (uint i = 0; i < sampleCount; ++i) |
|||
{ |
|||
float2 u = Hammersley2d(i, sampleCount); |
|||
u = frac(u + randNum); |
|||
|
|||
float3 L; |
|||
float NdotL; |
|||
float weightOverPdf; |
|||
ImportanceSampleLambert(u, localToWorld, L, NdotL, weightOverPdf); |
|||
|
|||
if (NdotL > 0.0) |
|||
{ |
|||
float4 val = SampleEnv(lightLoopContext, lightData.envIndex, L, 0); |
|||
|
|||
// diffuse Albedo is apply here as describe in ImportanceSampleLambert function |
|||
acc += bsdfData.diffuseColor * LambertNoPI() * weightOverPdf * val.rgb; |
|||
} |
|||
} |
|||
|
|||
return acc / sampleCount; |
|||
} |
|||
|
|||
float3 IntegrateDisneyDiffuseIBLRef(LightLoopContext lightLoopContext, |
|||
float3 V, PreLightData preLightData, EnvLightData lightData, BSDFData bsdfData, |
|||
uint sampleCount = 4096) |
|||
{ |
|||
float3x3 localToWorld = float3x3(bsdfData.tangentWS, bsdfData.bitangentWS, bsdfData.normalWS); |
|||
float NdotV = max(preLightData.NdotV, MIN_N_DOT_V); |
|||
float3 acc = float3(0.0, 0.0, 0.0); |
|||
|
|||
// Add some jittering on Hammersley2d |
|||
float2 randNum = InitRandom(V.xy * 0.5 + 0.5); |
|||
|
|||
for (uint i = 0; i < sampleCount; ++i) |
|||
{ |
|||
float2 u = Hammersley2d(i, sampleCount); |
|||
u = frac(u + randNum); |
|||
|
|||
float3 L; |
|||
float NdotL; |
|||
float weightOverPdf; |
|||
// for Disney we still use a Cosine importance sampling, true Disney importance sampling imply a look up table |
|||
ImportanceSampleLambert(u, localToWorld, L, NdotL, weightOverPdf); |
|||
|
|||
if (NdotL > 0.0) |
|||
{ |
|||
float3 H = normalize(L + V); |
|||
float LdotH = dot(L, H); |
|||
// Note: we call DisneyDiffuse that require to multiply by Albedo / PI. Divide by PI is already taken into account |
|||
// in weightOverPdf of ImportanceSampleLambert call. |
|||
float disneyDiffuse = DisneyDiffuse(NdotV, NdotL, LdotH, bsdfData.perceptualRoughness); |
|||
|
|||
// diffuse Albedo is apply here as describe in ImportanceSampleLambert function |
|||
float4 val = SampleEnv(lightLoopContext, lightData.envIndex, L, 0); |
|||
acc += bsdfData.diffuseColor * disneyDiffuse * weightOverPdf * val.rgb; |
|||
} |
|||
} |
|||
|
|||
return acc / sampleCount; |
|||
} |
|||
|
|||
// Ref: Moving Frostbite to PBR (Appendix A) |
|||
float3 IntegrateSpecularGGXIBLRef(LightLoopContext lightLoopContext, |
|||
float3 V, PreLightData preLightData, EnvLightData lightData, BSDFData bsdfData, |
|||
uint sampleCount = 4096) |
|||
{ |
|||
float3x3 localToWorld = float3x3(bsdfData.tangentWS, bsdfData.bitangentWS, bsdfData.normalWS); |
|||
float NdotV = max(preLightData.NdotV, MIN_N_DOT_V); |
|||
float3 acc = float3(0.0, 0.0, 0.0); |
|||
|
|||
// Add some jittering on Hammersley2d |
|||
float2 randNum = InitRandom(V.xy * 0.5 + 0.5); |
|||
|
|||
for (uint i = 0; i < sampleCount; ++i) |
|||
{ |
|||
float2 u = Hammersley2d(i, sampleCount); |
|||
u = frac(u + randNum); |
|||
|
|||
float VdotH; |
|||
float NdotL; |
|||
float3 L; |
|||
float weightOverPdf; |
|||
|
|||
// GGX BRDF |
|||
if (bsdfData.materialId == MATERIALID_LIT_ANISO) |
|||
{ |
|||
ImportanceSampleAnisoGGX(u, V, localToWorld, bsdfData.roughnessT, bsdfData.roughnessB, NdotV, L, VdotH, NdotL, weightOverPdf); |
|||
} |
|||
else |
|||
{ |
|||
ImportanceSampleGGX(u, V, localToWorld, bsdfData.roughness, NdotV, L, VdotH, NdotL, weightOverPdf); |
|||
} |
|||
|
|||
|
|||
if (NdotL > 0.0) |
|||
{ |
|||
// Fresnel component is apply here as describe in ImportanceSampleGGX function |
|||
float3 FweightOverPdf = F_Schlick(bsdfData.fresnel0, VdotH) * weightOverPdf; |
|||
|
|||
float4 val = SampleEnv(lightLoopContext, lightData.envIndex, L, 0); |
|||
|
|||
acc += FweightOverPdf * val.rgb; |
|||
} |
|||
} |
|||
|
|||
return acc / sampleCount; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0406917314064054eb0ef42f727a8889 |
|||
timeCreated: 1500913760 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Shader "Hidden/HDRenderPipeline/CopyStencilBuffer" |
|||
{ |
|||
SubShader |
|||
{ |
|||
Pass |
|||
{ |
|||
Stencil |
|||
{ |
|||
Ref 1 // StencilLightingUsage.SplitLighting |
|||
Comp Equal |
|||
Pass Keep |
|||
} |
|||
|
|||
Cull Off |
|||
ZTest Always |
|||
ZWrite Off |
|||
Blend Off |
|||
|
|||
HLSLPROGRAM |
|||
#pragma target 4.5 |
|||
#pragma only_renderers d3d11 ps4 metal // TEMP: until we go further in dev |
|||
// #pragma enable_d3d11_debug_symbols |
|||
|
|||
#pragma vertex Vert |
|||
#pragma fragment Frag |
|||
|
|||
#include "../../../../ShaderLibrary/Common.hlsl" |
|||
#include "../../../ShaderConfig.cs.hlsl" |
|||
#include "../../../ShaderVariables.hlsl" |
|||
#include "../../../Lighting/LightDefinition.cs.hlsl" |
|||
|
|||
struct Attributes |
|||
{ |
|||
uint vertexID : SV_VertexID; |
|||
}; |
|||
|
|||
struct Varyings |
|||
{ |
|||
float4 positionCS : SV_Position; |
|||
}; |
|||
|
|||
Varyings Vert(Attributes input) |
|||
{ |
|||
Varyings output; |
|||
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); |
|||
return output; |
|||
} |
|||
|
|||
// Should use HiS and therefore be faster than a GPU memcpy(). |
|||
float4 Frag(Varyings input) : SV_Target // use SV_StencilRef in D3D 11.3+ |
|||
{ |
|||
return float4(STENCILLIGHTINGUSAGE_SPLIT_LIGHTING, 0, 0, 0); |
|||
} |
|||
ENDHLSL |
|||
} |
|||
} |
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7fd941b2d9d2a39429de64bde023932c |
|||
timeCreated: 1499946987 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 59a5ca19094a8c64099eded20685322f |
|||
folderAsset: yes |
|||
timeCreated: 1500627638 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 2b0e7252e10375942943003cdd139be0 |
|||
folderAsset: yes |
|||
timeCreated: 1500627615 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 0ef495ee49d152b419e9fd62aa24523f |
|||
timeCreated: 1489679489 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef __FEATURE_FLAGS_H__ |
|||
#define __FEATURE_FLAGS_H__ |
|||
|
|||
static const uint FeatureVariantFlags[NUM_FEATURE_VARIANTS] = |
|||
{ |
|||
/* 0 */ 0 | MATERIALFEATUREFLAGS_MASK, // TODO: ask Runes if this is really needed ? In case of material only, it mean debug and we don't care about performance |
|||
/* 1 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | MATERIALFEATUREFLAGS_LIT_STANDARD, |
|||
/* 2 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_STANDARD, |
|||
/* 3 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | MATERIALFEATUREFLAGS_LIT_STANDARD, |
|||
/* 3 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_STANDARD, |
|||
/* 5 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | MATERIALFEATUREFLAGS_LIT_STANDARD, |
|||
/* 6 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_STANDARD, |
|||
/* 7 */ LIGHTFEATUREFLAGS_MASK | MATERIALFEATUREFLAGS_LIT_STANDARD, |
|||
/* 8 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | MATERIALFEATUREFLAGS_MASK, |
|||
/* 9 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_MASK, |
|||
/* 10 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | MATERIALFEATUREFLAGS_MASK, |
|||
/* 11 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_MASK, |
|||
/* 12 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | MATERIALFEATUREFLAGS_MASK, |
|||
/* 13 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_MASK, |
|||
/* 14 */ LIGHTFEATUREFLAGS_MASK | MATERIALFEATUREFLAGS_MASK, |
|||
/* 15 */ 0xFFFFFFFF // shouldn't be needed |
|||
}; |
|||
|
|||
uint FeatureFlagsToTileVariant(uint featureFlags) |
|||
{ |
|||
for(int i = 0; i < NUM_FEATURE_VARIANTS; i++) |
|||
{ |
|||
if((featureFlags & FeatureVariantFlags[i]) == featureFlags) |
|||
return i; |
|||
} |
|||
return NUM_FEATURE_VARIANTS - 1; |
|||
} |
|||
|
|||
uint TileVariantToFeatureFlags(uint variant) |
|||
{ |
|||
return FeatureVariantFlags[variant]; |
|||
} |
|||
|
|||
#endif |
撰写
预览
正在加载...
取消
保存
Reference in new issue