angular-three-gltf
Advanced tools
Comparing version
@@ -58,2 +58,3 @@ #!/usr/bin/env node | ||
--root, -r Sets directory from which .gltf file is served | ||
--importattribute Use import attribute to load gltf (default: false) | ||
--transform, -T Transform the asset for the web (draco, prune, resize) | ||
@@ -86,2 +87,3 @@ --resolution, -R Resolution for texture resizing (default: 1024) | ||
root: { type: "string", shortFlag: "r" }, | ||
importattribute: { type: "boolean", default: false }, | ||
transform: { type: "boolean", shortFlag: "T" }, | ||
@@ -88,0 +90,0 @@ resolution: { type: "number", shortFlag: "R", default: 1024 }, |
{ | ||
"name": "angular-three-gltf", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "GLTF to Angular Three converter", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -17,3 +17,4 @@ import THREE from "three"; | ||
const gltfAnimationApiTypeName = componentName + "AnimationApi"; | ||
const gltfResultTypeName = componentName + "GLTFResult"; | ||
const gltfName = componentName + "GLTF"; | ||
const gltfResultTypeName = gltfName + "GLTFResult"; | ||
const useNewAnimationApi = | ||
@@ -633,9 +634,15 @@ options.ngtVer?.major >= 4 || | ||
import { Group${ngtTypesArr.length ? ", " + ngtTypesArr.join(", ") : ""} } from 'three'; | ||
import { extend, NgtThreeElements, NgtObjectEvents${hasArgs ? ", NgtArgs" : ""} } from 'angular-three'; | ||
import { Component, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Signal, input, viewChild, ElementRef, inject, effect${hasAnimations ? ", computed, model" : ""} } from '@angular/core'; | ||
import { extend, type NgtThreeElements, NgtObjectEvents${hasArgs ? ", NgtArgs" : ""} } from 'angular-three'; | ||
import { Component, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, type Signal, input, viewChild, ElementRef, inject, effect${hasAnimations ? ", computed, model" : ""} } from '@angular/core'; | ||
import { injectGLTF } from 'angular-three-soba/loaders'; | ||
import { GLTF } from 'three-stdlib'; | ||
import type { GLTF } from 'three-stdlib'; | ||
${hasAnimations ? "import { injectAnimations, NgtsAnimationClips, NgtsAnimationApi } from 'angular-three-soba/misc';" : ""} | ||
${ngtTypes.has("PerspectiveCamera") ? "import { NgtsPerspectiveCamera } from 'angular-three-soba/cameras';" : ""} | ||
${ngtTypes.has("OrthographicCamera") ? "import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';" : ""} | ||
${ | ||
options.importattribute && !url.startsWith("http") | ||
? `// @ts-expect-error - import .glb/.gltf file | ||
import ${gltfName} from '.${url}' with { loader: 'file' };` | ||
: "" | ||
} | ||
`; | ||
@@ -723,3 +730,3 @@ | ||
protected gltf = injectGLTF<${gltfResultTypeName}>(() => "${url}"${gltfOptions ? `, ${JSON.stringify(gltfOptions)}` : ""}); | ||
protected gltf = injectGLTF<${gltfResultTypeName}>(() => "${options.importattribute && !url.startsWith("http") ? gltfName : url}"${gltfOptions ? `, ${JSON.stringify(gltfOptions)}` : ""}); | ||
@@ -726,0 +733,0 @@ constructor() { |
153954
0.31%3499
0.26%