Hello Gerrit, Volker,

On 08/14/2012 08:34 PM, Gerrit Voß wrote:
small comment, changes during local rendering should never be needed to
get the clustering right. Usually they should not even be transmitted.
Because, rendering locally on the master while clustering is optional,
for example on our main cluster the application is started remotely,
without anybody being even being logged into the master, so no
rendering will happen in this setup.

hmm, makes sense. During development I went back and forth a couple of times about what to distribute and what not, but I kept running into problems with keeping stuff local - may have been due to bugs in the app or in the handling of local containers that are fixed now. Anyway, I'm attaching an (untested) patch that creates the {CPU,GPU}SkinningDataAttachment locally [1]. If anyone feels adventurous and helpful: I'd appreciate if you'd give it a try :)

        Cheers,
                Carsten

[1] I needed to add cloneLocal() functions to the GeoProperties, which seems like a useful addition independent of the rest of the patch?
diff --git a/Source/System/Dynamics/Skeleton/OSGCPUSkinningAlgorithm.cpp b/Source/System/Dynamics/Skeleton/OSGCPUSkinningAlgorithm.cpp
index 48a177c..aa76a3c 100644
--- a/Source/System/Dynamics/Skeleton/OSGCPUSkinningAlgorithm.cpp
+++ b/Source/System/Dynamics/Skeleton/OSGCPUSkinningAlgorithm.cpp
@@ -331,7 +331,7 @@ CPUSkinningAlgorithm::renderEnter(Action *action)
 
     if(data == NULL)
     {
-        data = CPUSkinningDataAttachment::create();
+        data = CPUSkinningDataAttachment::createLocal();
         skinGeo->addAttachment(data);
     }
 
@@ -368,7 +368,7 @@ CPUSkinningAlgorithm::intersectEnter(Action *action)
 
     if(data == NULL)
     {
-        data = CPUSkinningDataAttachment::create();
+        data = CPUSkinningDataAttachment::createLocal();
         skinGeo->addAttachment(data);
     }
 
