1
0
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:
Kevin Levron 2021-04-30 18:44:59 +02:00
parent 8801b9bac5
commit 1c9124d14e
12 changed files with 495 additions and 236 deletions

620
build/trois.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,7 @@ function bindProp(src, srcProp, dst, dstProp) {
setFromProp(dst[_dstProp], value);
}, {deep: true});
} else {
if (ref.value)
if (ref.value !== void 0)
dst[_dstProp] = src[srcProp];
vue.watch(ref, (value) => {
dst[_dstProp] = value;
@ -764,8 +764,9 @@ var Object3D = vue.defineComponent({
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
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() {
return {};
@ -791,6 +792,7 @@ var Object3D = vue.defineComponent({
bindProp(this, "rotation", o3d);
bindProp(this, "scale", o3d);
bindProp(this, "userData", o3d.userData);
bindProp(this, "visible", o3d);
if (this.lookAt)
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
vue.watch(() => this.lookAt, (v) => {
@ -926,19 +928,26 @@ var CubeCamera = vue.defineComponent({
cubeRTSize: {type: Number, default: 256},
cubeCameraNear: {type: Number, default: 0.1},
cubeCameraFar: {type: Number, default: 2e3},
autoUpdate: Boolean
autoUpdate: Boolean,
hideMeshes: {type: Array, default: () => []}
},
setup(props) {
const rendererC = vue.inject(RendererInjectionKey);
if (!rendererC || !rendererC.scene) {
console.error("Missing Renderer / Scene");
return;
return {};
}
const renderer = rendererC.renderer, scene = rendererC.scene;
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 updateRT = () => {
props.hideMeshes.forEach((m) => {
m.visible = false;
});
cubeCamera.update(renderer, scene);
props.hideMeshes.forEach((m) => {
m.visible = true;
});
};
if (props.autoUpdate) {
rendererC.onBeforeRender(updateRT);
@ -948,7 +957,11 @@ var CubeCamera = vue.defineComponent({
} else {
rendererC.onMounted(updateRT);
}
return {cubeRT, cubeCamera};
return {cubeRT, cubeCamera, updateRT};
},
created() {
if (this.cubeCamera)
this.initObject3D(this.cubeCamera);
},
render() {
return [];
@ -2887,6 +2900,7 @@ const TroisJSVuePlugin = {
"Renderer",
"Scene",
"Group",
"CubeCamera",
"AmbientLight",
"DirectionalLight",
"HemisphereLight",
@ -2898,12 +2912,14 @@ const TroisJSVuePlugin = {
"MatcapMaterial",
"PhongMaterial",
"PhysicalMaterial",
"PointsMaterial",
"ShaderMaterial",
"StandardMaterial",
"SubSurfaceMaterial",
"ToonMaterial",
"Texture",
"CubeTexture",
"BufferGeometry",
"Mesh",
"Box",
"BoxGeometry",
@ -2940,6 +2956,7 @@ const TroisJSVuePlugin = {
"TubeGeometry",
"Image",
"InstancedMesh",
"Points",
"Sprite",
"FBXModel",
"GLTFModel",

File diff suppressed because one or more lines are too long

View File

@ -37,7 +37,7 @@ function bindProp(src, srcProp, dst, dstProp) {
setFromProp(dst[_dstProp], value);
}, {deep: true});
} else {
if (ref.value)
if (ref.value !== void 0)
dst[_dstProp] = src[srcProp];
watch(ref, (value) => {
dst[_dstProp] = value;
@ -760,8 +760,9 @@ var Object3D = defineComponent({
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
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() {
return {};
@ -787,6 +788,7 @@ var Object3D = defineComponent({
bindProp(this, "rotation", o3d);
bindProp(this, "scale", o3d);
bindProp(this, "userData", o3d.userData);
bindProp(this, "visible", o3d);
if (this.lookAt)
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
watch(() => this.lookAt, (v) => {
@ -922,19 +924,26 @@ var CubeCamera = defineComponent({
cubeRTSize: {type: Number, default: 256},
cubeCameraNear: {type: Number, default: 0.1},
cubeCameraFar: {type: Number, default: 2e3},
autoUpdate: Boolean
autoUpdate: Boolean,
hideMeshes: {type: Array, default: () => []}
},
setup(props) {
const rendererC = inject(RendererInjectionKey);
if (!rendererC || !rendererC.scene) {
console.error("Missing Renderer / Scene");
return;
return {};
}
const renderer = rendererC.renderer, scene = rendererC.scene;
const cubeRT = new WebGLCubeRenderTarget(props.cubeRTSize, {format: RGBFormat, generateMipmaps: true, minFilter: LinearMipmapLinearFilter});
const cubeCamera = new CubeCamera$1(props.cubeCameraNear, props.cubeCameraFar, cubeRT);
const updateRT = () => {
props.hideMeshes.forEach((m) => {
m.visible = false;
});
cubeCamera.update(renderer, scene);
props.hideMeshes.forEach((m) => {
m.visible = true;
});
};
if (props.autoUpdate) {
rendererC.onBeforeRender(updateRT);
@ -944,7 +953,11 @@ var CubeCamera = defineComponent({
} else {
rendererC.onMounted(updateRT);
}
return {cubeRT, cubeCamera};
return {cubeRT, cubeCamera, updateRT};
},
created() {
if (this.cubeCamera)
this.initObject3D(this.cubeCamera);
},
render() {
return [];
@ -2883,6 +2896,7 @@ const TroisJSVuePlugin = {
"Renderer",
"Scene",
"Group",
"CubeCamera",
"AmbientLight",
"DirectionalLight",
"HemisphereLight",
@ -2894,12 +2908,14 @@ const TroisJSVuePlugin = {
"MatcapMaterial",
"PhongMaterial",
"PhysicalMaterial",
"PointsMaterial",
"ShaderMaterial",
"StandardMaterial",
"SubSurfaceMaterial",
"ToonMaterial",
"Texture",
"CubeTexture",
"BufferGeometry",
"Mesh",
"Box",
"BoxGeometry",
@ -2936,6 +2952,7 @@ const TroisJSVuePlugin = {
"TubeGeometry",
"Image",
"InstancedMesh",
"Points",
"Sprite",
"FBXModel",
"GLTFModel",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -37,7 +37,7 @@ function bindProp(src, srcProp, dst, dstProp) {
setFromProp(dst[_dstProp], value);
}, {deep: true});
} else {
if (ref.value)
if (ref.value !== void 0)
dst[_dstProp] = src[srcProp];
watch(ref, (value) => {
dst[_dstProp] = value;
@ -760,8 +760,9 @@ var Object3D = defineComponent({
rotation: {type: Object, default: () => ({x: 0, y: 0, z: 0})},
scale: {type: Object, default: () => ({x: 1, y: 1, z: 1, order: "XYZ"})},
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() {
return {};
@ -787,6 +788,7 @@ var Object3D = defineComponent({
bindProp(this, "rotation", o3d);
bindProp(this, "scale", o3d);
bindProp(this, "userData", o3d.userData);
bindProp(this, "visible", o3d);
if (this.lookAt)
o3d.lookAt((_a = this.lookAt.x) != null ? _a : 0, this.lookAt.y, this.lookAt.z);
watch(() => this.lookAt, (v) => {
@ -922,19 +924,26 @@ var CubeCamera = defineComponent({
cubeRTSize: {type: Number, default: 256},
cubeCameraNear: {type: Number, default: 0.1},
cubeCameraFar: {type: Number, default: 2e3},
autoUpdate: Boolean
autoUpdate: Boolean,
hideMeshes: {type: Array, default: () => []}
},
setup(props) {
const rendererC = inject(RendererInjectionKey);
if (!rendererC || !rendererC.scene) {
console.error("Missing Renderer / Scene");
return;
return {};
}
const renderer = rendererC.renderer, scene = rendererC.scene;
const cubeRT = new WebGLCubeRenderTarget(props.cubeRTSize, {format: RGBFormat, generateMipmaps: true, minFilter: LinearMipmapLinearFilter});
const cubeCamera = new CubeCamera$1(props.cubeCameraNear, props.cubeCameraFar, cubeRT);
const updateRT = () => {
props.hideMeshes.forEach((m) => {
m.visible = false;
});
cubeCamera.update(renderer, scene);
props.hideMeshes.forEach((m) => {
m.visible = true;
});
};
if (props.autoUpdate) {
rendererC.onBeforeRender(updateRT);
@ -944,7 +953,11 @@ var CubeCamera = defineComponent({
} else {
rendererC.onMounted(updateRT);
}
return {cubeRT, cubeCamera};
return {cubeRT, cubeCamera, updateRT};
},
created() {
if (this.cubeCamera)
this.initObject3D(this.cubeCamera);
},
render() {
return [];
@ -2883,6 +2896,7 @@ const TroisJSVuePlugin = {
"Renderer",
"Scene",
"Group",
"CubeCamera",
"AmbientLight",
"DirectionalLight",
"HemisphereLight",
@ -2894,12 +2908,14 @@ const TroisJSVuePlugin = {
"MatcapMaterial",
"PhongMaterial",
"PhysicalMaterial",
"PointsMaterial",
"ShaderMaterial",
"StandardMaterial",
"SubSurfaceMaterial",
"ToonMaterial",
"Texture",
"CubeTexture",
"BufferGeometry",
"Mesh",
"Box",
"BoxGeometry",
@ -2936,6 +2952,7 @@ const TroisJSVuePlugin = {
"TubeGeometry",
"Image",
"InstancedMesh",
"Points",
"Sprite",
"FBXModel",
"GLTFModel",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "troisjs",
"version": "0.3.0-beta.4",
"version": "0.3.0-beta.5",
"scripts": {
"dev": "vite",
"types": "tsc",