[2.1] Updating hlms properties during runtime Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
gabbsson
Halfling
Posts: 65
Joined: Wed Aug 08, 2018 9:03 am
x 9

[2.1] Updating hlms properties during runtime

Post by gabbsson » Wed Aug 21, 2019 11:10 am

Hello!

A while back I created my own implementation for unlit and PBS to add some custom stuff, namely clipping and different polygon modes (wire frame for example). I did this by also creating custom datablocks (which inherit from the unlit and pbs datablocks respectively) and added my own variables for isClipped and polygonMode. This way clipping is done per datablock, so that I can "turn it off and on", even if all clipped objects are clipped the same.

The variables are read in the custom hlms calculateHashForPreCreate and setPropertys are called on the variables.
In other words no data is being sent based on the variables (clipping planes are later sent using a listener).

The issue is if I change the variables of the datablock it does not trigger a new shader to be compiled, which honestly doesn't feel all that surprising after thinking about it. Nothing is really checking if the values are being changed. So I'm assuming there is a way to let the hlms know it needs to create a new shader based on the datablock that now has updated values.
I read the manual for HLMS and still could not find what I am looking for.

So to summarize: The implementation works great if nothing changes during run-time, but I want to be able to change whether or not a datablock should be clipped after creating it.

I've also considered that perhaps this is not the intended way to use datablocks, and that I should instead create datablocks from the start with different values set. A more "everything is created at start, nothing can change during run-time" approach.

Any insight would be appreciated!

Cheers
0 x

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1063
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 82

Re: [2.1] Updating hlms properties during runtime

Post by xrgo » Wed Aug 21, 2019 12:37 pm

hi! you have to call flushRenderables();
1 x

gabbsson
Halfling
Posts: 65
Joined: Wed Aug 08, 2018 9:03 am
x 9

Re: [2.1] Updating hlms properties during runtime

Post by gabbsson » Wed Aug 21, 2019 2:05 pm

xrgo wrote:
Wed Aug 21, 2019 12:37 pm
hi! you have to call flushRenderables();
Perfect! Thank you!
0 x

Post Reply