Skip to content

Commit

Permalink
Fixed missing unlit material
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Feb 9, 2025
1 parent 9d258d1 commit 61f2adf
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 5 deletions.
8 changes: 4 additions & 4 deletions movement_look_rotation/example/look_rotation.collection
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ embedded_instances {
"name: \\\"{{NAME}}\\\"\\n"
"materials {\\n"
" name: \\\"colormap\\\"\\n"
" material: \\\"/examples/material/unlit/unlit.material\\\"\\n"
" material: \\\"/example/unlit.material\\\"\\n"
" textures {\\n"
" sampler: \\\"texture0\\\"\\n"
" texture: \\\"/assets/models/kenney_prototype-kit/Textures/colormap.png\\\"\\n"
Expand All @@ -62,7 +62,7 @@ embedded_instances {
"name: \\\"{{NAME}}\\\"\\n"
"materials {\\n"
" name: \\\"colormap\\\"\\n"
" material: \\\"/examples/material/unlit/unlit.material\\\"\\n"
" material: \\\"/example/unlit.material\\\"\\n"
" textures {\\n"
" sampler: \\\"texture0\\\"\\n"
" texture: \\\"/assets/models/kenney_prototype-kit/Textures/colormap.png\\\"\\n"
Expand Down Expand Up @@ -98,7 +98,7 @@ embedded_instances {
"name: \\\"{{NAME}}\\\"\\n"
"materials {\\n"
" name: \\\"colormap\\\"\\n"
" material: \\\"/examples/material/unlit/unlit.material\\\"\\n"
" material: \\\"/example/unlit.material\\\"\\n"
" textures {\\n"
" sampler: \\\"texture0\\\"\\n"
" texture: \\\"/assets/models/kenney_prototype-kit/Textures/colormap.png\\\"\\n"
Expand Down Expand Up @@ -134,7 +134,7 @@ embedded_instances {
"name: \\\"{{NAME}}\\\"\\n"
"materials {\\n"
" name: \\\"colormap\\\"\\n"
" material: \\\"/examples/material/unlit/unlit.material\\\"\\n"
" material: \\\"/example/unlit.material\\\"\\n"
" textures {\\n"
" sampler: \\\"texture0\\\"\\n"
" texture: \\\"/assets/models/kenney_prototype-kit/Textures/colormap.png\\\"\\n"
Expand Down
19 changes: 19 additions & 0 deletions movement_look_rotation/example/unlit.fp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#version 140

// Inputs should match the vertex shader's outputs.
in vec2 var_texcoord0;

// The texture to sample.
uniform lowp sampler2D texture0;

// The final color of the fragment.
out lowp vec4 final_color;

void main()
{
// Sample the texture at the fragment's texture coordinates.
vec4 color = texture(texture0, var_texcoord0.xy);

// Output the sampled color.
final_color = color;
}
25 changes: 25 additions & 0 deletions movement_look_rotation/example/unlit.material
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "unlit"
tags: "model"
vertex_program: "/example/unlit.vp"
fragment_program: "/example/unlit.fp"
vertex_space: VERTEX_SPACE_LOCAL
vertex_constants {
name: "mtx_world"
type: CONSTANT_TYPE_WORLD
}
vertex_constants {
name: "mtx_view"
type: CONSTANT_TYPE_VIEW
}
vertex_constants {
name: "mtx_proj"
type: CONSTANT_TYPE_PROJECTION
}
samplers {
name: "texture0"
wrap_u: WRAP_MODE_CLAMP_TO_EDGE
wrap_v: WRAP_MODE_CLAMP_TO_EDGE
filter_min: FILTER_MODE_MIN_LINEAR
filter_mag: FILTER_MODE_MAG_LINEAR
max_anisotropy: 0.0
}
26 changes: 26 additions & 0 deletions movement_look_rotation/example/unlit.vp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#version 140

// The model's vertex position and texture coordinates.
in vec4 position;
in vec2 texcoord0;

// The projection, view and world matrices.
uniform general_vp
{
mat4 mtx_world;
mat4 mtx_view;
mat4 mtx_proj;
};

// The output of a vertex shader are passed to the fragment shader.
// The texture coordinates of the vertex.
out vec2 var_texcoord0;

void main()
{
// Pass the texture coordinates to the fragment shader.
var_texcoord0 = texcoord0;

// Transform the vertex position to clip space.
gl_Position = mtx_proj * mtx_view * mtx_world * vec4(position.xyz, 1.0);
}
2 changes: 1 addition & 1 deletion render_orbit_camera/example/orbit_camera.collection
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ embedded_instances {
"name: \\\"{{NAME}}\\\"\\n"
"materials {\\n"
" name: \\\"colormap\\\"\\n"
" material: \\\"/examples/material/unlit/unlit.material\\\"\\n"
" material: \\\"/example/unlit.material\\\"\\n"
" textures {\\n"
" sampler: \\\"texture0\\\"\\n"
" texture: \\\"/assets/models/kenney_prototype-kit/Textures/colormap.png\\\"\\n"
Expand Down
19 changes: 19 additions & 0 deletions render_orbit_camera/example/unlit.fp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#version 140

// Inputs should match the vertex shader's outputs.
in vec2 var_texcoord0;

// The texture to sample.
uniform lowp sampler2D texture0;

// The final color of the fragment.
out lowp vec4 final_color;

void main()
{
// Sample the texture at the fragment's texture coordinates.
vec4 color = texture(texture0, var_texcoord0.xy);

// Output the sampled color.
final_color = color;
}
25 changes: 25 additions & 0 deletions render_orbit_camera/example/unlit.material
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "unlit"
tags: "model"
vertex_program: "/example/unlit.vp"
fragment_program: "/example/unlit.fp"
vertex_space: VERTEX_SPACE_LOCAL
vertex_constants {
name: "mtx_world"
type: CONSTANT_TYPE_WORLD
}
vertex_constants {
name: "mtx_view"
type: CONSTANT_TYPE_VIEW
}
vertex_constants {
name: "mtx_proj"
type: CONSTANT_TYPE_PROJECTION
}
samplers {
name: "texture0"
wrap_u: WRAP_MODE_CLAMP_TO_EDGE
wrap_v: WRAP_MODE_CLAMP_TO_EDGE
filter_min: FILTER_MODE_MIN_LINEAR
filter_mag: FILTER_MODE_MAG_LINEAR
max_anisotropy: 0.0
}
26 changes: 26 additions & 0 deletions render_orbit_camera/example/unlit.vp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#version 140

// The model's vertex position and texture coordinates.
in vec4 position;
in vec2 texcoord0;

// The projection, view and world matrices.
uniform general_vp
{
mat4 mtx_world;
mat4 mtx_view;
mat4 mtx_proj;
};

// The output of a vertex shader are passed to the fragment shader.
// The texture coordinates of the vertex.
out vec2 var_texcoord0;

void main()
{
// Pass the texture coordinates to the fragment shader.
var_texcoord0 = texcoord0;

// Transform the vertex position to clip space.
gl_Position = mtx_proj * mtx_view * mtx_world * vec4(position.xyz, 1.0);
}

0 comments on commit 61f2adf

Please sign in to comment.