mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
defineComponent for geometries (#10)
This commit is contained in:
parent
e02d28dfd9
commit
f6ecd087fb
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { BoxGeometry } from 'three';
|
import { BoxGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ export function createGeometry(comp) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -27,4 +28,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { CircleGeometry } from 'three';
|
import { CircleGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ export function createGeometry(comp) {
|
|||||||
return new CircleGeometry(comp.radius, comp.segments, comp.thetaStart, comp.thetaLength);
|
return new CircleGeometry(comp.radius, comp.segments, comp.thetaStart, comp.thetaLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -20,4 +21,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { ConeGeometry } from 'three';
|
import { ConeGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ export function createGeometry(comp) {
|
|||||||
return new ConeGeometry(comp.radius, comp.height, comp.radialSegments, comp.heightSegments, comp.openEnded, comp.thetaStart, comp.thetaLength);
|
return new ConeGeometry(comp.radius, comp.height, comp.radialSegments, comp.heightSegments, comp.openEnded, comp.thetaStart, comp.thetaLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -23,5 +24,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { CylinderGeometry } from 'three';
|
import { CylinderGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ export function createGeometry(comp) {
|
|||||||
return new CylinderGeometry(comp.radiusTop, comp.radiusBottom, comp.height, comp.radialSegments, comp.heightSegments, comp.openEnded, comp.thetaStart, comp.thetaLength);
|
return new CylinderGeometry(comp.radiusTop, comp.radiusBottom, comp.height, comp.radialSegments, comp.heightSegments, comp.openEnded, comp.thetaStart, comp.thetaLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -24,4 +25,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { DodecahedronGeometry } from 'three';
|
import { DodecahedronGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ export function createGeometry(comp) {
|
|||||||
return new DodecahedronGeometry(comp.radius, comp.detail);
|
return new DodecahedronGeometry(comp.radius, comp.detail);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -18,4 +19,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { watch } from 'vue';
|
import { defineComponent, watch } from 'vue';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
inject: ['mesh'],
|
inject: ['mesh'],
|
||||||
props: {
|
props: {
|
||||||
rotateX: Number,
|
rotateX: Number,
|
||||||
@ -46,4 +46,4 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
render() { return []; },
|
render() { return []; },
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { IcosahedronGeometry } from 'three';
|
import { IcosahedronGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ export function createGeometry(comp) {
|
|||||||
return new IcosahedronGeometry(comp.radius, comp.detail);
|
return new IcosahedronGeometry(comp.radius, comp.detail);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -18,4 +19,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { LatheGeometry } from 'three';
|
import { LatheGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ export function createGeometry(comp) {
|
|||||||
return new LatheGeometry(comp.points, comp.segments, comp.phiStart, comp.phiLength);
|
return new LatheGeometry(comp.points, comp.segments, comp.phiStart, comp.phiLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -20,4 +21,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { OctahedronGeometry } from 'three';
|
import { OctahedronGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ export function createGeometry(comp) {
|
|||||||
return new OctahedronGeometry(comp.radius, comp.detail);
|
return new OctahedronGeometry(comp.radius, comp.detail);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -18,4 +19,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { PlaneGeometry } from 'three';
|
import { PlaneGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ export function createGeometry(comp) {
|
|||||||
return new PlaneGeometry(comp.width, comp.height, comp.widthSegments, comp.heightSegments);
|
return new PlaneGeometry(comp.width, comp.height, comp.widthSegments, comp.heightSegments);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -20,4 +21,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { PolyhedronGeometry } from 'three';
|
import { PolyhedronGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ export function createGeometry(comp) {
|
|||||||
return new PolyhedronGeometry(comp.vertices, comp.indices, comp.radius, comp.detail);
|
return new PolyhedronGeometry(comp.vertices, comp.indices, comp.radius, comp.detail);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -20,4 +21,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { RingGeometry } from 'three';
|
import { RingGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ export function createGeometry(comp) {
|
|||||||
return new RingGeometry(comp.innerRadius, comp.outerRadius, comp.thetaSegments, comp.phiSegments, comp.thetaStart, comp.thetaLength);
|
return new RingGeometry(comp.innerRadius, comp.outerRadius, comp.thetaSegments, comp.phiSegments, comp.thetaStart, comp.thetaLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -22,4 +23,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { SphereGeometry } from 'three';
|
import { SphereGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -11,7 +12,7 @@ export function createGeometry(comp) {
|
|||||||
return new SphereGeometry(comp.radius, comp.widthSegments, comp.heightSegments);
|
return new SphereGeometry(comp.radius, comp.widthSegments, comp.heightSegments);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -19,4 +20,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { TetrahedronGeometry } from 'three';
|
import { TetrahedronGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ export function createGeometry(comp) {
|
|||||||
return new TetrahedronGeometry(comp.radius, comp.detail);
|
return new TetrahedronGeometry(comp.radius, comp.detail);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -18,4 +19,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { TorusGeometry } from 'three';
|
import { TorusGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -13,7 +14,7 @@ export function createGeometry(comp) {
|
|||||||
return new TorusGeometry(comp.radius, comp.tube, comp.radialSegments, comp.tubularSegments, comp.arc);
|
return new TorusGeometry(comp.radius, comp.tube, comp.radialSegments, comp.tubularSegments, comp.arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -21,4 +22,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { TorusKnotGeometry } from 'three';
|
import { TorusKnotGeometry } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ export function createGeometry(comp) {
|
|||||||
return new TorusKnotGeometry(comp.radius, comp.tube, comp.tubularSegments, comp.radialSegments, comp.p, comp.q);
|
return new TorusKnotGeometry(comp.radius, comp.tube, comp.tubularSegments, comp.radialSegments, comp.p, comp.q);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -22,4 +23,4 @@ export default {
|
|||||||
this.geometry = createGeometry(this);
|
this.geometry = createGeometry(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { defineComponent } from 'vue';
|
||||||
import { CatmullRomCurve3, Curve, TubeGeometry, Vector3 } from 'three';
|
import { CatmullRomCurve3, Curve, TubeGeometry, Vector3 } from 'three';
|
||||||
import Geometry from './Geometry.js';
|
import Geometry from './Geometry.js';
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ export function createGeometry(comp) {
|
|||||||
return new TubeGeometry(curve, comp.tubularSegments, comp.radius, comp.radiusSegments, comp.closed);
|
return new TubeGeometry(curve, comp.tubularSegments, comp.radius, comp.radiusSegments, comp.closed);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props,
|
props,
|
||||||
methods: {
|
methods: {
|
||||||
@ -34,7 +35,7 @@ export default {
|
|||||||
updateTubeGeometryPoints(this.geometry, points);
|
updateTubeGeometryPoints(this.geometry, points);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
export function updateTubeGeometryPoints(tube, points) {
|
export function updateTubeGeometryPoints(tube, points) {
|
||||||
const curve = new CatmullRomCurve3(points);
|
const curve = new CatmullRomCurve3(points);
|
||||||
|
Loading…
Reference in New Issue
Block a user