Smaller matrices in uniforms, texcoord transform to rotate voxel faces
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
struct GlobalUniforms {
|
||||
float4x4 matrixWStoVS;
|
||||
float3x4 matrixWStoVS;
|
||||
float4x4 matrixVStoCS;
|
||||
float2x3 matrixSSPXtoCS;
|
||||
|
||||
@@ -12,10 +12,10 @@ struct PointLight {
|
||||
float3 positionWS;
|
||||
float3 color;
|
||||
|
||||
IncomingLight getIncoming(float4x4 matrixWStoVS, float3 positionVS) {
|
||||
IncomingLight getIncoming(float3x4 matrixWStoVS, float3 positionVS) {
|
||||
IncomingLight light;
|
||||
|
||||
let lightPositionVS = mul(matrixWStoVS, float4(positionWS, 1.0)).xyz;
|
||||
let lightPositionVS = mul(matrixWStoVS, float4(positionWS, 1.0));
|
||||
let lightDirectionVS = normalize(lightPositionVS - positionVS);
|
||||
let lightDistance = distance(positionVS, lightPositionVS);
|
||||
let lightAttenuation = 1.0 / (lightDistance * lightDistance);
|
||||
@@ -31,11 +31,11 @@ struct DirectionalLight {
|
||||
float3 directionWS;
|
||||
float3 color;
|
||||
|
||||
IncomingLight getIncoming(float4x4 matrixWStoVS) {
|
||||
IncomingLight getIncoming(float3x4 matrixWStoVS) {
|
||||
IncomingLight light;
|
||||
|
||||
light.radiance = color;
|
||||
light.directionVS = normalize(mul(matrixWStoVS, float4(-directionWS, 0.0)).xyz);
|
||||
light.directionVS = normalize(mul(matrixWStoVS, float4(-directionWS, 0.0)));
|
||||
return light;
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,9 @@ struct Material {
|
||||
}
|
||||
|
||||
struct ObjectUniforms {
|
||||
float4x4 matrixOStoWS;
|
||||
float4x4 matrixOStoWSNormal;
|
||||
// Limited to a composition of translation and rotation
|
||||
float3x4 matrixOStoWS;
|
||||
float2x3 texCoordTransform;
|
||||
|
||||
uint16_t material;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user