Fixed Shadow bugs and implemented scripting for trajectory rendering #407

Merged
Xenosas1337 merged 5 commits from SP3-1-Rendering into main 2023-03-09 15:10:59 +08:00
18 changed files with 382 additions and 153 deletions

View File

@ -21,6 +21,7 @@
Color: {x: 1, y: 1, z: 1, w: 1} Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 1 Strength: 1
Casting Shadows: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 5 - EID: 5
@ -35,6 +36,7 @@
Color: {x: 0.901608765, y: 0.867841423, z: 1, w: 1} Color: {x: 0.901608765, y: 0.867841423, z: 1, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 0.699999988 Strength: 0.699999988
Casting Shadows: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 65674 - EID: 65674
@ -43,17 +45,18 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0.242245644, y: 1.56757355, z: -6.07086945} Translate: {x: 0.236000001, y: 1.56757355, z: -6.07086945}
Rotate: {x: -0, y: 0, z: -0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Light Component: Light Component:
Position: {x: 2, y: 1.5, z: -5.5999999} Position: {x: 2, y: 1.5, z: -5.5999999}
Type: Directional Type: Directional
Direction: {x: 0, y: 0, z: -1} Direction: {x: -0.0780000016, y: 0.159999996, z: -1}
Color: {x: 0, y: 0, z: 0, w: 1} Color: {x: 0, y: 0, z: 0, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 1 Strength: 1
Casting Shadows: true
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 240 - EID: 240
@ -80,6 +83,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -131,6 +135,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -182,6 +187,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -233,6 +239,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -284,6 +291,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -335,6 +343,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -386,6 +395,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -437,6 +447,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -494,6 +505,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -535,6 +547,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -576,6 +589,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -617,6 +631,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -658,6 +673,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -709,6 +725,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -760,6 +777,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -811,6 +829,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -862,6 +881,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -913,6 +933,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -964,6 +985,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1015,6 +1037,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1066,6 +1089,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1117,6 +1141,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1168,6 +1193,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1219,6 +1245,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1270,6 +1297,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1321,6 +1349,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1372,6 +1401,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1423,6 +1453,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1474,6 +1505,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1525,6 +1557,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1576,6 +1609,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1627,6 +1661,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1684,6 +1719,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1735,6 +1771,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1786,6 +1823,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1837,6 +1875,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1888,6 +1927,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1939,6 +1979,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -1996,6 +2037,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2047,6 +2089,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2098,6 +2141,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2149,6 +2193,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2200,6 +2245,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2251,6 +2297,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2308,6 +2355,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2349,6 +2397,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2390,6 +2439,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2431,6 +2481,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2472,6 +2523,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2529,6 +2581,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2570,6 +2623,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2611,6 +2665,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2652,6 +2707,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -2695,6 +2751,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -2757,6 +2814,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -2999,6 +3057,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: false Use Gravity: false
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3180,6 +3239,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3227,6 +3287,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3268,6 +3329,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3309,6 +3371,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3350,6 +3413,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3391,6 +3455,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3438,6 +3503,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3479,6 +3545,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3520,6 +3587,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3561,6 +3629,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3602,6 +3671,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3649,6 +3719,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3690,6 +3761,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3731,6 +3803,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3772,6 +3845,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3813,6 +3887,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3860,6 +3935,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3901,6 +3977,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3942,6 +4019,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -3983,6 +4061,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4024,6 +4103,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4071,6 +4151,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4112,6 +4193,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4153,6 +4235,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4194,6 +4277,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4235,6 +4319,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4282,6 +4367,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4323,6 +4409,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4364,6 +4451,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4405,6 +4493,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4446,6 +4535,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4493,6 +4583,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4534,6 +4625,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4575,6 +4667,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4616,6 +4709,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4657,6 +4751,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4704,6 +4799,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4745,6 +4841,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4786,6 +4883,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4827,6 +4925,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4868,6 +4967,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4915,6 +5015,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4956,6 +5057,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -4997,6 +5099,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -5038,6 +5141,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -5079,6 +5183,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -5126,6 +5231,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -5167,6 +5273,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -5208,6 +5315,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -5249,6 +5357,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -5373,6 +5482,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -7421,7 +7531,7 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 2, y: 0, z: 0} Translate: {x: 2, y: 0, z: 0}
Rotate: {x: -0, y: 0, z: 0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
@ -14149,4 +14259,31 @@
Perspective: true Perspective: true
FOV: 90 FOV: 90
IsActive: true IsActive: true
Scripts: ~
- EID: 537
Name: ShadowFixRoof
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -0.0146873593, y: 2.83242893, z: 0}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 5.15999985, y: 5.15999985, z: 5.15999985}
IsActive: true
Renderable Component:
Mesh: 142812576
Material: 127069936
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 2, y: 0.0500000007, z: 2}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: -0.00999999978, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~ Scripts: ~

View File

