angular-three-plugin 4.0.0-next.102 → 4.0.0-next.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -9,9 +9,9 @@ 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 {
|
|
12
|
+
import { gltfResource } from 'angular-three-soba/loaders';
|
|
13
13
|
import type { GLTF } from 'three-stdlib';<% if (animations.length) { %>
|
|
14
|
-
import {
|
|
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) { %>
|
|
@@ -19,7 +19,7 @@ import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';<% } %>
|
|
|
19
19
|
import <%= gltfName %> from '<%= gltfPath %>' with { loader: 'file' };
|
|
20
20
|
<% } %>
|
|
21
21
|
<% if (preload) { %>
|
|
22
|
-
|
|
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 =
|
|
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
|
|
78
|
+
const _animations = animations(this.gltf, this.modelRef);
|
|
79
79
|
effect(() => {
|
|
80
|
-
if (!
|
|
81
|
-
this.animations.set(
|
|
80
|
+
if (!_animations.isReady) return;
|
|
81
|
+
this.animations.set(_animations);
|
|
82
82
|
});
|
|
83
83
|
<% } %>
|
|
84
84
|
|