浏览代码

Change LightingDefinition.hlsl to LightDefinition.cs

Allow to share code between hlsl and C# like Morten, also add define in
common.hlsl that was in common.h for Morten
/main
sebastienlagarde 8 年前
当前提交
5ac28581
共有 6 个文件被更改,包括 66 次插入53 次删除
  1. 11
      Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl
  2. 2
      Assets/ScriptableRenderLoop/UnityStandard/Shaders/Material/Material.hlsl
  3. 42
      Assets/ScriptableRenderLoop/UnityStandard/Shaders/LightDefinition.cs
  4. 12
      Assets/ScriptableRenderLoop/UnityStandard/Shaders/LightDefinition.cs.meta
  5. 44
      Assets/ScriptableRenderLoop/UnityStandard/Shaders/Lighting/LightingDefinition.hlsl
  6. 8
      Assets/ScriptableRenderLoop/UnityStandard/Shaders/Lighting/LightingDefinition.hlsl.meta

11
Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl


#endif
// ----------------------------------------------------------------------------
// Common define allowing to include shared file between C# and hlsl
// ----------------------------------------------------------------------------
#define __HLSL 1
#define public
#define Vec2 float2
#define Vec3 float3
#define Vec4 float4
#define Mat44 float4x4
// ----------------------------------------------------------------------------
// Common math definition and fastmath function
// ----------------------------------------------------------------------------

2
Assets/ScriptableRenderLoop/UnityStandard/Shaders/Material/Material.hlsl


#include "../../ShaderLibrary/BSDF.hlsl"
#include "../../ShaderLibrary/CommonLighting.hlsl"
#include "../Lighting/LightingDefinition.hlsl"
#include "../LightDefinition.cs"
#include "CommonMaterial.hlsl"
// Here we include all the different lighting model supported by the renderloop based on define done in .shader

42
Assets/ScriptableRenderLoop/UnityStandard/Shaders/LightDefinition.cs


// Note: This file is included both in C# code and in hlsl code, avoiding duplication
//-----------------------------------------------------------------------------
// structure definition
//-----------------------------------------------------------------------------
struct PunctualLightData
{
public Vec3 positionWS;
public float invSqrAttenuationRadius;
public Vec3 color;
public float unused;
public Vec3 forward;
public float diffuseScale;
public Vec3 up;
public float specularScale;
public Vec3 right;
public float shadowDimmer;
public float angleScale;
public float angleOffset;
public Vec2 unused2;
};
struct AreaLightData
{
public Vec3 positionWS;
};
struct EnvLightData
{
public Vec3 positionWS;
};
struct PlanarLightData
{
public Vec3 positionWS;
};

12
Assets/ScriptableRenderLoop/UnityStandard/Shaders/LightDefinition.cs.meta


fileFormatVersion: 2
guid: e64b20c2b80648b4ca959ca3ebb53413
timeCreated: 1474472211
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

44
Assets/ScriptableRenderLoop/UnityStandard/Shaders/Lighting/LightingDefinition.hlsl


#ifndef UNITY_LIGHTING_DEFINITION_INCLUDED
#define UNITY_LIGHTING_DEFINITION_INCLUDED
//-----------------------------------------------------------------------------
// structure definition
//-----------------------------------------------------------------------------
struct PunctualLightData
{
float3 positionWS;
float invSqrAttenuationRadius;
float3 color;
float unused;
float3 forward;
float diffuseScale;
float3 up;
float specularScale;
float3 right;
float shadowDimmer;
float angleScale;
float angleOffset;
float2 unused2;
};
struct AreaLightData
{
float3 positionWS;
};
struct EnvLightData
{
float3 positionWS;
};
struct PlanarLightData
{
float3 positionWS;
};
#endif // UNITY_LIGHTING_DEFINITION_INCLUDED

8
Assets/ScriptableRenderLoop/UnityStandard/Shaders/Lighting/LightingDefinition.hlsl.meta


fileFormatVersion: 2
guid: 4177b2c24c1e70a44835076b95cd7420
timeCreated: 1474465931
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存