@ -26,7 +26,7 @@
NumberOfChildren: 1 NumberOfChildren: 1
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0.189419448, z: 0} Translate: {x: 0, y: 0.201105013, z: 0}
Rotate: {x: 0.00523597933, y: -2.96353412, z: -6.40293041e-10} Rotate: {x: 0.00523597933, y: -2.96353412, z: -6.40293041e-10}
Scale: {x: 1.00000191, y: 1, z: 1.00000191} Scale: {x: 1.00000191, y: 1, z: 1.00000191}
IsActive: true IsActive: true
@ -41,9 +41,9 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0.006237939, y: -0.000393368304, z: 0} Translate: {x: 0.00623797067, y: -0.000395311916, z: -2.03726813e-08}
Rotate: {x: -0, y: 2.79945588, z: 0} Rotate: {x: 1.35041773e-08, y: 2.79945588, z: -9.6043955e-09}
Scale: {x: 1.0000881, y: 1, z: 1.0000881} Scale: {x: 1.00008798, y: 1, z: 1.0000881}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 144838771 Mesh: 144838771
@ -67,6 +67,7 @@
Color: {x: 1, y: 1, z: 1, w: 1} Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 0 Strength: 0
Casting Shadows: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 4 - EID: 4
@ -81,6 +82,7 @@
Color: {x: 1, y: 1, z: 1, w: 1} Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 0.600000024 Strength: 0.600000024
Casting Shadows: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 5 - EID: 5
@ -97,4 +99,50 @@
Mesh: 141771688 Mesh: 141771688
Material: 124370424 Material: 124370424
IsActive: true IsActive: true
Scripts: ~
- EID: 6
Name: TrajectoryTest
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -3.39616156, y: 3.66783714, z: -0.722039163}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true
Interpolate: true
Sleeping Enabled: false
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Sphere
Radius: 1
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Trajectory Renderer Component:
Mesh: 134305891
Start Color: {x: 1, y: 0.951541781, z: 0}
Start Alpha: 1
End Color: {x: 0, y: 1, z: 0.748898745}
End Alpha: 1
"Color Eval Rate ": 0.192000002
IsActive: true
Scripts: ~ Scripts: ~

View File

@ -1,4 +1,5 @@
#version 450 #version 450
#extension GL_EXT_nonuniform_qualifier : require
struct DirectionalLightStruct struct DirectionalLightStruct
{ {
@ -63,8 +64,6 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
// Perform perspective division and convert to 0 to 1 range // Perform perspective division and convert to 0 to 1 range
vec3 converted = (fragPosLightPOV.xyz / fragPosLightPOV.w) * vec3(0.5f) + vec3(0.5f); vec3 converted = (fragPosLightPOV.xyz / fragPosLightPOV.w) * vec3(0.5f) + vec3(0.5f);
// float sampledDepth = texture(shadowMap, converted.xy).r;
// float sampledDepth = texture(shadowMap, converted.xy).z;
vec2 moments = texture(shadowMap, converted.xy).xy; vec2 moments = texture(shadowMap, converted.xy).xy;
if (converted.x < 0.0f || converted.x > 1.0f || converted.y < 0.0f || converted.y > 1.0f) if (converted.x < 0.0f || converted.x > 1.0f || converted.y < 0.0f || converted.y > 1.0f)
@ -74,9 +73,12 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
float worldNormalDotLight = dot (normalize (worldNormal), normalize(lightDir)); float worldNormalDotLight = dot (normalize (worldNormal), normalize(lightDir));
if (worldNormalDotLight < 0.0f) if (worldNormalDotLight <= 0.0f)
return 0.7f; return 0.7f;
// if (worldNormalDotLight <= 0.01f)
// return 0.7f;
if (fragPosLightPOV.z > moments.x && fragPosLightPOV.w > 0.0f) if (fragPosLightPOV.z > moments.x && fragPosLightPOV.w > 0.0f)
{ {
float p = step (fragPosLightPOV.z, moments.x); float p = step (fragPosLightPOV.z, moments.x);
@ -95,6 +97,7 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
return 0.0f; return 0.0f;
} }
// return min (worldNormalDotLight + 0.7f, 1.0f);
return 1.0f; return 1.0f;
} }
@ -121,18 +124,21 @@ void main()
// light layer index // light layer index
uint lightLayer = lightLayerAndNormal.x; uint lightLayer = lightLayerAndNormal.x;
// Normals are stored in 2 32-bit uints (only first 48 bits are used) where they can be unpacked in 3 floats so we unpack them here.
vec3 worldNormal = vec3 (unpackHalf2x16 (lightLayerAndNormal.y).xy, unpackHalf2x16 (lightLayerAndNormal.z).x); vec3 worldNormal = vec3 (unpackHalf2x16 (lightLayerAndNormal.y).xy, unpackHalf2x16 (lightLayerAndNormal.z).x);
vec3 fragColor = vec3 (0.0f); vec3 fragColor = vec3 (0.0f);
vec4 shadowMapColor = vec4 (1.0f); vec4 shadowMapColor = vec4 (1.0f);
// Shadow multiplier
float shadowValue = 1.0f;
for (int i = 0; i < lightCounts.ambientLights; ++i) for (int i = 0; i < lightCounts.ambientLights; ++i)
{ {
if ((lightLayer & AmbLightData.aLightData[i].cullingMask) != 0) if ((lightLayer & AmbLightData.aLightData[i].cullingMask) != 0)
{ {
// Just do some add // Just do some add
//fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (0.5f);
fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (AmbLightData.aLightData[i].strength); fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (AmbLightData.aLightData[i].strength);
} }
} }
@ -153,12 +159,16 @@ void main()
// If the shadow map is enabled (test the bit) // If the shadow map is enabled (test the bit)
if ((DirLightData.dLightData[i].shadowData & uint(1)) == 1) if ((DirLightData.dLightData[i].shadowData & uint(1)) == 1)
{ {
// calculate shadow map here uint shadowMapIndex = (DirLightData.dLightData[i].shadowData >> 8);
fragColor.rgb *= CalcShadowValue (shadowMaps[0], positionWorld, DirLightData.dLightData[i].pvMatrix, worldNormal, DirLightData.dLightData[i].directionWorld.xyz).xxx; shadowValue = min (shadowValue, CalcShadowValue (shadowMaps[nonuniformEXT(shadowMapIndex)], positionWorld, DirLightData.dLightData[i].pvMatrix, worldNormal, DirLightData.dLightData[i].directionWorld.xyz));
} }
} }
} }
// calculate shadow map here
if (shadowValue != 0.0f)
fragColor.rgb *= shadowValue;
float ssaoVal = imageLoad (ssaoBlurredImage, globalThread).r; float ssaoVal = imageLoad (ssaoBlurredImage, globalThread).r;
fragColor *= ssaoVal; fragColor *= ssaoVal;
@ -167,12 +177,4 @@ void main()
// store result into result image // store result into result image
imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), vec4(fragColor.rgb, 1.0f)); imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), vec4(fragColor.rgb, 1.0f));
// vec2 normTexCoords = vec2 (gl_GlobalInvocationID.xy) / vec2 (1024.0f);
// vec4 shadowMapVal = texture(shadowMaps[0], normTexCoords);
// if (normTexCoords.x > 1.0f || normTexCoords.y > 1.0f)
// shadowMapVal = vec4(0.0f);
// imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), shadowMapVal.xxxx);
} }

