[2.1] Easier way to communicate with hlms shader?

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4665
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 997
Contact:

Re: [2.1] Easier way to communicate with hlms shader?

Post by dark_sylinc »

Lax wrote: Tue Feb 23, 2021 1:48 pm @dark_sylinc: Would It be possible, that you add the '&' reference? It will not harm the pbs implementation and make it possible to use meta listeners!
A bit of RTFM here:
the return value is the new location of passBufferPtr. Thus doing:

Code: Select all

while( itor != end )
{
passBuffPtr = itor->preparePassBuffer( shadowNode, casterPass, dualParaboloid,sceneManager, passBufferPtr );
++itor;
}
return passBuffPtr;
Should do it
Lax
Hobgoblin
Posts: 505
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 32

Re: [2.1] Easier way to communicate with hlms shader?

Post by Lax »

ok thanks. I found a similiar solution.

I have another question:
I know add:

Code: Select all

Ogre::Archive* archiveFog = archiveManager.load(dataFolder + "Hlms/Fog/Any", "FileSystem", true);
archivePbsLibraryFolders.push_back(archiveFog);
Fog data to pbs, if fog is enabled. But now when I disable fog via:

Code: Select all

this->gameObjectPtr->getSceneManager()->setFog(Ogre::FOG_NONE);
The whole scene will become black.

Is it possible to add/remove custom shader from pbs at runtime?
I already tried:

Code: Select all

hlmsPbs->reloadFrom(archivePbs, &archivePbsLibraryFolders);
But that did not work and the scene started to flicker.

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image
Lax
Hobgoblin
Posts: 505
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 32

Re: [2.1] Easier way to communicate with hlms shader?

Post by Lax »

Hi,

I digged deeper in that topic. When I deactivate fog, the functions

Code: Select all

getPassBufferSize
and

Code: Select all

preparePassBuffer
, but of course, because when Fog is set to 'NONE', there is no listener, so the returned size in

Code: Select all

getPassBufferSize
is 0 and in

Code: Select all

preparePassBuffer
the

Code: Select all

passBufferPtr
is of course not incremented, this causes the black scene/flickering etc. So the question is: How can shader code be deactivated again?

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image
Post Reply