Files
coven/core/mesh_entity.jai
2025-07-12 17:26:23 +02:00

44 lines
1.0 KiB
Plaintext

Mesh_Entity :: struct {
using #as entity: Entity;
entity.flags = .RENDERABLE;
entity.type = Mesh_Entity;
model_path: string;
}
init_entity :: (e: *Mesh_Entity) {
log_error("Missing collision on Mesh Entities\n");
assert(false);
if e.model_path.count > 0 {
load_model_into_entity(e, get_or_load_model(e.model_path));
//e.flags |= .COLLISION | .STATIC;
//e.collider.type = .MESH;
//e.collider.bake_mode = .FULL_MESH;
}
}
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);
}