View File

@ -77,7 +77,7 @@ void main()
worldSpacePosition = In.worldPos; worldSpacePosition = In.worldPos;
outEntityID = In2.eid; outEntityID = In2.eid;
lightLayerIndices = uvec4 (In2.lightLayerIndex, 0, 0, 1); lightLayerIndices = uvec4 (In2.lightLayerIndex, packHalf2x16 (In.worldNormal.xy), packHalf2x16 (vec2 (In.worldNormal.z, 1.0f)), 1);
// float vpHeight = float (In2.screenSpacePos.y) - MatProp.data[In2.materialIndex].highlightPosition; // float vpHeight = float (In2.screenSpacePos.y) - MatProp.data[In2.materialIndex].highlightPosition;
// bring the frame of reference to the object's screen space pos // bring the frame of reference to the object's screen space pos

View File

@ -186,7 +186,7 @@ namespace SHADE
.flags = vk::DescriptorBindingFlagBits::eVariableDescriptorCount, .flags = vk::DescriptorBindingFlagBits::eVariableDescriptorCount,
}; };
// For global data (generic data and textures) // For global data (generic data and textures). NOT USED.
Handle<SHVkDescriptorSetLayout> shadowMapDescLayout = logicalDevice->CreateDescriptorSetLayout({ shadowMapBinding }); Handle<SHVkDescriptorSetLayout> shadowMapDescLayout = logicalDevice->CreateDescriptorSetLayout({ shadowMapBinding });
SET_VK_OBJ_NAME(logicalDevice, vk::ObjectType::eDescriptorSetLayout, shadowMapDescLayout->GetVkHandle(), "[Descriptor Set Layout] Shadow Maps"); SET_VK_OBJ_NAME(logicalDevice, vk::ObjectType::eDescriptorSetLayout, shadowMapDescLayout->GetVkHandle(), "[Descriptor Set Layout] Shadow Maps");

View File

