Hi Carsten,

On 25.04.2012 16:44, Carsten Neumann wrote:
>       Hello Christoph,
>
> On 04/25/2012 04:09 AM, "Christoph Fünfzig" wrote:
>> I am wondering if separating a ChunkMaterial into two parts might be 
>> possible:
>> The first containing a SimpleSHLChunk for several childs:
>>      OSG::SimpleSHLChunkUnrecPtr shl = OSG::SimpleSHLChunk::create();
>>      shl->setVertexProgram      (_vp_program);
>>      shl->setFragmentProgram(_fp_program);
>>      // common parameters:
>>      shl->addUniformVariable("texScale0",  
>> OSG::Vec2f(1.0f/OSG::Real32(numTiles), 1.0f/OSG::Real32(numTiles)));
>>      shl->addUniformVariable("texScale1",  OSG::Vec2f(1.0f, 1.0f));
>>      // uniform sampler2D
>>      shl->addUniformVariable("tex_alpha",     0);
>>      shl->addUniformVariable("tex_ground",  1);
>>      shl->addUniformVariable("tex_detail1",   2);
>>      shl->addUniformVariable("tex_height",    3);
>>      shl->addUniformVariable("tex_gradient", 4);
>>
>> and a second containing special variables (scalings, coords) for a specific 
>> child node:
>>      OSG::SimpleSHLVariableChunkUnrecPtr shlparam = 
>> OSG::SimpleSHLVariableChunk::create();
>>      shlparam->addUniformVariable("texOrigin0", 
>> OSG::Vec2f(tx/OSG::Real32(numTiles),ty/OSG::Real32(numTiles)));
>>      shlparam->addUniformVariable("tileCoord",  OSG::Pnt2f(tx, ty));
>>      shlparam->addUniformVariable("tileOrigin", OSG::Pnt2f(-skySize, 
>> -skySize));
>>      shlparam->addUniformVariable("decimate",   10.0f);
>>
>> Is this possible or intended with an ChunkOverrideGroup containing the first?
>
> the shader chunks can be composed with ChunkOverrideGroups (so they 
> behave a bit odd in the sense that they are not really overridden, but 
> aggregated instead). I'm not 100% sure if that works with SimpleSHLChunk 
> or if you need to use ShaderProgramChunk and ShaderProgramVariableChunk.
>
> Gerrit: Can you help out here?
>
Well, I included ShaderProgramChunk and ShaderProgramVariableChunk:

1>c:\opensg2\opensg\source\system\state\shl\OSGShaderParameterChunkBase.h(105) 
: error C2146: erreur de syntaxe : absence de ';' avant l'identificateur 
'MFParametersType'
1>c:\opensg2\opensg\source\system\state\shl\OSGShaderParameterChunkBase.h(105) 
: error C4430: spécificateur de type manquant - int est pris en compte par 
défaut. Remarque : C++ ne prend pas en charge int par défaut
1>c:\opensg2\opensg\source\system\state\shl\OSGShaderParameterChunkBase.h(105) 
: error C4430: spécificateur de type manquant - int est pris en compte par 
défaut. Remarque : C++ ne prend pas en charge int par défaut

It seems to miss a type "MFUnrecChildShaderParameterPtr" (Windows 7, 64bit).

>> Does it have benefits to do so?
>
> Your application has to keep track of only one place to change uniform 
> values for groups of objects.
>       

Yes, definitely. But does it also have benefits for state sorting?
Is it on whole states or on state chunks level?

Thanks,
Christoph
-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                          
        
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to