42 lines
969 B
Plaintext
42 lines
969 B
Plaintext
Mesh_Entity :: struct {
|
|
using #as entity: Entity;
|
|
entity.flags = .RENDERABLE;
|
|
entity.type = Mesh_Entity;
|
|
|
|
model_path: string;
|
|
}
|
|
|
|
init_entity :: (e: *Mesh_Entity) {
|
|
if e.model_path.count > 0 {
|
|
load_model_into_entity(e, get_or_load_model(e.model_path));
|
|
e.flags |= .PHYSICS;
|
|
e.physics.type = .BOX;
|
|
e.physics.box.half_extent = .{0.5,0.5,0.5};
|
|
}
|
|
}
|
|
|
|
mesh_entity_files : [..] Mesh_Entity_Info;
|
|
|
|
Mesh_Entity_Info :: struct {
|
|
full_path: string;
|
|
}
|
|
|
|
mesh_entity_visitor :: (info : *File_Visit_Info, files: *[..] Mesh_Entity_Info) {
|
|
if info.is_directory return;
|
|
|
|
path, basename, ext := path_decomp (info.full_name);
|
|
|
|
// Entity text files
|
|
if ext == "fbx" {
|
|
file_info : Mesh_Entity_Info;
|
|
file_info.full_path = copy_string(info.full_name);
|
|
array_add(files, file_info);
|
|
}
|
|
}
|
|
|
|
find_all_mesh_entities :: () {
|
|
path := "../assets/models/level_design";
|
|
|
|
visit_files(path, true, *mesh_entity_files, mesh_entity_visitor);
|
|
}
|