Improve anti aliasing

This commit is contained in:
Hugo Mårdbrink 2025-08-27 20:55:04 +02:00
parent e1e480daf2
commit db75a10f2b
4 changed files with 7 additions and 6 deletions

View file

@ -3,8 +3,6 @@ package ecs
import "core:math" import "core:math"
import "core:math/linalg" import "core:math/linalg"
import sa "../sokol/app"
CameraSystem :: struct { CameraSystem :: struct {
using base: SystemBase, using base: SystemBase,
} }
@ -19,8 +17,6 @@ camera_system_update :: proc(camera_system: ^CameraSystem, coordinator: ^Coordin
camera := coordinator_get_component(CameraComponent, coordinator, entity) camera := coordinator_get_component(CameraComponent, coordinator, entity)
input := coordinator_get_component(InputComponent, coordinator, entity) input := coordinator_get_component(InputComponent, coordinator, entity)
if input.key_down[.ESCAPE] do sa.quit()
move_input: Vec3 move_input: Vec3
if input.key_down[.W] do move_input.y = 1 if input.key_down[.W] do move_input.y = 1
else if input.key_down[.S] do move_input.y = -1 else if input.key_down[.S] do move_input.y = -1

View file

@ -18,6 +18,8 @@ input_system_update :: proc(input_system: ^InputSystem, coordinator: ^Coordinato
case .KEY_UP: case .KEY_UP:
input.key_down[event.key_code] = false input.key_down[event.key_code] = false
} }
if input.key_down[.ESCAPE] do sa.quit()
} }
} }

View file

@ -70,6 +70,7 @@ init_outline_material :: proc(render_system: ^RenderSystem) {
bias_slope_scale = 1.0, bias_slope_scale = 1.0,
compare = .LESS_EQUAL, compare = .LESS_EQUAL,
}, },
sample_count = 4,
}) })
sampler := sg.make_sampler({}) sampler := sg.make_sampler({})
@ -102,6 +103,7 @@ init_cube_material :: proc(render_system: ^RenderSystem) {
bias_slope_scale = 1.0, bias_slope_scale = 1.0,
compare = .LESS_EQUAL, compare = .LESS_EQUAL,
}, },
sample_count = 4,
}) })
w, h: i32 w, h: i32
@ -122,7 +124,7 @@ init_cube_material :: proc(render_system: ^RenderSystem) {
} }
} }
} }
} },
}) })
sampler := sg.make_sampler({}) sampler := sg.make_sampler({})

View file

@ -140,6 +140,7 @@ create_cube :: proc() {
rotation = ecs.Vec3{ 0.0, 0.0, 0.0 }, rotation = ecs.Vec3{ 0.0, 0.0, 0.0 },
scale = ecs.Vec3{ 1.0, 1.0, 1.0 }, scale = ecs.Vec3{ 1.0, 1.0, 1.0 },
}) })
ecs.coordinator_add_component( ecs.coordinator_add_component(
ecs.ColorComponent, ecs.ColorComponent,
&g.coordinator, &g.coordinator,
@ -223,7 +224,7 @@ create_scene :: proc() {
ecs.InputComponent{ ecs.InputComponent{
key_down = {}, key_down = {},
mouse_movement = Vec2{ 0, 0 } mouse_movement = Vec2{ 0, 0 }
}) })
ecs.render_system_init(g.render_system, user_entity) ecs.render_system_init(g.render_system, user_entity)
} }