-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: sampler and useSampler #286
Conversation
|
✅ Deploy Preview for cientos-tresjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty neat implementation, just consider changing the naming convention to SurfaceSampler
to be explicit about the functionality and some minor stuff
Great job buddy
|
||
export type TransformFn = (payload: TransformPayload, i: number) => void | ||
|
||
export const useSampler = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @JaimeTorrealba small feedback for the naming.
useSampler
sounds too generic, I would have called this useSurfaceSampler
because it is more clear and verbose on the functionality that covers + the original class from threejs is MeshSurfaceSampler
weight?: string, | ||
transform?: TransformFn, | ||
) => { | ||
const buffer = ref(new InterleavedBuffer(new Float32Array(count * 16), 16)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const buffer = ref(new InterleavedBuffer(new Float32Array(count * 16), 16)) | |
const arr = new Float32Array(count * 16) | |
const buffer = ref(new InterleavedBuffer(arr, 16)) |
More readable :)
InterleavedBuffer, | ||
} from 'three' | ||
import type { Mesh, InstancedMesh } from 'three' | ||
import { MeshSurfaceSampler } from 'three/examples/jsm/math/MeshSurfaceSampler' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { MeshSurfaceSampler } from 'three/examples/jsm/math/MeshSurfaceSampler' | |
import { MeshSurfaceSampler } from 'three-stdlib' |
Avoid exporting these extra classes from three since they are not three-shakeable and not ESM compatible, use three-stdlib
instead
@@ -0,0 +1,31 @@ | |||
<!-- eslint-disable max-len --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JaimeTorrealba avoid as much as possible to add disable rules on top of the file, use the above this line option
closes #156