Carsten Neumann ha scritto:
> Hello Carlo,
>
> Carlo Orru wrote:
>
>> Thanks a lot for your precious pieces of advice!
>>
>> The Framework developement is going on, but I'm facing problems when I
>> have to deal with multifields inside a field container.
>> As you may know, in my framework there are three kinds of control points:
>> 1 - Control Points containing a single field (i.e.
>> ControlPoint<SField<Vec3f>>)
>> 2 - Control Points containing a multi field (i.e.
>> ControlPoint<MField<Vec3f>>)
>> 3 - Control Points containing the whole field container (i.e.
>> ControlPoint<ComponentTransformPtr>)
>>
>> In the first two cases everything seems to work fine, while in the last
>> one I have a problem with multi fields.
>> Here's how things work when I interpolate between two control points
>> containing a FieldContainer:
>>
> ^^^^^
> typo? did you mean FieldContainerPtr ?
>
Yes, sorry...
>
>> // 'size' is the number of fields to deal with.
>> // 'fc_ptr_dst' is the field container to be updated.
>> // 'fc_src0' and 'fc_src1' are the field containers held inside the
>> two controlpoints to interpolate between.
>> // 'TypeIdentifier' is a class containing a
>> 'FieldValueInterpolator<>' object for every kind of datatype.
>>
>> TypeIdentifier* ti = TypeIdentifier::Instantiate();
>>
>> for ( Int32 i = 0 ; (UInt32)i < size ; i++ )
>> {
>> f = fc_ptr_dst->getField(vID[i]);
>> f0 = fc_src0->getField(vID[i]);
>> f1 = fc_src1->getField(vID[i]);
>>
>> FieldValueInterpolatorBase* fvib =
>> ti->getFieldValueInterpolator(f->getType().getId());
>> if ( fvib == NULL ) continue ;
>> fvib->updateField(ratio, f0, f1, fc_ptr_dst, vID[i], int_type);
>>
>> }
>>
>> Since multifields inside a field container are stored as singlefields of
>> 'FieldContainerPtr' type,
>>
>
> Sorry, I don't understand what you are trying to say in this last
> sentence and verbatim it is not correct. There are SFFieldContainerPtr
> as well as MFFieldContainerPtr and for all things derived from
> FieldContainer, i.e. SF{SomeContainer}Ptr and MF{SomeContainer}Ptr.
>
Sorry, when I wrote such sentence I had 'SFGeoPositionsPtr' in mind, which
is derived from FieldContainer and contains a MFVec3f...
(I'm trying to test my framework on a Geometry core).
>> and I get a field via the getField() method,
>> how am I supposed to know if I'm dealing with a FieldContainer or not ?
>> I have tried with
>> f->getContentType().isDerivedFrom(FieldContainer::getClassType()) and
>> f->getType().isDerivedFrom(FieldContainer::getClassType()),
>> but they both seem to return FALSE even if 'f' actually IS a
>> FieldContainer (i.e. a GeoPositionsPtr)...
>>
>
> yes, this is an unfortunate deficiency of the type system, the pointers
> do not mimic the inheritance hierarchy of the containers. The workaround
> that is used in a couple of places in the system is to check if the
> typename ends with "Ptr". This is somewhat ugly, but works in practice
> pretty well.
>
OK, thanks a lot!
Cheers,
Carlo
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core