Hi,

On Wed, 2011-03-23 at 14:54 +0100, Johannes Brunen wrote:
> Hello Gerrit,
> 
> sorry, but I have another GraphOp related problem or misunderstanding.
> 
> Attached you will find a simple OpenSG model which does contain 2 cube 
> geometries. One cube is a copy of the other one. I tried to use the 
> SharePtrGraphOp on this graph with the parameter set to includes="Geometry". 
> However, the geometry is not shared. After looking into the code I found the 
> following lines of code:
> 
> FieldContainer *SharePtrGraphOp::shareFC(FieldContainer *fc)
> {
>     ...
>     FCSetIt fcsIt  = tmIt->second.begin();
>     FCSetIt fcsEnd = tmIt->second.end  ();
> 
>     for(; fcsIt != fcsEnd; ++fcsIt)
>     {
>         Time compareStart = getSystemTime();
> 
>         bool compare      = compareContainerEqual(*fcsIt, fc, true, true); 
> <==
> 
>         _compareTime += getSystemTime() - compareStart;
> 
>         if(compare)
>         {
>             if(*fcsIt != fc)
>                 _shareCount[fcTypeId] += 1;
> 
>             return *fcsIt;
>         }
>     }
> }
> 
> The call to compareContainerEqual states that attachments should be ignored 
> but the compare to identity flag rules the attachment flag out.
> 
> bool compareContainerEqualImpl(
>     const FieldContainer *lhs,
>     const FieldContainer *rhs,
>           FCSet          &lhsVisitedSet,
>           FCSet          &rhsVisitedSet,
>           bool            ignoreAttachments,
>           bool            compareIdentity   )
> {
> ...
>         if(compareIdentity == true)
>         {
>             if(lhsField->equal(rhsField) == false)
>                 returnValue = false;
>         }
>         else
>         {
>             if(lhsField->isPointerField() == true)
>             {
>                 returnValue = comparePointerFields(
>                     lhsField,          rhsField,
>                     lhsVisitedSet,     rhsVisitedSet,
>                     ignoreAttachments, compareIdentity);
>             }
>             else
>             {
>                 if(lhsField->equal(rhsField) == false)
>                     returnValue = false;
>             }
>         }
> }
> 
> This, however, does prevent sharing of the geometries due to the 
> DrawableStatsAttachments.

besides other things this part was indeed wrong and should be fixed
along with the other problems.

> I need a little additional explanation about this graph op and its proper 
> application. What is the correct way to share the geometry cores?

The minimum would be:

op->setParams("includes=Geometry,GeoProperty");

If the geometries also contain a material, Material might have to be
added.

For the attached model, the order of the vertex positions and normals
is different between the two geometries so even with the changes there
will still be two geometries left, which share the indices but not the
properties (which is a little scary in itself). The SharePtrOp as it is
does not check and share if the values between different containers are
permutations of each other.

kind regards
  gerrit




------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to