Removed non #if'ed physics code.
This commit is contained in:
@@ -9,8 +9,10 @@ Mesh_Entity :: struct {
|
||||
init_entity :: (e: *Mesh_Entity) {
|
||||
if e.model_path.count > 0 {
|
||||
load_model_into_entity(e, get_or_load_model(e.model_path));
|
||||
#if PHYSICS {
|
||||
e.flags |= .PHYSICS;
|
||||
e.physics.type = .TRIANGLE_MESH;
|
||||
}
|
||||
//e.physics.box.half_extent = .{0.5,0.5,0.5};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,9 @@ unload_scene :: (scene: *Scene) {
|
||||
destroy_entity(e);
|
||||
}
|
||||
|
||||
#if PHYSICS {
|
||||
deinit_physx_scene(scene);
|
||||
}
|
||||
|
||||
free(scene.name);
|
||||
fini(*scene.pool);
|
||||
@@ -163,7 +165,7 @@ reload_scene :: (scene: *Scene) {
|
||||
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);
|
||||
new_name := name;
|
||||
|
||||
@@ -195,7 +197,9 @@ create_scene :: (name: string = "", max_entities: s64 = 256) -> *Scene {
|
||||
|
||||
array_reserve(*scene.entities, max_entities);
|
||||
|
||||
#if PHYSICS {
|
||||
init_physx_scene(scene);
|
||||
}
|
||||
|
||||
scene.directional_light.color_and_intensity = .{1,1,1,2};
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,12 @@ Engine_Core :: struct {
|
||||
on_scene_loaded: (*Scene, Engine_Mode);
|
||||
on_pre_scene_loaded: (*Scene, Engine_Mode);
|
||||
on_pre_scene_unloaded: (*Scene);
|
||||
|
||||
#if PHYSICS {
|
||||
on_trigger_enter: (*Entity, *Entity);
|
||||
on_trigger_exit: (*Entity, *Entity);
|
||||
}
|
||||
}
|
||||
|
||||
paused: bool;
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ init_trigger_line_rendering :: () {
|
||||
}
|
||||
|
||||
render_trigger_lines :: () {
|
||||
#if PHYSICS {
|
||||
for e: engine.current_scene.entities {
|
||||
if e.physics.type == .BOX {
|
||||
color := Color.{0,0,1,1};//e.collider.aabb_color;
|
||||
@@ -85,4 +86,5 @@ render_trigger_lines :: () {
|
||||
}
|
||||
|
||||
render_lines();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user