浏览代码

HDRenderLoop: Push a version with C# that compile

/main
Sebastien Lagarde 8 年前
当前提交
5afbdc3c
共有 6 个文件被更改,包括 570 次插入570 次删除
  1. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Editor/HDRenderLoopInspector.cs
  2. 17
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  3. 52
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightDefinition.cs.hlsl
  4. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightLoop.cs
  5. 998
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs
  6. 67
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs.hlsl

4
Assets/ScriptableRenderLoop/HDRenderLoop/Editor/HDRenderLoopInspector.cs


EditorGUILayout.Space();
// TODO: we should call a virtual method or something similar to setup the UI, inspector should not know about it
TilePass tilePass = renderLoop.lightLoop as TilePass;
TilePass.LightLoop tilePass = renderLoop.lightLoop as TilePass.LightLoop;
if (tilePass != null)
{
EditorGUILayout.LabelField(styles.tileLightLoopSettings);

tilePass.debugViewTilesFlags = EditorGUILayout.MaskField("DebugView Tiles", tilePass.debugViewTilesFlags, styles.tileLightLoopDebugTileFlagStrings);
tilePass.enableSplitLightEvaluation = EditorGUILayout.Toggle(styles.directSplitLightEvaluation, tilePass.enableSplitLightEvaluation);
tilePass.enableSplitLightEvaluation = EditorGUILayout.Toggle(styles.splitLightEvaluation, tilePass.enableSplitLightEvaluation);
tilePass.enableBigTilePrepass = EditorGUILayout.Toggle(styles.bigTilePrepass, tilePass.enableBigTilePrepass);
tilePass.enableClustered = EditorGUILayout.Toggle(styles.clustered, tilePass.enableClustered);
tilePass.disableTileAndCluster = EditorGUILayout.Toggle(styles.disableTileAndCluster, tilePass.disableTileAndCluster);

17
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


int m_HeightOnRecord;
// This must be allocate outside of Rebuild() else the option in the class can't be set in the inspector (as it will in this case recreate the class with default value)
LightLoop m_lightLoop = new TilePass();
BaseLightLoop m_lightLoop = new TilePass.LightLoop();
public LightLoop lightLoop
public BaseLightLoop lightLoop
{
get { return m_lightLoop; }
}

void RenderForward(CullResults cullResults, Camera camera, RenderLoop renderLoop, bool renderOpaque)
{
// TODO: Currently we can't render opaque object forward when deferred is enabled
// miss option
if (!debugParameters.useForwardRenderingOnly && renderOpaque)
return;
using (new Utilities.ProfilingSample("Forward Pass", renderLoop))
{
// Bind material data

m_lightLoop.RenderForward(camera, renderLoop, renderOpaque);
if (debugParameters.useForwardRenderingOnly)
if (renderOpaque)
RenderTransparentRenderList(cullResults, camera, renderLoop, "Forward", Utilities.kRendererConfigurationBakedLighting);
else
{
RenderTransparentRenderList(cullResults, camera, renderLoop, "Forward", Utilities.kRendererConfigurationBakedLighting);
}
}
}

52
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightDefinition.cs.hlsl


// PackingRules = Exact
struct DirectionalLightData
{
float3 direction;
float3 forward;
float diffuseScale;
float3 up;
float invScaleY;

int cookieIndex;
};
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.PunctualShadowData
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.ShadowData
struct PunctualShadowData
struct ShadowData
{
float4x4 worldToShadow;
int lightType;

};
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.DirectionalShadowData
// PackingRules = Exact
struct DirectionalShadowData
{
float4x4 worldToShadow;
float bias;
float quality;
float2 unused2;
};
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.EnvLightData
// PackingRules = Exact
struct EnvLightData

//
// Accessors for UnityEngine.Experimental.ScriptableRenderLoop.DirectionalLightData
//
float3 GetDirection(DirectionalLightData value)
float3 GetForward(DirectionalLightData value)
return value.direction;
return value.forward;
}
float GetDiffuseScale(DirectionalLightData value)
{

}
//
// Accessors for UnityEngine.Experimental.ScriptableRenderLoop.PunctualShadowData
// Accessors for UnityEngine.Experimental.ScriptableRenderLoop.ShadowData
float4x4 GetWorldToShadow(PunctualShadowData value)
float4x4 GetWorldToShadow(ShadowData value)
int GetLightType(PunctualShadowData value)
int GetLightType(ShadowData value)
float GetBias(PunctualShadowData value)
float GetBias(ShadowData value)
float GetQuality(PunctualShadowData value)
float GetQuality(ShadowData value)
float GetUnused(PunctualShadowData value)
float GetUnused(ShadowData value)
}
//
// Accessors for UnityEngine.Experimental.ScriptableRenderLoop.DirectionalShadowData
//
float4x4 GetWorldToShadow(DirectionalShadowData value)
{
return value.worldToShadow;
}
float GetBias(DirectionalShadowData value)
{
return value.bias;
}
float GetQuality(DirectionalShadowData value)
{
return value.quality;
}
float2 GetUnused2(DirectionalShadowData value)
{
return value.unused2;
}
//

