当前位置: 首页>>代码示例>>C++>>正文


C++ NodeUnrecPtr::findAttachment方法代码示例

本文整理汇总了C++中NodeUnrecPtr::findAttachment方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeUnrecPtr::findAttachment方法的具体用法?C++ NodeUnrecPtr::findAttachment怎么用?C++ NodeUnrecPtr::findAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NodeUnrecPtr的用法示例。


在下文中一共展示了NodeUnrecPtr::findAttachment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dropPhysicsBody

void dropPhysicsBody(RenderAction* action,const NodeUnrecPtr node, MaterialUnrecPtr mat)
{
    //Get the Physics Body object attached to this node, if there is one
    AttachmentUnrecPtr TheBodyAttachment(node->findAttachment(PhysicsBody::getClassType()));

    if(TheBodyAttachment != NULL)
    {
        PhysicsBodyDrawWrapper::drop(action, node, dynamic_pointer_cast<PhysicsBody>(TheBodyAttachment), mat);
    }
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:10,代码来源:OSGPhysicsBodyDrawFuncs.cpp

示例2: read

NodeTransitPtr SceneFileHandlerBase::read(const Char8      *fileName,
                                                GraphOpSeq *graphOpSeq,       
                                                Resolver    resolver,
                                                bool        bWarnNotFound )
{
    NodeTransitPtr returnValue(NULL);

    if(fileName == NULL)
    {
        SWARNING << "cannot read NULL file" << std::endl;
        return NodeTransitPtr(NULL);
    }

    std::string fullFilePath = initPathHandler(fileName);

    if(fullFilePath.empty() == true)
    {
        if(_readFP != NULL)
        {
            // that's a fallback could be a url so the callback
            // can handle this correctly.
            SceneFileType *type = getFileType(fileName);
            if(type != NULL)
            {
                // create a dummy stream with the bad flag set.
                std::ifstream in;
                in.setstate(std::ios::badbit);
                returnValue = _readFP(type, in, fileName);
            }
            else
            {
                if(bWarnNotFound == true)
                    SWARNING << "Couldn't open file " << fileName << std::endl;
            }
        }
        else
        {
            if(bWarnNotFound == true)
                SWARNING << "Couldn't open file " << fileName << std::endl;
        }

        commitChanges();

        return returnValue;
    }


    SceneFileType *type  = getFileType(fullFilePath.c_str());
    NodeUnrecPtr   scene = NULL;

    if(type != NULL)
    {
        triggerReadBegin(fullFilePath.c_str());
        updateReadProgress(0);

        SINFO << "try to read " << fullFilePath
              << " as "         << type->getName() << std::endl;

        std::ifstream in(fullFilePath.c_str(), std::ios::binary);

        if(in)
        {
            scene = read(in, fullFilePath.c_str(), graphOpSeq);

            in.close();

            if(scene != NULL)
            {
                triggerReadEnd(fullFilePath.c_str());

                FileContextAttachmentUnrecPtr pFContext = 
                    dynamic_cast<FileContextAttachment *>(
                        scene->findAttachment(
                            FileContextAttachment::getClassGroupId()));

                if(pFContext == NULL)
                {
                    pFContext = FileContextAttachment::create();

                    pFContext->setResolvedName(fullFilePath);

                    scene->addAttachment(pFContext);
                }
            }
        }
        else
        {
            if(bWarnNotFound == true)
            {
                SWARNING << "Couldn't open input stream for file "
                         << fullFilePath
                         << std::endl;
            }
        }

#ifndef OSG_DISABLE_DEPRECATED

        // Ok stream interface didn't work try via filename
        if(scene == NULL)
            scene = type->readFile(fullFilePath.c_str());
//.........这里部分代码省略.........
开发者ID:jondo2010,项目名称:OpenSG,代码行数:101,代码来源:OSGSceneFileHandler.cpp


注:本文中的NodeUnrecPtr::findAttachment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。