mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
defineComponent for lights (#10)
This commit is contained in:
parent
8eff7c1728
commit
09290f9d88
@ -1,11 +1,12 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { AmbientLight } from 'three';
|
import { AmbientLight } from 'three';
|
||||||
import Light from './Light.js';
|
import Light from './Light.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Light,
|
extends: Light,
|
||||||
created() {
|
created() {
|
||||||
this.light = new AmbientLight(this.color, this.intensity);
|
this.light = new AmbientLight(this.color, this.intensity);
|
||||||
this.initLight();
|
this.initLight();
|
||||||
},
|
},
|
||||||
__hmrId: 'AmbientLight',
|
__hmrId: 'AmbientLight',
|
||||||
};
|
});
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { DirectionalLight } from 'three';
|
import { DirectionalLight } from 'three';
|
||||||
import Light from './Light.js';
|
import Light from './Light.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Light,
|
extends: Light,
|
||||||
props: {
|
props: {
|
||||||
target: Object,
|
target: Object,
|
||||||
@ -11,4 +12,4 @@ export default {
|
|||||||
this.initLight();
|
this.initLight();
|
||||||
},
|
},
|
||||||
__hmrId: 'DirectionalLight',
|
__hmrId: 'DirectionalLight',
|
||||||
};
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
import { defineComponent, watch } from 'vue';
|
||||||
import { HemisphereLight } from 'three';
|
import { HemisphereLight } from 'three';
|
||||||
import { watch } from 'vue';
|
|
||||||
import Light from './Light.js';
|
import Light from './Light.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Light,
|
extends: Light,
|
||||||
props: {
|
props: {
|
||||||
groundColor: { type: String, default: '#444444' },
|
groundColor: { type: String, default: '#444444' },
|
||||||
@ -13,4 +13,4 @@ export default {
|
|||||||
this.initLight();
|
this.initLight();
|
||||||
},
|
},
|
||||||
__hmrId: 'HemisphereLight',
|
__hmrId: 'HemisphereLight',
|
||||||
};
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { watch } from 'vue';
|
import { defineComponent, watch } from 'vue';
|
||||||
import Object3D from '../core/Object3D.js';
|
import Object3D from '../core/Object3D.js';
|
||||||
import { bindProp, setFromProp } from '../tools';
|
import { bindProp, setFromProp } from '../tools';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Object3D,
|
extends: Object3D,
|
||||||
name: 'Light',
|
name: 'Light',
|
||||||
props: {
|
props: {
|
||||||
@ -44,4 +44,4 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
__hmrId: 'Light',
|
__hmrId: 'Light',
|
||||||
};
|
});
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { PointLight } from 'three';
|
import { PointLight } from 'three';
|
||||||
import Light from './Light.js';
|
import Light from './Light.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Light,
|
extends: Light,
|
||||||
props: {
|
props: {
|
||||||
distance: {
|
distance: {
|
||||||
@ -18,4 +19,4 @@ export default {
|
|||||||
this.initLight();
|
this.initLight();
|
||||||
},
|
},
|
||||||
__hmrId: 'PointLight',
|
__hmrId: 'PointLight',
|
||||||
};
|
});
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
import { defineComponent, watch } from 'vue';
|
||||||
import { RectAreaLight } from 'three';
|
import { RectAreaLight } from 'three';
|
||||||
import { RectAreaLightUniformsLib } from 'three/examples/jsm/lights/RectAreaLightUniformsLib.js';
|
import { RectAreaLightUniformsLib } from 'three/examples/jsm/lights/RectAreaLightUniformsLib.js';
|
||||||
import { RectAreaLightHelper } from 'three/examples/jsm/helpers/RectAreaLightHelper.js';
|
import { RectAreaLightHelper } from 'three/examples/jsm/helpers/RectAreaLightHelper.js';
|
||||||
import { watch } from 'vue';
|
|
||||||
import Light from './Light.js';
|
import Light from './Light.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Light,
|
extends: Light,
|
||||||
props: {
|
props: {
|
||||||
width: { type: Number, default: 10 },
|
width: { type: Number, default: 10 },
|
||||||
@ -32,4 +32,4 @@ export default {
|
|||||||
if (this.lightHelper) this.removeFromParent(this.lightHelper);
|
if (this.lightHelper) this.removeFromParent(this.lightHelper);
|
||||||
},
|
},
|
||||||
__hmrId: 'RectAreaLight',
|
__hmrId: 'RectAreaLight',
|
||||||
};
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
import { defineComponent, watch } from 'vue';
|
||||||
import { SpotLight } from 'three';
|
import { SpotLight } from 'three';
|
||||||
import { watch } from 'vue';
|
|
||||||
import Light from './Light.js';
|
import Light from './Light.js';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Light,
|
extends: Light,
|
||||||
props: {
|
props: {
|
||||||
angle: { type: Number, default: Math.PI / 3 },
|
angle: { type: Number, default: Math.PI / 3 },
|
||||||
@ -21,4 +21,4 @@ export default {
|
|||||||
this.initLight();
|
this.initLight();
|
||||||
},
|
},
|
||||||
__hmrId: 'SpotLight',
|
__hmrId: 'SpotLight',
|
||||||
};
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user