Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/extras/gizmo/shape/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ const shaderDesc = {
vertexGLSL: /* glsl */`
attribute vec3 vertex_position;
attribute vec4 vertex_color;

varying vec4 vColor;

uniform mat4 matrix_model;
uniform mat4 matrix_viewProjection;

void main(void) {
gl_Position = matrix_viewProjection * matrix_model * vec4(vertex_position, 1.0);
gl_Position.z = clamp(gl_Position.z, -abs(gl_Position.w), abs(gl_Position.w));
Expand All @@ -57,11 +60,45 @@ const shaderDesc = {
`,
fragmentGLSL: /* glsl */`
#include "gammaPS"

precision highp float;

varying vec4 vColor;

void main(void) {
gl_FragColor = vec4(gammaCorrectOutput(decodeGamma(vColor)), vColor.w);
}
`,
vertexWGSL: /* wgsl */`
attribute vertex_position: vec3f;
attribute vertex_color: vec4f;

uniform matrix_model: mat4x4f;
uniform matrix_viewProjection: mat4x4f;

varying vColor: vec4f;

@vertex
fn vertexMain(input: VertexInput) -> VertexOutput {
var output: VertexOutput;
output.vColor = input.vertex_color;
let pos = vec4f(input.vertex_position, 1.0);
output.position = uniform.matrix_viewProjection * uniform.matrix_model * pos;
output.position.z = clamp(output.position.z, -abs(output.position.w), abs(output.position.w));
return output;
}
`,
fragmentWGSL: /* wgsl */`
#include "gammaPS"

varying vColor: vec4f;

@fragment
fn fragmentMain(input: FragmentInput) -> FragmentOutput {
var output: FragmentOutput;
output.color = vec4f(gammaCorrectOutput(decodeGamma(input.vColor)), input.vColor.w);
return output;
}
`
};

Expand Down