mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
0.3.0-beta.5
This commit is contained in:
parent
8801b9bac5
commit
1c9124d14e
620
build/trois.d.ts
vendored
620
build/trois.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -41,7 +41,7 @@ function bindProp(src, srcProp, dst, dstProp) {
|
|||||||
setFromProp(dst[_dstProp], value);
|
setFromProp(dst[_dstProp], value);
|
||||||
}, {deep: true});
|
}, {deep: true});
|
||||||
} else {
|
} else {
|
||||||
if (ref.value)
|
if (ref.value !== void 0)
|
||||||
dst[_dstProp] = src[srcProp];
|
dst[_dstProp] = src[srcProp];
|
||||||
vue.watch(ref, (value) => {
|
vue.watch(ref, (value) => {
|
||||||
dst[_dstProp] = value;
|
dst[_dstProp] = value;
|
||||||
@ -764,8 +764,9 @@ var Object3D = vue.defineComponent({
|
|||||||
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
|
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
|
||||||
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
|
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
|
||||||
lookAt: {type: Object, default: null},
|
lookAt: {type: Object, default: null},
|
||||||
autoRemove: {type: Boolean, default: true},
|
userData: {type: Object, default: () => ({})},
|
||||||
userData: {type: Object, default: () => ({})}
|
visible: {type: Boolean, default: true},
|
||||||
|
autoRemove: {type: Boolean, default: true}
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
return {};
|
return {};
|
||||||
@ -791,6 +792,7 @@ var Object3D = vue.defineComponent({
|
|||||||
bindProp(this, "rotation", o3d);
|
bindProp(this, "rotation", o3d);
|
||||||
bindProp(this, "scale", o3d);
|
bindProp(this, "scale", o3d);
|
||||||
bindProp(this, "userData", o3d.userData);
|
bindProp(this, "userData", o3d.userData);
|
||||||
|
bindProp(this, "visible", o3d);
|
||||||
if (this.lookAt)
|
if (this.lookAt)
|
||||||
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
|
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
|
||||||
vue.watch(() => this.lookAt, (v) => {
|
vue.watch(() => this.lookAt, (v) => {
|
||||||
@ -926,19 +928,26 @@ var CubeCamera = vue.defineComponent({
|
|||||||
cubeRTSize: {type: Number, default: 256},
|
cubeRTSize: {type: Number, default: 256},
|
||||||
cubeCameraNear: {type: Number, default: 0.1},
|
cubeCameraNear: {type: Number, default: 0.1},
|
||||||
cubeCameraFar: {type: Number, default: 2e3},
|
cubeCameraFar: {type: Number, default: 2e3},
|
||||||
autoUpdate: Boolean
|
autoUpdate: Boolean,
|
||||||
|
hideMeshes: {type: Array, default: () => []}
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const rendererC = vue.inject(RendererInjectionKey);
|
const rendererC = vue.inject(RendererInjectionKey);
|
||||||
if (!rendererC || !rendererC.scene) {
|
if (!rendererC || !rendererC.scene) {
|
||||||
console.error("Missing Renderer / Scene");
|
console.error("Missing Renderer / Scene");
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
const renderer = rendererC.renderer, scene = rendererC.scene;
|
const renderer = rendererC.renderer, scene = rendererC.scene;
|
||||||
const cubeRT = new three.WebGLCubeRenderTarget(props.cubeRTSize, {format: three.RGBFormat, generateMipmaps: true, minFilter: three.LinearMipmapLinearFilter});
|
const cubeRT = new three.WebGLCubeRenderTarget(props.cubeRTSize, {format: three.RGBFormat, generateMipmaps: true, minFilter: three.LinearMipmapLinearFilter});
|
||||||
const cubeCamera = new three.CubeCamera(props.cubeCameraNear, props.cubeCameraFar, cubeRT);
|
const cubeCamera = new three.CubeCamera(props.cubeCameraNear, props.cubeCameraFar, cubeRT);
|
||||||
const updateRT = () => {
|
const updateRT = () => {
|
||||||
|
props.hideMeshes.forEach((m) => {
|
||||||
|
m.visible = false;
|
||||||
|
});
|
||||||
cubeCamera.update(renderer, scene);
|
cubeCamera.update(renderer, scene);
|
||||||
|
props.hideMeshes.forEach((m) => {
|
||||||
|
m.visible = true;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
if (props.autoUpdate) {
|
if (props.autoUpdate) {
|
||||||
rendererC.onBeforeRender(updateRT);
|
rendererC.onBeforeRender(updateRT);
|
||||||
@ -948,7 +957,11 @@ var CubeCamera = vue.defineComponent({
|
|||||||
} else {
|
} else {
|
||||||
rendererC.onMounted(updateRT);
|
rendererC.onMounted(updateRT);
|
||||||
}
|
}
|
||||||
return {cubeRT, cubeCamera};
|
return {cubeRT, cubeCamera, updateRT};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if (this.cubeCamera)
|
||||||
|
this.initObject3D(this.cubeCamera);
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return [];
|
return [];
|
||||||
@ -2887,6 +2900,7 @@ const TroisJSVuePlugin = {
|
|||||||
"Renderer",
|
"Renderer",
|
||||||
"Scene",
|
"Scene",
|
||||||
"Group",
|
"Group",
|
||||||
|
"CubeCamera",
|
||||||
"AmbientLight",
|
"AmbientLight",
|
||||||
"DirectionalLight",
|
"DirectionalLight",
|
||||||
"HemisphereLight",
|
"HemisphereLight",
|
||||||
@ -2898,12 +2912,14 @@ const TroisJSVuePlugin = {
|
|||||||
"MatcapMaterial",
|
"MatcapMaterial",
|
||||||
"PhongMaterial",
|
"PhongMaterial",
|
||||||
"PhysicalMaterial",
|
"PhysicalMaterial",
|
||||||
|
"PointsMaterial",
|
||||||
"ShaderMaterial",
|
"ShaderMaterial",
|
||||||
"StandardMaterial",
|
"StandardMaterial",
|
||||||
"SubSurfaceMaterial",
|
"SubSurfaceMaterial",
|
||||||
"ToonMaterial",
|
"ToonMaterial",
|
||||||
"Texture",
|
"Texture",
|
||||||
"CubeTexture",
|
"CubeTexture",
|
||||||
|
"BufferGeometry",
|
||||||
"Mesh",
|
"Mesh",
|
||||||
"Box",
|
"Box",
|
||||||
"BoxGeometry",
|
"BoxGeometry",
|
||||||
@ -2940,6 +2956,7 @@ const TroisJSVuePlugin = {
|
|||||||
"TubeGeometry",
|
"TubeGeometry",
|
||||||
"Image",
|
"Image",
|
||||||
"InstancedMesh",
|
"InstancedMesh",
|
||||||
|
"Points",
|
||||||
"Sprite",
|
"Sprite",
|
||||||
"FBXModel",
|
"FBXModel",
|
||||||
"GLTFModel",
|
"GLTFModel",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -37,7 +37,7 @@ function bindProp(src, srcProp, dst, dstProp) {
|
|||||||
setFromProp(dst[_dstProp], value);
|
setFromProp(dst[_dstProp], value);
|
||||||
}, {deep: true});
|
}, {deep: true});
|
||||||
} else {
|
} else {
|
||||||
if (ref.value)
|
if (ref.value !== void 0)
|
||||||
dst[_dstProp] = src[srcProp];
|
dst[_dstProp] = src[srcProp];
|
||||||
watch(ref, (value) => {
|
watch(ref, (value) => {
|
||||||
dst[_dstProp] = value;
|
dst[_dstProp] = value;
|
||||||
@ -760,8 +760,9 @@ var Object3D = defineComponent({
|
|||||||
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
|
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
|
||||||
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
|
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
|
||||||
lookAt: {type: Object, default: null},
|
lookAt: {type: Object, default: null},
|
||||||
autoRemove: {type: Boolean, default: true},
|
userData: {type: Object, default: () => ({})},
|
||||||
userData: {type: Object, default: () => ({})}
|
visible: {type: Boolean, default: true},
|
||||||
|
autoRemove: {type: Boolean, default: true}
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
return {};
|
return {};
|
||||||
@ -787,6 +788,7 @@ var Object3D = defineComponent({
|
|||||||
bindProp(this, "rotation", o3d);
|
bindProp(this, "rotation", o3d);
|
||||||
bindProp(this, "scale", o3d);
|
bindProp(this, "scale", o3d);
|
||||||
bindProp(this, "userData", o3d.userData);
|
bindProp(this, "userData", o3d.userData);
|
||||||
|
bindProp(this, "visible", o3d);
|
||||||
if (this.lookAt)
|
if (this.lookAt)
|
||||||
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
|
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
|
||||||
watch(() => this.lookAt, (v) => {
|
watch(() => this.lookAt, (v) => {
|
||||||
@ -922,19 +924,26 @@ var CubeCamera = defineComponent({
|
|||||||
cubeRTSize: {type: Number, default: 256},
|
cubeRTSize: {type: Number, default: 256},
|
||||||
cubeCameraNear: {type: Number, default: 0.1},
|
cubeCameraNear: {type: Number, default: 0.1},
|
||||||
cubeCameraFar: {type: Number, default: 2e3},
|
cubeCameraFar: {type: Number, default: 2e3},
|
||||||
autoUpdate: Boolean
|
autoUpdate: Boolean,
|
||||||
|
hideMeshes: {type: Array, default: () => []}
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const rendererC = inject(RendererInjectionKey);
|
const rendererC = inject(RendererInjectionKey);
|
||||||
if (!rendererC || !rendererC.scene) {
|
if (!rendererC || !rendererC.scene) {
|
||||||
console.error("Missing Renderer / Scene");
|
console.error("Missing Renderer / Scene");
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
const renderer = rendererC.renderer, scene = rendererC.scene;
|
const renderer = rendererC.renderer, scene = rendererC.scene;
|
||||||
const cubeRT = new WebGLCubeRenderTarget(props.cubeRTSize, {format: RGBFormat, generateMipmaps: true, minFilter: LinearMipmapLinearFilter});
|
const cubeRT = new WebGLCubeRenderTarget(props.cubeRTSize, {format: RGBFormat, generateMipmaps: true, minFilter: LinearMipmapLinearFilter});
|
||||||
const cubeCamera = new CubeCamera$1(props.cubeCameraNear, props.cubeCameraFar, cubeRT);
|
const cubeCamera = new CubeCamera$1(props.cubeCameraNear, props.cubeCameraFar, cubeRT);
|
||||||
const updateRT = () => {
|
const updateRT = () => {
|
||||||
|
props.hideMeshes.forEach((m) => {
|
||||||
|
m.visible = false;
|
||||||
|
});
|
||||||
cubeCamera.update(renderer, scene);
|
cubeCamera.update(renderer, scene);
|
||||||
|
props.hideMeshes.forEach((m) => {
|
||||||
|
m.visible = true;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
if (props.autoUpdate) {
|
if (props.autoUpdate) {
|
||||||
rendererC.onBeforeRender(updateRT);
|
rendererC.onBeforeRender(updateRT);
|
||||||
@ -944,7 +953,11 @@ var CubeCamera = defineComponent({
|
|||||||
} else {
|
} else {
|
||||||
rendererC.onMounted(updateRT);
|
rendererC.onMounted(updateRT);
|
||||||
}
|
}
|
||||||
return {cubeRT, cubeCamera};
|
return {cubeRT, cubeCamera, updateRT};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if (this.cubeCamera)
|
||||||
|
this.initObject3D(this.cubeCamera);
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return [];
|
return [];
|
||||||
@ -2883,6 +2896,7 @@ const TroisJSVuePlugin = {
|
|||||||
"Renderer",
|
"Renderer",
|
||||||
"Scene",
|
"Scene",
|
||||||
"Group",
|
"Group",
|
||||||
|
"CubeCamera",
|
||||||
"AmbientLight",
|
"AmbientLight",
|
||||||
"DirectionalLight",
|
"DirectionalLight",
|
||||||
"HemisphereLight",
|
"HemisphereLight",
|
||||||
@ -2894,12 +2908,14 @@ const TroisJSVuePlugin = {
|
|||||||
"MatcapMaterial",
|
"MatcapMaterial",
|
||||||
"PhongMaterial",
|
"PhongMaterial",
|
||||||
"PhysicalMaterial",
|
"PhysicalMaterial",
|
||||||
|
"PointsMaterial",
|
||||||
"ShaderMaterial",
|
"ShaderMaterial",
|
||||||
"StandardMaterial",
|
"StandardMaterial",
|
||||||
"SubSurfaceMaterial",
|
"SubSurfaceMaterial",
|
||||||
"ToonMaterial",
|
"ToonMaterial",
|
||||||
"Texture",
|
"Texture",
|
||||||
"CubeTexture",
|
"CubeTexture",
|
||||||
|
"BufferGeometry",
|
||||||
"Mesh",
|
"Mesh",
|
||||||
"Box",
|
"Box",
|
||||||
"BoxGeometry",
|
"BoxGeometry",
|
||||||
@ -2936,6 +2952,7 @@ const TroisJSVuePlugin = {
|
|||||||
"TubeGeometry",
|
"TubeGeometry",
|
||||||
"Image",
|
"Image",
|
||||||
"InstancedMesh",
|
"InstancedMesh",
|
||||||
|
"Points",
|
||||||
"Sprite",
|
"Sprite",
|
||||||
"FBXModel",
|
"FBXModel",
|
||||||
"GLTFModel",
|
"GLTFModel",
|
||||||
|
File diff suppressed because one or more lines are too long
4
build/trois.module.cdn.min.js
vendored
4
build/trois.module.cdn.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -37,7 +37,7 @@ function bindProp(src, srcProp, dst, dstProp) {
|
|||||||
setFromProp(dst[_dstProp], value);
|
setFromProp(dst[_dstProp], value);
|
||||||
}, {deep: true});
|
}, {deep: true});
|
||||||
} else {
|
} else {
|
||||||
if (ref.value)
|
if (ref.value !== void 0)
|
||||||
dst[_dstProp] = src[srcProp];
|
dst[_dstProp] = src[srcProp];
|
||||||
watch(ref, (value) => {
|
watch(ref, (value) => {
|
||||||
dst[_dstProp] = value;
|
dst[_dstProp] = value;
|
||||||
@ -760,8 +760,9 @@ var Object3D = defineComponent({
|
|||||||
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
|
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
|
||||||
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
|
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
|
||||||
lookAt: {type: Object, default: null},
|
lookAt: {type: Object, default: null},
|
||||||
autoRemove: {type: Boolean, default: true},
|
userData: {type: Object, default: () => ({})},
|
||||||
userData: {type: Object, default: () => ({})}
|
visible: {type: Boolean, default: true},
|
||||||
|
autoRemove: {type: Boolean, default: true}
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
return {};
|
return {};
|
||||||
@ -787,6 +788,7 @@ var Object3D = defineComponent({
|
|||||||
bindProp(this, "rotation", o3d);
|
bindProp(this, "rotation", o3d);
|
||||||
bindProp(this, "scale", o3d);
|
bindProp(this, "scale", o3d);
|
||||||
bindProp(this, "userData", o3d.userData);
|
bindProp(this, "userData", o3d.userData);
|
||||||
|
bindProp(this, "visible", o3d);
|
||||||
if (this.lookAt)
|
if (this.lookAt)
|
||||||
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
|
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
|
||||||
watch(() => this.lookAt, (v) => {
|
watch(() => this.lookAt, (v) => {
|
||||||
@ -922,19 +924,26 @@ var CubeCamera = defineComponent({
|
|||||||
cubeRTSize: {type: Number, default: 256},
|
cubeRTSize: {type: Number, default: 256},
|
||||||
cubeCameraNear: {type: Number, default: 0.1},
|
cubeCameraNear: {type: Number, default: 0.1},
|
||||||
cubeCameraFar: {type: Number, default: 2e3},
|
cubeCameraFar: {type: Number, default: 2e3},
|
||||||
autoUpdate: Boolean
|
autoUpdate: Boolean,
|
||||||
|
hideMeshes: {type: Array, default: () => []}
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const rendererC = inject(RendererInjectionKey);
|
const rendererC = inject(RendererInjectionKey);
|
||||||
if (!rendererC || !rendererC.scene) {
|
if (!rendererC || !rendererC.scene) {
|
||||||
console.error("Missing Renderer / Scene");
|
console.error("Missing Renderer / Scene");
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
const renderer = rendererC.renderer, scene = rendererC.scene;
|
const renderer = rendererC.renderer, scene = rendererC.scene;
|
||||||
const cubeRT = new WebGLCubeRenderTarget(props.cubeRTSize, {format: RGBFormat, generateMipmaps: true, minFilter: LinearMipmapLinearFilter});
|
const cubeRT = new WebGLCubeRenderTarget(props.cubeRTSize, {format: RGBFormat, generateMipmaps: true, minFilter: LinearMipmapLinearFilter});
|
||||||
const cubeCamera = new CubeCamera$1(props.cubeCameraNear, props.cubeCameraFar, cubeRT);
|
const cubeCamera = new CubeCamera$1(props.cubeCameraNear, props.cubeCameraFar, cubeRT);
|
||||||
const updateRT = () => {
|
const updateRT = () => {
|
||||||
|
props.hideMeshes.forEach((m) => {
|
||||||
|
m.visible = false;
|
||||||
|
});
|
||||||
cubeCamera.update(renderer, scene);
|
cubeCamera.update(renderer, scene);
|
||||||
|
props.hideMeshes.forEach((m) => {
|
||||||
|
m.visible = true;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
if (props.autoUpdate) {
|
if (props.autoUpdate) {
|
||||||
rendererC.onBeforeRender(updateRT);
|
rendererC.onBeforeRender(updateRT);
|
||||||
@ -944,7 +953,11 @@ var CubeCamera = defineComponent({
|
|||||||
} else {
|
} else {
|
||||||
rendererC.onMounted(updateRT);
|
rendererC.onMounted(updateRT);
|
||||||
}
|
}
|
||||||
return {cubeRT, cubeCamera};
|
return {cubeRT, cubeCamera, updateRT};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if (this.cubeCamera)
|
||||||
|
this.initObject3D(this.cubeCamera);
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return [];
|
return [];
|
||||||
@ -2883,6 +2896,7 @@ const TroisJSVuePlugin = {
|
|||||||
"Renderer",
|
"Renderer",
|
||||||
"Scene",
|
"Scene",
|
||||||
"Group",
|
"Group",
|
||||||
|
"CubeCamera",
|
||||||
"AmbientLight",
|
"AmbientLight",
|
||||||
"DirectionalLight",
|
"DirectionalLight",
|
||||||
"HemisphereLight",
|
"HemisphereLight",
|
||||||
@ -2894,12 +2908,14 @@ const TroisJSVuePlugin = {
|
|||||||
"MatcapMaterial",
|
"MatcapMaterial",
|
||||||
"PhongMaterial",
|
"PhongMaterial",
|
||||||
"PhysicalMaterial",
|
"PhysicalMaterial",
|
||||||
|
"PointsMaterial",
|
||||||
"ShaderMaterial",
|
"ShaderMaterial",
|
||||||
"StandardMaterial",
|
"StandardMaterial",
|
||||||
"SubSurfaceMaterial",
|
"SubSurfaceMaterial",
|
||||||
"ToonMaterial",
|
"ToonMaterial",
|
||||||
"Texture",
|
"Texture",
|
||||||
"CubeTexture",
|
"CubeTexture",
|
||||||
|
"BufferGeometry",
|
||||||
"Mesh",
|
"Mesh",
|
||||||
"Box",
|
"Box",
|
||||||
"BoxGeometry",
|
"BoxGeometry",
|
||||||
@ -2936,6 +2952,7 @@ const TroisJSVuePlugin = {
|
|||||||
"TubeGeometry",
|
"TubeGeometry",
|
||||||
"Image",
|
"Image",
|
||||||
"InstancedMesh",
|
"InstancedMesh",
|
||||||
|
"Points",
|
||||||
"Sprite",
|
"Sprite",
|
||||||
"FBXModel",
|
"FBXModel",
|
||||||
"GLTFModel",
|
"GLTFModel",
|
||||||
|
File diff suppressed because one or more lines are too long
8
build/trois.module.min.js
vendored
8
build/trois.module.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "troisjs",
|
"name": "troisjs",
|
||||||
"version": "0.3.0-beta.4",
|
"version": "0.3.0-beta.5",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"types": "tsc",
|
"types": "tsc",
|
||||||
|
Loading…
Reference in New Issue
Block a user