@@ -9,17 +9,17 @@ import type * as THREE from 'three';
9
9
import { Group<%= threeImports %> } from 'three';
10
10
import { extend, type NgtThreeElements, NgtObjectEvents<% if (args) { %>, NgtArgs<% } %> } from 'angular-three';
11
11
import { Component, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, input, viewChild, ElementRef, inject, effect<% if (animations.length) { %>, model<% } %> } from '@angular/core';
12
- import { injectGLTF } from 'angular-three-soba/loaders';
12
+ import { gltfResource } from 'angular-three-soba/loaders';
13
13
import type { GLTF } from 'three-stdlib';<% if (animations.length) { %>
14
- import { injectAnimations , type NgtsAnimationClips, type NgtsAnimationApi } from 'angular-three-soba/misc';<% } %><% if (perspective) { %>
14
+ import { animations , type NgtsAnimationClips, type NgtsAnimationApi } from 'angular-three-soba/misc';<% } %><% if (perspective) { %>
15
15
import { NgtsPerspectiveCamera } from 'angular-three-soba/cameras';<% } %><% if (orthographic) { %>
16
16
import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';<% } %>
17
17
<% if (useImportAttribute) { %>
18
18
// @ts-expect-error - import .glb/.gltf file
19
19
import <%= gltfName %> from '<%= gltfPath %>' with { loader: 'file' };
20
20
<% } %>
21
21
<% if (preload) { %>
22
- injectGLTF .preload(() => <% if (useImportAttribute) { %><%= gltfName %><% } else { %>'<%= gltfPath %>'<% } %>);
22
+ gltfResource .preload(<% if (useImportAttribute) { %><%= gltfName %><% } else { %>'<%= gltfPath %>'<% } %>);
23
23
<% } %>
24
24
<% if (animations.length) { %>
25
25
type ActionName = <% animations.map(clip => "\""+ clip.name + "\"").join(" | ") %>;
@@ -40,7 +40,7 @@ export type <%= gltfResultTypeName %> = GLTF & {
40
40
@Component({
41
41
selector: '<%= selector %>',
42
42
template: `
43
- @if (gltf(); as gltf) {
43
+ @if (gltf.value (); as gltf) {
44
44
@let nodes = gltf.nodes;
45
45
@let materials = gltf.materials;
46
46
@@ -69,16 +69,16 @@ export class <%= className %> {
69
69
70
70
modelRef = viewChild<ElementRef<Group>>('model');
71
71
72
- protected gltf = injectGLTF <<%= gltfResultTypeName %>>(() => <% if (useImportAttribute) { %> <%= gltfName %> <% } else { %> '<%= url %>' <% } %><% if (gltfOptions) { %>, <%= gltfOptions %><% } %>);
72
+ protected gltf = gltfResource <<%= gltfResultTypeName %>>(() => <% if (useImportAttribute) { %> <%= gltfName %> <% } else { %> '<%= url %>' <% } %><% if (gltfOptions) { %>, <%= gltfOptions %><% } %>);
73
73
74
74
constructor() {
75
75
extend({ Group<%= threeImports %> });
76
76
77
77
<% if (animations.length) { %>
78
- const animations = injectAnimations (this.gltf, this.modelRef);
78
+ const _animations = animations (this.gltf, this.modelRef);
79
79
effect(() => {
80
- if (!animations .isReady) return;
81
- this.animations.set(animations );
80
+ if (!_animations .isReady) return;
81
+ this.animations.set(_animations );
82
82
});
83
83
<% } %>
84
84
0 commit comments