On 29.10.2015 01:12, Carsten Neumann wrote:

I think for consistency with most of the rest of the
API (and symmetry with addOverride) it should be subOverride instead of
removeOverride.
Yes, you are right.

Could you also please add a comment to the new bool removeOverride field
describing what it does.
Yes.

I'm wondering if it would be better to have a separate collection of
chunks to "remove" instead of changing the semantics of the group based
on a bool flag? But given that this is driven by your needs I don't feel
strongly one way or the other :)
Personally, I think that it would be a kind of code bloat to introduce new classes specifically for that matter.

Below you can find the patch file and the modified source files.

Thanks for taking your time to look at this issue.

Best,
Johannes


diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderAction.h
 
d:/_xxx/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderAction.h
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderAction.h
 2015-10-09 14:25:58.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderAction.h
     2015-11-02 10:13:38.308513600 +0100
@@ -157,6 +157,8 @@ class OSG_SYSTEM_DLLMAPPING RenderAction
 

           void           addOverride        (UInt32      uiSlot, 

                                              StateChunk *pChunk);

+          void           subOverride        (UInt32      uiSlot, 

+                                             StateChunk *pChunk);

 

     const StateOverride *getCurrentOverrides(void              ) const;

 

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderAction.inl
 
d:/_xxx/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderAction.inl
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderAction.inl
       2015-10-09 14:25:58.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderAction.inl
   2015-11-02 10:13:25.241691000 +0100
@@ -114,6 +114,12 @@ void RenderAction::addOverride(UInt32 ui
 }

 

 inline

+void RenderAction::subOverride(UInt32 uiSlot, StateChunk *pChunk)

+{

+    _pActivePartition->subOverride(uiSlot, pChunk);

+}

+

