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

Function spawnModelEntity

src/world/loader.ts:198–220  ·  view source on GitHub ↗
(
  entity: EntityData,
  ctx: InstantiateContext,
  warnings: string[],
)

Source from the content-addressed store, hash-verified

196}
197
198function spawnModelEntity(
199 entity: EntityData,
200 ctx: InstantiateContext,
201 warnings: string[],
202): SceneNodeHandle {
203 const modelRef = entity.modelRef as string;
204 const modelHandle = ctx.getModelHandle(modelRef);
205 if (modelHandle === 0) {
206 warnings.push('entity ' + entity.id + ' references unknown model "' + modelRef + '" — skipped');
207 return 0;
208 }
209
210 const node = createSceneNode();
211 attachModelToNode(node, modelHandle, 0);
212 setSceneNodeTransform(node, trsToMat4(entity.transform));
213
214 if (entity.tint !== null) {
215 applyTint(node, entity.tint);
216 }
217
218 setSceneNodeVisible(node, true);
219 return node;
220}
221
222function spawnPrefabEntity(
223 entity: EntityData,

Callers 1

spawnEntityFunction · 0.85

Calls 7

createSceneNodeFunction · 0.90
attachModelToNodeFunction · 0.90
setSceneNodeTransformFunction · 0.90
setSceneNodeVisibleFunction · 0.90
applyTintFunction · 0.85
trsToMat4Function · 0.70
pushMethod · 0.45

Tested by

no test coverage detected