how to select uniform in renderhook

Started by MichaelJPCT, January 13, 2020, 07:39:23 AM

Previous topic - Next topic

MichaelJPCT

Hi Egon,
if multiple objects share a shader, i must set a renderhook to apply a uniform to an object. the question is ,how to select the correct uniform to an object?
i have an array of objects and an array of uniforms.
i need an ID for each object right?
currently i use object3d.set/get transparency like an id to select uniforms. it works, but i dont think this is the formal way.
i see object3d.getid, but this id is different from the id in my array. should i map these 2 types of id's? is it the formal way to select uniforms?

thanks for your support.

EgonOlsen

There's no formal way. You could extend Object3D and add your uniform to it, or you could use http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#setUserObject(java.lang.Object) to add some context instance to your object. That's a little bit dodgy, but it might do the trick.

MichaelJPCT

thanks, i think these ways can all work.