+inline

 const StateOverride *RenderAction::getCurrentOverrides(void) const

 {

     return _pActivePartition->getCurrentOverrides();

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderPartition.h
 
d:/_xxx/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderPartition.h
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderPartition.h
      2015-10-09 14:25:58.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderPartition.h
  2015-11-02 10:13:57.368546300 +0100
@@ -307,6 +307,9 @@ class OSG_SYSTEM_DLLMAPPING RenderPartit
           void           addOverride        (UInt32      uiSlot, 

                                              StateChunk *pChunk);

 

+          void           subOverride        (UInt32      uiSlot, 

+                                             StateChunk *pChunk);

+

     const StateOverride *getCurrentOverrides(void              ) const;

 

     /*-------------------------- comparison ---------------------------------*/

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderPartition.inl
 
d:/_xxx/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderPartition.inl
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderPartition.inl
    2015-10-09 14:25:58.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/Action/RenderAction/OSGRenderPartition.inl
        2015-11-02 10:13:47.141328700 +0100
@@ -386,6 +386,12 @@ void RenderPartition::addOverride(UInt32
 }

 

 inline

+void RenderPartition::subOverride(UInt32 uiSlot, StateChunk *pChunk)

+{

+    _sStateOverrides.top()->subOverride(uiSlot, pChunk);

+}

+

+inline

 const StateOverride *RenderPartition::getCurrentOverrides(void) const

 {

     return _sStateOverrides.top();

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroup.cpp
 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroup.cpp
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroup.cpp
       2015-10-09 14:26:00.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroup.cpp
   2015-11-02 10:13:13.335270500 +0100
@@ -224,7 +224,10 @@ Action::ResultE ChunkOverrideGroup::rend
         while(chIt != chEnd)

         {

             if(*chIt != NULL && (*chIt)->getIgnore() == false)

-                pAction->addOverride(uiSlot, *chIt);

+                if (getSubOverride())

+                    pAction->subOverride(uiSlot, *chIt);

+                else

+                    pAction->addOverride(uiSlot, *chIt);

             

             ++uiSlot;

             ++chIt;

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroup.fcd
 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroup.fcd
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroup.fcd
       2015-10-09 14:26:00.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroup.fcd
   2015-11-02 09:42:04.477588600 +0100
@@ -15,7 +15,7 @@
   ChunkOverrideGroup is a simple group node that allows for material chunks

   to be set that will override all chunks stored in materials in the entire 

   subtree. Currently the last chunk override wins (note the difference to

-  the material group). This might change in future

+  the material group). This might change in future.

 

   <Field

         name="fallbackChunkBlock"

@@ -25,5 +25,19 @@
         access="public"

         >

   </Field>

+

+<Field

+        name="subOverride"

+        type="bool"

+        cardinality="single"

+        visibility="external"

+        defaultValue="false"

+        access="public"

+       >

+                If true, the ChunkOverrideGroup group does not add new 
override chunks, 

+                but subtract the chunks from the list of already defined 
override chunks.

+                Basically, that allows to negate overrides at a deeper level 
in the scene graph.

+</Field>

+

 </FieldContainer>

 

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.cpp
 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.cpp
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.cpp
   2015-10-09 14:26:00.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.cpp
       2015-11-02 10:53:33.781770400 +0100
@@ -75,10 +75,10 @@ OSG_BEGIN_NAMESPACE
 \***************************************************************************/

 

 /*! \class OSG::ChunkOverrideGroup

-    ChunkOverrideGroup is a simple group node that allows for material chunks

-    to be set that will override all chunks stored in materials in the entire 

-    subtree. Currently the last chunk override wins (note the difference to

-    the material group). This might change in future

+    ChunkOverrideGroup is a simple group node that allows for material chunks
+    to be set that will override all chunks stored in materials in the entire 
+    subtree. Currently the last chunk override wins (note the difference to
+    the material group). This might change in future.

  */

 

 /***************************************************************************\

@@ -89,6 +89,12 @@ OSG_BEGIN_NAMESPACE
     

 */

 

+/*! \var bool            ChunkOverrideGroupBase::_sfSubOverride

+    If true, the ChunkOverrideGroup group does not add new override chunks, 
+    but subtract the chunks from the list of already defined override chunks.
+    Basically, that allows to negate overrides at a deeper level in the scene 
graph.

+*/

+

 

 /***************************************************************************\

  *                      FieldType/FieldTrait Instantiation                 *

@@ -132,6 +138,20 @@ void ChunkOverrideGroupBase::classDescIn
         static_cast<FieldGetMethodSig 
>(&ChunkOverrideGroup::getHandleFallbackChunkBlock));

 

     oType.addInitialDesc(pDesc);

+

+    pDesc = new SFBool::Description(

+        SFBool::getClassType(),

+        "subOverride",

+        "If true, the ChunkOverrideGroup group does not add new override 
chunks, \n"
+        "but subtract the chunks from the list of already defined override 
chunks.\n"
+        "Basically, that allows to negate overrides at a deeper level in the 
scene graph.\n",

+        SubOverrideFieldId, SubOverrideFieldMask,

+        false,

+        (Field::SFDefaultFlags | Field::FStdAccess),

+        
static_cast<FieldEditMethodSig>(&ChunkOverrideGroup::editHandleSubOverride),

+        static_cast<FieldGetMethodSig 
>(&ChunkOverrideGroup::getHandleSubOverride));

+

+    oType.addInitialDesc(pDesc);

 }

 

 

@@ -146,39 +166,53 @@ ChunkOverrideGroupBase::TypeObject Chunk
     
reinterpret_cast<InitalInsertDescFunc>(&ChunkOverrideGroup::classDescInserter),

     false,

     0,

-    "<?xml version=\"1.0\"?>\n"

-    "\n"

-    "<FieldContainer\n"

-    "   name=\"ChunkOverrideGroup\"\n"

-    "   parent=\"Group\"\n"

-    "   library=\"System\"\n"

-    "   pointerfieldtypes=\"both\"\n"

-    "   structure=\"concrete\"\n"

-    "   systemcomponent=\"true\"\n"

-    "   parentsystemcomponent=\"true\"\n"

-    "   isNodeCore=\"true\"\n"

-    "   docGroupBase=\"GrpSystemNodeCoreGroups\"\n"

-    "   >\n"

-    "\n"

-    "  ChunkOverrideGroup is a simple group node that allows for material 
chunks\n"

-    "  to be set that will override all chunks stored in materials in the 
entire \n"

-    "  subtree. Currently the last chunk override wins (note the difference 
to\n"

-    "  the material group). This might change in future\n"

-    "\n"

-    "  <Field\n"

-    "\t name=\"fallbackChunkBlock\"\n"

-    "\t type=\"ChunkBlockPtr\"\n"

-    "\t cardinality=\"single\"\n"

-    "\t visibility=\"external\"\n"

-    "\t access=\"public\"\n"

-    "\t >\n"

-    "  </Field>\n"

-    "</FieldContainer>\n"

+    "<?xml version=\"1.0\"?>\n"
+    "\n"
+    "<FieldContainer\n"
+    "   name=\"ChunkOverrideGroup\"\n"
+    "   parent=\"Group\"\n"
+    "   library=\"System\"\n"
+    "   pointerfieldtypes=\"both\"\n"
+    "   structure=\"concrete\"\n"
+    "   systemcomponent=\"true\"\n"
+    "   parentsystemcomponent=\"true\"\n"
+    "   isNodeCore=\"true\"\n"
+    "   docGroupBase=\"GrpSystemNodeCoreGroups\"\n"
+    "   >\n"
+    "\n"
+    "  ChunkOverrideGroup is a simple group node that allows for material 
chunks\n"
+    "  to be set that will override all chunks stored in materials in the 
entire \n"
+    "  subtree. Currently the last chunk override wins (note the difference 
to\n"
+    "  the material group). This might change in future.\n"
+    "\n"
+    "  <Field\n"
+    "\t name=\"fallbackChunkBlock\"\n"
+    "\t type=\"ChunkBlockPtr\"\n"
+    "\t cardinality=\"single\"\n"
+    "\t visibility=\"external\"\n"
+    "\t access=\"public\"\n"
+    "\t >\n"
+    "  </Field>\n"
+    "\n"
+    "<Field\n"
+    "        name=\"subOverride\"\n"
+    "        type=\"bool\"\n"
+    "        cardinality=\"single\"\n"
+    "        visibility=\"external\"\n"
+    "        defaultValue=\"false\"\n"
+    "        access=\"public\"\n"
+    "\t>\n"
+    "                If true, the ChunkOverrideGroup group does not add new 
override chunks, \n"
+    "                but subtract the chunks from the list of already defined 
override chunks.\n"
+    "                Basically, that allows to negate overrides at a deeper 
level in the scene graph.\n"
+    "</Field>\n"
+    "\n"
+    "</FieldContainer>\n"
     "\n",

-    "ChunkOverrideGroup is a simple group node that allows for material 
chunks\n"

-    "to be set that will override all chunks stored in materials in the entire 
\n"

-    "subtree. Currently the last chunk override wins (note the difference to\n"

-    "the material group). This might change in future\n"

+    "ChunkOverrideGroup is a simple group node that allows for material 
chunks\n"
+    "to be set that will override all chunks stored in materials in the entire 
\n"
+    "subtree. Currently the last chunk override wins (note the difference to\n"
+    "the material group). This might change in future.\n"

     );

 

 /*------------------------------ get -----------------------------------*/

@@ -229,6 +263,19 @@ void ChunkOverrideGroupBase::setFallback
 }

 

 

+SFBool *ChunkOverrideGroupBase::editSFSubOverride(void)

+{

+    editSField(SubOverrideFieldMask);

+

+    return &_sfSubOverride;

+}

+

+const SFBool *ChunkOverrideGroupBase::getSFSubOverride(void) const

+{

+    return &_sfSubOverride;

+}

+

+

 

 

 

@@ -243,6 +290,10 @@ SizeT ChunkOverrideGroupBase::getBinSize
     {

         returnValue += _sfFallbackChunkBlock.getBinSize();

     }

+    if(FieldBits::NoField != (SubOverrideFieldMask & whichField))

+    {

+        returnValue += _sfSubOverride.getBinSize();

+    }

 

     return returnValue;

 }

