Skip to content

Commit

Permalink
renamed physical shapes to *Shape
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Jul 16, 2024
1 parent 100f730 commit 6bcc7bb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package/src/bullet/hooks/useBoxShape.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo } from 'react'
import { Box } from '../types/Shapes'
import { BoxShape } from '../types/Shapes'
import { BulletAPI } from '../bulletApi'

export function useBoxShape(halfX: number, halfY: number, halfZ: number): Box {
export function useBoxShape(halfX: number, halfY: number, halfZ: number): BoxShape {
return useMemo(() => BulletAPI.createBoxShape(halfX, halfY, halfZ), [halfX, halfY, halfZ])
}
4 changes: 2 additions & 2 deletions package/src/bullet/hooks/useCylinderShape.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from 'react'
import { Cylinder } from '../types/Shapes'
import { CylinderShape } from '../types/Shapes'
import { BulletAPI } from '../bulletApi'
import { Float3 } from '../../types'

Expand All @@ -8,7 +8,7 @@ type CylinderShapeProps = {
localScaling?: Float3
}

export function useCylinderShape(props: CylinderShapeProps | undefined): Cylinder | undefined {
export function useCylinderShape(props: CylinderShapeProps | undefined): CylinderShape | undefined {
const { half, localScaling } = props ?? {}
const scaleX = localScaling?.[0]
const scaleY = localScaling?.[1]
Expand Down
4 changes: 2 additions & 2 deletions package/src/bullet/hooks/useSphereShape.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo } from 'react'
import { Sphere } from '../types/Shapes'
import { SphereShape } from '../types/Shapes'
import { BulletAPI } from '../bulletApi'

export function useSphereShape(radius: number): Sphere {
export function useSphereShape(radius: number): SphereShape {
return useMemo(() => BulletAPI.createSphereShape(radius), [radius])
}
4 changes: 2 additions & 2 deletions package/src/bullet/hooks/useStaticPlaneShape.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo } from 'react'
import { StaticPlane } from '../types/Shapes'
import { StaticPlaneShape } from '../types/Shapes'
import { BulletAPI } from '../bulletApi'

export function useStaticPlaneShape(normalX: number, normalY: number, normalZ: number, constant: number): StaticPlane {
export function useStaticPlaneShape(normalX: number, normalY: number, normalZ: number, constant: number): StaticPlaneShape {
return useMemo(() => BulletAPI.createStaticPlaneShape(normalX, normalY, normalZ, constant), [normalX, normalY, normalZ, constant])
}
8 changes: 4 additions & 4 deletions package/src/bullet/types/Shapes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export interface BaseShape {
margin: number
}

export interface Box extends BaseShape {}
export interface BoxShape extends BaseShape {}

export interface Cylinder extends BaseShape {}
export interface CylinderShape extends BaseShape {}

export interface StaticPlane extends BaseShape {}
export interface StaticPlaneShape extends BaseShape {}

export interface Sphere extends BaseShape {}
export interface SphereShape extends BaseShape {}
14 changes: 7 additions & 7 deletions package/src/bullet/types/api.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Mat4 } from '../../types/TransformManager'
import { DiscreteDynamicWorld } from './DiscreteDynamicWorld'
import { CollisionCallback, RigidBody } from './RigidBody'
import { BaseShape, Box, Cylinder, Sphere, StaticPlane } from './Shapes'
import { BaseShape, BoxShape, CylinderShape, SphereShape, StaticPlaneShape } from './Shapes'

export interface BulletAPI {
createDiscreteDynamicWorld(gravityX: number, gravityY: number, gravityZ: number): DiscreteDynamicWorld
createBoxShape(halfX: number, halfY: number, halfZ: number): Box
createBoxShape(halfX: number, halfY: number, halfZ: number): BoxShape
/**
* Implements a cylinder shape primitive, centered around the origin. Its central axis aligned with the Y axis.
* cylinderShapeX is aligned with the X axis and cylinderShapeZ around the Z axis.
Expand All @@ -21,11 +21,11 @@ export interface BulletAPI {
* @param halfY
* @param halfZ
*/
createCylinderShape(halfX: number, halfY: number, halfZ: number): Cylinder
createCylinderShapeX(halfX: number, halfY: number, halfZ: number): Cylinder
createCylinderShapeZ(halfX: number, halfY: number, halfZ: number): Cylinder
createStaticPlaneShape(normalX: number, normalY: number, normalZ: number, constant: number): StaticPlane
createSphereShape(radius: number): Sphere
createCylinderShape(halfX: number, halfY: number, halfZ: number): CylinderShape
createCylinderShapeX(halfX: number, halfY: number, halfZ: number): CylinderShape
createCylinderShapeZ(halfX: number, halfY: number, halfZ: number): CylinderShape
createStaticPlaneShape(normalX: number, normalY: number, normalZ: number, constant: number): StaticPlaneShape
createSphereShape(radius: number): SphereShape
createRigidBody(
mass: number,
x: number,
Expand Down

0 comments on commit 6bcc7bb

Please sign in to comment.