www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: MichaelJPCT on January 13, 2020, 07:39:23 am

Title: how to select uniform in renderhook
Post by: MichaelJPCT on January 13, 2020, 07:39:23 am
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.
Title: Re: how to select uniform in renderhook
Post by: EgonOlsen on January 14, 2020, 09:20:07 am
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) (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.
Title: Re: how to select uniform in renderhook
Post by: MichaelJPCT on January 15, 2020, 06:31:57 am
thanks, i think these ways can all work.