struct Uniforms { viewport_size: vec2, world_per_pixel: f32, lwdisplay_enable: f32, flat_shade: f32, transparency_enable: f32, linetype_scale: f32, _pad: f32, view_rot: mat4x4, eye_high: vec3, _pad_eh: f32, eye_low: vec3, _pad_el: f32, light_position_type: array, 4>, light_direction_intensity: array, 4>, light_color_hotspot: array, 4>, light_attenuation: array, 4>, lighting: vec4, visual_style: vec4, visual_style_color: vec4, viewport_background: vec4, view_tone: vec4, background_top: vec4, background_middle: vec4, background_bottom: vec4, background_aux0: vec4, background_aux1: vec4, background_params: vec4, background_image_params: vec4, background_image_transform: vec4, environment_params: vec4, environment_view: mat4x4, shadow_view_proj: mat4x4, shadow_params: vec4, fog_color: vec4, fog_params: vec4, fog_distances: vec4, light_web_profile_a: array, 4>, light_web_profile_b: array, 4>, light_web_rotation: array, 4>, }; struct MeshInstance { model_row_0: vec4, model_row_1: vec4, model_row_2: vec4, translation_low: vec4, normal_row_0: vec4, normal_row_1: vec4, normal_row_2: vec4, }; @group(0) @binding(0) var u: Uniforms; struct VertexIn { @location(0) position: vec3, @location(3) position_low: vec3, }; struct InstanceIn { @location(4) model_row_0: vec4, @location(5) model_row_1: vec4, @location(7) model_row_2: vec4, @location(8) translation_low: vec4, }; @vertex fn vs_main( vertex: VertexIn, instance: InstanceIn, ) -> @builtin(position) vec4 { let world_high = vec3( dot(instance.model_row_0.xyz, vertex.position) + instance.model_row_0.w, dot(instance.model_row_1.xyz, vertex.position) + instance.model_row_1.w, dot(instance.model_row_2.xyz, vertex.position) + instance.model_row_2.w, ); let world_low = vec3( dot(instance.model_row_0.xyz, vertex.position_low), dot(instance.model_row_1.xyz, vertex.position_low), dot(instance.model_row_2.xyz, vertex.position_low), ) + instance.translation_low.xyz; let relative = (world_high - u.eye_high) + (world_low - u.eye_low); return u.shadow_view_proj * vec4(relative, 1.0); }