@ -865,32 +865,30 @@ namespace SHADE
std::string depthResourceName = "ShadowMap_Depth " + std::to_string(EVENT_DATA->lightEntity); std::string depthResourceName = "ShadowMap_Depth " + std::to_string(EVENT_DATA->lightEntity);
std::string shadowMapResourceName = "ShadowMap " + std::to_string(EVENT_DATA->lightEntity); std::string shadowMapResourceName = "ShadowMap " + std::to_string(EVENT_DATA->lightEntity);
std::string shadowMapBlurredResourceName = "ShadowMap Blurred" + std::to_string(EVENT_DATA->lightEntity); std::string shadowMapBlurredResourceName = "ShadowMap Blurred" + std::to_string(EVENT_DATA->lightEntity);
Handle<SHSubpass> gBufferWriteSubpass = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data())->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_WRITE_SUBPASS);
Handle<SHSubpass> gBufferWriteVfxSubpass = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data())->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_WRITE_VFX_SUBPASS); // we need to wait for the device to finish using the graph first
device->WaitIdle();
if (EVENT_DATA->enableShadow) if (EVENT_DATA->enableShadow)
{ {
// When the light first enables shadow rendering, we need to prepare the relevant objects to render shadows; namely renderpasses and subpasses, pipelines and descriptor sets // When the light first enables shadow rendering, we need to prepare the relevant objects to render shadows; namely renderpasses and subpasses, pipelines and descriptor sets
if (EVENT_DATA->firstEnable) if (EVENT_DATA->firstEnable)
{ {
// we need to wait for the device to finish using the graph first Handle<SHSubpass> gBufferWriteSubpass = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data())->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_WRITE_SUBPASS);
device->WaitIdle(); Handle<SHSubpass> gBufferWriteVfxSubpass = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data())->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_WRITE_VFX_SUBPASS);
// Create new renderer for the light component and give it to the light component // Create new renderer for the light component and give it to the light component
Handle<SHRenderer> newRenderer = resourceManager.Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, SHRenderer::PROJECTION_TYPE::ORTHOGRAPHIC); Handle<SHRenderer> newRenderer = resourceManager.Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, SHRenderer::PROJECTION_TYPE::ORTHOGRAPHIC);
lightComp->SetRenderer(newRenderer); lightComp->SetRenderer(newRenderer);
// assign shadow map index to light component
lightComp->SetShadowMapIndex(lightingSubSystem->GetNumShadowMaps());
// Add the shadow map resource to the graph // Add the shadow map resource to the graph
renderGraph->AddResource(depthResourceName, { SH_RENDER_GRAPH_RESOURCE_FLAGS::DEPTH }, false, SHLightingSubSystem::SHADOW_MAP_WIDTH, SHLightingSubSystem::SHADOW_MAP_HEIGHT, vk::Format::eD32Sfloat); renderGraph->AddResource(depthResourceName, { SH_RENDER_GRAPH_RESOURCE_FLAGS::DEPTH }, false, SHLightingSubSystem::SHADOW_MAP_WIDTH, SHLightingSubSystem::SHADOW_MAP_HEIGHT, vk::Format::eD32Sfloat);
renderGraph->AddResource(shadowMapResourceName, { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, false, SHLightingSubSystem::SHADOW_MAP_WIDTH, SHLightingSubSystem::SHADOW_MAP_HEIGHT, vk::Format::eR32G32B32A32Sfloat); renderGraph->AddResource(shadowMapResourceName, { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, false, SHLightingSubSystem::SHADOW_MAP_WIDTH, SHLightingSubSystem::SHADOW_MAP_HEIGHT, vk::Format::eR32G32B32A32Sfloat);
renderGraph->AddResource(shadowMapBlurredResourceName, { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, false, SHLightingSubSystem::SHADOW_MAP_WIDTH, SHLightingSubSystem::SHADOW_MAP_HEIGHT, vk::Format::eR32G32B32A32Sfloat); renderGraph->AddResource(shadowMapBlurredResourceName, { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, false, SHLightingSubSystem::SHADOW_MAP_WIDTH, SHLightingSubSystem::SHADOW_MAP_HEIGHT, vk::Format::eR32G32B32A32Sfloat);
// link resource to node. This means linking the resource and regenerating the node's renderpass and framebuffer. // link resource to node. This means linking the resource and regenerating the node's renderpass and framebuffer.
auto shadowMapNode = renderGraph->AddNodeAfter(SHGraphicsConstants::RenderGraphEntityNames::SHADOW_MAP_PASS.data() + shadowMapResourceName, { depthResourceName.c_str(), shadowMapResourceName.c_str(), shadowMapBlurredResourceName.c_str() }, SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data()); auto shadowMapNode = renderGraph->AddNodeAfter(SHGraphicsConstants::RenderGraphEntityNames::SHADOW_MAP_PASS.data() + shadowMapResourceName, { depthResourceName.c_str(), shadowMapResourceName.c_str(), shadowMapBlurredResourceName.c_str() }, SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data());
@ -929,6 +927,10 @@ namespace SHADE
// add the shadow map and the blurred version to the lighting system // add the shadow map and the blurred version to the lighting system
uint32_t const NEW_SHADOW_MAP_INDEX = lightingSubSystem->AddShadowMap(renderGraph->GetRenderGraphResource(shadowMapBlurredResourceName), EVENT_DATA->lightEntity); uint32_t const NEW_SHADOW_MAP_INDEX = lightingSubSystem->AddShadowMap(renderGraph->GetRenderGraphResource(shadowMapBlurredResourceName), EVENT_DATA->lightEntity);
// assign shadow map index to light component
lightComp->SetShadowMapIndex(NEW_SHADOW_MAP_INDEX);
// Get deferred composite node compute and modify descriptor set // Get deferred composite node compute and modify descriptor set
auto nodeCompute = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::DEFERRED_COMPOSITE_PASS.data())->GetNodeCompute(SHGraphicsConstants::RenderGraphEntityNames::DEFERRED_COMPOSITE_COMPUTE.data()); auto nodeCompute = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::DEFERRED_COMPOSITE_PASS.data())->GetNodeCompute(SHGraphicsConstants::RenderGraphEntityNames::DEFERRED_COMPOSITE_COMPUTE.data());
nodeCompute->ModifyWriteDescImageComputeResource(SHGraphicsConstants::DescriptorSetBindings::SHADOW_MAP_IMAGE_SAMPLER_DATA, lightingSubSystem->GetViewSamplerLayout(NEW_SHADOW_MAP_INDEX), NEW_SHADOW_MAP_INDEX); nodeCompute->ModifyWriteDescImageComputeResource(SHGraphicsConstants::DescriptorSetBindings::SHADOW_MAP_IMAGE_SAMPLER_DATA, lightingSubSystem->GetViewSamplerLayout(NEW_SHADOW_MAP_INDEX), NEW_SHADOW_MAP_INDEX);
@ -942,7 +944,8 @@ namespace SHADE
else else
{ {
// get the shadow map node // get the shadow map node
renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::SHADOW_MAP_PASS.data() + shadowMapResourceName)->SetDynamicActive(false); if (auto node = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::SHADOW_MAP_PASS.data() + shadowMapResourceName))
node->SetDynamicActive(false);
} }
return eventPtr->handle; return eventPtr->handle;
@ -963,12 +966,12 @@ namespace SHADE
std::string shadowMapBlurredResourceName = "ShadowMap Blurred" + std::to_string(EVENT_DATA->lightEntity); std::string shadowMapBlurredResourceName = "ShadowMap Blurred" + std::to_string(EVENT_DATA->lightEntity);
// Remove render graph node // Remove render graph node
//renderGraph->RemoveNode(SHGraphicsConstants::RenderGraphEntityNames::SHADOW_MAP_PASS.data() + shadowMapResourceName); renderGraph->RemoveNode(SHGraphicsConstants::RenderGraphEntityNames::SHADOW_MAP_PASS.data() + shadowMapResourceName);
// Remove render graph resource // Remove render graph resource
//renderGraph->RemoveResource(depthResourceName); renderGraph->RemoveResource(depthResourceName);
//renderGraph->RemoveResource(shadowMapResourceName); renderGraph->RemoveResource(shadowMapResourceName);
//renderGraph->RemoveResource(shadowMapBlurredResourceName); renderGraph->RemoveResource(shadowMapBlurredResourceName);
// Register light component shadow map index into light system as recyclable // Register light component shadow map index into light system as recyclable
lightingSubSystem->RemoveShadowMap (EVENT_DATA->lightEntity); lightingSubSystem->RemoveShadowMap (EVENT_DATA->lightEntity);

