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

meshes cleanup

This commit is contained in:
Kevin Levron 2020-09-28 16:18:57 +02:00
parent bf7d30b7bb
commit f8cc0fb429
15 changed files with 14 additions and 43 deletions

View File

@ -9,7 +9,6 @@ export default {
segments: { type: Number, default: 8 }, segments: { type: Number, default: 8 },
thetaStart: { type: Number, default: 0 }, thetaStart: { type: Number, default: 0 },
thetaLength: { type: Number, default: Math.PI * 2 }, thetaLength: { type: Number, default: Math.PI * 2 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -12,7 +12,6 @@ export default {
openEnded: { type: Boolean, default: false }, openEnded: { type: Boolean, default: false },
thetaStart: { type: Number, default: 0 }, thetaStart: { type: Number, default: 0 },
thetaLength: { type: Number, default: Math.PI * 2 }, thetaLength: { type: Number, default: Math.PI * 2 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -13,7 +13,6 @@ export default {
openEnded: { type: Boolean, default: false }, openEnded: { type: Boolean, default: false },
thetaStart: { type: Number, default: 0 }, thetaStart: { type: Number, default: 0 },
thetaLength: { type: Number, default: Math.PI * 2 }, thetaLength: { type: Number, default: Math.PI * 2 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -7,7 +7,6 @@ export default {
props: { props: {
radius: { type: Number, default: 1 }, radius: { type: Number, default: 1 },
detail: { type: Number, default: 0 }, detail: { type: Number, default: 0 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -7,7 +7,6 @@ export default {
props: { props: {
radius: { type: Number, default: 1 }, radius: { type: Number, default: 1 },
detail: { type: Number, default: 0 }, detail: { type: Number, default: 0 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -9,7 +9,6 @@ export default {
segments: { type: Number, default: 12 }, segments: { type: Number, default: 12 },
phiStart: { type: Number, default: 0 }, phiStart: { type: Number, default: 0 },
phiLength: { type: Number, default: Math.PI * 2 }, phiLength: { type: Number, default: Math.PI * 2 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -7,7 +7,6 @@ export default {
props: { props: {
radius: { type: Number, default: 1 }, radius: { type: Number, default: 1 },
detail: { type: Number, default: 0 }, detail: { type: Number, default: 0 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -1,34 +1,24 @@
import { PlaneBufferGeometry } from 'three'; import { PlaneBufferGeometry } from 'three';
import { watch } from 'vue';
import Mesh from './Mesh.js'; import Mesh from './Mesh.js';
export default { export default {
extends: Mesh, extends: Mesh,
props: { props: {
width: { width: { type: Number, default: 1 },
type: Number, height: { type: Number, default: 1 },
default: 1, widthSegments: { type: Number, default: 1 },
}, heightSegments: { type: Number, default: 1 },
height: {
type: Number,
default: 1,
},
widthSegments: {
type: Number,
default: 1,
},
heightSegments: {
type: Number,
default: 1,
},
},
watch: {
width() { this.refreshGeometry(); },
height() { this.refreshGeometry(); },
widthSegments() { this.refreshGeometry(); },
heightSegments() { this.refreshGeometry(); },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();
const watchProps = ['width', 'height', 'widthSegments', 'heightSegments'];
watchProps.forEach(prop => {
watch(() => this[prop], () => {
this.refreshGeometry();
});
});
}, },
methods: { methods: {
createGeometry() { createGeometry() {

View File

@ -7,7 +7,6 @@ export default {
props: { props: {
radius: { type: Number, default: 1 }, radius: { type: Number, default: 1 },
detail: { type: Number, default: 0 }, detail: { type: Number, default: 0 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -11,7 +11,6 @@ export default {
phiSegments: { type: Number, default: 1 }, phiSegments: { type: Number, default: 1 },
thetaStart: { type: Number, default: 0 }, thetaStart: { type: Number, default: 0 },
thetaLength: { type: Number, default: Math.PI * 2 }, thetaLength: { type: Number, default: Math.PI * 2 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -5,14 +5,8 @@ export default {
extends: Mesh, extends: Mesh,
props: { props: {
radius: Number, radius: Number,
widthSegments: { widthSegments: { type: Number, default: 12 },
type: Number, heightSegments: { type: Number, default: 12 },
default: 12,
},
heightSegments: {
type: Number,
default: 12,
},
}, },
watch: { watch: {
radius() { this.refreshGeometry(); }, radius() { this.refreshGeometry(); },

View File

@ -7,7 +7,6 @@ export default {
props: { props: {
radius: { type: Number, default: 1 }, radius: { type: Number, default: 1 },
detail: { type: Number, default: 0 }, detail: { type: Number, default: 0 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -10,7 +10,6 @@ export default {
radialSegments: { type: Number, default: 8 }, radialSegments: { type: Number, default: 8 },
tubularSegments: { type: Number, default: 6 }, tubularSegments: { type: Number, default: 6 },
arc: { type: Number, default: Math.PI * 2 }, arc: { type: Number, default: Math.PI * 2 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -11,7 +11,6 @@ export default {
tubularSegments: { type: Number, default: 8 }, tubularSegments: { type: Number, default: 8 },
p: { type: Number, default: 2 }, p: { type: Number, default: 2 },
q: { type: Number, default: 3 }, q: { type: Number, default: 3 },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();

View File

@ -10,7 +10,6 @@ export default {
radius: { type: Number, default: 1 }, radius: { type: Number, default: 1 },
radialSegments: { type: Number, default: 8 }, radialSegments: { type: Number, default: 8 },
closed: { type: Boolean, default: false }, closed: { type: Boolean, default: false },
}, },
created() { created() {
this.createGeometry(); this.createGeometry();