MCPcopy
hub / github.com/magcius/noclip.website / fetchSpriteModel

Method fetchSpriteModel

src/SourceEngine/EntitySystem.ts:390–401  ·  view source on GitHub ↗
(renderContext: SourceRenderContext, modelName: string)

Source from the content-addressed store, hash-verified

388 }
389
390 private async fetchSpriteModel(renderContext: SourceRenderContext, modelName: string) {
391 assert(this.spawnState === SpawnState.ReadyForSpawn);
392 this.spawnState = SpawnState.FetchingResources;
393 const materialName = modelName.replace('.spr', '.vmt');
394 const materialCache = renderContext.materialCache;
395 const materialInstance = await materialCache.createMaterialInstance(materialName);
396 materialInstance.paramSetNumber('$rendermode', this.rendermode);
397 materialInstance.entityParams = this.ensureMaterialParams();
398 await materialInstance.init(renderContext);
399 this.modelSprite = new SpriteInstance(renderContext, materialInstance);
400 this.spawnState = SpawnState.ReadyForSpawn;
401 }
402
403 private updateStudioPose(): void {
404 if (this.modelStudio === null)

Callers 1

setModelNameMethod · 0.95

Calls 4

ensureMaterialParamsMethod · 0.95
initMethod · 0.65
assertFunction · 0.50

Tested by

no test coverage detected