Skip to content

Commit

Permalink
feat(cientos): shapes types
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Mar 6, 2023
1 parent 07609be commit aa7361b
Show file tree
Hide file tree
Showing 15 changed files with 324 additions and 134 deletions.
36 changes: 25 additions & 11 deletions packages/cientos/src/core/Box.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [1, 1, 1],
color: '0xffffff',
},
)
export interface BoxProps extends TresObject {
/**
* The width, height and depth of the box.
* @default [1, 1, 1]
* @type {number[]}
* @memberof BoxProps
* @see https://threejs.org/docs/#api/en/geometries/BoxGeometry
*
*/
args?: number[]
/**
* The color of the box.
* @default 0xffffff
* @type {TresColor}
* @memberof BoxProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(defineProps<BoxProps>(), {
args: () => [1, 1, 1],
color: '0xffffff',
})
const boxRef = shallowRef()
Expand Down
22 changes: 20 additions & 2 deletions packages/cientos/src/core/Circle.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
export interface CircleProps extends TresObject {
/**
* The radius, segment, thetaStart, thetaLength of the circle.
* @default [1, 32, 0, Math.PI * 2]
* @type {number[]}
* @memberof CircleProps
* @see https://threejs.org/docs/#api/en/geometries/CircleGeometry
*/
args?: number[]
/**
* The color of the circle.
* @default 0xffffff
* @type {TresColor}
* @memberof CircleProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [1, 32],
args: () => [1, 32, 0, Math.PI * 2],
color: '0xffffff',
},
)
Expand Down
35 changes: 24 additions & 11 deletions packages/cientos/src/core/Cone.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [1, 1, 12],
color: '0xffffff',
},
)
export interface ConeProps extends TresObject {
/**
* The radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength of the cone.
* @default [1, 1, 12, false, 0, Math.PI * 2]
* @type {number[]}
* @memberof ConeProps
* @see https://threejs.org/docs/#api/en/geometries/ConeGeometry
*/
args?: [number, number, number, boolean, number, number]
/**
* The color of the cone.
* @default 0xffffff
* @type {TresColor}
* @memberof ConeProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(defineProps<ConeProps>(), {
args: () => [1, 1, 12, false, 0, Math.PI * 2],
color: '0xffffff',
})
const coneRef = shallowRef()
Expand Down
35 changes: 24 additions & 11 deletions packages/cientos/src/core/Dodecahedron.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [1, 0],
color: '0xffffff',
},
)
export interface DodecahedronProps extends TresObject {
/**
* The radius and detail of the dodecahedron.
* @default [1, 0]
* @type {number[]}
* @memberof DodecahedronProps
* @see https://threejs.org/docs/#api/en/geometries/DodecahedronGeometry
*/
args?: number[]
/**
* The color of the dodecahedron.
* @default 0xffffff
* @type {TresColor}
* @memberof DodecahedronProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(defineProps<DodecahedronProps>(), {
args: () => [1, 0],
color: '0xffffff',
})
const dodecahedronRef = shallowRef()
Expand Down
34 changes: 23 additions & 11 deletions packages/cientos/src/core/Icosahedron.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [1, 0],
color: '0xffffff',
},
)
export interface IcosahedronProps extends TresObject {
/**
* The radius and detail of the icosahedron.
* @default [1, 0]
* @type {number[]}
* @memberof IcosahedronProps
* @see https://threejs.org/docs/#api/en/geometries/IcosahedronGeometry
*/
args?: number[]
/**
* The color of the icosahedron.
* @default 0xffffff
* @type {TresColor}
* @memberof IcosahedronProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(defineProps<IcosahedronProps>(), {
args: () => [1, 0],
color: '0xffffff',
})
const icosahedronRef = shallowRef()
Expand Down
35 changes: 24 additions & 11 deletions packages/cientos/src/core/Octahedron.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [1, 0],
color: '0xffffff',
},
)
export interface OctahedronProps extends TresObject {
/**
* The radius and detail of the octahedron.
* @default [1, 0]
* @type {number[]}
* @memberof OctahedronProps
* @see https://threejs.org/docs/#api/en/geometries/OctahedronGeometry
*/
args?: number[]
/**
* The color of the octahedron.
* @default 0xffffff
* @type {TresColor}
* @memberof OctahedronProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(defineProps<OctahedronProps>(), {
args: () => [1, 0],
color: '0xffffff',
})
const octahedronRef = shallowRef()
Expand Down
21 changes: 20 additions & 1 deletion packages/cientos/src/core/Plane.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
export interface PlaneProps extends TresObject {
/**
* The width and height, widthSegments, heightSegments of the plane.
* @default [1, 1, 1, 1]
* @type {number[]}
* @memberof PlaneProps
* @see https://threejs.org/docs/#api/en/geometries/PlaneGeometry
*/
args?: number[]
/**
* The color of the plane.
* @default 0xffffff
* @type {TresColor}
* @memberof PlaneProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(
defineProps<{
args?: number[]
Expand Down
34 changes: 23 additions & 11 deletions packages/cientos/src/core/Ring.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [0.5, 1, 32],
color: '0xffffff',
},
)
export interface RingProps extends TresObject {
/**
* The innerRadius, outerRadius, thetaSegments, phiSegments, tethaStart, thetaLength of the ring.
* @default [0.5, 1, 32, 1, 0, Math.PI * 2]
* @type {number[]}
* @memberof RingProps
* @see https://threejs.org/docs/#api/en/geometries/RingGeometry
*/
args?: number[]
/**
* The color of the ring.
* @default 0xffffff
* @type {TresColor}
* @memberof RingProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(defineProps<RingProps>(), {
args: () => [0.5, 1, 32],
color: '0xffffff',
})
const ringRef = shallowRef()
Expand Down
36 changes: 25 additions & 11 deletions packages/cientos/src/core/Sphere.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [2, 32, 16],
color: '0xffffff',
},
)
export interface SphereProps extends TresObject {
/**
* The radius, widthSegments, heightSegments, phiStart phiLength,
* thetaStart and thetaLength of the sphere.
* @default [2, 32, 16, 0, Math.PI * 2, 0, Math.PI]
* @type {number[]}
* @memberof SphereProps
* @see https://threejs.org/docs/#api/en/geometries/SphereGeometry
*/
args?: number[]
/**
* The color of the sphere.
* @default 0xffffff
* @type {TresColor}
* @memberof SphereProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(defineProps<SphereProps>(), {
args: () => [2, 32, 16],
color: '0xffffff',
})
const sphereRef = shallowRef()
Expand Down
35 changes: 24 additions & 11 deletions packages/cientos/src/core/Tetrahedron.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
<script setup lang="ts">
import { TresColor } from '@tresjs/core/dist/types'
import { TresColor, TresObject } from '@tresjs/core'
import { shallowRef } from 'vue'
withDefaults(
defineProps<{
args?: number[]
color?: TresColor
}>(),
{
args: () => [1, 0],
color: '0xffffff',
},
)
export interface TetrahedronProps extends TresObject {
/**
* The radius and detail of the tetrahedron.
* @default [1, 0]
* @type {number[]}
* @memberof TetrahedronProps
* @see https://threejs.org/docs/#api/en/geometries/TetrahedronGeometry
*/
args?: number[]
/**
* The color of the tetrahedron.
* @default 0xffffff
* @type {TresColor}
* @memberof TetrahedronProps
* @see https://threejs.org/docs/#api/en/materials/MeshBasicMaterial
*/
color?: TresColor
}
withDefaults(defineProps<TetrahedronProps>(), {
args: () => [1, 0],
color: '0xffffff',
})
const tetrahedronRef = shallowRef()
Expand Down
Loading

0 comments on commit aa7361b

Please sign in to comment.