Updates
This commit is contained in:
parent
973cdb9506
commit
2ccda376bb
BIN
assets/testblend.glb
(Stored with Git LFS)
Normal file
BIN
assets/testblend.glb
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -20,6 +20,7 @@ import "core:hash"
|
||||
import "core:log"
|
||||
import "core:math"
|
||||
import "core:math/linalg"
|
||||
import "core:mem"
|
||||
import "core:slice"
|
||||
import "game:physics"
|
||||
import "game:physics/bvh"
|
||||
@ -693,6 +694,26 @@ update_world :: proc(world: ^World, dt: f32, config: World_Update_Config) {
|
||||
wheel.turn_angle = TURN_ANGLE * turn_vel_correction * turn_input
|
||||
}
|
||||
|
||||
{
|
||||
level_model := assets.get_model(&g_mem.assetman, "assets/testblend.glb")
|
||||
|
||||
for i in 0 ..< level_model.meshCount {
|
||||
mesh := &level_model.meshes[i]
|
||||
|
||||
if mesh.triangleCount > 0 {
|
||||
physics.immediate_level_geom(
|
||||
&world.physics_scene,
|
||||
hash.fnv32a(cast([]byte)(fmt.tprintf("level mesh {}", i))),
|
||||
{
|
||||
rotation = linalg.QUATERNIONF32_IDENTITY,
|
||||
vertices = (cast([^]rl.Vector3)mesh.vertices)[:mesh.vertexCount],
|
||||
indices = mesh.indices[:mesh.triangleCount * 3],
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(world.track.points) > 1 {
|
||||
interpolated_points := calculate_spline_interpolated_points(
|
||||
world.track.points[:],
|
||||
@ -1031,6 +1052,8 @@ draw_world :: proc(world: ^World) {
|
||||
|
||||
sim_state := physics.get_sim_state(&world.physics_scene)
|
||||
|
||||
level_model := assets.get_model(&g_mem.assetman, "assets/testblend.glb")
|
||||
|
||||
car_body := physics.get_body(sim_state, world.car_handle)
|
||||
car_model := assets.get_model(&g_mem.assetman, "assets/ice_cream_truck.glb")
|
||||
engine := physics.get_engine(sim_state, world.engine_handle)
|
||||
@ -1105,6 +1128,8 @@ draw_world :: proc(world: ^World) {
|
||||
// .VEC3,
|
||||
// )
|
||||
|
||||
render.draw_model(level_model, {}, 1)
|
||||
|
||||
render.draw_model(car_model, {}, car_matrix)
|
||||
|
||||
render.draw_mesh_light(
|
||||
|
@ -128,6 +128,7 @@ build_static_tlas :: proc(sim_state: ^Sim_State) -> Static_TLAS {
|
||||
}
|
||||
}
|
||||
|
||||
log.debugf("num vertices {}, len vertices {}", num_vertices, len(vertices))
|
||||
assert(num_vertices == len(vertices))
|
||||
assert(num_indices == len(indices))
|
||||
|
||||
|
BIN
src_assets/testblend.blend
(Stored with Git LFS)
Normal file
BIN
src_assets/testblend.blend
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
src_assets/testblend.blend1
(Stored with Git LFS)
Normal file
BIN
src_assets/testblend.blend1
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user