@@ -256,6 +307,10 @@ void ChunkOverrideGroupBase::copyToBin(B
     {

         _sfFallbackChunkBlock.copyToBin(pMem);

     }

+    if(FieldBits::NoField != (SubOverrideFieldMask & whichField))

+    {

+        _sfSubOverride.copyToBin(pMem);

+    }

 }

 

 void ChunkOverrideGroupBase::copyFromBin(BinaryDataHandler &pMem,

@@ -268,6 +323,11 @@ void ChunkOverrideGroupBase::copyFromBin
         editSField(FallbackChunkBlockFieldMask);

         _sfFallbackChunkBlock.copyFromBin(pMem);

     }

+    if(FieldBits::NoField != (SubOverrideFieldMask & whichField))

+    {

+        editSField(SubOverrideFieldMask);

+        _sfSubOverride.copyFromBin(pMem);

+    }

 }

 

 //! create a new instance of the class

@@ -393,13 +453,15 @@ FieldContainerTransitPtr ChunkOverrideGr
 

 ChunkOverrideGroupBase::ChunkOverrideGroupBase(void) :

     Inherited(),

-    _sfFallbackChunkBlock     (NULL)

+    _sfFallbackChunkBlock     (NULL),

+    _sfSubOverride            (bool(false))

 {

 }

 

 ChunkOverrideGroupBase::ChunkOverrideGroupBase(const ChunkOverrideGroupBase 
&source) :

     Inherited(source),

