is this the right way to use repeatRendering?

Started by MichaelJPCT, March 04, 2020, 03:10:37 PM

Previous topic - Next topic

MichaelJPCT

i plan to use a renderhook and a shader to draw an object3D multiple times.
in repeatRendering, pseudo code:

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.

MichaelJPCT

also there is another question: can a shader be applied to Object3D's in multiple World's ?

Thanks in advance.

EgonOlsen

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.

MichaelJPCT

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.

EgonOlsen

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.

MichaelJPCT