www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: MichaelJPCT on March 04, 2020, 03:10:37 pm

Title: is this the right way to use repeatRendering?
Post by: MichaelJPCT on March 04, 2020, 03:10:37 pm
i plan to use a renderhook and a shader to draw an object3D multiple times.
in repeatRendering, pseudo code:
Code: [Select]
if id>0 { id-=1; myobject.setOrigin(positionArray[id]); myshader.setUniform(uniformArray[id]); return true; }
return false;

if this doesnt work, i would use a shader and a renderhook on multiple Object3D`s with the same Mesh.
Title: Re: is this the right way to use repeatRendering?
Post by: MichaelJPCT on March 04, 2020, 07:25:07 pm
also there is another question: can a shader be applied to Object3D's in multiple World's ?

Thanks in advance.
Title: Re: is this the right way to use repeatRendering?
Post by: EgonOlsen on March 06, 2020, 08:40:18 am
I've never really used the repeatRendering()-solution myself, but I think that it should work this way. A shader can be applied to Object3Ds in multiple Worlds. That shouldn't be a problem.
Title: Re: is this the right way to use repeatRendering?
Post by: MichaelJPCT on March 10, 2020, 02:02:26 pm
i tested repeatRendering. it seems that setOrigin doesn't work at that moment. setFloatArrayUniform works though.
so if i still want to use repeatRendering, i have to change the shader to take object position into account.
i prefer using multiple object3d's, as adding 3 floats on each vertex seems less efficient.
Title: Re: is this the right way to use repeatRendering?
Post by: EgonOlsen on March 10, 2020, 02:41:56 pm
No, setOrigin will have no effect in this case. repeatRendering() really just does that: It repeats the rendering. Any object manipulations outside of the shaders aren't possible at this stage.
Title: Re: is this the right way to use repeatRendering?
Post by: MichaelJPCT on March 10, 2020, 05:50:20 pm
what a pity.
thanks anyway.