@@ -525,7 +525,7 @@ void CPUSkinningAlgorithm::transformGeometry(
         if(prop == NULL)
         {
             GeoVectorPropertyUnrecPtr newProp =
-                dynamic_pointer_cast<GeoVectorProperty>(origProp->clone());
+                dynamic_pointer_cast<GeoVectorProperty>(origProp->cloneLocal());
 
             mfProps->replace(i, newProp);
             prop = newProp;
diff --git a/Source/System/Dynamics/Skeleton/OSGGPUSkinningAlgorithm.cpp b/Source/System/Dynamics/Skeleton/OSGGPUSkinningAlgorithm.cpp
index 10bebb8..40c42c2 100644
--- a/Source/System/Dynamics/Skeleton/OSGGPUSkinningAlgorithm.cpp
+++ b/Source/System/Dynamics/Skeleton/OSGGPUSkinningAlgorithm.cpp
@@ -220,7 +220,7 @@ GPUSkinningAlgorithm::renderEnter(Action *action)
 
     if(data == NULL)
     {
-        data = GPUSkinningDataAttachment::create();
+        data = GPUSkinningDataAttachment::createLocal();
         skel->addAttachment(data);
     }
 
@@ -230,10 +230,11 @@ GPUSkinningAlgorithm::renderEnter(Action *action)
 
     if(shCode == NULL)
     {
-        shCode = ShaderProgramChunk::create();
+        shCode = ShaderProgramChunk::createLocal();
         data->setShaderCode(shCode);
 
-        ShaderProgramUnrecPtr vp = ShaderProgram::createVertexShader();
+        ShaderProgramUnrecPtr vp = ShaderProgram::createLocal();
+        vp->setShaderType(GL_VERTEX_SHADER);
         vp->setProgram(_vpVertexSkinning);
 
         shCode->addShader(vp);
@@ -332,8 +333,7 @@ GPUSkinningAlgorithm::skeletonChanged(FieldContainer    *fc,
     // the data - it either is updated by the same sync or
     // the sync marks it as invalid.
 
-    if(origin != ChangedOrigin::Sync  &&
-       ((Skeleton::JointMatricesFieldMask      |
+    if(((Skeleton::JointMatricesFieldMask      |
          Skeleton::JointNormalMatricesFieldMask) & whichField) != 0)
     {
         OSG_ASSERT(fc == _sfSkeleton.getValue());
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferProperty.cpp b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferProperty.cpp
index 8e331fd..be0a0aa 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferProperty.cpp
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferProperty.cpp
@@ -168,5 +168,18 @@ GeoPropertyTransitPtr GeoIntegralBufferProperty::clone(void)
     return GeoPropertyTransitPtr(NULL);
 }
 
+GeoPropertyTransitPtr GeoIntegralBufferProperty::cloneLocal(BitVector bFlags)
+{
+    OSG_ASSERT(false);
+
+    return GeoPropertyTransitPtr(NULL);
+}
+
+GeoPropertyTransitPtr GeoIntegralBufferProperty::cloneDependent(BitVector bFlags)
+{
+    OSG_ASSERT(false);
+
+    return GeoPropertyTransitPtr(NULL);
+}
 
 OSG_END_NAMESPACE
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferProperty.h b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferProperty.h
index f7ddfc4..8ab6cca 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferProperty.h
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoIntegralBufferProperty.h
@@ -121,7 +121,10 @@ class OSG_DRAWABLE_DLLMAPPING GeoIntegralBufferProperty :
                                                   const SizeT     index) const;
     virtual void                  setGenericValue(const MaxTypeT &val,
                                                   const SizeT     index);
-    virtual GeoPropertyTransitPtr clone          (      void           );
+
+    virtual GeoPropertyTransitPtr clone         (void                           );
+    virtual GeoPropertyTransitPtr cloneLocal    (BitVector bFlags = FCLocal::All);
+    virtual GeoPropertyTransitPtr cloneDependent(BitVector bFlags               );
 
     /*! \}                                                                 */
     /*---------------------------------------------------------------------*/
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoMultiProperty.cpp b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoMultiProperty.cpp
index 964a0b8..10d801f 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoMultiProperty.cpp
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoMultiProperty.cpp
@@ -213,10 +213,13 @@ void GeoMultiProperty::setValue(const MaxTypeT &val, const UInt32 index)
     setGenericValue(val, index);
 }
 
+/*! Returns a copy of this property that holds the same data. The underlying
+    data (i.e. sfContainer) is shared, NOT duplicated.
+ */
 GeoPropertyTransitPtr GeoMultiProperty::clone(void)
 {
     ObjTransitPtr obj = GeoMultiProperty::create();
-    
+
     obj->setContainer (this->getContainer ());
     obj->setOffset    (this->getOffset    ());
     obj->setIFormat   (this->getIFormat   ());
@@ -224,7 +227,43 @@ GeoPropertyTransitPtr GeoMultiProperty::clone(void)
     obj->setISize     (this->getISize     ());
     obj->setINormalize(this->getINormalize());
     obj->setIStride   (this->getIStride   ());
-    
+
+    return GeoPropertyTransitPtr(obj);
+}
+
+/*! Returns a copy of this property that holds the same data. The underlying
+    data (i.e. sfContainer) is shared, NOT duplicated.
+ */
+GeoPropertyTransitPtr GeoMultiProperty::cloneLocal(BitVector bFlags)
+{
+    ObjTransitPtr obj = GeoMultiProperty::createLocal(bFlags);
+
+    obj->setContainer (this->getContainer ());
+    obj->setOffset    (this->getOffset    ());
+    obj->setIFormat   (this->getIFormat   ());
+    obj->setIDimension(this->getIDimension());
+    obj->setISize     (this->getISize     ());
+    obj->setINormalize(this->getINormalize());
+    obj->setIStride   (this->getIStride   ());
+
+    return GeoPropertyTransitPtr(obj);
+}
+
+/*! Returns a copy of this property that holds the same data. The underlying
+    data (i.e. sfContainer) is shared, NOT duplicated.
+ */
+GeoPropertyTransitPtr GeoMultiProperty::cloneDependent(BitVector bFlags)
+{
+    ObjTransitPtr obj = GeoMultiProperty::createDependent(bFlags);
+
+    obj->setContainer (this->getContainer ());
+    obj->setOffset    (this->getOffset    ());
+    obj->setIFormat   (this->getIFormat   ());
+    obj->setIDimension(this->getIDimension());
+    obj->setISize     (this->getISize     ());
+    obj->setINormalize(this->getINormalize());
+    obj->setIStride   (this->getIStride   ());
+
     return GeoPropertyTransitPtr(obj);
 }
 
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoMultiProperty.h b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoMultiProperty.h
index ca4a3d3..0d23357 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoMultiProperty.h
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoMultiProperty.h
@@ -95,8 +95,10 @@ class OSG_DRAWABLE_DLLMAPPING GeoMultiProperty :
                   void      setValue     (const MaxTypeT &val,
                                           const UInt32    index  );
 
-    virtual GeoPropertyTransitPtr clone(void);
-                                          
+    virtual GeoPropertyTransitPtr clone         (void                           );
+    virtual GeoPropertyTransitPtr cloneLocal    (BitVector bFlags = FCLocal::All);
+    virtual GeoPropertyTransitPtr cloneDependent(BitVector bFlags               );
+
     /*! \}                                                                 */
     /*---------------------------------------------------------------------*/
     /*! \name                 Chunk Class Access                           */
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferProperty.cpp b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferProperty.cpp
index f46b032..1b35ae7 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferProperty.cpp
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferProperty.cpp
@@ -172,5 +172,18 @@ GeoPropertyTransitPtr GeoVectorBufferProperty::clone(void)
     return GeoPropertyTransitPtr(NULL);
 }
 
+GeoPropertyTransitPtr GeoVectorBufferProperty::cloneLocal(BitVector bFlags)
+{
+    OSG_ASSERT(false);
+
+    return GeoPropertyTransitPtr(NULL);
+}
+
+GeoPropertyTransitPtr GeoVectorBufferProperty::cloneDependent(BitVector bFlags)
+{
+    OSG_ASSERT(false);
+
+    return GeoPropertyTransitPtr(NULL);
+}
 
 OSG_END_NAMESPACE
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferProperty.h b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferProperty.h
index 0838181..d72ea67 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferProperty.h
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorBufferProperty.h
@@ -122,7 +122,10 @@ class OSG_DRAWABLE_DLLMAPPING GeoVectorBufferProperty :
                                                   const SizeT         ) const;
     virtual void                  setGenericValue(const MaxTypeT&,
                                                   const SizeT         );
-    virtual GeoPropertyTransitPtr clone          (      void          );
+
+    virtual GeoPropertyTransitPtr clone         (void                           );
+    virtual GeoPropertyTransitPtr cloneLocal    (BitVector bFlags = FCLocal::All);
+    virtual GeoPropertyTransitPtr cloneDependent(BitVector bFlags               );
 
     /*! \}                                                                 */
     /*---------------------------------------------------------------------*/
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.h b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.h
index d065af3..b10d91e 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.h
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.h
@@ -130,8 +130,10 @@ class TypedGeoIntegralProperty : public GeoIntegralProperty
     virtual       SizeT                  size         (void) const;
     virtual       UInt32                 size32       (void) const;
 
-    virtual       GeoPropertyTransitPtr  clone        (void);
-    
+    virtual GeoPropertyTransitPtr clone         (void                           );
+    virtual GeoPropertyTransitPtr cloneLocal    (BitVector bFlags = FCLocal::All);
+    virtual GeoPropertyTransitPtr cloneDependent(BitVector bFlags               );
+
             const StoredFieldType &operator->(      void               ) const;
 
                   StoredType       getValue  (const SizeT       index  ) const;
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.inl b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.inl
index cfb673d..dba9b3f 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.inl
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.inl
@@ -310,7 +310,39 @@ TypedGeoIntegralProperty<GeoPropertyDesc>::clone(void)
     ObjTransitPtr obj = Self::create();
 
     editMField(GeoPropDataFieldMask, obj->_field);
-    
+
+    obj->_field.setValues(_field);
+
+    return GeoPropertyTransitPtr(obj);
+}
+
+/*! Returns a local (not distributed) copy of this property that holds the same
+    data.
+ */
+template <class GeoPropertyDesc> inline
+GeoPropertyTransitPtr
+TypedGeoIntegralProperty<GeoPropertyDesc>::cloneLocal(BitVector bFlags)
+{
+    ObjTransitPtr obj = Self::createLocal(bFlags);
+
+    editMField(GeoPropDataFieldMask, obj->_field);
+
+    obj->_field.setValues(_field);
+
+    return GeoPropertyTransitPtr(obj);
+}
+
+/*! Returns a dependent (distributed like this instance) copy of this property
+    that holds the same data.
+ */
+template <class GeoPropertyDesc> inline
+GeoPropertyTransitPtr
+TypedGeoIntegralProperty<GeoPropertyDesc>::cloneDependent(BitVector bFlags)
+{
+    ObjTransitPtr obj = Self::createDependent(bFlags);
+
+    editMField(GeoPropDataFieldMask, obj->_field);
+
     obj->_field.setValues(_field);
 
     return GeoPropertyTransitPtr(obj);
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h
index 5d6acca..ca4f171 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h
@@ -147,8 +147,10 @@ class TypedGeoVectorProperty : public GeoVectorProperty
     virtual const UInt8                 *getData      (void) const;
     virtual       UInt8                 *editData     (void);
 
-    virtual       GeoPropertyTransitPtr  clone        (void);
-    
+    virtual GeoPropertyTransitPtr clone         (void                           );
+    virtual GeoPropertyTransitPtr cloneLocal    (BitVector bFlags = FCLocal::All);
+    virtual GeoPropertyTransitPtr cloneDependent(BitVector bFlags               );
+
             const StoredFieldType &operator->  (       void             ) const;
 
             StoredType             getValue    (const SizeT       index ) const;
diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.inl b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.inl
index daea08f..bd450d6 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.inl
+++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.inl
@@ -311,6 +311,37 @@ TypedGeoVectorProperty<GeoPropertyDesc>::clone(void)
     return GeoPropertyTransitPtr(obj);
 }
 
+/*! Returns a local (not distributed) copy of this property that holds the same
+    data.
+ */
+template <class GeoPropertyDesc> inline
+GeoPropertyTransitPtr
+TypedGeoVectorProperty<GeoPropertyDesc>::cloneLocal(BitVector bFlags)
+{
+    ObjTransitPtr obj = Self::createLocal(bFlags);
+
+    editMField(GeoPropDataFieldMask, obj->_field);
+
+    obj->_field.setValues(_field);
+
+    return GeoPropertyTransitPtr(obj);
+}
+
+/*! Returns a dependent (distributed like this instance) copy of this property
+    that holds the same data.
+ */
+template <class GeoPropertyDesc> inline
+GeoPropertyTransitPtr
+TypedGeoVectorProperty<GeoPropertyDesc>::cloneDependent(BitVector bFlags)
+{
+    ObjTransitPtr obj = Self::createDependent(bFlags);
+
+    editMField(GeoPropDataFieldMask, obj->_field);
+
+    obj->_field.setValues(_field);
+
+    return GeoPropertyTransitPtr(obj);
+}
 
 /*! \copydoc OSG::GeoVectorProperty::getFormat
  */
diff --git a/Source/System/NodeCores/Drawables/Geometry/PropertiesBase/OSGGeoProperty.h b/Source/System/NodeCores/Drawables/Geometry/PropertiesBase/OSGGeoProperty.h
index 7893ff1..64f8670 100644
--- a/Source/System/NodeCores/Drawables/Geometry/PropertiesBase/OSGGeoProperty.h
+++ b/Source/System/NodeCores/Drawables/Geometry/PropertiesBase/OSGGeoProperty.h
@@ -98,8 +98,11 @@ class OSG_SYSTEM_DLLMAPPING GeoProperty : public GeoPropertyBase
     { return NULL;  }
     virtual       UInt8                 *editData     (void)
     { return NULL;  }
-    virtual       GeoPropertyTransitPtr  clone        (void)       = 0;
-    
+
+    virtual GeoPropertyTransitPtr clone         (void                           ) = 0;
+    virtual GeoPropertyTransitPtr cloneLocal    (BitVector bFlags = FCLocal::All) = 0;
+    virtual GeoPropertyTransitPtr cloneDependent(BitVector bFlags               ) = 0;
+
     /*! \}                                                                 */
     /*---------------------------------------------------------------------*/
     /*! \name                      Sync                                    */
------------------------------------------------------------------------------
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