Removed non #if'ed physics code.
This commit is contained in:
@@ -9,8 +9,10 @@ Mesh_Entity :: struct {
|
|||||||
init_entity :: (e: *Mesh_Entity) {
|
init_entity :: (e: *Mesh_Entity) {
|
||||||
if e.model_path.count > 0 {
|
if e.model_path.count > 0 {
|
||||||
load_model_into_entity(e, get_or_load_model(e.model_path));
|
load_model_into_entity(e, get_or_load_model(e.model_path));
|
||||||
e.flags |= .PHYSICS;
|
#if PHYSICS {
|
||||||
e.physics.type = .TRIANGLE_MESH;
|
e.flags |= .PHYSICS;
|
||||||
|
e.physics.type = .TRIANGLE_MESH;
|
||||||
|
}
|
||||||
//e.physics.box.half_extent = .{0.5,0.5,0.5};
|
//e.physics.box.half_extent = .{0.5,0.5,0.5};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,9 @@ unload_scene :: (scene: *Scene) {
|
|||||||
destroy_entity(e);
|
destroy_entity(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit_physx_scene(scene);
|
#if PHYSICS {
|
||||||
|
deinit_physx_scene(scene);
|
||||||
|
}
|
||||||
|
|
||||||
free(scene.name);
|
free(scene.name);
|
||||||
fini(*scene.pool);
|
fini(*scene.pool);
|
||||||
@@ -163,7 +165,7 @@ reload_scene :: (scene: *Scene) {
|
|||||||
load_scene(name);
|
load_scene(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
create_scene :: (name: string = "", max_entities: s64 = 256) -> *Scene {
|
create_scene :: (name: string = "", max_entities: s64 = 256, trigger_callbacks := false) -> *Scene {
|
||||||
scene := New(Scene);
|
scene := New(Scene);
|
||||||
new_name := name;
|
new_name := name;
|
||||||
|
|
||||||
@@ -195,7 +197,9 @@ create_scene :: (name: string = "", max_entities: s64 = 256) -> *Scene {
|
|||||||
|
|
||||||
array_reserve(*scene.entities, max_entities);
|
array_reserve(*scene.entities, max_entities);
|
||||||
|
|
||||||
init_physx_scene(scene);
|
#if PHYSICS {
|
||||||
|
init_physx_scene(scene);
|
||||||
|
}
|
||||||
|
|
||||||
scene.directional_light.color_and_intensity = .{1,1,1,2};
|
scene.directional_light.color_and_intensity = .{1,1,1,2};
|
||||||
scene.directional_light.direction = to_v4(normalize(Vector3.{0.4, -0.7, 0.4}));
|
scene.directional_light.direction = to_v4(normalize(Vector3.{0.4, -0.7, 0.4}));
|
||||||
@@ -205,6 +209,12 @@ create_scene :: (name: string = "", max_entities: s64 = 256) -> *Scene {
|
|||||||
dir_light_data.direction = scene.directional_light.direction;
|
dir_light_data.direction = scene.directional_light.direction;
|
||||||
upload_data_to_buffer(engine.renderer, engine.directional_light_buffer, *dir_light_data, size_of(Directional_Light_Buffer_Data));
|
upload_data_to_buffer(engine.renderer, engine.directional_light_buffer, *dir_light_data, size_of(Directional_Light_Buffer_Data));
|
||||||
|
|
||||||
|
if trigger_callbacks {
|
||||||
|
if engine.procs.on_scene_loaded != null {
|
||||||
|
engine.procs.on_scene_loaded(scene, engine.mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return scene;
|
return scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,11 @@ Engine_Core :: struct {
|
|||||||
on_scene_loaded: (*Scene, Engine_Mode);
|
on_scene_loaded: (*Scene, Engine_Mode);
|
||||||
on_pre_scene_loaded: (*Scene, Engine_Mode);
|
on_pre_scene_loaded: (*Scene, Engine_Mode);
|
||||||
on_pre_scene_unloaded: (*Scene);
|
on_pre_scene_unloaded: (*Scene);
|
||||||
on_trigger_enter: (*Entity, *Entity);
|
|
||||||
on_trigger_exit: (*Entity, *Entity);
|
#if PHYSICS {
|
||||||
|
on_trigger_enter: (*Entity, *Entity);
|
||||||
|
on_trigger_exit: (*Entity, *Entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
paused: bool;
|
paused: bool;
|
||||||
|
|||||||
@@ -61,28 +61,30 @@ init_trigger_line_rendering :: () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render_trigger_lines :: () {
|
render_trigger_lines :: () {
|
||||||
for e: engine.current_scene.entities {
|
#if PHYSICS {
|
||||||
if e.physics.type == .BOX {
|
for e: engine.current_scene.entities {
|
||||||
color := Color.{0,0,1,1};//e.collider.aabb_color;
|
if e.physics.type == .BOX {
|
||||||
aabb := AABB.{-e.physics.box.half_extent, e.physics.box.half_extent};
|
color := Color.{0,0,1,1};//e.collider.aabb_color;
|
||||||
|
aabb := AABB.{-e.physics.box.half_extent, e.physics.box.half_extent};
|
||||||
|
|
||||||
min := aabb.min;
|
min := aabb.min;
|
||||||
max := aabb.max;
|
max := aabb.max;
|
||||||
|
|
||||||
add_line(transform_position(.{min.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{min.x, min.y, max.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{min.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{min.x, min.y, max.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{max.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, min.y, max.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{max.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, min.y, max.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{min.x, max.y, min.z}, e.transform.model_matrix), transform_position(.{min.x, max.y, max.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{min.x, max.y, min.z}, e.transform.model_matrix), transform_position(.{min.x, max.y, max.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{max.x, max.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, max.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{max.x, max.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, max.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{min.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{min.x, max.y, min.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{min.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{min.x, max.y, min.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{max.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, min.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{max.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, min.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{max.x, min.y, max.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, max.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{max.x, min.y, max.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, max.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{min.x, min.y, max.z}, e.transform.model_matrix), transform_position(.{min.x, max.y, max.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{min.x, min.y, max.z}, e.transform.model_matrix), transform_position(.{min.x, max.y, max.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{min.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, min.y, min.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{min.x, min.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, min.y, min.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{min.x, max.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, min.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{min.x, max.y, min.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, min.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{min.x, min.y, max.z}, e.transform.model_matrix), transform_position(.{max.x, min.y, max.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{min.x, min.y, max.z}, e.transform.model_matrix), transform_position(.{max.x, min.y, max.z}, e.transform.model_matrix), color);
|
||||||
add_line(transform_position(.{min.x, max.y, max.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, max.z}, e.transform.model_matrix), color);
|
add_line(transform_position(.{min.x, max.y, max.z}, e.transform.model_matrix), transform_position(.{max.x, max.y, max.z}, e.transform.model_matrix), color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render_lines();
|
render_lines();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user