Skip to content

Releases: pmndrs/react-ogl

v0.3.2

31 May 08:48
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.3.1...v0.3.2

v0.3.1

30 May 14:05
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.3.0...v0.3.1

v0.3.0

30 May 13:43
Compare
Choose a tag to compare

What's Changed

This is a big update in terms of feature parity with https://github.com/pmndrs/react-three-fiber with some perf improvements. Among them:

useStore, zustand, and granular useOGL signature

We now use Zustand under the hood for granular context subscriptions, including a new hook useStore:

// Only update when gl updates
import { useOGL } from 'react-ogl'
const gl = useOGL(state => state.gl)

// Or, for custom zustand selectors:
import { useStore } from 'react-ogl'
const store = useStore()
React.useEffect(() => store.subscribe(state => ... ), [])

expanded attach API

Expands the attach prop by accepting an attach function in addition to a string. This is 1-1 with R3F v8's unified attach API.

// will attach to parent.target
<parent>
  <child attach="target" />
</parent>

// will attach to parent.target.subtarget
<parent>
  <child attach="target-subtarget" />
</parent>

// will attach to parent.target[0] and parent.target[1], creates an array if parent.target is undefined
// useful for attaching multiple elements to an array
<parent>
  <child attach="target-0" />
  <child attach="target-1" />
</parent>

// will call child.setParent on mount and child.removeChild unmount
<parent>
  <child
    attach={(parent, self) => {
      self.setParent(parent)
      // remove on unmount
      return () => parent.removeChild(self)
    }}
  />
</parent>

specify effectful classes via extend

extend now accepts a passGL argument inwhich passes the active gl context automatically to the element in construction. Importantly, this will affect all elements passed in the call to extend or any elements who extend them. Passing gl as an arg to these elements will still work as before, however, it is unneeded.

// Marks both classes as effectful and will receive an effect
extend({ CustomClass1, CustomClass2 }, true)
- const gl = useOGL()
- <customClass1 args={[gl]} prop={value} />
- <customClass2 args={[gl]} prop={value} />

+ <customClass1 prop={value} />
+ <customClass2 prop={value} />

This is enabled for core classes to let users use props instead of args for common classes like meshes, materials, geometry, and so on.

<program vertex="" fragment="" />

Full Changelog: v0.2.2...v0.3.0

v0.2.2

30 May 09:01
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.2.1...v0.2.2

v0.2.1

28 May 13:07
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.2.0...v0.2.1

v0.2.0

28 May 04:48
Compare
Choose a tag to compare

What's Changed

This release does away with platform-specific imports (react-ogl/web or react-ogl/native) in favor of a unified target (react-ogl).

// web
- import ... from 'react-ogl/web'
+ import ... from 'react-ogl'

// native
- import ... from 'react-ogl/native'
+ import ... from 'react-ogl'

Additional fixes improve internal stability when using concurrent features, suspense, and devtools.

Full Changelog: v0.1.6...v0.2.0

v0.1.6

17 May 18:33
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.1.5...v0.1.6

v0.1.5

16 May 17:01
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.1.4...v0.1.5

v0.1.4

12 Apr 17:37
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.1.3...v0.1.4

v0.1.3

21 Mar 20:43
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.1.2...v0.1.3