Mesh_Entities!
This commit is contained in:
42
core/mesh_entity.jai
Normal file
42
core/mesh_entity.jai
Normal file
@@ -0,0 +1,42 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
for mesh_entity_files {
|
||||
print(it.full_path);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user