Hello Volker,
On 08/16/2012 04:12 AM, Volker Settgast wrote:
I added Your patch and found no difference in the cluster behavior.
The render server seems to had problems with the update. So at first I
noticed that the Skeleton::JointsChangedFieldMask is the only change (in the
servers).
right, the joints notify the skeleton that their transforms have changed
through the JointsChanged field. It's a dummy field as it does not store
data, but is only there to notify the skeleton that something was modified.
So to have some update I added that fieldmask test. Now, even if
setDataValid(false) is called and the renderEnter method updates the shader,
the skinning was not updated in the servers.
I had to add a commitChanges:
ah, right. Ok, the thing that has to happen on the servers is the
{CPU,GPU}SkinningAlgo::skeletonChanged() call that marks the data as
invalid.
This function is registered with the Skeleton as a changed functor (so
gets called after Skeleton::changed()) and looks for changes to the
JointMatrices and JointNormalMatrices fields. However, those only get
updated from within Skeleton::renderEnter() and without a
commitChanges() the algo does not see the change in time.
It should be enough to have {CPU,GPU}SkinningAlgo::skeletonChanged()
also check for Skeleton::JointsChangedFieldMask.
I'm attaching an updated patch.
Cheers,
Carsten
diff --git a/Source/System/Dynamics/Skeleton/OSGCPUSkinningAlgorithm.cpp b/Source/System/Dynamics/Skeleton/OSGCPUSkinningAlgorithm.cpp
index 48a177c..9d36fcc 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;
@@ -893,8 +893,9 @@ void CPUSkinningAlgorithm::intersectGeometry(IntersectAction *iact,
void CPUSkinningAlgorithm::skeletonChanged(FieldContainer *fc,
ConstFieldMaskArg whichField)
{
- if(((Skeleton::JointMatricesFieldMask |
- Skeleton::JointNormalMatricesFieldMask) & whichField) != 0)
+ if(((Skeleton::JointMatricesFieldMask |
+ Skeleton::JointNormalMatricesFieldMask |
+ Skeleton::JointsChangedFieldMask ) & whichField) != 0)
{
OSG_ASSERT(fc == _sfSkeleton.getValue());
diff --git a/Source/System/Dynamics/Skeleton/OSGGPUSkinningAlgorithm.cpp b/Source/System/Dynamics/Skeleton/OSGGPUSkinningAlgorithm.cpp
index 10bebb8..ab5cbbf 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);
@@ -328,13 +329,9 @@ GPUSkinningAlgorithm::skeletonChanged(FieldContainer *fc,
ConstFieldMaskArg whichField,
UInt32 origin )
{
- // if the skeleton was changed by a sync we don't invalidate
- // the data - it either is updated by the same sync or
- // the sync marks it as invalid.
-
- if(origin != ChangedOrigin::Sync &&
- ((Skeleton::JointMatricesFieldMask |
- Skeleton::JointNormalMatricesFieldMask) & whichField) != 0)
+ if(((Skeleton::JointMatricesFieldMask |
+ Skeleton::JointNormalMatricesFieldMask |
+ Skeleton::JointsChangedFieldMask ) & 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