@xviewer.js/core 1.0.0-alpha.61 → 1.0.0-alpha.62
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/dist/main.js +54 -58
- package/dist/main.js.map +1 -1
- package/dist/module.js +50 -59
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/Utils.d.ts +7 -0
- package/types/Viewer.d.ts +0 -13
- package/types/index.d.ts +1 -0
package/dist/module.js
CHANGED
|
@@ -4487,6 +4487,54 @@ function applyProps(target, props) {
|
|
|
4487
4487
|
}
|
|
4488
4488
|
return target;
|
|
4489
4489
|
}
|
|
4490
|
+
function find(node, path) {
|
|
4491
|
+
let child = null;
|
|
4492
|
+
let parts = path.split("/");
|
|
4493
|
+
let children = node.children;
|
|
4494
|
+
for (let part of parts){
|
|
4495
|
+
child = children.find((v)=>v.name === part);
|
|
4496
|
+
if (child) {
|
|
4497
|
+
children = child.children;
|
|
4498
|
+
} else {
|
|
4499
|
+
return null;
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4502
|
+
return child;
|
|
4503
|
+
}
|
|
4504
|
+
function getObject(node, filter, group = false) {
|
|
4505
|
+
const queue = [
|
|
4506
|
+
node
|
|
4507
|
+
];
|
|
4508
|
+
const objects = [];
|
|
4509
|
+
while(queue.length !== 0){
|
|
4510
|
+
let object = queue.shift();
|
|
4511
|
+
let target = filter(object);
|
|
4512
|
+
if (target) {
|
|
4513
|
+
objects.push(object);
|
|
4514
|
+
if (!group) {
|
|
4515
|
+
break;
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4518
|
+
object.children.forEach((v)=>queue.push(v));
|
|
4519
|
+
}
|
|
4520
|
+
if (group) {
|
|
4521
|
+
return objects;
|
|
4522
|
+
}
|
|
4523
|
+
return objects[0];
|
|
4524
|
+
}
|
|
4525
|
+
function getObjectByName(node, name) {
|
|
4526
|
+
return getObject(node, (v)=>v && v.name === name);
|
|
4527
|
+
}
|
|
4528
|
+
const __emtpyObject = {};
|
|
4529
|
+
function getObjectValue(object, name, group = false) {
|
|
4530
|
+
if (name) {
|
|
4531
|
+
if (group) {
|
|
4532
|
+
return Object.values(object || __emtpyObject).filter((v)=>v.name === name);
|
|
4533
|
+
}
|
|
4534
|
+
return Object.values(object || __emtpyObject).find((v)=>v.name === name);
|
|
4535
|
+
}
|
|
4536
|
+
return Object.values(object);
|
|
4537
|
+
}
|
|
4490
4538
|
|
|
4491
4539
|
class PluginManager {
|
|
4492
4540
|
get viewer() {
|
|
@@ -4602,62 +4650,6 @@ class Viewer extends EventEmitter {
|
|
|
4602
4650
|
], 2));
|
|
4603
4651
|
return geometry;
|
|
4604
4652
|
}
|
|
4605
|
-
static findChild(node, path) {
|
|
4606
|
-
let child = null;
|
|
4607
|
-
let parts = path.split("/");
|
|
4608
|
-
let children = node.children;
|
|
4609
|
-
for (let part of parts){
|
|
4610
|
-
child = children.find((v)=>v.name === part);
|
|
4611
|
-
if (child) {
|
|
4612
|
-
children = child.children;
|
|
4613
|
-
} else {
|
|
4614
|
-
return null;
|
|
4615
|
-
}
|
|
4616
|
-
}
|
|
4617
|
-
return child;
|
|
4618
|
-
}
|
|
4619
|
-
static getChildByName(node, name) {
|
|
4620
|
-
return Viewer.getObject(node, (v)=>v.name === name && v);
|
|
4621
|
-
}
|
|
4622
|
-
static getObject(node, filter, group = false) {
|
|
4623
|
-
const queue = [
|
|
4624
|
-
node
|
|
4625
|
-
];
|
|
4626
|
-
const objects = [];
|
|
4627
|
-
while(queue.length !== 0){
|
|
4628
|
-
let object = queue.shift();
|
|
4629
|
-
let target = filter(object);
|
|
4630
|
-
if (target) {
|
|
4631
|
-
objects.push(object);
|
|
4632
|
-
if (!group) {
|
|
4633
|
-
break;
|
|
4634
|
-
}
|
|
4635
|
-
}
|
|
4636
|
-
object.children.forEach((v)=>queue.push(v));
|
|
4637
|
-
}
|
|
4638
|
-
if (group) {
|
|
4639
|
-
return objects;
|
|
4640
|
-
}
|
|
4641
|
-
return objects[0];
|
|
4642
|
-
}
|
|
4643
|
-
static _getObjectValue(object, name, group = false) {
|
|
4644
|
-
if (name) {
|
|
4645
|
-
if (group) {
|
|
4646
|
-
return Object.values(object || Viewer.__emtpyObject).filter((v)=>v.name === name);
|
|
4647
|
-
}
|
|
4648
|
-
return Object.values(object || Viewer.__emtpyObject).find((v)=>v.name === name);
|
|
4649
|
-
}
|
|
4650
|
-
return Object.values(object);
|
|
4651
|
-
}
|
|
4652
|
-
static getMaterial(node, name, group = false) {
|
|
4653
|
-
return Viewer._getObjectValue(node.userData.materials, name, group);
|
|
4654
|
-
}
|
|
4655
|
-
static getTexture(node, name, group = false) {
|
|
4656
|
-
return Viewer._getObjectValue(node.userData.textures, name, group);
|
|
4657
|
-
}
|
|
4658
|
-
static getMesh(node, name, group = false) {
|
|
4659
|
-
return Viewer._getObjectValue(node.userData.meshes, name, group);
|
|
4660
|
-
}
|
|
4661
4653
|
get root() {
|
|
4662
4654
|
return this._root;
|
|
4663
4655
|
}
|
|
@@ -4859,7 +4851,7 @@ class Viewer extends EventEmitter {
|
|
|
4859
4851
|
this._tweenManager.killTweensOf(target);
|
|
4860
4852
|
}
|
|
4861
4853
|
traverseMaterials(callback) {
|
|
4862
|
-
|
|
4854
|
+
getObject(this._scene, (item)=>{
|
|
4863
4855
|
if (item.material) {
|
|
4864
4856
|
if (Array.isArray(item.material)) item.material.forEach(callback);
|
|
4865
4857
|
else callback(item.material);
|
|
@@ -5105,7 +5097,6 @@ Viewer._shadowCameraKeys = [
|
|
|
5105
5097
|
"near",
|
|
5106
5098
|
"far"
|
|
5107
5099
|
];
|
|
5108
|
-
Viewer.__emtpyObject = {};
|
|
5109
5100
|
Viewer.fullscreenMesh = new Mesh(Viewer.createFullscreenTriangle());
|
|
5110
5101
|
Viewer.fullscreenCamera = new OrthographicCamera(-1, 1, 1, -1, 0, 1);
|
|
5111
5102
|
Viewer._instanceCount = 0;
|
|
@@ -5827,5 +5818,5 @@ function getFilesFromItemList(items, onDone) {
|
|
|
5827
5818
|
}
|
|
5828
5819
|
}
|
|
5829
5820
|
|
|
5830
|
-
export { Animation, AnimationCurve, Box, BoxProjectionPlugin, CinestationBlendDefinition, CinestationBrain, Component, DebugPlugin, DeviceInput, DropFilePlugin, Easing, EnvironmentPlugin, EventEmitter, FInterpConstantTo, FInterpTo, FreelookVirtualCamera, Logger, ObjectInstance, Orientation, PerformanceMonitorPlugin, Perlin, Plane, Plugin, PropertyManager, QInterpConstantTo, QInterpTo, Quat_AngularDistance, Quat_Equals, Quat_exponentialDamp, Quat_quarticDamp, Quat_smoothDamp, Reflector, ReflectorMaterial, ResourceManager, Sphere, SystemInfo, Tween, TweenChain, TweenManager, VInterpConstantTo, VInterpTo, Vec3_smoothDamp, Vector3_NEG_ONE, Vector3_ONE, Vector3_RIGHT, Vector3_UNIT_X, Vector3_UNIT_Y, Vector3_UNIT_Z, Vector3_UP, Vector3_ZERO, Viewer, VirtualCamera, aEXRLoader, aFBXLoader, aGLTFLoader, aHDRLoader, aJSONLoader, aLoader, aTextureLoader, exponentialDamp, frag_BoxfilterBlur, frag_cubeMapToPanorama, frag_panoramaToCubeMap, getClassInstance, getShaderMaterial, mixin, property, quarticDamp, smoothDamp, vert_fullscreen };
|
|
5821
|
+
export { Animation, AnimationCurve, Box, BoxProjectionPlugin, CinestationBlendDefinition, CinestationBrain, Component, DebugPlugin, DeviceInput, DropFilePlugin, Easing, EnvironmentPlugin, EventEmitter, FInterpConstantTo, FInterpTo, FreelookVirtualCamera, Logger, ObjectInstance, Orientation, PerformanceMonitorPlugin, Perlin, Plane, Plugin, PropertyManager, QInterpConstantTo, QInterpTo, Quat_AngularDistance, Quat_Equals, Quat_exponentialDamp, Quat_quarticDamp, Quat_smoothDamp, Reflector, ReflectorMaterial, ResourceManager, Sphere, SystemInfo, Tween, TweenChain, TweenManager, VInterpConstantTo, VInterpTo, Vec3_smoothDamp, Vector3_NEG_ONE, Vector3_ONE, Vector3_RIGHT, Vector3_UNIT_X, Vector3_UNIT_Y, Vector3_UNIT_Z, Vector3_UP, Vector3_ZERO, Viewer, VirtualCamera, aEXRLoader, aFBXLoader, aGLTFLoader, aHDRLoader, aJSONLoader, aLoader, aTextureLoader, applyProps, exponentialDamp, find, frag_BoxfilterBlur, frag_cubeMapToPanorama, frag_panoramaToCubeMap, getClassInstance, getObject, getObjectByName, getObjectValue, getShaderMaterial, mixin, property, quarticDamp, smoothDamp, vert_fullscreen };
|
|
5831
5822
|
//# sourceMappingURL=module.js.map
|