Skip to content

Commit

Permalink
v2.5.0 - 2022-11-03
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornstar committed Nov 3, 2022
1 parent 8c96831 commit b472e28
Show file tree
Hide file tree
Showing 17 changed files with 390 additions and 544 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
if: github.repository_owner == 'pmndrs'
name: Release
runs-on: ubuntu-latest
steps:
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# @pmndrs/use-cannon Changelog

## v2.5.0 - 2022-11-03

- [@pmndrs/cannon-worker-api] v2.3.0
- [@react-three/cannon] v6.5.0
- [@react-three/cannon-examples] v2.4.0
- Setup changesets & publish workflow (@isaac-mason)
- Do not attempt to publish on forks (@bjornstar)

## v2.4.0 - 2022-08-18

- [@pmndrs/cannon-worker-api] v2.1.0
- [@pmndrs/cannon-worker-api] v2.2.0
- [@react-three/cannon] v6.4.0

## v2.3.0 - 2022-04-18
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pmndrs/use-cannon",
"version": "0.0.1",
"version": "2.5.0",
"private": true,
"description": "monorepo for @pmndrs/use-cannon",
"keywords": [
Expand All @@ -24,7 +24,7 @@
"lint-staged": "^12.1.2"
},
"engines": {
"node": ">=14",
"node": ">=16",
"npm": ">=8"
},
"lint-staged": {
Expand Down
6 changes: 2 additions & 4 deletions packages/cannon-worker-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# @pmndrs/cannon-worker-api Changelog

## 2.2.1
## v2.3.0 - 2022-11-03

### Patch Changes

- e0d4113: remove subscriptions when removing bodies and vehicles (@alex-shortt)
- Remove subscriptions when removing bodies and vehicles (@alex-shortt)

## v2.2.0 - 2022-08-18

Expand Down
2 changes: 1 addition & 1 deletion packages/cannon-worker-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pmndrs/cannon-worker-api",
"version": "2.2.1",
"version": "2.3.0",
"description": "An API to use cannon-es in a web worker",
"keywords": [
"cannon",
Expand Down
11 changes: 11 additions & 0 deletions packages/react-three-cannon-examples/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @react-three/cannon-examples Changelog

## v2.4.0 - 2022-11-03

- Remove some types & an expect-error that are no longer necessary (@bjornstar)
- Inline the only niceColors that we use (@bjornstar)
- Update `@react-three/cannon` to v6.5.0 (@bjornstar)
- Update `three-stdlib` to v2.17.3 (@bjornstar)
- Update `vite` to v3.2.2 (@bjornstar)
- Replace `vite-react-jsx` with `@vitejs/plugin-react` (@bjornstar)
- Remove `nice-color-palettes` (@bjornstar)
- Remove `@vitejs/plugin-react-refresh` (@bjornstar)

## v2.3.0 - 2022-04-18

- Use accurate ref types for all hooks (@bjornstar)
Expand Down
11 changes: 5 additions & 6 deletions packages/react-three-cannon-examples/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-three/cannon-examples",
"version": "2.3.0",
"version": "2.4.0",
"description": "Examples for @react-three/cannon",
"private": true,
"scripts": {
Expand All @@ -20,7 +20,7 @@
"not op_mini all"
],
"devDependencies": {
"@react-three/cannon": "^6.2.0",
"@react-three/cannon": "^6.5.0",
"@react-three/drei": "^9.4.3",
"@react-three/fiber": "^8.0.11",
"@types/lodash-es": "^4.17.6",
Expand All @@ -31,7 +31,7 @@
"@types/three": "^0.139.0",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"@vitejs/plugin-react-refresh": "^1.3.6",
"@vitejs/plugin-react": "^2.2.0",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-es": "^4.1.0",
Expand All @@ -40,17 +40,16 @@
"eslint-plugin-typescript-enum": "^2.1.0",
"lerp": "^1.0.3",
"lodash-es": "^4.17.21",
"nice-color-palettes": "3.0.0",
"prettier": "^2.6.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-is": "^18.0.0",
"react-router-dom": "^6.2.2",
"styled-components": "^5.3.5",
"three": "^0.139.1",
"three-stdlib": "^2.8.12",
"three-stdlib": "^2.17.3",
"typescript": "^4.6.3",
"vite": "^2.9.1",
"vite": "^3.2.2",
"vite-react-jsx": "^1.1.2",
"zustand": "^3.7.1"
},
Expand Down
1 change: 0 additions & 1 deletion packages/react-three-cannon-examples/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function Demos() {
export default function App() {
return (
<Router>
{/* @ts-expect-error Not sure how to fix the type here */}
<GlobalStyle />
<Intro />
</Router>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-three-cannon-examples/src/colors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// From `nice-color-palettes`, this one is index 17
export default ['#99b898', '#fecea8', '#ff847c', '#e84a5f', '#2a363b'] as const
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Canvas, useFrame, useLoader } from '@react-three/fiber'
import lerp from 'lerp'
import clamp from 'lodash-es/clamp'
import { Suspense, useRef } from 'react'
import type { Group, Loader, Material, Mesh, Object3D, Skeleton } from 'three'
import type { Group, Material, Mesh, Object3D, Skeleton } from 'three'
import { TextureLoader } from 'three'
import { DRACOLoader } from 'three-stdlib/loaders/DRACOLoader'
import type { GLTF } from 'three-stdlib/loaders/GLTFLoader'
Expand Down Expand Up @@ -53,11 +53,7 @@ const extensions = (loader: GLTFLoader) => {
}

function Paddle() {
const { nodes, materials } = useLoader<PingPongGLTF, '/pingpong.glb'>(
GLTFLoader,
'/pingpong.glb',
extensions as (loader: Loader) => void,
) as PingPongGLTF
const { nodes, materials } = useLoader(GLTFLoader, '/pingpong.glb', extensions) as PingPongGLTF
const { pong } = useStore((state) => state.api)
const welcome = useStore((state) => state.welcome)
const count = useStore((state) => state.count)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { PlaneProps, Triplet } from '@react-three/cannon'
import { Physics, useBox, usePlane, useSphere } from '@react-three/cannon'
import { Canvas, useFrame } from '@react-three/fiber'
import niceColors from 'nice-color-palettes'
import { useMemo, useRef, useState } from 'react'
import type { InstancedMesh, Mesh } from 'three'
import { Color } from 'three'

import niceColors from '../colors'

function Plane(props: PlaneProps) {
const [ref] = usePlane(() => ({ ...props }), useRef<Mesh>(null))
return (
Expand Down Expand Up @@ -78,7 +79,7 @@ export default () => {
const color = new Color()
for (let i = 0; i < number; i++)
color
.set(niceColors[17][Math.floor(Math.random() * 5)])
.set(niceColors[Math.floor(Math.random() * 5)])
.convertSRGBToLinear()
.toArray(array, i * 3)
return array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import type { Triplet } from '@react-three/cannon'
import { Physics, useHeightfield, useSphere } from '@react-three/cannon'
import type { Node } from '@react-three/fiber'
import { Canvas, extend, useFrame, useThree } from '@react-three/fiber'
import niceColors from 'nice-color-palettes'
import { useEffect, useLayoutEffect, useMemo, useRef } from 'react'
import type { BufferGeometry, InstancedMesh, Mesh, PerspectiveCamera } from 'three'
import { Color, Float32BufferAttribute } from 'three'
import { OrbitControls } from 'three-stdlib/controls/OrbitControls'

import niceColors from '../colors'

extend({ OrbitControls })

declare global {
Expand Down Expand Up @@ -128,7 +129,7 @@ function Heightfield({

return (
<mesh ref={ref} castShadow receiveShadow>
<meshPhongMaterial color={niceColors[17][4]} />
<meshPhongMaterial color={niceColors[4]} />
<HeightmapGeometry heights={heights} elementSize={elementSize} />
</mesh>
)
Expand All @@ -153,7 +154,7 @@ function Spheres({ columns, rows, spread }: { columns: number; rows: number; spr
const color = new Color()
for (let i = 0; i < number; i++)
color
.set(niceColors[17][Math.floor(Math.random() * 5)])
.set(niceColors[Math.floor(Math.random() * 5)])
.convertSRGBToLinear()
.toArray(array, i * 3)
return array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import type { PlaneProps, Triplet } from '@react-three/cannon'
import { Physics, useBox, usePlane, useSphere } from '@react-three/cannon'
import type { MeshPhongMaterialProps } from '@react-three/fiber'
import { Canvas, useFrame } from '@react-three/fiber'
import niceColors from 'nice-color-palettes'
import { useMemo, useRef } from 'react'
import type { InstancedMesh, Mesh } from 'three'
import { Color } from 'three'

import niceColors from '../colors'

type OurPlaneProps = Pick<MeshPhongMaterialProps, 'color'> & Pick<PlaneProps, 'position' | 'rotation'>

function Plane({ color, ...props }: OurPlaneProps) {
Expand Down Expand Up @@ -49,7 +50,7 @@ function InstancedSpheres({ number = 100 }) {
const color = new Color()
for (let i = 0; i < number; i++)
color
.set(niceColors[17][Math.floor(Math.random() * 5)])
.set(niceColors[Math.floor(Math.random() * 5)])
.convertSRGBToLinear()
.toArray(array, i * 3)
return array
Expand Down Expand Up @@ -79,11 +80,11 @@ export default () => (
/>
<pointLight position={[-30, 0, -30]} intensity={0.5} />
<Physics gravity={[0, 0, -30]}>
<Plane color={niceColors[17][4]} position={[0, 0, 0]} rotation={[0, 0, 0]} />
<Plane color={niceColors[17][1]} position={[-6, 0, 0]} rotation={[0, 0.9, 0]} />
<Plane color={niceColors[17][2]} position={[6, 0, 0]} rotation={[0, -0.9, 0]} />
<Plane color={niceColors[17][3]} position={[0, 6, 0]} rotation={[0.9, 0, 0]} />
<Plane color={niceColors[17][0]} position={[0, -6, 0]} rotation={[-0.9, 0, 0]} />
<Plane color={niceColors[4]} position={[0, 0, 0]} rotation={[0, 0, 0]} />
<Plane color={niceColors[1]} position={[-6, 0, 0]} rotation={[0, 0.9, 0]} />
<Plane color={niceColors[2]} position={[6, 0, 0]} rotation={[0, -0.9, 0]} />
<Plane color={niceColors[3]} position={[0, 6, 0]} rotation={[0.9, 0, 0]} />
<Plane color={niceColors[0]} position={[0, -6, 0]} rotation={[-0.9, 0, 0]} />
<Box />
<InstancedSpheres number={100} />
</Physics>
Expand Down
5 changes: 2 additions & 3 deletions packages/react-three-cannon-examples/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import reactRefresh from '@vitejs/plugin-react-refresh'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import reactJsx from 'vite-react-jsx'

export default defineConfig({ plugins: [reactJsx(), reactRefresh()] })
export default defineConfig({ plugins: [react()] })
4 changes: 4 additions & 0 deletions packages/react-three-cannon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @react-three/cannon Changelog

## v6.5.0 - 2022-11-03

- Update `@pmndrs/cannon-worker-api` to v2.3.0 (@bjornstar)

## v6.4.0 - 2022-08-18

- Add support for `frictionGravity` on WorldProps (@chnicoloso)
Expand Down
4 changes: 2 additions & 2 deletions packages/react-three-cannon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-three/cannon",
"version": "6.4.0",
"version": "6.5.0",
"description": "physics based hooks for react-three-fiber",
"keywords": [
"cannon",
Expand Down Expand Up @@ -30,7 +30,7 @@
"prettier-fix": "prettier --write ."
},
"dependencies": {
"@pmndrs/cannon-worker-api": "^2.1.0",
"@pmndrs/cannon-worker-api": "^2.3.0",
"cannon-es": "^0.20.0",
"cannon-es-debugger": "^1.0.0"
},
Expand Down
Loading

1 comment on commit b472e28

@vercel
Copy link

@vercel vercel bot commented on b472e28 Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

use-cannon – ./

use-cannon-pmndrs.vercel.app
cannon.pmnd.rs
use-cannon.vercel.app
use-cannon-git-master-pmndrs.vercel.app

Please sign in to comment.