init
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inNormal;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 l = normalize(vec3(0,-1,1));
|
||||
outColor = vec4(vec3(1,1,1) * dot(normalize(inNormal),l), 1);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,43 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec3 outNormal;
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outNormal = mat3(inverse(transpose(push.model))) * inNormal;
|
||||
gl_Position = ubo.proj_view * push.model * vec4(inPos, 1.0);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inColor;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = vec4(inColor, 1);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,43 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec3 outColor;
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = inNormal;
|
||||
gl_Position = ubo.proj_view * push.model * vec4(inPos, 1.0);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inColor;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = vec4(inColor, 1);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,43 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec3 outColor;
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = inPos;
|
||||
gl_Position = ubo.proj_view * push.model * vec4(inPos, 1.0);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inColor;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = vec4(inColor, 1);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,43 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec3 outColor;
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = vec3(inUV, 0);
|
||||
gl_Position = ubo.proj_view * push.model * vec4(inPos, 1.0);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,74 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023-2025 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) in VertexData
|
||||
{
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_in[3];
|
||||
|
||||
layout (location = 0) out VertexData
|
||||
{
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
//A,B,C -> B - A cross C - A
|
||||
//B - A
|
||||
vec3 AB = vertex_in[1].object_pos - vertex_in[0].object_pos;
|
||||
//C - A
|
||||
vec3 AC = vertex_in[2].object_pos - vertex_in[0].object_pos;
|
||||
vec3 normal = mat3(inverse(transpose(push.model))) * cross(AB, AC);
|
||||
|
||||
for(int i = 0; i < gl_in.length(); ++i)
|
||||
{
|
||||
gl_Position = gl_in[i].gl_Position;
|
||||
vertex_out.uv = vertex_in[i].uv;
|
||||
vertex_out.normal = normal;
|
||||
vertex_out.world_pos = vertex_in[i].world_pos;
|
||||
vertex_out.object_pos = vertex_in[i].object_pos;
|
||||
vertex_out.texture_index = vertex_in[i].texture_index;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColorMap;
|
||||
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) in VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_in;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 l = normalize(vec3(0,-1,1));
|
||||
vec4 texture_color = vec4(texture(samplerColorMap, vertex_in.uv));
|
||||
outColor = push.material_diffuse * texture_color * dot(normalize(vertex_in.normal),l) + 0.1f * texture_color;
|
||||
outColor += push.material_spec * vec4(vec3(1,1,1) * dot(normalize(vertex_in.normal),l), 1);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,50 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColorMap;
|
||||
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) in VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_in;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = vec4(normalize(vertex_in.normal) * 0.5 + 0.5,1);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,76 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023-2025 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) in VertexData
|
||||
{
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_in[3];
|
||||
|
||||
layout (location = 0) out VertexData
|
||||
{
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_out;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
float amplitude = 0.2f;
|
||||
float phase = 5.f;
|
||||
|
||||
for(int i = 0; i < gl_in.length(); ++i)
|
||||
{
|
||||
float sin_inside = abs(vertex_in[i].world_pos.x * vertex_in[i].world_pos.y * 2) + push.elapsed_time * phase;
|
||||
vec3 sin_offset = amplitude * vec3(sin(sin_inside), cos(sin_inside), 0);
|
||||
|
||||
vec4 position = vec4(vertex_in[i].world_pos + sin_offset, 1.f);
|
||||
gl_Position = ubo.proj_view * position;
|
||||
|
||||
vertex_out.uv = vertex_in[i].uv;
|
||||
vertex_out.normal = vertex_in[i].normal;
|
||||
vertex_out.world_pos = vertex_in[i].world_pos + sin_offset;
|
||||
vertex_out.object_pos = vertex_in[i].object_pos;
|
||||
vertex_out.texture_index = vertex_in[i].texture_index;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,67 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023-2025 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) in VertexData
|
||||
{
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_in[3];
|
||||
|
||||
layout (location = 0) out VertexData
|
||||
{
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
for(int i = 0; i < gl_in.length(); ++i)
|
||||
{
|
||||
gl_Position = gl_in[i].gl_Position;
|
||||
vertex_out.uv = vertex_in[i].uv;
|
||||
vertex_out.normal = vertex_in[i].normal;
|
||||
vertex_out.world_pos = vertex_in[i].world_pos;
|
||||
vertex_out.object_pos = vertex_in[i].object_pos;
|
||||
vertex_out.texture_index = vertex_in[i].texture_index;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColorMap;
|
||||
layout (binding = 2) uniform sampler2D skyboxMap;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) in VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_in;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
#define PI 3.1415926538
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 viewDir = normalize(push.camera_pos - vertex_in.world_pos);
|
||||
|
||||
vec3 reflectedDirection = normalize(reflect(viewDir, normalize(vertex_in.normal)));
|
||||
|
||||
float u = 0.5f + atan(reflectedDirection.z, reflectedDirection.x) / (2 * PI);
|
||||
float v = 0.5f + asin(reflectedDirection.y) / PI;
|
||||
|
||||
outColor = texture(skyboxMap, vec2(u, v));
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,55 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
float theta = push.elapsed_time * 0.1f;
|
||||
mat3 rotate = {{cos(theta),0,-sin(theta)},{0, 1, 0},{sin(theta), 0, cos(theta)}};
|
||||
vertex_out.uv = inUV;
|
||||
vertex_out.normal = mat3(inverse(transpose(push.model))) * inNormal;
|
||||
vertex_out.object_pos = inPos;
|
||||
vertex_out.world_pos = (push.model * vec4(rotate * inPos.xyz, 1.0f)).xyz;
|
||||
|
||||
gl_Position = ubo.proj_view * vec4(vertex_out.world_pos, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,49 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColorMap;
|
||||
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) in VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_in;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
outColor = vec4(texture(samplerColorMap, vertex_in.uv));
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,53 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
vertex_out.uv = inUV;
|
||||
vertex_out.normal = mat3(inverse(transpose(push.model))) * inNormal;
|
||||
vertex_out.object_pos = inPos;
|
||||
vertex_out.world_pos = (push.model * vec4(inPos.xyz, 1.0)).xyz;
|
||||
|
||||
gl_Position = ubo.proj_view * vec4(vertex_out.world_pos, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,49 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColorMap;
|
||||
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) in VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_in;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = texture(samplerColorMap, vertex_in.uv);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,57 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
vertex_out.uv = inUV;
|
||||
vertex_out.normal = mat3(inverse(transpose(push.model))) * inNormal;
|
||||
vertex_out.object_pos = inPos;
|
||||
vertex_out.world_pos = (push.model * vec4(inPos.xyz, 1.0)).xyz;
|
||||
|
||||
float amplitude = 0.5f;
|
||||
float phase = 2.0f;
|
||||
|
||||
vertex_out.world_pos.x += amplitude * sin(vertex_out.world_pos.x + vertex_out.world_pos.z + push.elapsed_time * phase);
|
||||
gl_Position = ubo.proj_view * vec4(vertex_out.world_pos, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,57 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
vertex_out.uv = inUV;
|
||||
vertex_out.normal = mat3(inverse(transpose(push.model))) * inNormal;
|
||||
vertex_out.object_pos = inPos;
|
||||
vertex_out.world_pos = (push.model * vec4(inPos.xyz, 1.0)).xyz;
|
||||
|
||||
float amplitude = 0.5f;
|
||||
float phase = 2.0f;
|
||||
|
||||
vertex_out.world_pos.y += amplitude * sin(vertex_out.world_pos.x + vertex_out.world_pos.z + push.elapsed_time * phase);
|
||||
gl_Position = ubo.proj_view * vec4(vertex_out.world_pos, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,57 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
vec3 camera_pos;
|
||||
float elapsed_time;
|
||||
float material_diffuse;
|
||||
float material_spec;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out VertexData {
|
||||
vec2 uv;
|
||||
vec3 normal;
|
||||
vec3 world_pos;
|
||||
vec3 object_pos;
|
||||
flat uint texture_index;
|
||||
} vertex_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
vertex_out.uv = inUV;
|
||||
vertex_out.normal = mat3(inverse(transpose(push.model))) * inNormal;
|
||||
vertex_out.object_pos = inPos;
|
||||
vertex_out.world_pos = (push.model * vec4(inPos.xyz, 1.0)).xyz;
|
||||
|
||||
float amplitude = 0.5f;
|
||||
float phase = 2.0f;
|
||||
|
||||
vertex_out.world_pos.z += amplitude * sin(vertex_out.world_pos.x + vertex_out.world_pos.z + push.elapsed_time * phase);
|
||||
gl_Position = ubo.proj_view * vec4(vertex_out.world_pos, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,38 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const vec2[3] positions = vec2[]
|
||||
(
|
||||
vec2(-1, -1),
|
||||
vec2(-1, 3),
|
||||
vec2( 3, -1)
|
||||
);
|
||||
|
||||
const vec2[3] uv = vec2[]
|
||||
(
|
||||
vec2(0, 0),
|
||||
vec2(0, 2),
|
||||
vec2(2, 0)
|
||||
);
|
||||
|
||||
layout (location = 0) out vec2 outUV;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(positions[gl_VertexIndex], 0.0f, 1.0f);
|
||||
outUV = uv[gl_VertexIndex];
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,27 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D samplerColorMap;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = texture(samplerColorMap, inUV).rgb;
|
||||
outColor = vec4(texture(samplerColorMap, inUV).rgb * 1.2f, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,69 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D samplerColorMap;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
float elapsed_time;
|
||||
} push;
|
||||
|
||||
//Based on HSV to RGB in https://en.wikipedia.org/wiki/HSL_and_HSV
|
||||
vec3 rgb_from_hsv(float hue, float sat, float value)
|
||||
{
|
||||
float h_prime = hue / 60.0f;
|
||||
float c = value * sat;
|
||||
float x = c * (1 - abs(mod(h_prime, 2) - 1));
|
||||
|
||||
vec3 rgb;
|
||||
if(h_prime < 1)
|
||||
{
|
||||
rgb = vec3(c, x, 0);
|
||||
}
|
||||
else if(h_prime < 2)
|
||||
{
|
||||
rgb = vec3(x, c, 0);
|
||||
}
|
||||
else if(h_prime < 3)
|
||||
{
|
||||
rgb = vec3(0, c, x);
|
||||
}
|
||||
else if(h_prime < 4)
|
||||
{
|
||||
rgb = vec3(0, x, c);
|
||||
}
|
||||
else if(h_prime < 5)
|
||||
{
|
||||
rgb = vec3(x, 0, c);
|
||||
}
|
||||
else if(h_prime < 6)
|
||||
{
|
||||
rgb = vec3(c, 0, x);
|
||||
}
|
||||
|
||||
return rgb + vec3(value - c);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = texture(samplerColorMap, inUV).rgb;
|
||||
float time_scale = 0.1f;
|
||||
outColor = vec4(color * rgb_from_hsv(mod(push.elapsed_time * 60.f, 360.f), 1.f, 1.f), 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,39 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D samplerColorMap;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = vec3(0);
|
||||
float weights[9] = {0,1,0,1,-4,1,0,1,0 };
|
||||
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2(-1, 1)).rgb * weights[0];
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2( 0, 1)).rgb * weights[1];
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2( 1, 1)).rgb * weights[2];
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2(-1, 0)).rgb * weights[3];
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2( 0, 0)).rgb * weights[4];
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2( 1, 0)).rgb * weights[5];
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2(-1,-1)).rgb * weights[6];
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2( 0,-1)).rgb * weights[7];
|
||||
color += textureOffset(samplerColorMap, inUV, ivec2( 1,-1)).rgb * weights[8];
|
||||
|
||||
outColor = vec4(color * 2.0f, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,27 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D samplerColorMap;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = texture(samplerColorMap, inUV).rgb;
|
||||
outColor = vec4(vec3(color.r + color.g + color.b) / 3.0f, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,27 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D samplerColorMap;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = texture(samplerColorMap, inUV).rgb;
|
||||
outColor = vec4(vec3(1.0f) - color, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (set = 0, binding = 0) uniform sampler2D samplerColorMap;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = texture(samplerColorMap, inUV).rgb;
|
||||
vec3 colorQuant = floor(color * 4) / 4.0f;
|
||||
outColor = vec4(colorQuant, 1.0f);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"skybox":
|
||||
{
|
||||
"vert":"skybox.vert.spv",
|
||||
"frag":"skybox.frag.spv"
|
||||
},
|
||||
"terrain":
|
||||
{
|
||||
"vert":"terrain.vert.spv",
|
||||
"frag":"terrain.frag.spv"
|
||||
},
|
||||
"basic":
|
||||
{
|
||||
"normals":
|
||||
{
|
||||
"vert":"basic_normals.vert.spv",
|
||||
"frag":"basic_normals.frag.spv"
|
||||
},
|
||||
"positions":
|
||||
{
|
||||
"vert":"basic_pos.vert.spv",
|
||||
"frag":"basic_pos.frag.spv"
|
||||
},
|
||||
"tex coords":
|
||||
{
|
||||
"vert":"basic_uv.vert.spv",
|
||||
"frag":"basic_uv.frag.spv"
|
||||
},
|
||||
"simple n dot l":
|
||||
{
|
||||
"vert":"basic_n_dot_l.vert.spv",
|
||||
"frag":"basic_n_dot_l.frag.spv"
|
||||
}
|
||||
},
|
||||
"post_process":
|
||||
{
|
||||
"vert":"post_process_FSQ.vert.spv",
|
||||
"frag":
|
||||
[
|
||||
"post_process_brighten.frag.spv",
|
||||
"post_process_invert.frag.spv",
|
||||
"post_process_grayscale.frag.spv",
|
||||
"post_process_quantize.frag.spv",
|
||||
"post_process_edge_detection.frag.spv",
|
||||
"post_process_color_cycle.frag.spv"
|
||||
]
|
||||
},
|
||||
"material":
|
||||
{
|
||||
"vert":
|
||||
[
|
||||
"material_scene.vert.spv",
|
||||
"material_rotates.vert.spv",
|
||||
"material_wave_x.vert.spv",
|
||||
"material_wave_y.vert.spv",
|
||||
"material_wave_z.vert.spv"
|
||||
],
|
||||
"geo":
|
||||
[
|
||||
"material_pass_through.geom.spv",
|
||||
"material_pass_sin_offset.geom.spv",
|
||||
"material_gen_normals.geom.spv"
|
||||
],
|
||||
"frag":
|
||||
[
|
||||
"material_normals.frag.spv",
|
||||
"material_texture.frag.spv",
|
||||
"material_reflective.frag.spv",
|
||||
"material_n_dot_l.frag.spv"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerEnvMap;
|
||||
|
||||
layout (location = 0) in vec3 inUVWorldPos;
|
||||
layout (location = 1) in vec3 inPos;
|
||||
layout (location = 2) in vec3 inNormal;
|
||||
|
||||
layout (location = 0) out vec4 outColor0;
|
||||
|
||||
layout (constant_id = 0) const int type = 0;
|
||||
|
||||
#define PI 3.1415926
|
||||
#define TwoPI (2.0 * PI)
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor0.rgb = texture(samplerEnvMap, vec2(inUVWorldPos.x, -inUVWorldPos.y)).rgb;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,50 @@
|
||||
#version 450
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out vec3 outUVWorldPos;
|
||||
layout (location = 1) out vec3 outPos;
|
||||
layout (location = 2) out vec3 outNormal;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outUVWorldPos = vec3(inUV,0.f);
|
||||
|
||||
outPos = vec3(mat3(ubo.view * push.model) * inPos);
|
||||
gl_Position = vec4(ubo.projection * vec4(outPos, 1.0));
|
||||
|
||||
outNormal = mat3(push.model * ubo.view) * inNormal;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,75 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (binding = 2) uniform sampler2D samplerHeight;
|
||||
layout (binding = 3) uniform sampler2DArray samplerLayers;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
layout (location = 0) in TerrainVertexData {
|
||||
vec2 uv;
|
||||
vec3 pos;
|
||||
vec3 normal;
|
||||
} vertex_in;
|
||||
|
||||
vec3 sampleTerrainLayer()
|
||||
{
|
||||
// Define some layer ranges for sampling depending on terrain height
|
||||
vec2 layers[6];
|
||||
layers[0] = vec2(-10.0, 10.0);
|
||||
layers[1] = vec2(5.0, 45.0);
|
||||
layers[2] = vec2(45.0, 80.0);
|
||||
layers[3] = vec2(75.0, 100.0);
|
||||
layers[4] = vec2(95.0, 150.0);
|
||||
layers[5] = vec2(140.0, 290.0);
|
||||
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
// Get height from displacement map
|
||||
float height = 255.0f - vertex_in.pos.y;//textureLod(samplerHeight, vertex_in.uv, 0.0).r * 255.0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
float range = layers[i].y - layers[i].x;
|
||||
float weight = (range - abs(height - layers[i].y)) / range;
|
||||
weight = max(0.0, weight);
|
||||
color += weight * texture(samplerLayers, vec3(vertex_in.uv * 16.0, i)).rgb;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
float fog(float density)
|
||||
{
|
||||
const float LOG2 = -1.442695;
|
||||
float dist = gl_FragCoord.z / gl_FragCoord.w * 0.1;
|
||||
float d = density * dist;
|
||||
return 1.0 - clamp(exp2(d * d * LOG2), 0.0, 1.0);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 N = normalize(vertex_in.normal);
|
||||
vec3 L = normalize(vec3(0,-1,1));
|
||||
vec3 ambient = vec3(0.5);
|
||||
vec3 diffuse = max(dot(N, L), 0.0) * vec3(1.0);
|
||||
|
||||
vec4 color = vec4((ambient + diffuse) * sampleTerrainLayer(), 1.0);
|
||||
|
||||
const vec4 fogColor = vec4(0.47, 0.5, 0.67, 0.0);
|
||||
outColor = mix(color, fogColor, fog(0.25));
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,47 @@
|
||||
#version 460
|
||||
/*
|
||||
* Copyright 2023 Nintendo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
layout (binding = 2) uniform sampler2D samplerHeight;
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO {
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 proj_view;
|
||||
} ubo;
|
||||
|
||||
layout(push_constant) uniform pushConstants
|
||||
{
|
||||
mat4 model;
|
||||
} push;
|
||||
|
||||
layout (location = 0) out TerrainVertexData {
|
||||
vec2 uv;
|
||||
vec3 pos;
|
||||
vec3 normal;
|
||||
} vertex_out;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vertex_out.uv = inUV;
|
||||
vertex_out.normal = inNormal;
|
||||
vertex_out.pos = vec3(inPos.x, textureLod(samplerHeight, inUV, 0.0).r * 256.0f, inPos.z);
|
||||
gl_Position = ubo.proj_view * push.model * vec4(vertex_out.pos, 1.0);
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user