1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

sokol: update sokol_gfx.h to the LAST version, and fix example 06 (#13100)

This commit is contained in:
penguindark
2022-01-08 19:29:29 +01:00
committed by GitHub
parent 64c8fb061d
commit 22fce6a525
5 changed files with 311 additions and 52 deletions

View File

@@ -10,11 +10,11 @@ uniform vs_params {
in vec4 a_Position; // Per-vertex position information we will pass in.
in vec3 a_Normal; // Per-vertex normal information we will pass in.
in vec4 a_Color; // Per-vertex color information we will pass in.
//in vec4 a_Color; // Per-vertex color information we will pass in.
in vec2 a_Texcoord0;
out vec3 v_Position; // This will be passed into the fragment shader.
out vec4 v_Color; // This will be passed into the fragment shader.
//out vec4 v_Color; // This will be passed into the fragment shader.
out vec3 v_Normal; // This will be passed into the fragment shader.
out vec3 v_Normal1;
out vec2 uv; // This will be passed into the fragment shader.
@@ -25,7 +25,7 @@ void main()
// Transform the vertex into eye space.
v_Position = vec3(u_MVMatrix * a_Position);
// Pass through the color.
v_Color = a_Color;
//v_Color = a_Color;
// calc eye space normal
v_Normal = vec3(u_NMatrix * vec4(a_Normal, 1.0));
// texture coord
@@ -51,7 +51,7 @@ uniform fs_params {
};
in vec3 v_Position; // Interpolated position for this fragment.
in vec4 v_Color; // This is the color from the vertex shader interpolated across the triangle per fragment.
//in vec4 v_Color; // This is the color from the vertex shader interpolated across the triangle per fragment.
in vec3 v_Normal; // Interpolated normal for this fragment.
in vec3 v_Normal1;
in vec2 uv;

View File

@@ -106,7 +106,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader,
// the constants [C.ATTR_vs_a_Position, C.ATTR_vs_a_Color, C.ATTR_vs_a_Texcoord0] are generated by sokol-shdc
pipdesc.layout.attrs[C.ATTR_vs_a_Position].format = .float3 // x,y,z as f32
pipdesc.layout.attrs[C.ATTR_vs_a_Normal].format = .float3 // x,y,z as f32
pipdesc.layout.attrs[C.ATTR_vs_a_Color].format = .ubyte4n // color as u32
// pipdesc.layout.attrs[C.ATTR_vs_a_Color].format = .ubyte4n // color as u32
pipdesc.layout.attrs[C.ATTR_vs_a_Texcoord0].format = .float2 // u,v as f32
// pipdesc.layout.attrs[C.ATTR_vs_a_Texcoord0].format = .short2n // u,v as u16
pipdesc.index_type = .uint32