array + instance_index is not the way

This commit is contained in:
Quaternions 2023-09-01 15:55:27 -07:00
parent 2df929c15f
commit b68dfa791d

View File

@ -78,13 +78,12 @@ var<uniform> r_EntityTransforms: array<EntityTransform, 7>;
@vertex
fn vs_entity(
@builtin(instance_index) instance_index: u32,
@location(0) pos: vec3<f32>,
@location(1) normal: vec3<f32>,
) -> EntityOutput {
var position: vec3<f32> = r_EntityTransforms[instance_index].matrix3 * pos+r_EntityTransforms[instance_index].translation;
var position: vec3<f32> = pos;//r_EntityTransforms[instance_index].matrix3 * pos+r_EntityTransforms[instance_index].translation;
var result: EntityOutput;
result.normal = r_EntityTransforms[instance_index].matrix3 * normal;
result.normal = normal;//r_EntityTransforms[instance_index].matrix3 * normal;
result.view = position - r_data.cam_pos.xyz;
result.position = r_data.proj * r_data.view * vec4<f32>(position, 1.0);
return result;