View File

@ -120,21 +120,17 @@ namespace SHADE
{ {
lightData.castShadows = flag; lightData.castShadows = flag;
// If the flag is true // Create new event and broadcast it
if (flag) SHLightShadowEvent newEvent;
{ newEvent.lightEntity = GetEID();
// Create new event and broadcast it
SHLightShadowEvent newEvent;
newEvent.lightEntity = GetEID();
// If shadow map index is invalid, that means light is enabling shadow for the first time. // If shadow map index is invalid, that means light is enabling shadow for the first time.
newEvent.firstEnable = (lightData.shadowMapIndex == SHLightData::INVALID_SHADOW_MAP_INDEX); newEvent.firstEnable = (lightData.shadowMapIndex == SHLightData::INVALID_SHADOW_MAP_INDEX);
// pass the flag to the event // pass the flag to the event
newEvent.enableShadow = flag; newEvent.enableShadow = flag;
SHEventManager::BroadcastEvent<SHLightShadowEvent>(newEvent, SH_GRAPHICS_LIGHT_ENABLE_SHADOW_EVENT); SHEventManager::BroadcastEvent<SHLightShadowEvent>(newEvent, SH_GRAPHICS_LIGHT_ENABLE_SHADOW_EVENT);
}
} }

View File

@ -62,15 +62,13 @@ namespace SHADE
// write view projection matrix if renderer is available // write view projection matrix if renderer is available
auto lightRenderer = lightComp->GetRenderer(); auto lightRenderer = lightComp->GetRenderer();
if (lightRenderer) if (lightRenderer)
{
lightPtr->pvMatrix = lightRenderer->GetCPUCameraData().viewProjectionMatrix; lightPtr->pvMatrix = lightRenderer->GetCPUCameraData().viewProjectionMatrix;
// Boolean to cast shadows in first 8 bits (1 byte) // Boolean to cast shadows in first 8 bits (1 byte)
lightPtr->shadowData = lightData.castShadows; lightPtr->shadowData = lightData.castShadows;
// Next 24 bits for shadow map index // Next 24 bits for shadow map index
lightPtr->shadowData |= (lightData.shadowMapIndex << 8); lightPtr->shadowData |= (lightData.shadowMapIndex << 8);
}
break; break;
} }
case SH_LIGHT_TYPE::POINT: case SH_LIGHT_TYPE::POINT:
@ -526,7 +524,7 @@ namespace SHADE
if (auto renderer = light.GetRenderer()) if (auto renderer = light.GetRenderer())
{ {
//SHMatrix orthoMatrix = SHMatrix::OrthographicRH() //SHMatrix orthoMatrix = SHMatrix::OrthographicRH()
renderer->UpdateDataManual(frameIndex, GetViewMatrix(&light), SHMatrix::OrthographicLH(15.0f, 15.0f, 1.0f, 80.0f)); renderer->UpdateDataManual(frameIndex, GetViewMatrix(&light), SHMatrix::OrthographicLH(20.0f, 20.0f, 1.0f, 80.0f));
} }
auto enumValue = SHUtilities::ConvertEnum(light.GetLightData().type); auto enumValue = SHUtilities::ConvertEnum(light.GetLightData().type);
@ -636,7 +634,7 @@ namespace SHADE
shadowMapImageSamplers.emplace_back(NEW_IMAGE_VIEW, shadowMapSampler, vk::ImageLayout::eShaderReadOnlyOptimal); shadowMapImageSamplers.emplace_back(NEW_IMAGE_VIEW, shadowMapSampler, vk::ImageLayout::eShaderReadOnlyOptimal);
// Add to container of shadow maps // Add to container of shadow maps
shadowMapIndexing.emplace(lightEntity, static_cast<uint32_t> (shadowMaps.size())); shadowMapIndexing.emplace(lightEntity, static_cast<uint32_t> (shadowMaps.size() - 1u));
usedIndex = static_cast<uint32_t>(shadowMapImageSamplers.size()) - 1u; usedIndex = static_cast<uint32_t>(shadowMapImageSamplers.size()) - 1u;
} }