-    _sfFallbackChunkBlock     (NULL)

+    _sfFallbackChunkBlock     (NULL),

+    _sfSubOverride            (source._sfSubOverride            )

 {

 }

 

@@ -449,6 +511,31 @@ EditFieldHandlePtr ChunkOverrideGroupBas
 

     return returnValue;

 }

+

+GetFieldHandlePtr ChunkOverrideGroupBase::getHandleSubOverride     (void) const

+{

+    SFBool::GetHandlePtr returnValue(

+        new  SFBool::GetHandle(

+             &_sfSubOverride,

+             this->getType().getFieldDesc(SubOverrideFieldId),

+             const_cast<ChunkOverrideGroupBase *>(this)));

+

+    return returnValue;

+}

+

+EditFieldHandlePtr ChunkOverrideGroupBase::editHandleSubOverride    (void)

+{

+    SFBool::EditHandlePtr returnValue(

+        new  SFBool::EditHandle(

+             &_sfSubOverride,

+             this->getType().getFieldDesc(SubOverrideFieldId),

+             this));

+

+

+    editSField(SubOverrideFieldMask);

+

+    return returnValue;

+}

 

 

 #ifdef OSG_MT_CPTR_ASPECT

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.h
 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.h
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.h
     2015-10-09 14:26:00.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.h
 2015-11-02 10:53:33.787770800 +0100
@@ -66,6 +66,7 @@
 #include "OSGGroup.h" // Parent

 

 #include "OSGChunkBlockFields.h"        // FallbackChunkBlock type

+#include "OSGSysFields.h"               // SubOverride type

 

 #include "OSGChunkOverrideGroupFields.h"

 

@@ -95,15 +96,19 @@ class OSG_SYSTEM_DLLMAPPING ChunkOverrid
     enum

     {

         FallbackChunkBlockFieldId = Inherited::NextFieldId,

-        NextFieldId = FallbackChunkBlockFieldId + 1

+        SubOverrideFieldId = FallbackChunkBlockFieldId + 1,

+        NextFieldId = SubOverrideFieldId + 1

     };

 

     static const OSG::BitVector FallbackChunkBlockFieldMask =

         (TypeTraits<BitVector>::One << FallbackChunkBlockFieldId);

+    static const OSG::BitVector SubOverrideFieldMask =

+        (TypeTraits<BitVector>::One << SubOverrideFieldId);

     static const OSG::BitVector NextFieldMask =

         (TypeTraits<BitVector>::One << NextFieldId);

         

     typedef SFUnrecChunkBlockPtr SFFallbackChunkBlockType;

+    typedef SFBool            SFSubOverrideType;

 

     /*---------------------------------------------------------------------*/

     /*! \name                    Class Get                                 */

@@ -131,15 +136,22 @@ class OSG_SYSTEM_DLLMAPPING ChunkOverrid
             const SFUnrecChunkBlockPtr *getSFFallbackChunkBlock(void) const;

                   SFUnrecChunkBlockPtr *editSFFallbackChunkBlock(void);

 

+                  SFBool              *editSFSubOverride    (void);

+            const SFBool              *getSFSubOverride     (void) const;

+

 

                   ChunkBlock * getFallbackChunkBlock(void) const;

 

+                  bool                &editSubOverride    (void);

+                  bool                 getSubOverride     (void) const;

+

     /*! \}                                                                 */

     /*---------------------------------------------------------------------*/

     /*! \name                    Field Set                                 */

     /*! \{                                                                 */

 

             void setFallbackChunkBlock(ChunkBlock * const value);

+            void setSubOverride    (const bool value);

 

     /*! \}                                                                 */

     /*---------------------------------------------------------------------*/

@@ -205,6 +217,7 @@ class OSG_SYSTEM_DLLMAPPING ChunkOverrid
     /*! \{                                                                 */

 

     SFUnrecChunkBlockPtr _sfFallbackChunkBlock;

+    SFBool            _sfSubOverride;

 

     /*! \}                                                                 */

     /*---------------------------------------------------------------------*/

@@ -235,6 +248,8 @@ class OSG_SYSTEM_DLLMAPPING ChunkOverrid
 

      GetFieldHandlePtr  getHandleFallbackChunkBlock (void) const;

      EditFieldHandlePtr editHandleFallbackChunkBlock(void);

+     GetFieldHandlePtr  getHandleSubOverride     (void) const;

