@@ -6,67 +6,85 @@ namespace UnityEngine.Experimental.ScriptableRenderLoop
66 // structure definition
77 //-----------------------------------------------------------------------------
88
9+ [ GenerateHLSL ]
10+ public enum GPULightType
11+ {
12+ Directional ,
13+ Spot ,
14+ Point ,
15+ ProjectorOrtho ,
16+ ProjectorPyramid ,
17+
18+ // AreaLight
19+ Rectangle ,
20+ Line ,
21+ // Currently not supported in real time (just use for reference)
22+ Sphere ,
23+ Disk ,
24+ Hemisphere ,
25+ Cylinder
26+ } ;
27+
928 // These structures share between C# and hlsl need to be align on float4, so we pad them.
1029 [ GenerateHLSL ]
11- public struct PunctualLightData
30+ public struct LightData
1231 {
1332 public Vector3 positionWS ;
1433 public float invSqrAttenuationRadius ;
1534
1635 public Vector3 color ;
17- public float useDistanceAttenuation ;
36+ public float angleScale ; // Spot light
1837
1938 public Vector3 forward ;
20- public float angleScale ;
39+ public float angleOffset ;
2140
2241 public Vector3 up ;
23- public float angleOffset ;
42+ public float diffuseScale ; // Spot light
2443
2544 public Vector3 right ;
26- public float diffuseScale ;
27-
2845 public float specularScale ;
46+
2947 public float shadowDimmer ;
3048 // index are -1 if not used
3149 public int shadowIndex ;
3250 public int IESIndex ;
33-
3451 public int cookieIndex ;
35- public Vector3 unused ;
36- } ;
3752
38- [ GenerateHLSL ]
39- public enum AreaShapeType
40- {
41- Rectangle ,
42- Line ,
43- // Currently not supported in real time (just use for reference)
44- Sphere ,
45- Disk ,
46- Hemisphere ,
47- Cylinder
53+ public GPULightType lightType ;
54+ // Area Light specific
55+ public Vector2 size ;
56+ public bool twoSided ;
4857 } ;
4958
5059 [ GenerateHLSL ]
51- public struct AreaLightData
60+ public struct DirectionalLightData
5261 {
53- public Vector3 positionWS ;
54- public float invSqrAttenuationRadius ;
62+ public Vector3 direction ;
63+ public float diffuseScale ;
5564
5665 public Vector3 color ;
57- public AreaShapeType shapeType ;
66+ public float specularScale ;
5867
59- public Vector3 forward ;
60- public float diffuseScale ;
68+ // Sun disc size
69+ public float cosAngle ; // Distance to disk
70+ public float sinAngle ; // Disk radius
71+ public int shadowIndex ;
72+ public float unsued ;
73+ } ;
6174
62- public Vector3 up ;
63- public float specularScale ;
6475
65- public Vector3 right ;
66- public float shadowDimmer ;
76+ // TODO: we may have to add various parameters here for shadow - was suppose to be coupled with a light loop
77+ // A point light is 6x PunctualShadowData
78+ [ GenerateHLSL ]
79+ public struct PunctualShadowData
80+ {
81+ // World to ShadowMap matrix
82+ // Include scale and bias for shadow atlas if any
83+ public Matrix4x4 worldToShadow ;
6784
68- public Vector2 size ;
69- public bool twoSided ;
85+ public GPULightType lightType ;
86+ public float bias ;
87+ public float quality ;
7088 public float unused ;
7189 } ;
7290
@@ -99,5 +117,4 @@ public struct EnvLightData
99117 public Vector3 offsetLS ;
100118 public float unused2 ;
101119 } ;
102-
103120} // namespace UnityEngine.Experimental.ScriptableRenderLoop
0 commit comments