Author Topic: is this the right way to use repeatRendering?  (Read 375 times)

Offline MichaelJPCT

  • long
  • ***
  • Posts: 201
    • View Profile
is this the right way to use repeatRendering?
« 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.

Offline MichaelJPCT

  • long
  • ***
  • Posts: 201
    • View Profile
Re: is this the right way to use repeatRendering?
« Reply #1 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12060
    • View Profile
    • http://www.jpct.net
Re: is this the right way to use repeatRendering?
« Reply #2 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.

Offline MichaelJPCT

  • long
  • ***
  • Posts: 201
    • View Profile
Re: is this the right way to use repeatRendering?
« Reply #3 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12060
    • View Profile
    • http://www.jpct.net
Re: is this the right way to use repeatRendering?
« Reply #4 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.

Offline MichaelJPCT

  • long
  • ***
  • Posts: 201
    • View Profile
Re: is this the right way to use repeatRendering?
« Reply #5 on: March 10, 2020, 05:50:20 pm »
what a pity.
thanks anyway.