View File

@ -22,19 +22,32 @@ namespace SHADE
} }
void SHTrajectoryRenderableComponent::ClearPositions(void) noexcept void SHTrajectoryRenderableComponent::SimulateTrajectory(EntityID eid, SHVec3 force, float timestep, uint32_t maxSteps) noexcept
{ {
positions.clear(); entityToSimulate = eid;
simulationForce = force;
simulationTimestep = timestep;
simulationMaxSteps = maxSteps;
} }
bool SHTrajectoryRenderableComponent::HasPositions(void) const noexcept float SHTrajectoryRenderableComponent::GetSimulationTimestep(void) const noexcept
{ {
return !positions.empty(); return simulationTimestep;
} }
std::vector<SHVec3> SHTrajectoryRenderableComponent::GetPositions(void) const noexcept void SHTrajectoryRenderableComponent::ResetSimulationInfo(void) noexcept
{ {
return positions; entityToSimulate = MAX_EID;
}
uint32_t SHTrajectoryRenderableComponent::GetSimulationMaxSteps(void) const noexcept
{
return simulationMaxSteps;
}
SHVec3 SHTrajectoryRenderableComponent::GetSimulationForce(void) const noexcept
{
return simulationForce;
} }
Handle<SHMesh> SHTrajectoryRenderableComponent::GetMesh(void) const noexcept Handle<SHMesh> SHTrajectoryRenderableComponent::GetMesh(void) const noexcept
@ -67,16 +80,16 @@ namespace SHADE
return colorEvolveRate; return colorEvolveRate;
} }
EntityID SHTrajectoryRenderableComponent::GetEntityToSimulate(void) const noexcept
{
return entityToSimulate;
}
void SHTrajectoryRenderableComponent::SetMesh(Handle<SHMesh> newMesh) noexcept void SHTrajectoryRenderableComponent::SetMesh(Handle<SHMesh> newMesh) noexcept
{ {
mesh = newMesh; mesh = newMesh;
} }
void SHTrajectoryRenderableComponent::SetPositions(std::vector<SHVec3> const& inPositions) noexcept
{
positions = inPositions;
}
void SHTrajectoryRenderableComponent::SetStartColor(SHVec3 color) noexcept void SHTrajectoryRenderableComponent::SetStartColor(SHVec3 color) noexcept
{ {
startColor = color; startColor = color;

View File

@ -17,9 +17,6 @@ namespace SHADE
//! Mesh used to render the trajectory //! Mesh used to render the trajectory
Handle<SHMesh> mesh; Handle<SHMesh> mesh;
//! positions to plot for rendering. Will be cleared every frame.
std::vector<SHVec3> positions;
//! Starting color of the trajectory //! Starting color of the trajectory
SHVec3 startColor; SHVec3 startColor;
@ -35,32 +32,48 @@ namespace SHADE
//! evolving rate of the color //! evolving rate of the color
float colorEvolveRate; float colorEvolveRate;
//! Used for the trajectory simulation. Indicates the time to pass before
//! plotting a point in the simulation
float simulationTimestep;
//! Entity to simulate trajectory of
EntityID entityToSimulate;
//! Force to use during simulation of
SHVec3 simulationForce;
//! max points to be plotted in the simulation before stopping.
//! Note that the plotting might still be halted if the simulation
//! detects a raycast hit with a collider.
uint32_t simulationMaxSteps;
public: public:
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* PRIVATE MEMBER FUNCTIONS */ /* PRIVATE MEMBER FUNCTIONS */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
void SetMesh(Handle<SHMesh> newMesh) noexcept; void SetMesh(Handle<SHMesh> newMesh) noexcept;
void SetPositions (std::vector<SHVec3> const& inPositions) noexcept;
void SetStartColor(SHVec3 startColor) noexcept; void SetStartColor(SHVec3 startColor) noexcept;
void SetEndColor (SHVec3 endColor) noexcept; void SetEndColor (SHVec3 endColor) noexcept;
void SetStartAlpha(float a) noexcept; void SetStartAlpha(float a) noexcept;
void SetEndAlpha (float a) noexcept; void SetEndAlpha (float a) noexcept;
void SetColorEvolveRate(float rate) noexcept; void SetColorEvolveRate(float rate) noexcept;
std::vector<SHVec3> GetPositions (void) const noexcept; Handle<SHMesh> GetMesh (void) const noexcept;
Handle<SHMesh> GetMesh (void) const noexcept; SHVec3 const& GetStartColor (void) const noexcept;
SHVec3 const& GetStartColor (void) const noexcept; SHVec3 const& GetEndColor (void) const noexcept;
SHVec3 const& GetEndColor (void) const noexcept; float GetStartAlpha (void) const noexcept;
float GetStartAlpha (void) const noexcept; float GetEndAlpha (void) const noexcept;
float GetEndAlpha (void) const noexcept; float GetColorEvolveRate (void) const noexcept;
float GetColorEvolveRate (void) const noexcept; EntityID GetEntityToSimulate (void) const noexcept;
SHVec3 GetSimulationForce (void) const noexcept;
uint32_t GetSimulationMaxSteps (void) const noexcept;
float GetSimulationTimestep (void) const noexcept;
void ResetSimulationInfo (void) noexcept;
void OnCreate(void) override final; void OnCreate(void) override final;
void OnDestroy(void) override final; void OnDestroy(void) override final;
void ClearPositions(void) noexcept; void SimulateTrajectory (EntityID eid, SHVec3 force, float timestep, uint32_t maxSteps) noexcept;
bool HasPositions(void) const noexcept;
RTTR_ENABLE() RTTR_ENABLE()

View File

@ -11,6 +11,8 @@
#include "Graphics/RenderGraph/SHSubpass.h" #include "Graphics/RenderGraph/SHSubpass.h"
#include "Graphics/MiddleEnd/GlobalData/SHGlobalDescriptorSets.h" #include "Graphics/MiddleEnd/GlobalData/SHGlobalDescriptorSets.h"
#include "Graphics/MiddleEnd/Interface/SHRenderer.h" #include "Graphics/MiddleEnd/Interface/SHRenderer.h"
#include "Physics/System/SHPhysicsSystem.h"
#include "ECS_Base/Managers/SHSystemManager.h"
namespace SHADE namespace SHADE
{ {
@ -74,83 +76,90 @@ namespace SHADE
void SHTrajectoryRenderingSubSystem::Run(uint32_t frameIndex) noexcept void SHTrajectoryRenderingSubSystem::Run(uint32_t frameIndex) noexcept
{ {
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
auto& comps = SHComponentManager::GetDense<SHTrajectoryRenderableComponent>(); auto& comps = SHComponentManager::GetDense<SHTrajectoryRenderableComponent>();
for (auto& comp : comps) for (auto& comp : comps)
{ {
//std::vector<SHVec3> test{}; if (EntityID entityToSimulate = comp.GetEntityToSimulate(); entityToSimulate != MAX_EID)
//test.resize(10);
//float x = 0.0f;
//for (auto& vec : test)
//{
// vec = SHVec3(x, 5.0f, 0.0f);
// x += 0.5f;
//}
//comp.SetPositions (test);
// If has positions, feed data to buffer.
if (comp.HasPositions())
{ {
auto meshHandle = comp.GetMesh(); std::vector<SHVec3> positions{};
std::vector<SHQuaternion> quats{};
// dont do anything if no mesh physicsSystem->SimulateBody
if (!meshHandle) (positions, quats,
continue; SHPhysicsSystem::SimulateBodyInfo
SHTransformComponent* transform = SHComponentManager::GetComponent_s<SHTransformComponent>(comp.GetEID());
if (transform)
{
// convenient variable
SHVec3 const& startColor = comp.GetStartColor();
SHVec3 const& endColor = comp.GetEndColor();
float colorEvolveRate = comp.GetColorEvolveRate();
// trs to be reused
SHMatrix trs = transform->GetTRS();
// starting color of trajectory
SHVec4 currentColor = comp.GetStartColor();
// Start from 0 and slowly evolve to 1
float lerpValue = 0.0f;
// Will be used for baseInstance later
uint32_t oldTransformDataSize = transformData.size();
auto const& positions = comp.GetPositions();
for (auto& pos : positions)
{ {
// modify position and reuse matrix .bodyEID = entityToSimulate,
trs.m[3][0] = pos.x; .force = comp.GetSimulationForce(),
trs.m[3][1] = pos.y; .continuousForce = false,
trs.m[3][2] = pos.z; .timeStep = comp.GetSimulationTimestep(),
.maxSteps = static_cast<int>(comp.GetSimulationMaxSteps()),
transformData.push_back(trs);
colorData.push_back(currentColor);
// evolve lerp value and clamp to 1
lerpValue = std::min (1.0f, lerpValue + colorEvolveRate);
// evolve color
currentColor = SHVec3::Lerp(startColor, endColor, lerpValue);
currentColor.w = SHMath::Lerp (comp.GetStartAlpha(), comp.GetEndAlpha(), lerpValue);
} }
);
// add draw data for this trajectory comp.ResetSimulationInfo();
drawData.push_back(vk::DrawIndexedIndirectCommand
// If has positions, feed data to buffer.
if (!positions.empty())
{
auto meshHandle = comp.GetMesh();
// dont do anything if no mesh
if (!meshHandle)
continue;
SHTransformComponent* transform = SHComponentManager::GetComponent_s<SHTransformComponent>(comp.GetEID());
if (transform)
{
// convenient variable
SHVec3 const& startColor = comp.GetStartColor();
SHVec3 const& endColor = comp.GetEndColor();
float colorEvolveRate = comp.GetColorEvolveRate();
// trs to be reused
SHMatrix trs = transform->GetTRS();
// starting color of trajectory
SHVec4 currentColor = comp.GetStartColor();
// Start from 0 and slowly evolve to 1
float lerpValue = 0.0f;
// Will be used for baseInstance later
uint32_t oldTransformDataSize = transformData.size();
for (auto& pos : positions)
{ {
.indexCount = meshHandle->IndexCount, // modify position and reuse matrix
.instanceCount = static_cast<uint32_t>(transformData.size()) - oldTransformDataSize, trs.m[3][0] = pos.x;
.firstIndex = meshHandle->FirstIndex, trs.m[3][1] = pos.y;
.vertexOffset = meshHandle->FirstVertex, trs.m[3][2] = pos.z;
.firstInstance = oldTransformDataSize
}); transformData.push_back(trs);
colorData.push_back(currentColor);
// evolve lerp value and clamp to 1
lerpValue = std::min(1.0f, lerpValue + colorEvolveRate);
// evolve color
currentColor = SHVec3::Lerp(startColor, endColor, lerpValue);
currentColor.w = SHMath::Lerp(comp.GetStartAlpha(), comp.GetEndAlpha(), lerpValue);
}
// add draw data for this trajectory
drawData.push_back(vk::DrawIndexedIndirectCommand
{
.indexCount = meshHandle->IndexCount,
.instanceCount = static_cast<uint32_t>(transformData.size()) - oldTransformDataSize,
.firstIndex = meshHandle->FirstIndex,
.vertexOffset = meshHandle->FirstVertex,
.firstInstance = oldTransformDataSize
});
}
} }
} }
// clear at the end of every frame since data is already in buffers
comp.ClearPositions();
} }
if (!transformData.empty()) if (!transformData.empty())

View File

@ -194,9 +194,9 @@ namespace SHADE
// In reality, the check for variable descriptor sets do not exists in spirv-reflect. Fortunately, when a shader // In reality, the check for variable descriptor sets do not exists in spirv-reflect. Fortunately, when a shader
// defines a boundless descriptor binding in the shader, the information reflected makes the array dimensions // defines a boundless descriptor binding in the shader, the information reflected makes the array dimensions
// contain a 1 element of value 1. Knowing that having an array [1] doesn't make sense, we can use this to // contain a 1 element of value 0. Knowing that having an array [1] doesn't make sense, we can use this to
// signify a variable sized binding. // signify a variable sized binding.
if (reflectedBinding->array.dims[0] == 1) if (reflectedBinding->array.dims_count == 1 && reflectedBinding->array.dims[0] == 0)
{ {
// variable binding has to be the last in the set // variable binding has to be the last in the set
if (i == set->binding_count - 1) if (i == set->binding_count - 1)

View File

@ -111,7 +111,6 @@ namespace SHADE
renderGraphStorage->graphResources->at(resourceName).Free(); renderGraphStorage->graphResources->at(resourceName).Free();
renderGraphStorage->graphResources->erase (resourceName); renderGraphStorage->graphResources->erase (resourceName);
resourceHdl.Free ();
/* /*
* IMPORTANT NOTES * IMPORTANT NOTES
* *
@ -134,8 +133,11 @@ namespace SHADE
// Get handle to node since it exists // Get handle to node since it exists
auto nodeHdl = nodes[nodeIndexing[nodeName]]; auto nodeHdl = nodes[nodeIndexing[nodeName]];
nodes.erase(nodes.begin() + nodeIndexing[nodeName]);
nodeHdl.Free(); nodeHdl.Free();
nodeIndexing.erase(nodeName);
ReindexNodes();
} }
} }

View File

@ -118,7 +118,7 @@ namespace SHADE
if (layouts.size() == descMappings.at(SHPredefinedDescriptorTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE) + 1) if (layouts.size() == descMappings.at(SHPredefinedDescriptorTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE) + 1)
{ {
Handle<SHVkDescriptorSetLayout> computeResourceLayout = {}; Handle<SHVkDescriptorSetLayout> computeResourceLayout = {};
computeResourceLayout = layouts[descMappings.at(SHPredefinedDescriptorTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE)]; computeResourceLayout = layouts[descMappings.at(SHPredefinedDescriptorTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE)];
// create compute resources // create compute resources
computeResource = graphStorage->resourceHub->Create<ComputeResource>(); computeResource = graphStorage->resourceHub->Create<ComputeResource>();

View File

@ -13,6 +13,11 @@ namespace SHADE
} }
void TrajectoryRenderable::SimulateTrajectory(EntityID eid, Vector3 force, float timestep, uint32_t maxSteps)
{
GetNativeComponent()->SimulateTrajectory(eid, Convert::ToNative(force), timestep, maxSteps);
}
MeshAsset TrajectoryRenderable::Mesh::get() MeshAsset TrajectoryRenderable::Mesh::get()
{ {
auto mesh = GetNativeComponent()->GetMesh(); auto mesh = GetNativeComponent()->GetMesh();

View File

@ -82,6 +82,9 @@ namespace SHADE
float get(); float get();
void set(float val); void set(float val);
} }
void SimulateTrajectory(EntityID eid, Vector3 force, float timestep, uint32_t maxSteps);
}; };
} }