Remove textures
|
|
@ -8,7 +8,7 @@ WINDOW_TITLE :: "ECS Test"
|
||||||
// Behaviour
|
// Behaviour
|
||||||
SPAWN_INTERVAL :: 0.2 // in seconds
|
SPAWN_INTERVAL :: 0.2 // in seconds
|
||||||
GRAVITY_CONSTANT :: -2.5
|
GRAVITY_CONSTANT :: -2.5
|
||||||
SPAWN_AREA :: 50 // one side
|
SPAWN_AREA :: 30 // one side
|
||||||
Y_DESPAWN_CUTOFF :: -15
|
Y_DESPAWN_CUTOFF :: -15
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
|
|
@ -25,4 +25,4 @@ BORDER_COLOR :: [4]f32{ 0, 0, 0, 1 }
|
||||||
// User
|
// User
|
||||||
MOVEMENT_SPEED :: 3.0
|
MOVEMENT_SPEED :: 3.0
|
||||||
LOOK_SENSITIVITY :: 0.15
|
LOOK_SENSITIVITY :: 0.15
|
||||||
START_POSITION :: [3]f32{ 30, 0, 60 }
|
START_POSITION :: [3]f32{ 15, 0, 60 }
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,12 @@ import program_config "../config"
|
||||||
|
|
||||||
import shaders "../shaders/out"
|
import shaders "../shaders/out"
|
||||||
|
|
||||||
VertexData :: struct {
|
CubeVertexData :: struct {
|
||||||
|
pos: Vec3,
|
||||||
|
}
|
||||||
|
|
||||||
|
OutlineVertexData :: struct {
|
||||||
pos: Vec3,
|
pos: Vec3,
|
||||||
uv: Vec2,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh :: struct {
|
Mesh :: struct {
|
||||||
|
|
@ -37,8 +40,6 @@ Mesh :: struct {
|
||||||
Material :: struct {
|
Material :: struct {
|
||||||
pipeline: sg.Pipeline,
|
pipeline: sg.Pipeline,
|
||||||
shader: sg.Shader,
|
shader: sg.Shader,
|
||||||
image: sg.Image,
|
|
||||||
sampler: sg.Sampler,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem :: struct {
|
RenderSystem :: struct {
|
||||||
|
|
@ -57,7 +58,6 @@ init_outline_material :: proc(render_system: ^RenderSystem) {
|
||||||
layout = {
|
layout = {
|
||||||
attrs = {
|
attrs = {
|
||||||
shaders.ATTR_outline_pos = { format = .FLOAT3 },
|
shaders.ATTR_outline_pos = { format = .FLOAT3 },
|
||||||
shaders.ATTR_outline_uv = { format = .FLOAT2 },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
index_type = .UINT16,
|
index_type = .UINT16,
|
||||||
|
|
@ -73,12 +73,9 @@ init_outline_material :: proc(render_system: ^RenderSystem) {
|
||||||
sample_count = 4,
|
sample_count = 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
sampler := sg.make_sampler({})
|
|
||||||
|
|
||||||
render_system.materials[.Outline] = Material{
|
render_system.materials[.Outline] = Material{
|
||||||
shader = shader,
|
shader = shader,
|
||||||
pipeline = pipeline,
|
pipeline = pipeline,
|
||||||
sampler = sampler,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,7 +87,6 @@ init_cube_material :: proc(render_system: ^RenderSystem) {
|
||||||
layout = {
|
layout = {
|
||||||
attrs = {
|
attrs = {
|
||||||
shaders.ATTR_cube_pos = { format = .FLOAT3 },
|
shaders.ATTR_cube_pos = { format = .FLOAT3 },
|
||||||
shaders.ATTR_cube_uv = { format = .FLOAT2 },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
index_type = .UINT16,
|
index_type = .UINT16,
|
||||||
|
|
@ -106,69 +102,44 @@ init_cube_material :: proc(render_system: ^RenderSystem) {
|
||||||
sample_count = 4,
|
sample_count = 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
w, h: i32
|
|
||||||
pixels := stbi.load("res/white.png", &w, &h, nil, 4)
|
|
||||||
assert(pixels != nil)
|
|
||||||
defer(stbi.image_free(pixels))
|
|
||||||
|
|
||||||
image := sg.make_image({
|
|
||||||
width = w,
|
|
||||||
height = h,
|
|
||||||
pixel_format = .RGBA8,
|
|
||||||
data = {
|
|
||||||
subimage = {
|
|
||||||
0 = {
|
|
||||||
0 = {
|
|
||||||
ptr = pixels,
|
|
||||||
size = uint(w * h * 4)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
sampler := sg.make_sampler({})
|
|
||||||
|
|
||||||
render_system.materials[.Cube] = Material{
|
render_system.materials[.Cube] = Material{
|
||||||
shader = shader,
|
shader = shader,
|
||||||
pipeline = pipeline,
|
pipeline = pipeline,
|
||||||
image = image,
|
|
||||||
sampler = sampler,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
init_cube_mesh :: proc (render_system: ^RenderSystem) {
|
init_cube_mesh :: proc (render_system: ^RenderSystem) {
|
||||||
cube_vertices := []VertexData {
|
cube_vertices := []CubeVertexData {
|
||||||
{ pos = { -0.5, -0.5, 0.5 }, uv = { 0, 0 } },
|
{ pos = { -0.5, -0.5, 0.5 } },
|
||||||
{ pos = { 0.5, -0.5, 0.5 }, uv = { 1, 0 } },
|
{ pos = { 0.5, -0.5, 0.5 } },
|
||||||
{ pos = { 0.5, 0.5, 0.5 }, uv = { 1, 1 } },
|
{ pos = { 0.5, 0.5, 0.5 } },
|
||||||
{ pos = { -0.5, 0.5, 0.5 }, uv = { 0, 1 } },
|
{ pos = { -0.5, 0.5, 0.5 } },
|
||||||
|
|
||||||
{ pos = { -0.5, -0.5, -0.5 }, uv = { 1, 0 } },
|
{ pos = { -0.5, -0.5, -0.5 } },
|
||||||
{ pos = { 0.5, -0.5, -0.5 }, uv = { 0, 0 } },
|
{ pos = { 0.5, -0.5, -0.5 } },
|
||||||
{ pos = { 0.5, 0.5, -0.5 }, uv = { 0, 1 } },
|
{ pos = { 0.5, 0.5, -0.5 } },
|
||||||
{ pos = { -0.5, 0.5, -0.5 }, uv = { 1, 1 } },
|
{ pos = { -0.5, 0.5, -0.5 } },
|
||||||
|
|
||||||
{ pos = { -0.5, 0.5, 0.5 }, uv = { 0, 0 } },
|
{ pos = { -0.5, 0.5, 0.5 } },
|
||||||
{ pos = { 0.5, 0.5, 0.5 }, uv = { 1, 0 } },
|
{ pos = { 0.5, 0.5, 0.5 } },
|
||||||
{ pos = { 0.5, 0.5, -0.5 }, uv = { 1, 1 } },
|
{ pos = { 0.5, 0.5, -0.5 } },
|
||||||
{ pos = { -0.5, 0.5, -0.5 }, uv = { 0, 1 } },
|
{ pos = { -0.5, 0.5, -0.5 } },
|
||||||
|
|
||||||
{ pos = { -0.5, -0.5, 0.5 }, uv = { 0, 0 } },
|
{ pos = { -0.5, -0.5, 0.5 } },
|
||||||
{ pos = { 0.5, -0.5, 0.5 }, uv = { 1, 0 } },
|
{ pos = { 0.5, -0.5, 0.5 } },
|
||||||
{ pos = { 0.5, -0.5, -0.5 }, uv = { 1, 1 } },
|
{ pos = { 0.5, -0.5, -0.5 } },
|
||||||
{ pos = { -0.5, -0.5, -0.5 }, uv = { 0, 1 } },
|
{ pos = { -0.5, -0.5, -0.5 } },
|
||||||
|
|
||||||
{ pos = { 0.5, -0.5, 0.5 }, uv = { 0, 0 } },
|
{ pos = { 0.5, -0.5, 0.5 } },
|
||||||
{ pos = { 0.5, -0.5, -0.5 }, uv = { 1, 0 } },
|
{ pos = { 0.5, -0.5, -0.5 } },
|
||||||
{ pos = { 0.5, 0.5, -0.5 }, uv = { 1, 1 } },
|
{ pos = { 0.5, 0.5, -0.5 } },
|
||||||
{ pos = { 0.5, 0.5, 0.5 }, uv = { 0, 1 } },
|
{ pos = { 0.5, 0.5, 0.5 } },
|
||||||
|
|
||||||
{ pos = { -0.5, -0.5, 0.5 }, uv = { 1, 0 } },
|
{ pos = { -0.5, -0.5, 0.5 } },
|
||||||
{ pos = { -0.5, -0.5, -0.5 }, uv = { 0, 0 } },
|
{ pos = { -0.5, -0.5, -0.5 } },
|
||||||
{ pos = { -0.5, 0.5, -0.5 }, uv = { 0, 1 } },
|
{ pos = { -0.5, 0.5, -0.5 } },
|
||||||
{ pos = { -0.5, 0.5, 0.5 }, uv = { 1, 1 } },
|
{ pos = { -0.5, 0.5, 0.5 } },
|
||||||
}
|
}
|
||||||
vertex_buffer := sg.make_buffer({
|
vertex_buffer := sg.make_buffer({
|
||||||
data = sg_range(cube_vertices)
|
data = sg_range(cube_vertices)
|
||||||
|
|
@ -225,13 +196,10 @@ render_system_delete :: proc(render_system: ^RenderSystem, coordinator: ^Coordin
|
||||||
sg.destroy_buffer(cube_mesh.vertex_buffer)
|
sg.destroy_buffer(cube_mesh.vertex_buffer)
|
||||||
|
|
||||||
cube_material := render_system.materials[.Cube]
|
cube_material := render_system.materials[.Cube]
|
||||||
sg.destroy_image(cube_material.image)
|
|
||||||
sg.destroy_sampler(cube_material.sampler)
|
|
||||||
sg.destroy_pipeline(cube_material.pipeline)
|
sg.destroy_pipeline(cube_material.pipeline)
|
||||||
sg.destroy_shader(cube_material.shader)
|
sg.destroy_shader(cube_material.shader)
|
||||||
|
|
||||||
outline_material := render_system.materials[.Outline]
|
outline_material := render_system.materials[.Outline]
|
||||||
sg.destroy_sampler(outline_material.sampler)
|
|
||||||
sg.destroy_pipeline(outline_material.pipeline)
|
sg.destroy_pipeline(outline_material.pipeline)
|
||||||
sg.destroy_shader(outline_material.shader)
|
sg.destroy_shader(outline_material.shader)
|
||||||
|
|
||||||
|
|
@ -313,9 +281,6 @@ cube_pass :: proc(render_system: ^RenderSystem, coordinator: ^Coordinator, proj:
|
||||||
|
|
||||||
sg.apply_pipeline(material.pipeline)
|
sg.apply_pipeline(material.pipeline)
|
||||||
sg.apply_bindings({
|
sg.apply_bindings({
|
||||||
images = { shaders.IMG_tex = material.image },
|
|
||||||
samplers = { shaders.SMP_smp = material.sampler },
|
|
||||||
|
|
||||||
vertex_buffers = { 0 = mesh.vertex_buffer },
|
vertex_buffers = { 0 = mesh.vertex_buffer },
|
||||||
index_buffer = mesh.index_buffer,
|
index_buffer = mesh.index_buffer,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 165 B |
BIN
res/white.png
|
Before Width: | Height: | Size: 105 B |
|
|
@ -16,25 +16,13 @@ import sg "../../sokol/gfx"
|
||||||
Fragment Shader: fs_cube
|
Fragment Shader: fs_cube
|
||||||
Attributes:
|
Attributes:
|
||||||
ATTR_cube_pos => 0
|
ATTR_cube_pos => 0
|
||||||
ATTR_cube_uv => 1
|
|
||||||
Bindings:
|
Bindings:
|
||||||
Uniform block 'VsParamsCube':
|
Uniform block 'VsParamsCube':
|
||||||
Odin struct: Vsparamscube
|
Odin struct: Vsparamscube
|
||||||
Bind slot: UB_VsParamsCube => 0
|
Bind slot: UB_VsParamsCube => 0
|
||||||
Image 'tex':
|
|
||||||
Image type: ._2D
|
|
||||||
Sample type: .FLOAT
|
|
||||||
Multisampled: false
|
|
||||||
Bind slot: IMG_tex => 0
|
|
||||||
Sampler 'smp':
|
|
||||||
Type: .FILTERING
|
|
||||||
Bind slot: SMP_smp => 0
|
|
||||||
*/
|
*/
|
||||||
ATTR_cube_pos :: 0
|
ATTR_cube_pos :: 0
|
||||||
ATTR_cube_uv :: 1
|
|
||||||
UB_VsParamsCube :: 0
|
UB_VsParamsCube :: 0
|
||||||
IMG_tex :: 0
|
|
||||||
SMP_smp :: 0
|
|
||||||
Vsparamscube :: struct #align(16) {
|
Vsparamscube :: struct #align(16) {
|
||||||
using _: struct #packed {
|
using _: struct #packed {
|
||||||
mvp: Mat4,
|
mvp: Mat4,
|
||||||
|
|
@ -56,14 +44,12 @@ Vsparamscube :: struct #align(16) {
|
||||||
struct main0_out
|
struct main0_out
|
||||||
{
|
{
|
||||||
float4 color [[user(locn0)]];
|
float4 color [[user(locn0)]];
|
||||||
float2 tex_coord [[user(locn1)]];
|
|
||||||
float4 gl_Position [[position]];
|
float4 gl_Position [[position]];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct main0_in
|
struct main0_in
|
||||||
{
|
{
|
||||||
float3 pos [[attribute(0)]];
|
float3 pos [[attribute(0)]];
|
||||||
float2 uv [[attribute(1)]];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
vertex main0_out main0(main0_in in [[stage_in]], constant VsParamsCube& _19 [[buffer(0)]])
|
vertex main0_out main0(main0_in in [[stage_in]], constant VsParamsCube& _19 [[buffer(0)]])
|
||||||
|
|
@ -71,13 +57,12 @@ Vsparamscube :: struct #align(16) {
|
||||||
main0_out out = {};
|
main0_out out = {};
|
||||||
out.gl_Position = _19.mvp * float4(in.pos, 1.0);
|
out.gl_Position = _19.mvp * float4(in.pos, 1.0);
|
||||||
out.color = _19.col;
|
out.color = _19.col;
|
||||||
out.tex_coord = in.uv;
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@(private="file")
|
@(private="file")
|
||||||
vs_cube_source_metal_macos := [593]u8 {
|
vs_cube_source_metal_macos := [496]u8 {
|
||||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||||
|
|
@ -90,32 +75,26 @@ vs_cube_source_metal_macos := [593]u8 {
|
||||||
0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||||
0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,
|
0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,
|
||||||
0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
||||||
0x61,0x74,0x32,0x20,0x74,0x65,0x78,0x5f,0x63,0x6f,0x6f,0x72,0x64,0x20,0x5b,0x5b,
|
0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
|
||||||
0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,
|
0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,
|
||||||
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,
|
0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,
|
||||||
0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,
|
||||||
0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,
|
||||||
0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,
|
||||||
0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,
|
0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,
|
||||||
0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,
|
||||||
0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,
|
0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,
|
||||||
0x62,0x75,0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,
|
0x6e,0x74,0x20,0x56,0x73,0x50,0x61,0x72,0x61,0x6d,0x73,0x43,0x75,0x62,0x65,0x26,
|
||||||
0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,
|
0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,
|
||||||
0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,
|
0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||||
0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,
|
0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,
|
||||||
0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x56,0x73,0x50,0x61,0x72,0x61,0x6d,
|
0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||||
0x73,0x43,0x75,0x62,0x65,0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,
|
0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,
|
||||||
0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,
|
||||||
0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,
|
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,
|
||||||
0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,
|
0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,
|
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||||
0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,0x6f,
|
|
||||||
0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,
|
|
||||||
0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x63,0x6f,0x6c,
|
|
||||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x74,0x65,0x78,0x5f,0x63,0x6f,
|
|
||||||
0x6f,0x72,0x64,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,
|
|
||||||
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,
|
|
||||||
0x00,
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
#include <metal_stdlib>
|
#include <metal_stdlib>
|
||||||
|
|
@ -131,19 +110,18 @@ vs_cube_source_metal_macos := [593]u8 {
|
||||||
struct main0_in
|
struct main0_in
|
||||||
{
|
{
|
||||||
float4 color [[user(locn0)]];
|
float4 color [[user(locn0)]];
|
||||||
float2 tex_coord [[user(locn1)]];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[texture(0)]], sampler smp [[sampler(0)]])
|
fragment main0_out main0(main0_in in [[stage_in]])
|
||||||
{
|
{
|
||||||
main0_out out = {};
|
main0_out out = {};
|
||||||
out.frag_color = tex.sample(smp, in.tex_coord) * in.color;
|
out.frag_color = in.color;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@(private="file")
|
@(private="file")
|
||||||
fs_cube_source_metal_macos := [450]u8 {
|
fs_cube_source_metal_macos := [315]u8 {
|
||||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||||
|
|
@ -155,24 +133,15 @@ fs_cube_source_metal_macos := [450]u8 {
|
||||||
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||||
0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
|
0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
|
||||||
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,
|
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,
|
||||||
0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,
|
||||||
0x32,0x20,0x74,0x65,0x78,0x5f,0x63,0x6f,0x6f,0x72,0x64,0x20,0x5b,0x5b,0x75,0x73,
|
0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,
|
||||||
0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,
|
0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,
|
||||||
0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,
|
||||||
0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,
|
||||||
0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,
|
0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,
|
||||||
0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,
|
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,
|
||||||
0x6f,0x61,0x74,0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,
|
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
|
||||||
0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
|
0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||||
0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,
|
|
||||||
0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,
|
|
||||||
0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,
|
|
||||||
0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
|
|
||||||
0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,
|
|
||||||
0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x5f,0x63,0x6f,0x6f,0x72,0x64,
|
|
||||||
0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,
|
|
||||||
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,
|
|
||||||
0x0a,0x00,
|
|
||||||
}
|
}
|
||||||
cube_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
cube_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||||
desc: sg.Shader_Desc
|
desc: sg.Shader_Desc
|
||||||
|
|
@ -184,22 +153,10 @@ cube_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||||
desc.fragment_func.source = transmute(cstring)&fs_cube_source_metal_macos
|
desc.fragment_func.source = transmute(cstring)&fs_cube_source_metal_macos
|
||||||
desc.fragment_func.entry = "main0"
|
desc.fragment_func.entry = "main0"
|
||||||
desc.attrs[0].base_type = .FLOAT
|
desc.attrs[0].base_type = .FLOAT
|
||||||
desc.attrs[1].base_type = .FLOAT
|
|
||||||
desc.uniform_blocks[0].stage = .VERTEX
|
desc.uniform_blocks[0].stage = .VERTEX
|
||||||
desc.uniform_blocks[0].layout = .STD140
|
desc.uniform_blocks[0].layout = .STD140
|
||||||
desc.uniform_blocks[0].size = 80
|
desc.uniform_blocks[0].size = 80
|
||||||
desc.uniform_blocks[0].msl_buffer_n = 0
|
desc.uniform_blocks[0].msl_buffer_n = 0
|
||||||
desc.images[0].stage = .FRAGMENT
|
|
||||||
desc.images[0].multisampled = false
|
|
||||||
desc.images[0].image_type = ._2D
|
|
||||||
desc.images[0].sample_type = .FLOAT
|
|
||||||
desc.images[0].msl_texture_n = 0
|
|
||||||
desc.samplers[0].stage = .FRAGMENT
|
|
||||||
desc.samplers[0].sampler_type = .FILTERING
|
|
||||||
desc.samplers[0].msl_sampler_n = 0
|
|
||||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
|
||||||
desc.image_sampler_pairs[0].image_slot = 0
|
|
||||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
|
||||||
}
|
}
|
||||||
return desc
|
return desc
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import sg "../../sokol/gfx"
|
||||||
Fragment Shader: fs_outline
|
Fragment Shader: fs_outline
|
||||||
Attributes:
|
Attributes:
|
||||||
ATTR_outline_pos => 0
|
ATTR_outline_pos => 0
|
||||||
ATTR_outline_uv => 1
|
|
||||||
Bindings:
|
Bindings:
|
||||||
Uniform block 'VsParamsOutline':
|
Uniform block 'VsParamsOutline':
|
||||||
Odin struct: Vsparamsoutline
|
Odin struct: Vsparamsoutline
|
||||||
|
|
@ -26,7 +25,6 @@ import sg "../../sokol/gfx"
|
||||||
Bind slot: UB_FsParamsOutline => 1
|
Bind slot: UB_FsParamsOutline => 1
|
||||||
*/
|
*/
|
||||||
ATTR_outline_pos :: 0
|
ATTR_outline_pos :: 0
|
||||||
ATTR_outline_uv :: 1
|
|
||||||
UB_VsParamsOutline :: 0
|
UB_VsParamsOutline :: 0
|
||||||
UB_FsParamsOutline :: 1
|
UB_FsParamsOutline :: 1
|
||||||
Vsparamsoutline :: struct #align(16) {
|
Vsparamsoutline :: struct #align(16) {
|
||||||
|
|
@ -156,7 +154,6 @@ outline_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||||
desc.fragment_func.source = transmute(cstring)&fs_outline_source_metal_macos
|
desc.fragment_func.source = transmute(cstring)&fs_outline_source_metal_macos
|
||||||
desc.fragment_func.entry = "main0"
|
desc.fragment_func.entry = "main0"
|
||||||
desc.attrs[0].base_type = .FLOAT
|
desc.attrs[0].base_type = .FLOAT
|
||||||
desc.attrs[1].base_type = .FLOAT
|
|
||||||
desc.uniform_blocks[0].stage = .VERTEX
|
desc.uniform_blocks[0].stage = .VERTEX
|
||||||
desc.uniform_blocks[0].layout = .STD140
|
desc.uniform_blocks[0].layout = .STD140
|
||||||
desc.uniform_blocks[0].size = 64
|
desc.uniform_blocks[0].size = 64
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
@vs vs_cube
|
@vs vs_cube
|
||||||
in vec3 pos;
|
in vec3 pos;
|
||||||
in vec2 uv;
|
|
||||||
|
|
||||||
layout(binding = 0) uniform VsParamsCube {
|
layout(binding = 0) uniform VsParamsCube {
|
||||||
mat4 mvp;
|
mat4 mvp;
|
||||||
|
|
@ -13,27 +12,21 @@ layout(binding = 0) uniform VsParamsCube {
|
||||||
};
|
};
|
||||||
|
|
||||||
out vec4 color;
|
out vec4 color;
|
||||||
out vec2 tex_coord;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = mvp * vec4(pos, 1);
|
gl_Position = mvp * vec4(pos, 1);
|
||||||
color = col;
|
color = col;
|
||||||
tex_coord = uv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@fs fs_cube
|
@fs fs_cube
|
||||||
in vec4 color;
|
in vec4 color;
|
||||||
in vec2 tex_coord;
|
|
||||||
|
|
||||||
layout(binding=0) uniform texture2D tex;
|
|
||||||
layout(binding=0) uniform sampler smp;
|
|
||||||
|
|
||||||
out vec4 frag_color;
|
out vec4 frag_color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
frag_color = texture(sampler2D(tex, smp), tex_coord) * color;
|
frag_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
@vs vs_outline
|
@vs vs_outline
|
||||||
in vec3 pos;
|
in vec3 pos;
|
||||||
in vec2 uv;
|
|
||||||
|
|
||||||
layout(binding = 0) uniform VsParamsOutline {
|
layout(binding = 0) uniform VsParamsOutline {
|
||||||
mat4 mvp;
|
mat4 mvp;
|
||||||
|
|
|
||||||