still having a lot of view projection errors
This commit is contained in:
parent
4670f874f5
commit
72b97b3743
|
|
@ -26,15 +26,17 @@ StructuredBuffer<Scene> scene: register(t0, space0);
|
|||
|
||||
cbuffer Uniforms : register(b0, space1)
|
||||
{
|
||||
float4x4 ViewProjection : packoffset(c0);
|
||||
float time: packoffset(c16);
|
||||
float4x4 ViewProjection;
|
||||
float time;
|
||||
};
|
||||
|
||||
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
|
||||
|
||||
Output main(Input input)
|
||||
{
|
||||
Output output;
|
||||
output.TexCoord = input.UV;
|
||||
|
||||
output.Position = mul(ViewProjection, mul(float4(input.Position, 1.0), scene[input.InstanceIndex].Model));
|
||||
output.Position = mul(mul(float4(input.Position, 1.0), transpose(scene[input.InstanceIndex].Model)), transpose(ViewProjection));
|
||||
return output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
{
|
||||
"name" : "time",
|
||||
"type" : "float",
|
||||
"offset" : 256
|
||||
"offset" : 64
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
{
|
||||
"type" : "_10",
|
||||
"name" : "type.Uniforms",
|
||||
"block_size" : 260,
|
||||
"block_size" : 68,
|
||||
"set" : 1,
|
||||
"binding" : 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ pub fn resolve(self: *@This()) void {
|
|||
|
||||
self.transform = mul(zm.translationV(position.fmul(-1).toZm()), self.transform);
|
||||
self.final = mul(self.transform, self.projection);
|
||||
core.engine_log("{any}", .{self.final});
|
||||
self.finalAlt = mul(self.transform, self.projectionAlt);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -16,7 +16,6 @@ struct type_StructuredBuffer_Scene
|
|||
struct type_Uniforms
|
||||
{
|
||||
float4x4 ViewProjection;
|
||||
char _m1_pad[192];
|
||||
float time;
|
||||
};
|
||||
|
||||
|
|
@ -36,7 +35,7 @@ vertex main0_out main0(main0_in in [[stage_in]], constant type_Uniforms& Uniform
|
|||
{
|
||||
main0_out out = {};
|
||||
out.out_var_TEXCOORD0 = in.in_var_TEXCOORD3;
|
||||
out.gl_Position = Uniforms.ViewProjection * (float4(in.in_var_TEXCOORD0, 1.0) * scene._m0[gl_InstanceIndex].Model);
|
||||
out.gl_Position = transpose(transpose(Uniforms.ViewProjection)) * (transpose(transpose(scene._m0[gl_InstanceIndex].Model)) * float4(in.in_var_TEXCOORD0, 1.0));
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue