mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
add meshes (generated code)
This commit is contained in:
parent
3d917f30aa
commit
8bc88a2147
30
src/meshes/Circle.js
Normal file
30
src/meshes/Circle.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { CircleBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
segments: { type: Number, default: 8 },
|
||||||
|
thetaStart: { type: Number, default: 0 },
|
||||||
|
thetaLength: { type: Number, default: Math.PI * 2 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'segments', 'thetaStart', 'thetaLength'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new CircleBufferGeometry(this.radius, this.segments, this.thetaStart, this.thetaLength);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Circle',
|
||||||
|
};
|
33
src/meshes/Cone.js
Normal file
33
src/meshes/Cone.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { ConeBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
height: { type: Number, default: 1 },
|
||||||
|
radialSegments: { type: Number, default: 8 },
|
||||||
|
heightSegments: { type: Number, default: 1 },
|
||||||
|
openEnded: { type: Boolean, default: false },
|
||||||
|
thetaStart: { type: Number, default: 0 },
|
||||||
|
thetaLength: { type: Number, default: Math.PI * 2 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'height', 'radialSegments', 'heightSegments', 'openEnded', 'thetaStart', 'thetaLength'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new ConeBufferGeometry(this.radius, this.height, this.radialSegments, this.heightSegments, this.openEnded, this.thetaStart, this.thetaLength);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Cone',
|
||||||
|
};
|
34
src/meshes/Cylinder.js
Normal file
34
src/meshes/Cylinder.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { CylinderBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radiusTop: { type: Number, default: 1 },
|
||||||
|
radiusBottom: { type: Number, default: 1 },
|
||||||
|
height: { type: Number, default: 1 },
|
||||||
|
radialSegments: { type: Number, default: 8 },
|
||||||
|
heightSegments: { type: Number, default: 1 },
|
||||||
|
openEnded: { type: Boolean, default: false },
|
||||||
|
thetaStart: { type: Number, default: 0 },
|
||||||
|
thetaLength: { type: Number, default: Math.PI * 2 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radiusTop', 'radiusBottom', 'height', 'radialSegments', 'heightSegments', 'openEnded', 'thetaStart', 'thetaLength'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new CylinderBufferGeometry(this.radiusTop, this.radiusBottom, this.height, this.radialSegments, this.heightSegments, this.openEnded, this.thetaStart, this.thetaLength);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Cylinder',
|
||||||
|
};
|
28
src/meshes/Dodecahedron.js
Normal file
28
src/meshes/Dodecahedron.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { DodecahedronBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
detail: { type: Number, default: 0 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'detail'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new DodecahedronBufferGeometry(this.radius, this.detail);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Dodecahedron',
|
||||||
|
};
|
28
src/meshes/Icosahedron.js
Normal file
28
src/meshes/Icosahedron.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { IcosahedronBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
detail: { type: Number, default: 0 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'detail'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new IcosahedronBufferGeometry(this.radius, this.detail);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Icosahedron',
|
||||||
|
};
|
30
src/meshes/Lathe.js
Normal file
30
src/meshes/Lathe.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { LatheBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
points: Array,
|
||||||
|
segments: { type: Number, default: 12 },
|
||||||
|
phiStart: { type: Number, default: 0 },
|
||||||
|
phiLength: { type: Number, default: Math.PI * 2 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['points', 'segments', 'phiStart', 'phiLength'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new LatheBufferGeometry(this.points, this.segments, this.phiStart, this.phiLength);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Lathe',
|
||||||
|
};
|
28
src/meshes/Octahedron.js
Normal file
28
src/meshes/Octahedron.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { OctahedronBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
detail: { type: Number, default: 0 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'detail'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new OctahedronBufferGeometry(this.radius, this.detail);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Octahedron',
|
||||||
|
};
|
28
src/meshes/Polyhedron.js
Normal file
28
src/meshes/Polyhedron.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { PolyhedronBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
detail: { type: Number, default: 0 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'detail'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new PolyhedronBufferGeometry(this.radius, this.detail);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Polyhedron',
|
||||||
|
};
|
32
src/meshes/Ring.js
Normal file
32
src/meshes/Ring.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { RingBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
innerRadius: { type: Number, default: 0.5 },
|
||||||
|
outerRadius: { type: Number, default: 1 },
|
||||||
|
thetaSegments: { type: Number, default: 8 },
|
||||||
|
phiSegments: { type: Number, default: 1 },
|
||||||
|
thetaStart: { type: Number, default: 0 },
|
||||||
|
thetaLength: { type: Number, default: Math.PI * 2 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['innerRadius', 'outerRadius', 'thetaSegments', 'phiSegments', 'thetaStart', 'thetaLength'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new RingBufferGeometry(this.innerRadius, this.outerRadius, this.thetaSegments, this.phiSegments, this.thetaStart, this.thetaLength);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Ring',
|
||||||
|
};
|
28
src/meshes/Tetrahedron.js
Normal file
28
src/meshes/Tetrahedron.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { TetrahedronBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
detail: { type: Number, default: 0 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'detail'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new TetrahedronBufferGeometry(this.radius, this.detail);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Tetrahedron',
|
||||||
|
};
|
31
src/meshes/Torus.js
Normal file
31
src/meshes/Torus.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { TorusBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
tube: { type: Number, default: 0.4 },
|
||||||
|
radialSegments: { type: Number, default: 8 },
|
||||||
|
tubularSegments: { type: Number, default: 6 },
|
||||||
|
arc: { type: Number, default: Math.PI * 2 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'tube', 'radialSegments', 'tubularSegments', 'arc'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new TorusBufferGeometry(this.radius, this.tube, this.radialSegments, this.tubularSegments, this.arc);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Torus',
|
||||||
|
};
|
32
src/meshes/TorusKnot.js
Normal file
32
src/meshes/TorusKnot.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { TorusKnotBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
tube: { type: Number, default: 0.4 },
|
||||||
|
radialSegments: { type: Number, default: 64 },
|
||||||
|
tubularSegments: { type: Number, default: 8 },
|
||||||
|
p: { type: Number, default: 2 },
|
||||||
|
q: { type: Number, default: 3 },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['radius', 'tube', 'radialSegments', 'tubularSegments', 'p', 'q'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new TorusKnotBufferGeometry(this.radius, this.tube, this.radialSegments, this.tubularSegments, this.p, this.q);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'TorusKnot',
|
||||||
|
};
|
31
src/meshes/Tube.js
Normal file
31
src/meshes/Tube.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { Curve, TubeBufferGeometry } from 'three';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import Mesh from './Mesh.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
extends: Mesh,
|
||||||
|
props: {
|
||||||
|
path: Curve,
|
||||||
|
tubularSegments: { type: Number, default: 64 },
|
||||||
|
radius: { type: Number, default: 1 },
|
||||||
|
radialSegments: { type: Number, default: 8 },
|
||||||
|
closed: { type: Boolean, default: false },
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.createGeometry();
|
||||||
|
|
||||||
|
const watchProps = ['path', 'tubularSegments', 'radius', 'radialSegments', 'closed'];
|
||||||
|
watchProps.forEach(prop => {
|
||||||
|
watch(() => this[prop], () => {
|
||||||
|
this.refreshGeometry();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createGeometry() {
|
||||||
|
this.geometry = new TubeBufferGeometry(this.path, this.tubularSegments, this.radius, this.radialSegments, this.closed);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__hmrId: 'Tube',
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user