var gsplatVS = `
#include "gsplatCommonVS"
varying gaussianUV: vec2f;
varying gaussianColor: vec4f;
#ifndef DITHER_NONE
	varying id: f32;
#endif
const discardVec: vec4f = vec4f(0.0, 0.0, 2.0, 1.0);
#ifdef PREPASS_PASS
	varying vLinearDepth: f32;
#endif
@vertex
fn vertexMain(input: VertexInput) -> VertexOutput {
	var output: VertexOutput;
	var source: SplatSource;
	if (!initSource(&source)) {
		output.position = discardVec;
		return output;
	}
	let modelCenter: vec3f = readCenter(&source);
	var center: SplatCenter;
	if (!initCenter(modelCenter, &center)) {
		output.position = discardVec;
		return output;
	}
	var corner: SplatCorner;
	if (!initCorner(&source, &center, &corner)) {
		output.position = discardVec;
		return output;
	}
	var clr: vec4f = readColor(&source);
	#if GSPLAT_AA
		clr.a = clr.a * corner.aaFactor;
	#endif
	#if SH_BANDS > 0
		let modelView3x3 = mat3x3f(center.modelView[0].xyz, center.modelView[1].xyz, center.modelView[2].xyz);
		let dir = normalize(center.view * modelView3x3);
		var sh: array<vec3f, SH_COEFFS>;
		var scale: f32;
		readSHData(&source, &sh, &scale);
		clr = vec4f(clr.xyz + evalSH(&sh, dir) * scale, clr.a);
	#endif
	clipCorner(&corner, clr.w);
	output.position = center.proj + vec4f(corner.offset, 0.0, 0.0);
	output.gaussianUV = corner.uv;
	output.gaussianColor = vec4f(prepareOutputFromGamma(max(clr.xyz, vec3f(0.0))), clr.w);
	#ifndef DITHER_NONE
		output.id = f32(source.id);
	#endif
	#ifdef PREPASS_PASS
		output.vLinearDepth = -center.view.z;
	#endif
	return output;
}
`;

export { gsplatVS as default };
