Beispiel #1
0
OSG_USING_NAMESPACE

//---------------------------------------------------------------------------
//  Class
//---------------------------------------------------------------------------

/***************************************************************************\
 *                               Types                                     *
\***************************************************************************/

/***************************************************************************\
 *                           Class variables                               *
\***************************************************************************/

/***************************************************************************\
 *                           Class methods                                 *
\***************************************************************************/

/*-------------------------------------------------------------------------*\
 -  private                                                                -
\*-------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------*\
 -  protected                                                              -
\*-------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------*\
 -  public                                                                 -
\*-------------------------------------------------------------------------*/

/***************************************************************************\
 *                           Instance methods                              *
\***************************************************************************/

/*-------------------------------------------------------------------------*\
 -  private                                                                -
\*-------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------*\
 -  protected                                                              -
\*-------------------------------------------------------------------------*/

void OSGLoader::initFieldTypeMapper(void)
{
    setIntExtMapping(SFBool::getClassType().getId(),
                     ScanParseSkel::OSGsfBool);

/*
    setIntExtMapping(ScanParseSkel::OSGsfColor,
               ::getClassType().getId());
*/

    setIntExtMapping(SFReal32::getClassType().getId(),
                     ScanParseSkel::OSGsfFloat);
/*
    setIntExtMapping(SFImagePtr::getClassType().getId(),
                     ScanParseSkel::OSGsfString);
*/
    setIntExtMapping(SFInt32::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);


    setIntExtMapping(SFQuaternion::getClassType().getId(),
                     ScanParseSkel::OSGsfRotation);

    setIntExtMapping(SFString::getClassType().getId(),
                     ScanParseSkel::OSGsfString);

    setIntExtMapping(SFTime::getClassType().getId(),
                     ScanParseSkel::OSGsfTime);

    setIntExtMapping(SFVec2f::getClassType().getId(),
                     ScanParseSkel::OSGsfVec2f);

    setIntExtMapping(SFVec3f::getClassType().getId(),
                     ScanParseSkel::OSGsfVec3f);

    setIntExtMapping(SFVec4f::getClassType().getId(),
                     ScanParseSkel::OSGsfVec4f);

    setIntExtMapping(SFColor4f::getClassType().getId(),
                     ScanParseSkel::OSGsfColor4f);

    setIntExtMapping(SFColor4ub::getClassType().getId(),
                     ScanParseSkel::OSGsfColor4i);

    setIntExtMapping(SFColor3f::getClassType().getId(),
                     ScanParseSkel::OSGsfColor3f);

/*
    setIntExtMapping(ScanParseSkel::OSGmfColor,
               ::getClassType().getId());
*/

    setIntExtMapping(MFReal32::getClassType().getId(),
                     ScanParseSkel::OSGmfFloat);

    setIntExtMapping(MFInt32::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);

    setIntExtMapping(MFQuaternion::getClassType().getId(),
                     ScanParseSkel::OSGmfRotation);

    setIntExtMapping(MFString::getClassType().getId(),
                     ScanParseSkel::OSGmfString);

    setIntExtMapping(MFTime::getClassType().getId(),
                     ScanParseSkel::OSGmfTime);


    setIntExtMapping(MFVec2f::getClassType().getId(),
                     ScanParseSkel::OSGmfVec2f);

    setIntExtMapping(MFVec3f::getClassType().getId(),
                     ScanParseSkel::OSGmfVec3f);

    setIntExtMapping(MFVec4f::getClassType().getId(),
                     ScanParseSkel::OSGmfVec4f);

    setIntExtMapping(MFColor4f::getClassType().getId(),
                     ScanParseSkel::OSGmfColor4f);

    setIntExtMapping(MFColor4ub::getClassType().getId(),
                     ScanParseSkel::OSGmfColor4i);

    setIntExtMapping(MFColor3f::getClassType().getId(),
                     ScanParseSkel::OSGmfColor3f);

    setIntExtMapping(SFNodePtr::getClassType().getId(),
                     ScanParseSkel::OSGsfNode);
    setIntExtMapping(MFNodePtr::getClassType().getId(),
                     ScanParseSkel::OSGmfNode);


    /* To Base Type Mappings */

    setIntExtMapping(SFUInt8::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFUInt8::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);

    setIntExtMapping(SFInt8::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFInt8::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);


    setIntExtMapping(SFUInt16::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFUInt16::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);

    setIntExtMapping(SFInt16::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFInt16::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);


    setIntExtMapping(SFUInt32::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFUInt32::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);

    setIntExtMapping(SFGLenum::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(SFGLenum::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);


    /* To Node Mappings */

    setIntExtMapping(SFAttachmentMap::getClassType().getId(),
                     ScanParseSkel::OSGmfNode);

    /* extended types */

    setIntExtMapping(SFMatrix::getClassType().getId(),
                     ScanParseSkel::OSGsfMatrix);

    setIntExtMapping(SFPnt3f::getClassType().getId(),
                     ScanParseSkel::OSGsfPnt3f);

    setIntExtMapping(MFPnt3f::getClassType().getId(),
                     ScanParseSkel::OSGmfPnt3f);
    setIntExtMapping(SFDynamicVolume::getClassType().getId(),
                     ScanParseSkel::OSGmfFloat);

    setIntExtMapping(SFPlane::getClassType().getId(),
                     ScanParseSkel::OSGsfPlane);
    setIntExtMapping(MFPlane::getClassType().getId(),
                     ScanParseSkel::OSGmfPlane);

    setIntExtMapping(SFDynamicVolume::getClassType().getId(),
                     ScanParseSkel::OSGsfVolume);
}
void OSGLoader::initFieldTypeMapper(void)
{
    setIntExtMapping(SFBool::getClassType().getId(),
                     ScanParseSkel::OSGsfBool);

/*
    setIntExtMapping(ScanParseSkel::OSGsfColor,
               ::getClassType().getId());
*/

    setIntExtMapping(SFReal32::getClassType().getId(),
                     ScanParseSkel::OSGsfFloat);
    setIntExtMapping(SFReal64::getClassType().getId(),
                     ScanParseSkel::OSGsfFloat);
/*
    setIntExtMapping(SFImagePtr::getClassType().getId(),
                     ScanParseSkel::OSGsfString);
*/
    setIntExtMapping(SFInt32::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);


    setIntExtMapping(SFQuaternion::getClassType().getId(),
                     ScanParseSkel::OSGsfRotation);

    setIntExtMapping(SFString::getClassType().getId(),
                     ScanParseSkel::OSGsfString);

    setIntExtMapping(SFTime::getClassType().getId(),
                     ScanParseSkel::OSGsfTime);

    setIntExtMapping(SFVec2f::getClassType().getId(),
                     ScanParseSkel::OSGsfVec2f);
    setIntExtMapping(SFVec2d::getClassType().getId(),
                     ScanParseSkel::OSGsfVec2f);

    setIntExtMapping(SFVec2s::getClassType().getId(),
                     ScanParseSkel::OSGsfVec2i);

    setIntExtMapping(SFVec3f::getClassType().getId(),
                     ScanParseSkel::OSGsfVec3f);
    setIntExtMapping(SFVec3d::getClassType().getId(),
                     ScanParseSkel::OSGsfVec3f);

    setIntExtMapping(SFVec4f::getClassType().getId(),
                     ScanParseSkel::OSGsfVec4f);

    setIntExtMapping(SFColor4f::getClassType().getId(),
                     ScanParseSkel::OSGsfColor4f);

    setIntExtMapping(SFColor4ub::getClassType().getId(),
                     ScanParseSkel::OSGsfColor4i);

    setIntExtMapping(SFColor3f::getClassType().getId(),
                     ScanParseSkel::OSGsfColor3f);

/*
    setIntExtMapping(ScanParseSkel::OSGmfColor,
               ::getClassType().getId());
*/

    setIntExtMapping(MFReal32::getClassType().getId(),
                     ScanParseSkel::OSGmfFloat);

    setIntExtMapping(MFInt32::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);

    setIntExtMapping(MFQuaternion::getClassType().getId(),
                     ScanParseSkel::OSGmfRotation);

    setIntExtMapping(MFString::getClassType().getId(),
                     ScanParseSkel::OSGmfString);

    setIntExtMapping(MFTime::getClassType().getId(),
                     ScanParseSkel::OSGmfTime);


    setIntExtMapping(MFVec2f::getClassType().getId(),
                     ScanParseSkel::OSGmfVec2f);

    setIntExtMapping(MFVec3f::getClassType().getId(),
                     ScanParseSkel::OSGmfVec3f);

    setIntExtMapping(MFVec4f::getClassType().getId(),
                     ScanParseSkel::OSGmfVec4f);

    setIntExtMapping(MFColor4f::getClassType().getId(),
                     ScanParseSkel::OSGmfColor4f);

    setIntExtMapping(MFColor4ub::getClassType().getId(),
                     ScanParseSkel::OSGmfColor4i);

    setIntExtMapping(MFColor3f::getClassType().getId(),
                     ScanParseSkel::OSGmfColor3f);

    setIntExtMapping(SFUnrecNodePtr::getClassType().getId(),
                     ScanParseSkel::OSGsfNode);
    setIntExtMapping(MFUnrecChildNodePtr::getClassType().getId(),
                     ScanParseSkel::OSGmfNode);


    /* To Base Type Mappings */

    setIntExtMapping(SFUInt8::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFUInt8::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);

    setIntExtMapping(SFInt8::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFInt8::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);


    setIntExtMapping(SFUInt16::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFUInt16::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);

    setIntExtMapping(SFInt16::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFInt16::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);


    setIntExtMapping(SFUInt32::getClassType().getId(),
                     ScanParseSkel::OSGsfInt32);
    setIntExtMapping(MFUInt32::getClassType().getId(),
                     ScanParseSkel::OSGmfInt32);

    setIntExtMapping(SFGLenum::getClassType().getId(),
                     ScanParseSkel::OSGsfString);
    setIntExtMapping(MFGLenum::getClassType().getId(),
                     ScanParseSkel::OSGmfString);

#ifdef OSG_NEW_SHADER
    setIntExtMapping(MFShaderParameter::getClassType().getId(),
                     ScanParseSkel::OSGmfString);

    setIntExtMapping(MFShaderAttribute::getClassType().getId(),
                     ScanParseSkel::OSGmfString);
#endif

    /* To Node Mappings */

    setIntExtMapping(SFAttachmentPtrMap::getClassType().getId(),
                     ScanParseSkel::OSGmfNode);

    setIntExtMapping(SFMaterialPtrMap::getClassType().getId(),
                     ScanParseSkel::OSGmfNode);

    setIntExtMapping(SFChunkBlockPtrMap::getClassType().getId(),
                     ScanParseSkel::OSGmfNode);

    /* extended types */

    setIntExtMapping(SFMatrix::getClassType().getId(),
                     ScanParseSkel::OSGsfMatrix);

    setIntExtMapping(SFPnt3f::getClassType().getId(),
                     ScanParseSkel::OSGsfPnt3f);

    setIntExtMapping(MFPnt3f::getClassType().getId(),
                     ScanParseSkel::OSGmfPnt3f);

    setIntExtMapping(SFPnt2f::getClassType().getId(),
                     ScanParseSkel::OSGsfPnt2f);

    setIntExtMapping(MFPnt2f::getClassType().getId(),
                     ScanParseSkel::OSGmfPnt2f);

    setIntExtMapping(SFPlane::getClassType().getId(),
                     ScanParseSkel::OSGsfPlane);
    setIntExtMapping(MFPlane::getClassType().getId(),
                     ScanParseSkel::OSGmfPlane);

    setIntExtMapping(SFBoxVolume::getClassType().getId(),
                     ScanParseSkel::OSGsfVolume);


    // Map from scanner/parser to OSG

    setExtIntMapping(ScanParseSkel::OSGsfBool,
                     SFBool::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfColor,
                     SFColor3f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfColorRGBA,
                     SFColor4f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfDouble,
                     SFReal64::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfFloat,
                     SFReal32::getClassType().getId());

#if 0
    setExtIntMapping(ScanParseSkel::OSGsfImage,
                    ::getClassType().getId());
#endif

    setExtIntMapping(ScanParseSkel::OSGsfInt32,
                     SFInt32::getClassType().getId());
#if 0
    setExtIntMapping(ScanParseSkel::OSGsfMatrix3d,
                    ::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfMatrix3f,
                    ::getClassType().getId());
#endif
    setExtIntMapping(ScanParseSkel::OSGsfMatrix4d,
                     SFMatrix4d::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfMatrix4f,
                     SFMatrix::getClassType().getId());
#if 0
    setExtIntMapping(ScanParseSkel::OSGsfNode,
                    ::getClassType().getId());
#endif
    setExtIntMapping(ScanParseSkel::OSGsfRotation,
                     SFQuaternion::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfString,
                     SFString::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfTime,
                     SFTime::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfVec2d,
                     SFVec2d::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfVec2f,
                     SFVec2f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfVec3d,
                     SFVec3d::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfVec3f,
                     SFVec3f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfVec4d,
                     SFVec4d::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfVec4f,
                     SFVec4f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfBool,
                     MFBool::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfColor,
                     MFColor3f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfColorRGBA,
                     MFColor4f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfDouble,
                     MFReal64::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfFloat,
                     MFReal32::getClassType().getId());
#if 0
    setExtIntMapping(ScanParseSkel::OSGmfImage,
                     ::getClassType().getId());
#endif
    setExtIntMapping(ScanParseSkel::OSGmfInt32,
                     MFInt32::getClassType().getId());
#if 0
    setExtIntMapping(ScanParseSkel::OSGmfMatrix3d,
                     ::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfMatrix3f,
                    ::getClassType().getId());
#endif
    setExtIntMapping(ScanParseSkel::OSGmfMatrix4d,
                     MFMatrix4d::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfMatrix4f,
                     MFMatrix::getClassType().getId());
#if 0
    setExtIntMapping(ScanParseSkel::OSGmfNode,
                    ::getClassType().getId());
#endif
    setExtIntMapping(ScanParseSkel::OSGmfRotation,
                     MFQuaternion::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfString,
                     MFString::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfTime,
                     MFTime::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfVec2d,
                     MFVec2d::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfVec2f,
                     MFVec2f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfVec3d,
                     MFVec3d::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfVec3f,
                     MFVec3f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfVec4d,
                     MFVec4d::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfVec4f,
                     MFVec4f::getClassType().getId());

    setExtIntMapping(ScanParseSkel::OSGmfColor4f,
                     MFColor4f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfColor4i,
                     MFColor4ub::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfColor3f,
                     MFColor3f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfMatrix,
                     MFMatrix::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfPnt2f,
                     MFPnt2f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfPnt3f,
                     MFPnt3f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfPnt4f,
                     MFPnt4f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfPlane,
                     MFPlane::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfColor4f,
                     SFColor4f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfColor4i,
                     SFColor4ub::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfColor3f,
                     SFColor3f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfMatrix,
                     SFMatrix::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfPnt2f,
                     SFPnt2f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfPnt3f,
                     SFPnt3f::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfPnt4f,
                     SFPnt4f::getClassType().getId());
#if 0
    setExtIntMapping(ScanParseSkel::OSGsfVec2i,
                     SFVec2i::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGmfVec2i,
                     MFVec2i::getClassType().getId());
#endif
    setExtIntMapping(ScanParseSkel::OSGsfPlane,
                     SFPlane::getClassType().getId());
    setExtIntMapping(ScanParseSkel::OSGsfVolume,
                     SFBoxVolume::getClassType().getId());

}