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


C++ csRef::QuerySceneNode方法代码示例

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


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

示例1: ProcessAttach

void psCharAppearance::ProcessAttach(csRef<iMeshWrapper> meshWrap, csRef<iSpriteCal3DSocket> socket)
{
    if(!socket.IsValid())
        return;
    CS_ASSERT(socket.IsValid());
    
    meshWrap->GetFlags().Set(CS_ENTITY_NODECAL);
    const char* socketName = socket->GetName();

    // Given a socket name of "righthand", we're looking for a key in the form of "socket_righthand"
    csString keyName = "socket_";
    keyName += socketName;

    // Variables for transform to be specified
    float trans_x = 0, trans_y = 0.0, trans_z = 0, rot_x = -PI/2, rot_y = 0, rot_z = 0;
    csRef<iObjectIterator> it = meshWrap->GetFactory()->QueryObject()->GetIterator();

    while ( it->HasNext() )
    {
        csRef<iKeyValuePair> key ( scfQueryInterface<iKeyValuePair> (it->Next()));
        if (key && keyName == key->GetKey())
        {
            sscanf(key->GetValue(),"%f,%f,%f,%f,%f,%f",&trans_x,&trans_y,&trans_z,&rot_x,&rot_y,&rot_z);
        }
    }

    meshWrap->QuerySceneNode()->SetParent( baseMesh->QuerySceneNode ());
    socket->SetMeshWrapper( meshWrap );
    socket->SetTransform( csTransform(csZRotMatrix3(rot_z)*csYRotMatrix3(rot_y)*csXRotMatrix3(rot_x), csVector3(trans_x,trans_y,trans_z)) );

    usedSlots.PushSmart(socketName);
}
开发者ID:garinh,项目名称:planeshift,代码行数:32,代码来源:charapp.cpp

示例2: AttachLight

unsigned int psLight::AttachLight(const char* name, const csVector3& pos,
  	float radius, const csColor& colour, csRef<iMeshWrapper> mw)
{
    baseColour = colour;
    csString lightName = name;
    lightName.Append("_%u", genUniqueID);
    light = engine->CreateLight(lightName, pos, radius, colour, CS_LIGHT_DYNAMICTYPE_DYNAMIC);
    light->SetAttenuationMode(CS_ATTN_INVERSE);

    // Attach to mesh.
    light->QuerySceneNode()->SetParent(mw->QuerySceneNode());

    csString sname(mw->GetMovable()->GetSectors()->Get(0)->QueryObject()->GetName());
    if(sname.Find("room") == 0)
    {
        // Add to the podium sector.
        podium = engine->GetSectors()->FindByName("room");
        if(podium.IsValid()) podium->GetLights()->Add(light);
    }

    lastTime = vclock->GetCurrentTicks();

    return ++genUniqueID;
}
开发者ID:garinh,项目名称:planeshift,代码行数:24,代码来源:pseffectlight.cpp

示例3: ApplyRider

void psCharAppearance::ApplyRider(csRef<iMeshWrapper> mesh)
{
    csRef<iSpriteCal3DState> mountstate = scfQueryInterface<iSpriteCal3DState> (mesh->GetMeshObject());
    
    csRef<iSpriteCal3DSocket> socket = mountstate->FindSocket( "back" );
    
    if ( !socket )
    {
        Error1("Socket back not found.");
        return;
    }
    
    baseMesh->GetFlags().Set(CS_ENTITY_NODECAL);
    const char* socketName = socket->GetName();

    // Given a socket name of "righthand", we're looking for a key in the form of "socket_righthand"
    csString keyName = "socket_";
    keyName += socketName;

    // Variables for transform to be specified
    float trans_x = 0, trans_y = 0.0, trans_z = 0, rot_x = -PI/2, rot_y = 0, rot_z = 0;
    csRef<iObjectIterator> it = baseMesh->GetFactory()->QueryObject()->GetIterator();

    while ( it->HasNext() )
    {
        csRef<iKeyValuePair> key ( scfQueryInterface<iKeyValuePair> (it->Next()));
        if (key && keyName == key->GetKey())
        {
            sscanf(key->GetValue(),"%f,%f,%f,%f,%f,%f",&trans_x,&trans_y,&trans_z,&rot_x,&rot_y,&rot_z);
        }
    }

    baseMesh->QuerySceneNode()->SetParent( mesh->QuerySceneNode ());
    socket->SetMeshWrapper( baseMesh );
    socket->SetTransform( csTransform(csZRotMatrix3(rot_z)*csYRotMatrix3(rot_y)*csXRotMatrix3(rot_x), csVector3(trans_x,trans_y,trans_z)) );
}
开发者ID:garinh,项目名称:planeshift,代码行数:36,代码来源:charapp.cpp


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