+     EditFieldHandlePtr editHandleSubOverride    (void);

 

     /*! \}                                                                 */

     /*---------------------------------------------------------------------*/

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.inl
 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.inl
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.inl
   2015-10-09 14:26:00.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/NodeCores/Groups/Base/OSGChunkOverrideGroupBase.inl
       2015-11-02 10:53:33.783770500 +0100
@@ -74,6 +74,31 @@ OSG::UInt16 ChunkOverrideGroupBase::getC
 

 /*------------------------------ get -----------------------------------*/

 

+//! Get the value of the ChunkOverrideGroup::_sfSubOverride field.

+

+inline

+bool &ChunkOverrideGroupBase::editSubOverride(void)

+{

+    editSField(SubOverrideFieldMask);

+

+    return _sfSubOverride.getValue();

+}

+

+//! Get the value of the ChunkOverrideGroup::_sfSubOverride field.

+inline

+      bool  ChunkOverrideGroupBase::getSubOverride(void) const

+{

+    return _sfSubOverride.getValue();

+}

+

+//! Set the value of the ChunkOverrideGroup::_sfSubOverride field.

+inline

+void ChunkOverrideGroupBase::setSubOverride(const bool value)

+{

+    editSField(SubOverrideFieldMask);

+

+    _sfSubOverride.setValue(value);

+}

 

 

 #ifdef OSG_MT_CPTR_ASPECT

@@ -88,6 +113,9 @@ void ChunkOverrideGroupBase::execSync (
 

     if(FieldBits::NoField != (FallbackChunkBlockFieldMask & whichField))

         _sfFallbackChunkBlock.syncWith(pFrom->_sfFallbackChunkBlock);

+

+    if(FieldBits::NoField != (SubOverrideFieldMask & whichField))

+        _sfSubOverride.syncWith(pFrom->_sfSubOverride);

 }

 #endif

 

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/State/Base/OSGStateOverride.cpp
 
d:/_xxx/Comp/builder/support/opensg/Source/System/State/Base/OSGStateOverride.cpp
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/State/Base/OSGStateOverride.cpp
       2015-10-09 14:26:00.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/State/Base/OSGStateOverride.cpp
   2015-11-02 09:31:30.227274600 +0100
@@ -295,3 +295,150 @@ void StateOverride::addOverride(UInt32 u
         this->addOverride(uiSlot, pSPChunk);

     }

 }

+

+void StateOverride::subOverride(UInt32 uiSlot, ShaderProgramChunk *pChunk)

+{

+    if(pChunk == NULL)

+    {

+        return;

+    }

+

+    ShaderProgramChunk::MFVertexShaderType::const_iterator sIt  = 

+        pChunk->getMFVertexShader()->begin();

+

+    ShaderProgramChunk::MFVertexShaderType::const_iterator sEnd = 

+        pChunk->getMFVertexShader()->end();

+

+

+    for(; sIt != sEnd; ++sIt)

+    {

+        UInt16    uiProgId = (*sIt)->getProgramId();

+

+        std::pair<IdStoreIt, IdStoreIt> pairIt 

+            = std::equal_range(_vProgIds.begin(),

+                               _vProgIds.end  (),

+                               uiProgId         );

+

+        if(pairIt.first != pairIt.second)

+        {

+            _vProgIds.erase(pairIt.first);

+        }

+    }

+

+    sIt  = pChunk->getMFGeometryShader()->begin();

+    sEnd = pChunk->getMFGeometryShader()->end  ();

+

+    for(; sIt != sEnd; ++sIt)

+    {

+        UInt16    uiProgId = (*sIt)->getProgramId();

+

+        std::pair<IdStoreIt, IdStoreIt> pairIt 

+            = std::equal_range(_vProgIds.begin(),

+                               _vProgIds.end  (),

+                               uiProgId         );

+

+        if(pairIt.first != pairIt.second)

+        {

+            _vProgIds.erase(pairIt.first);

+        }

+    }

+

+    sIt  = pChunk->getMFFragmentShader()->begin();

+    sEnd = pChunk->getMFFragmentShader()->end  ();

+

+    for(; sIt != sEnd; ++sIt)

+    {

+        UInt16    uiProgId = (*sIt)->getProgramId();

+

+        std::pair<IdStoreIt, IdStoreIt> pairIt 

+            = std::equal_range(_vProgIds.begin(),

+                               _vProgIds.end  (),

+                               uiProgId         );

+

+        if(pairIt.first != pairIt.second)

+        {

+            _vProgIds.erase(pairIt.first);

+        }

+    }

+

+    ProgramChunkStore::const_iterator sIt2 = std::find(_vProgChunks.begin(), 
_vProgChunks.end(), pChunk);

+    if (sIt2 != _vProgChunks.end())

+        _vProgChunks.erase(sIt2);

+}

