1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

updated tools location

This commit is contained in:
Sander Moolin 2021-03-25 09:24:30 -04:00
parent e622bedc6d
commit abbe3d433c
23 changed files with 28 additions and 26 deletions

View File

@ -1,7 +1,7 @@
import { DoubleSide, Mesh, MeshStandardMaterial, PlaneGeometry } from 'three'; import { DoubleSide, Mesh, MeshStandardMaterial, PlaneGeometry } from 'three';
import { watch } from 'vue'; import { watch } from 'vue';
import Object3D from '../../core/Object3D.js'; import Object3D from '../../core/Object3D.js';
import { bindProps } from '../../tools.js'; import { bindProps } from '../../tools';
import LiquidEffect from './LiquidEffect.js'; import LiquidEffect from './LiquidEffect.js';
export default { export default {

View File

@ -14,7 +14,7 @@ import Camera from '../../core/PerspectiveCamera.js';
import Renderer from '../../core/Renderer.js'; import Renderer from '../../core/Renderer.js';
import Scene from '../../core/Scene.js'; import Scene from '../../core/Scene.js';
import { lerp } from '../../tools.js'; import { lerp } from '../../tools';
import AnimatedPlane from './AnimatedPlane.js'; import AnimatedPlane from './AnimatedPlane.js';
import useTextures from '../../use/useTextures'; import useTextures from '../../use/useTextures';

View File

@ -13,7 +13,7 @@ import OrthographicCamera from '../../core/OrthographicCamera.js';
import Renderer from '../../core/Renderer.js'; import Renderer from '../../core/Renderer.js';
import Scene from '../../core/Scene.js'; import Scene from '../../core/Scene.js';
import { lerp, lerpv2 } from '../../tools.js'; import { lerp, lerpv2 } from '../../tools';
import ZoomBlurImage from './ZoomBlurImage.js'; import ZoomBlurImage from './ZoomBlurImage.js';
import useTextures from '../../use/useTextures.js'; import useTextures from '../../use/useTextures.js';

View File

@ -1,5 +1,5 @@
import { watch } from 'vue'; import { watch } from 'vue';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools/index.js';
export default { export default {
name: 'Object3D', name: 'Object3D',
@ -10,7 +10,9 @@ export default {
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 } }, scale: { type: Object, default: { x: 1, y: 1, z: 1 } },
lookAt: { type: Object, default: null }, lookAt: { type: Object, default: null },
onPointerEnter: { type: Function, default: null } onPointerEnter: { type: Function, default: null },
onPointerOver: { type: Function, default: null },
onPointerLeave: { type: Function, default: null }
}, },
// can't use setup because it will not be used in sub components // can't use setup because it will not be used in sub components
// setup() {}, // setup() {},
@ -30,8 +32,8 @@ export default {
if (this.lookAt) this.o3d.lookAt(this.lookAt.x, this.lookAt.y, this.lookAt.z); if (this.lookAt) this.o3d.lookAt(this.lookAt.x, this.lookAt.y, this.lookAt.z);
watch(() => this.lookAt, (v) => { this.o3d.lookAt(v.x, v.y, v.z); }, { deep: true }); watch(() => this.lookAt, (v) => { this.o3d.lookAt(v.x, v.y, v.z); }, { deep: true });
if (this.onPointerEnter) { if (this.onPointerEnter || this.onPointerOver || this.onPointerLeave) {
this.three.onBeforeRender(this.raycastEnter) this.three.onBeforeRender(this.pointerHandler)
} }
// find first viable parent // find first viable parent
@ -49,7 +51,7 @@ export default {
}, },
add(o) { this.o3d.add(o); }, add(o) { this.o3d.add(o); },
remove(o) { this.o3d.remove(o); }, remove(o) { this.o3d.remove(o); },
raycastEnter() { pointerHandler() {
this.three.raycaster.setFromCamera(this.three.mouse, this.three.camera) this.three.raycaster.setFromCamera(this.three.mouse, this.three.camera)
const intersects = this.three.raycaster.intersectObjects([this.o3d]) const intersects = this.three.raycaster.intersectObjects([this.o3d])
if (intersects.length) { if (intersects.length) {

View File

@ -1,6 +1,6 @@
import { OrthographicCamera } from 'three'; import { OrthographicCamera } from 'three';
import { watch } from 'vue'; import { watch } from 'vue';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools';
import Camera from './Camera.js'; import Camera from './Camera.js';
export default { export default {

View File

@ -1,6 +1,6 @@
import { PerspectiveCamera } from 'three'; import { PerspectiveCamera } from 'three';
import { watch } from 'vue'; import { watch } from 'vue';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools';
import Camera from './Camera.js'; import Camera from './Camera.js';
export default { export default {

View File

@ -3,7 +3,7 @@ import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
import { watch } from 'vue'; import { watch } from 'vue';
import EffectPass from './EffectPass.js'; import EffectPass from './EffectPass.js';
import TiltShift from '../shaders/TiltShift.js'; import TiltShift from '../shaders/TiltShift.js';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools';
export default { export default {
extends: EffectPass, extends: EffectPass,

View File

@ -1,7 +1,7 @@
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js'; import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
import EffectPass from './EffectPass.js'; import EffectPass from './EffectPass.js';
import ZoomBlur from '../shaders/ZoomBlur.js'; import ZoomBlur from '../shaders/ZoomBlur.js';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools';
export default { export default {
extends: EffectPass, extends: EffectPass,

View File

@ -8,4 +8,4 @@ export * from './effects/index.js';
// export * from './components/index.js'; // export * from './components/index.js';
export * from './tools.js'; export * from './tools';

View File

@ -1,6 +1,6 @@
import { watch } from 'vue'; import { watch } from 'vue';
import Object3D from '../core/Object3D.js'; import Object3D from '../core/Object3D.js';
import { bindProp, setFromProp } from '../tools.js'; import { bindProp, setFromProp } from '../tools';
export default { export default {
extends: Object3D, extends: Object3D,

View File

@ -1,5 +1,5 @@
import { MeshBasicMaterial } from 'three'; import { MeshBasicMaterial } from 'three';
import { bindProps, propsValues } from '../tools.js'; import { bindProps, propsValues } from '../tools';
import Material, { wireframeProps } from './Material'; import Material, { wireframeProps } from './Material';
export default { export default {

View File

@ -1,5 +1,5 @@
import { MeshLambertMaterial } from 'three'; import { MeshLambertMaterial } from 'three';
import { bindProps, propsValues } from '../tools.js'; import { bindProps, propsValues } from '../tools';
import Material, { wireframeProps } from './Material'; import Material, { wireframeProps } from './Material';
export default { export default {

View File

@ -1,6 +1,6 @@
import { MeshMatcapMaterial, TextureLoader } from 'three'; import { MeshMatcapMaterial, TextureLoader } from 'three';
// import { watch } from 'vue'; // import { watch } from 'vue';
import { propsValues, getMatcapUrl } from '../tools.js'; import { propsValues, getMatcapUrl } from '../tools';
import Material from './Material'; import Material from './Material';
export default { export default {

View File

@ -1,6 +1,6 @@
import { MeshPhongMaterial } from 'three'; import { MeshPhongMaterial } from 'three';
import { watch } from 'vue'; import { watch } from 'vue';
import { bindProps, propsValues } from '../tools.js'; import { bindProps, propsValues } from '../tools';
import Material, { wireframeProps } from './Material'; import Material, { wireframeProps } from './Material';
export default { export default {

View File

@ -1,5 +1,5 @@
import { MeshPhysicalMaterial } from 'three'; import { MeshPhysicalMaterial } from 'three';
import { propsValues } from '../tools.js'; import { propsValues } from '../tools';
import StandardMaterial from './StandardMaterial'; import StandardMaterial from './StandardMaterial';
export default { export default {

View File

@ -1,6 +1,6 @@
import { ShaderMaterial } from 'three'; import { ShaderMaterial } from 'three';
import { watch } from 'vue'; import { watch } from 'vue';
import { propsValues, defaultFragmentShader, defaultVertexShader } from '../tools.js'; import { propsValues, defaultFragmentShader, defaultVertexShader } from '../tools';
export default { export default {
inject: ['three', 'mesh'], inject: ['three', 'mesh'],

View File

@ -1,6 +1,6 @@
import { MeshStandardMaterial } from 'three'; import { MeshStandardMaterial } from 'three';
import { watch } from 'vue'; import { watch } from 'vue';
import { bindProp, bindProps, propsValues } from '../tools.js'; import { bindProp, bindProps, propsValues } from '../tools';
import Material, { wireframeProps } from './Material'; import Material, { wireframeProps } from './Material';
const props = { const props = {

View File

@ -1,6 +1,6 @@
import { ClampToEdgeWrapping, LinearFilter, LinearMipmapLinearFilter, TextureLoader, UVMapping } from 'three'; import { ClampToEdgeWrapping, LinearFilter, LinearMipmapLinearFilter, TextureLoader, UVMapping } from 'three';
import { watch } from 'vue'; import { watch } from 'vue';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools';
export default { export default {
inject: ['material'], inject: ['material'],

View File

@ -1,5 +1,5 @@
import { MeshToonMaterial } from 'three'; import { MeshToonMaterial } from 'three';
import { bindProps, propsValues } from '../tools.js'; import { bindProps, propsValues } from '../tools';
import Material, { wireframeProps } from './Material'; import Material, { wireframeProps } from './Material';
export default { export default {

View File

@ -8,7 +8,7 @@ import {
WebGLCubeRenderTarget, WebGLCubeRenderTarget,
} from 'three'; } from 'three';
import Mesh from './Mesh.js'; import Mesh from './Mesh.js';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools';
export default { export default {
extends: Mesh, extends: Mesh,

View File

@ -1,6 +1,6 @@
import { InstancedMesh } from 'three'; import { InstancedMesh } from 'three';
import Object3D from '../core/Object3D.js'; import Object3D from '../core/Object3D.js';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools';
export default { export default {
extends: Object3D, extends: Object3D,

View File

@ -6,7 +6,7 @@ import {
WebGLCubeRenderTarget, WebGLCubeRenderTarget,
} from 'three'; } from 'three';
import Mesh from './Mesh.js'; import Mesh from './Mesh.js';
import { bindProp } from '../tools.js'; import { bindProp } from '../tools';
export default { export default {
extends: Mesh, extends: Mesh,