MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / loadModel

Function loadModel

src/models/index.ts:130–152  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

128declare function bloom_read_file(path: number): number;
129
130export function loadModel(path: string): Model {
131 // Check for OBJ format
132 const pathLower = (path as string).toLowerCase();
133 if (pathLower.endsWith('.obj')) {
134 const text: string = bloom_read_file(path as any) as any;
135 if (text) {
136 const parsed = parseOBJ(text);
137 if (parsed) {
138 const handle = bloom_create_mesh(
139 parsed.vertices as any,
140 parsed.vertices.length / 12,
141 parsed.indices as any,
142 parsed.indices.length,
143 );
144 return makeModel(handle, 1, 1);
145 }
146 }
147 return makeModel(0);
148 }
149
150 const handle = bloom_load_model(path as any);
151 return makeModel(handle);
152}
153
154export function drawModel(model: Model, position: Vec3, scale: number, tint: Color): void {
155 bloom_draw_model(model.handle, position.x, position.y, position.z, scale, tint.r, tint.g, tint.b, tint.a);

Callers 5

main.tsFile · 0.90
main.tsFile · 0.90
main.tsFile · 0.90
main.tsFile · 0.90
setupGltfModelFunction · 0.90

Calls 5

parseOBJFunction · 0.85
makeModelFunction · 0.85
bloom_read_fileFunction · 0.50
bloom_create_meshFunction · 0.50
bloom_load_modelFunction · 0.50

Tested by

no test coverage detected