+

+void StateOverride::subOverride(UInt32                      uiSlot, 

+                                ShaderProgramVariableChunk *pChunk)

+{

+    if(pChunk == NULL)

+    {

+        return;

+    }

+

+    UInt16    uiVarId = pChunk->getVariableId();

+

+

+    std::pair<IdStoreIt, IdStoreIt> pairIt 

+            = std::equal_range(_vProgVarIds.begin(),

+                               _vProgVarIds.end  (),

+                               uiVarId             );

+

+        

+    if(pairIt.first != pairIt.second)

+    {

+        _vProgVarIds.erase(pairIt.first);

+    }

+

+    ProgramVarChunkStore::const_iterator sIt2 = 
std::find(_vProgVarChunks.begin(), _vProgVarChunks.end(), pChunk);

+    if (sIt2 != _vProgVarChunks.end())

+        _vProgVarChunks.erase(sIt2);

+}

+

+void StateOverride::subOverride(UInt32          uiSlot, 

+                                SimpleSHLChunk *pChunk)

+{

+    eraseOverride(uiSlot, pChunk);

+}

+

+void StateOverride::eraseOverride(UInt32      uiSlot, 

+                                  StateChunk *pChunk)

+{

+    ChunkElement newElem(uiSlot, pChunk);

+

+    

+    std::pair<ChunkStoreIt, ChunkStoreIt> pairIt

+                     = std::equal_range(_vChunks.begin(),

+                                        _vChunks.end  (),

+                                         newElem        );

+

+    for (; pairIt.first != pairIt.second; ++pairIt.first)

+    {

+        if (pairIt.first->first == uiSlot) {

+            _vChunks.erase(pairIt.first);

+            break;

+        }

+    }

+}

+

+void StateOverride::subOverride(UInt32 uiSlot, StateChunk *pChunk)

+{

+    ShaderProgramChunk *pSPChunk = dynamic_cast<ShaderProgramChunk *>(pChunk);

+

+    if(pSPChunk == NULL)

+    {

+        ShaderProgramVariableChunk *pSPVChunk = 

+            dynamic_cast<ShaderProgramVariableChunk *>(pChunk);

+

+        if(pSPVChunk == NULL)

+        {

+            eraseOverride(uiSlot, pChunk);

+        }

+        else

+        {

+            this->subOverride(uiSlot, pSPVChunk);

+        }

+    }

+    else

+    {

+        this->subOverride(uiSlot, pSPChunk);

+    }

+}

diff -rupN 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/State/Base/OSGStateOverride.h
 d:/_xxx/Comp/builder/support/opensg/Source/System/State/Base/OSGStateOverride.h
--- 
d:/cpp_xxx_/Comp/builder/support/opensg/Source/System/State/Base/OSGStateOverride.h
 2015-10-09 14:26:00.000000000 +0200
+++ 
d:/_xxx/Comp/builder/support/opensg/Source/System/State/Base/OSGStateOverride.h 
    2015-11-02 10:12:27.384390500 +0100
@@ -148,6 +148,17 @@ class OSG_SYSTEM_DLLMAPPING StateOverrid
     void addOverride  (UInt32                      uiSlot, 

                        ShaderProgramVariableChunk *pChunk);

 

+

+    void subOverride  (UInt32                      uiSlot, 

+                       StateChunk                 *pChunk);

+    void subOverride  (UInt32                      uiSlot, 

+                       SimpleSHLChunk             *pChunk);

+    void subOverride  (UInt32                      uiSlot, 

+                       ShaderProgramChunk         *pChunk);

+    void subOverride  (UInt32                      uiSlot, 

+                       ShaderProgramVariableChunk *pChunk);

+

+

     bool empty        (void                      );

 

     bool isTransparent(void                      );

@@ -214,6 +225,9 @@ class OSG_SYSTEM_DLLMAPPING StateOverrid
     void insertOverride(UInt32      uiSlot, 

                         StateChunk *pChunk);

 

+    void eraseOverride (UInt32      uiSlot, 

+                        StateChunk *pChunk);

+

     /*! \}                                                                 */

     /*==========================  PRIVATE  ================================*/

 

Attachment: subOverride.azip
Description: Binary data

------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to