2
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightLoop.cs


namespace UnityEngine.Experimental.ScriptableRenderLoop
{
public class LightLoop
public class BaseLightLoop
{
// TODO: We should rather put the texture settings in LightLoop, but how do we serialize it ?
public virtual void Rebuild(TextureSettings textureSettings) {}

998
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs
文件差异内容过多而无法显示
查看文件

67
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs.hlsl


#ifndef TILEPASS_CS_HLSL
#define TILEPASS_CS_HLSL
//
// UnityEngine.Experimental.ScriptableRenderLoop.TilePass.LightVolumeType: static fields
//
#define LIGHTVOLUMETYPE_CONE (0)
#define LIGHTVOLUMETYPE_SPHERE (1)
#define LIGHTVOLUMETYPE_BOX (2)
#define LIGHTVOLUMETYPE_COUNT (3)
//
// UnityEngine.Experimental.ScriptableRenderLoop.TilePass.LightCategory: static fields
//
#define LIGHTCATEGORY_PUNCTUAL (0)
#define LIGHTCATEGORY_AREA (1)
#define LIGHTCATEGORY_ENV (2)
#define LIGHTCATEGORY_COUNT (3)
//
// UnityEngine.Experimental.ScriptableRenderLoop.TilePass.LightDefinitions: static fields
//
#define MAX_NR_LIGHTS_PER_CAMERA (1024)

#define HAS_COOKIE_TEXTURE (2)
#define IS_BOX_PROJECTED (4)
#define HAS_SHADOW (8)
#define MAX_VOLUME_TYPES (3)
#define SPOT_VOLUME (0)
#define SPHERE_VOLUME (1)
#define BOX_VOLUME (2)
#define DIRECTIONAL_VOLUME (3)
#define NR_LIGHT_CATEGORIES (3)
#define PUNCTUAL_LIGHT_CATEGORY (0)
#define REFLECTION_LIGHT_CATEGORY (1)
#define AREA_LIGHT_CATEGORY (2)
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.TilePass.SFiniteLightBound
// PackingRules = Exact

float radius;
};
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.TilePass.LightShapeData
// Generated from UnityEngine.Experimental.ScriptableRenderLoop.TilePass.LightVolumeData
struct LightShapeData
struct LightVolumeData
uint lightIndex;
uint lightVolume;
uint lightVolume;
uint lightCategory;
uint lightCategory;
float unused;
float3 boxInvRange;
float unused2;
};

}
//
// Accessors for UnityEngine.Experimental.ScriptableRenderLoop.TilePass.LightShapeData
// Accessors for UnityEngine.Experimental.ScriptableRenderLoop.TilePass.LightVolumeData
float3 GetLightPos(LightShapeData value)
float3 GetLightPos(LightVolumeData value)
uint GetLightIndex(LightShapeData value)
uint GetLightVolume(LightVolumeData value)
return value.lightIndex;
return value.lightVolume;
float3 GetLightAxisX(LightShapeData value)
float3 GetLightAxisX(LightVolumeData value)
uint GetLightVolume(LightShapeData value)
uint GetLightCategory(LightVolumeData value)
return value.lightVolume;
return value.lightCategory;
float3 GetLightAxisY(LightShapeData value)
float3 GetLightAxisY(LightVolumeData value)
float GetRadiusSq(LightShapeData value)
float GetRadiusSq(LightVolumeData value)
float3 GetLightAxisZ(LightShapeData value)
float3 GetLightAxisZ(LightVolumeData value)
float GetCotan(LightShapeData value)
float GetCotan(LightVolumeData value)
float3 GetBoxInnerDist(LightShapeData value)
float3 GetBoxInnerDist(LightVolumeData value)
uint GetLightCategory(LightShapeData value)
float GetUnused(LightVolumeData value)
return value.lightCategory;
return value.unused;
float3 GetBoxInvRange(LightShapeData value)
float3 GetBoxInvRange(LightVolumeData value)
float GetUnused2(LightShapeData value)
float GetUnused2(LightVolumeData value)
{
return value.unused2;
}

正在加载...
取消
保存