Skip to content
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

Support inline method in geometries ( EJ: toNonIndexed , setFromPoints) #230

Open
JaimeTorrealba opened this issue Apr 22, 2023 · 6 comments
Labels
question Further information is requested waiting for author

Comments

@JaimeTorrealba
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently, the toNonIndexed method
doesn't work

Describe the solution you'd like
I would like to manipulate the vertex by nonIndexed geometries

Suggested solution
add a new prop to all geometries
Ej:

Additional context
This is useful is you want to manipulate the vertex individually, in the vertex shader

@alvarosabu
Copy link
Member

@JaimeTorrealba the core is different than cientos. Here all the components are generated on the custom renderer based on THREE instance constructor meaning that all the methods and props available here should work https://threejs.org/docs/index.html#api/en/core/BufferGeometry.toNonIndexed

<BufferGeometry :to-non-indexed="callback" />

Another solution would be to pass a template ref to the buffer geometry

<script lang="ts">
const bufferRef = shallowRef()

watchEffect(() => bufferRef.value.toNonIndexed())
</script>
<BufferGeometry ref="bufferRef" />

@alvarosabu alvarosabu added the question Further information is requested label Apr 23, 2023
@JaimeTorrealba
Copy link
Member Author

Unfortunately, this method as a prop doesn't work
image

And if I try to use in the watch just not take because the geometry is already created
image

I could make it work using a workaround

image

But is not the desire

@alvarosabu
Copy link
Member

Screenshot 2023-04-25 at 09 17 24

The method itself is successfully called on the nodeOps see the attachment above. I'm still confused about what would be the desired result. Could you elaborate more?

@JaimeTorrealba
Copy link
Member Author

with no indexed
image

I left you the difference with and without using toNonIndexed() method, this is using for creating some interesting effect like
https://serene-mousse-562782.netlify.app/destroyObject

If the geometries are indexed, the effect just don't work properly (also particles effects to)

The main thing is that if I try to accomplish this with tresJs prop toNonIndexed, the geometry is still indexed

Copy link
Member

@JaimeTorrealba should this be optional or mandator? And couldn't this method be called using templateRefs?

@JaimeTorrealba
Copy link
Member Author

As we discuss methods inline like
const lineGeometry = new BufferGeometry().setFromPoints(points) will not work on the template

<TresBufferGeometry :set-from-points="points" /> // this doesn't work

So we have to create on the script tag. Which is not ideal

@JaimeTorrealba JaimeTorrealba changed the title Support toNonIndexed() method in geometries Support inline method in geometries ( EJ: toNonIndexed , setFromPoints) Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested waiting for author
Projects
Status: No status
Development

No branches or pull requests

2 participants