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


C++ PODVector类代码示例

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


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

示例1: HandleNodeAdded

// ----------------------------------------------------------------------------
void IKSolver::HandleNodeAdded(StringHash eventType, VariantMap& eventData)
{
    using namespace NodeAdded;

    if (solver_->tree == NULL)
        return;

    Node* node = static_cast<Node*>(eventData[P_NODE].GetPtr());

    PODVector<Node*> nodes;
    node->GetChildrenWithComponent<IKEffector>(nodes, true);
    for (PODVector<Node*>::ConstIterator it = nodes.Begin(); it != nodes.End(); ++it)
    {
        BuildTreeToEffector(*it);
        effectorList_.Push((*it)->GetComponent<IKEffector>());
    }
}
开发者ID:gogoprog,项目名称:Urho3D,代码行数:18,代码来源:IKSolver.cpp

示例2:

PODVector<OffMeshConnection*> DynamicNavigationMesh::CollectOffMeshConnections(const BoundingBox& bounds)
{
    PODVector<OffMeshConnection*> connections;
    node_->GetComponents<OffMeshConnection>(connections, true);
    for (unsigned i = 0; i < connections.Size(); ++i)
    {
        OffMeshConnection* connection = connections[i];
        if (!(connection->IsEnabledEffective() && connection->GetEndPoint()))
        {
            // discard this connection
            connections.Erase(i);
            --i;
        }
    }

    return connections;
}
开发者ID:newbthenewbd,项目名称:Urho3D,代码行数:17,代码来源:DynamicNavigationMesh.cpp

示例3: GetQueryFilterTypesAttr

bool CrowdManager::CreateCrowd()
{
    if (!navigationMesh_ || !navigationMesh_->InitializeQuery())
        return false;

    // Preserve the existing crowd configuration before recreating it
    VariantVector queryFilterTypeConfiguration, obstacleAvoidanceTypeConfiguration;
    bool recreate = crowd_ != nullptr;
    if (recreate)
    {
        queryFilterTypeConfiguration = GetQueryFilterTypesAttr();
        obstacleAvoidanceTypeConfiguration = GetObstacleAvoidanceTypesAttr();
        dtFreeCrowd(crowd_);
    }
    crowd_ = dtAllocCrowd();

    // Initialize the crowd
    if (maxAgentRadius_ == 0.f)
        maxAgentRadius_ = navigationMesh_->GetAgentRadius();
    if (!crowd_->init(maxAgents_, maxAgentRadius_, navigationMesh_->navMesh_, CrowdAgentUpdateCallback))
    {
        URHO3D_LOGERROR("Could not initialize DetourCrowd");
        return false;
    }

    if (recreate)
    {
        // Reconfigure the newly initialized crowd
        SetQueryFilterTypesAttr(queryFilterTypeConfiguration);
        SetObstacleAvoidanceTypesAttr(obstacleAvoidanceTypeConfiguration);

        // Re-add the existing crowd agents
        PODVector<CrowdAgent*> agents = GetAgents();
        for (unsigned i = 0; i < agents.Size(); ++i)
        {
            // Keep adding until the crowd cannot take it anymore
            if (agents[i]->AddAgentToCrowd(true) == -1)
            {
                URHO3D_LOGWARNINGF("CrowdManager: %d crowd agents orphaned", agents.Size() - i);
                break;
            }
        }
    }

    return true;
}
开发者ID:1vanK,项目名称:Urho3D,代码行数:46,代码来源:CrowdManager.cpp

示例4: callback

void PhysicsWorld2D::Raycast(PODVector<PhysicsRaycastResult2D>& results, const Vector2& startPoint, const Vector2& endPoint,
    unsigned collisionMask)
{
    results.Clear();

    RayCastCallback callback(results, startPoint, collisionMask);
    world_->RayCast(&callback, ToB2Vec2(startPoint), ToB2Vec2(endPoint));
}
开发者ID:Batanick,项目名称:Urho3D,代码行数:8,代码来源:PhysicsWorld2D.cpp

示例5: GetAssetsByImporterType

void AssetDatabase::GetAssetsByImporterType(StringHash type, const String &resourceType, PODVector<Asset*>& assets) const
{
    assets.Clear();

    List<SharedPtr<Asset>>::ConstIterator itr = assets_.Begin();

    while (itr != assets_.End())
    {
        Asset* asset = *itr;

        if (asset->GetImporterType() == type)
            assets.Push(asset);

        itr++;
    }

}
开发者ID:JohnnyWahib,项目名称:AtomicGameEngine,代码行数:17,代码来源:AssetDatabase.cpp

示例6: ImportDirtyAssets

bool AssetDatabase::ImportDirtyAssets()
{

    PODVector<Asset*> assets;
    GetDirtyAssets(assets);

    for (unsigned i = 0; i < assets.Size(); i++)
    {
        assets[i]->Import();
        assets[i]->Save();
        assets[i]->dirty_ = false;
        assets[i]->UpdateFileTimestamp();
    }

    return assets.Size() != 0;

}
开发者ID:JohnnyWahib,项目名称:AtomicGameEngine,代码行数:17,代码来源:AssetDatabase.cpp

示例7: CursorRayCast

bool MasterControl::CursorRayCast(double maxDistance, PODVector<RayQueryResult> &hitResults)
{
    Ray cameraRay = world.camera->camera_->GetScreenRay(0.5f,0.5f);
    RayOctreeQuery query(hitResults, cameraRay, RAY_TRIANGLE, maxDistance, DRAWABLE_GEOMETRY);
    world.scene->GetComponent<Octree>()->Raycast(query);
    if (hitResults.Size()) return true;
    else return false;
}
开发者ID:elix22,项目名称:OGTatt,代码行数:8,代码来源:mastercontrol.cpp

示例8: assert

    CSComponentAssembly* CSComponentAssembly::ResolveClassAssembly(const String& fullClassName)
    {
        Context* context = ScriptSystem::GetContext();
        assert(context);

        String classname = fullClassName;
        String csnamespace;

        // Handle namespaces
        if (fullClassName.Contains('.'))
        {

            StringVector elements = fullClassName.Split('.');

            if (elements.Size() <= 1)
                return 0;

            classname = elements.Back();
            elements.Pop();

            csnamespace = String::Joined(elements, ".");
        }

        ResourceCache* cache = context->GetSubsystem<ResourceCache>();

        PODVector<CSComponentAssembly*> assemblies;

        cache->GetResources<CSComponentAssembly>(assemblies);

        for (unsigned i = 0; i < assemblies.Size(); i++)
        {
            CSComponentAssembly* assembly = assemblies[i];

            // TODO: support namespaces
            const StringVector& classNames = assembly->GetClassNames();
            if (classNames.Contains(classname))
            {
                return assembly;
            }

        }

        return 0;

    }
开发者ID:dragonCASTjosh,项目名称:AtomicGameEngine,代码行数:45,代码来源:CSComponentAssembly.cpp

示例9: FindPath

void NavigationMesh::FindPath(PODVector<Vector3>& dest, const Vector3& start, const Vector3& end, const Vector3& extents)
{
    PROFILE(FindPath);
    
    dest.Clear();
    
    if (!InitializeQuery())
        return;
    
    // Navigation data is in local space. Transform path points from world to local
    const Matrix3x4& transform = node_->GetWorldTransform();
    Matrix3x4 inverse = transform.Inverse();
    
    Vector3 localStart = inverse * start;
    Vector3 localEnd = inverse * end;
    
    dtPolyRef startRef;
    dtPolyRef endRef;
    navMeshQuery_->findNearestPoly(&localStart.x_, &extents.x_, queryFilter_, &startRef, 0);
    navMeshQuery_->findNearestPoly(&localEnd.x_, &extents.x_, queryFilter_, &endRef, 0);
    
    if (!startRef || !endRef)
        return;
    
    int numPolys = 0;
    int numPathPoints = 0;
    
    navMeshQuery_->findPath(startRef, endRef, &localStart.x_, &localEnd.x_, queryFilter_, pathData_->polys_, &numPolys,
        MAX_POLYS);
    if (!numPolys)
        return;
    
    Vector3 actualLocalEnd = localEnd;
    
    // If full path was not found, clamp end point to the end polygon
    if (pathData_->polys_[numPolys - 1] != endRef)
        navMeshQuery_->closestPointOnPoly(pathData_->polys_[numPolys - 1], &localEnd.x_, &actualLocalEnd.x_);
    
    navMeshQuery_->findStraightPath(&localStart.x_, &actualLocalEnd.x_, pathData_->polys_, numPolys,
        &pathData_->pathPoints_[0].x_, pathData_->pathFlags_, pathData_->pathPolys_, &numPathPoints, MAX_POLYS);
    
    // Transform path result back to world space
    for (int i = 0; i < numPathPoints; ++i)
        dest.Push(transform * pathData_->pathPoints_[i]);
}
开发者ID:SkunkWorks99,项目名称:Urho3D,代码行数:45,代码来源:NavigationMesh.cpp

示例10: ClipPolygon

static void ClipPolygon(PODVector<DecalVertex>& dest, const PODVector<DecalVertex>& src, const Plane& plane, bool skinned)
{
    unsigned last = 0;
    float lastDistance = 0.0f;
    dest.Clear();

    if (src.Empty())
        return;

    for (unsigned i = 0; i < src.Size(); ++i)
    {
        float distance = plane.Distance(src[i].position_);
        if (distance >= 0.0f)
        {
            if (lastDistance < 0.0f)
                dest.Push(ClipEdge(src[last], src[i], lastDistance, distance, skinned));

            dest.Push(src[i]);
        }
        else
        {
            if (lastDistance >= 0.0f && i != 0)
                dest.Push(ClipEdge(src[last], src[i], lastDistance, distance, skinned));
        }

        last = i;
        lastDistance = distance;
    }

    // Recheck the distances of the last and first vertices and add the final clipped vertex if applicable
    float distance = plane.Distance(src[0].position_);
    if ((lastDistance < 0.0f && distance >= 0.0f) || (lastDistance >= 0.0f && distance < 0.0f))
        dest.Push(ClipEdge(src[last], src[0], lastDistance, distance, skinned));
}
开发者ID:TheComet93,项目名称:Urho3D,代码行数:34,代码来源:DecalSet.cpp

示例11: RemoveGravityVectorsRecursively

// ----------------------------------------------------------------------------
void GravityManager::RemoveGravityVectorsRecursively(Node* node)
{
    // Recursively retrieve all nodes that have a gravity probe component
    PODVector<Node*> gravityVectorNodesToRemove;
    node->GetChildrenWithComponent<GravityVector>(gravityVectorNodesToRemove, true);
    // Don't forget to check this node's components as well
    if(node->GetComponent<GravityVector>())
        gravityVectorNodesToRemove.Push(node);

    // search for found components and remove them from our internal list
    PODVector<Node*>::ConstIterator it = gravityVectorNodesToRemove.Begin();
    for(; it != gravityVectorNodesToRemove.End(); ++it)
    {
        PODVector<GravityVector*>::Iterator gravityNode = gravityVectors_.Find((*it)->GetComponent<GravityVector>());
        if(gravityNode != gravityVectors_.End())
            gravityVectors_.Erase(gravityNode);
    }
}
开发者ID:TheComet93,项目名称:iceweasel,代码行数:19,代码来源:GravityManager.cpp

示例12: ProcessRayQuery

void CustomGeometry::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
{
    RayQueryLevel level = query.level_;

    switch (level)
    {
    case RAY_AABB:
        Drawable::ProcessRayQuery(query, results);
        break;

    case RAY_OBB:
    case RAY_TRIANGLE:
        {
            Matrix3x4 inverse(node_->GetWorldTransform().Inverse());
            Ray localRay = query.ray_.Transformed(inverse);
            float distance = localRay.HitDistance(boundingBox_);
            Vector3 normal = -query.ray_.direction_;

            if (level == RAY_TRIANGLE && distance < query.maxDistance_)
            {
                distance = M_INFINITY;

                for (unsigned i = 0; i < batches_.Size(); ++i)
                {
                    Geometry* geometry = batches_[i].geometry_;
                    if (geometry)
                    {
                        Vector3 geometryNormal;
                        float geometryDistance = geometry->GetHitDistance(localRay, &geometryNormal);
                        if (geometryDistance < query.maxDistance_ && geometryDistance < distance)
                        {
                            distance = geometryDistance;
                            normal = (node_->GetWorldTransform() * Vector4(geometryNormal, 0.0f)).Normalized();
                        }
                    }
                }
            }

            if (distance < query.maxDistance_)
            {
                RayQueryResult result;
                result.position_ = query.ray_.origin_ + distance * query.ray_.direction_;
                result.normal_ = normal;
                result.distance_ = distance;
                result.drawable_ = this;
                result.node_ = node_;
                result.subObject_ = M_MAX_UNSIGNED;
                results.Push(result);
            }
        }
        break;

    case RAY_TRIANGLE_UV:
        ATOMIC_LOGWARNING("RAY_TRIANGLE_UV query level is not supported for CustomGeometry component");
        break;
    }
}
开发者ID:JimMarlowe,项目名称:AtomicGameEngine,代码行数:57,代码来源:CustomGeometry.cpp

示例13: HandleTriggerStart

void Pickup::HandleTriggerStart(StringHash eventType, VariantMap &eventData)
{
    PODVector<RigidBody*> collidingBodies;
    triggerBody_->GetCollidingBodies(collidingBodies);

    for (int i = 0; i < collidingBodies.Size(); i++) {
        RigidBody* collider = collidingBodies[i];
        if (collider->GetNode()->GetNameHash() == N_PLAYER) {
            masterControl_->player_->Pickup(pickupType_);
            masterControl_->spawnMaster_->SpawnHitFX(GetPosition(), false);
            switch (pickupType_){
            case PT_MULTIX: case PT_CHAOBALL: Deactivate(); break;
            case PT_APPLE: case PT_HEART: Respawn(); break;
            default: break;
            }
        }
    }
}
开发者ID:1vanK,项目名称:heXon,代码行数:18,代码来源:pickup.cpp

示例14: ProcessRayQuery

void StaticModel::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
{
    RayQueryLevel level = query.level_;

    switch (level)
    {
    case RAY_AABB:
        Drawable::ProcessRayQuery(query, results);
        break;

    case RAY_OBB:
    case RAY_TRIANGLE:
    case RAY_TRIANGLE_UV:
        Matrix3x4 inverse(node_->GetWorldTransform().Inverse());
        Ray localRay = query.ray_.Transformed(inverse);
        float distance = localRay.HitDistance(boundingBox_);
        Vector3 normal = -query.ray_.direction_;
        Vector2 geometryUV;
        unsigned hitBatch = M_MAX_UNSIGNED;

        if (level >= RAY_TRIANGLE && distance < query.maxDistance_)
        {
            distance = M_INFINITY;

            for (unsigned i = 0; i < batches_.Size(); ++i)
            {
                Geometry* geometry = batches_[i].geometry_;
                if (geometry)
                {
                    Vector3 geometryNormal;
                    float geometryDistance = level == RAY_TRIANGLE ? geometry->GetHitDistance(localRay, &geometryNormal) :
                        geometry->GetHitDistance(localRay, &geometryNormal, &geometryUV);
                    if (geometryDistance < query.maxDistance_ && geometryDistance < distance)
                    {
                        distance = geometryDistance;
                        normal = (node_->GetWorldTransform() * Vector4(geometryNormal, 0.0f)).Normalized();
                        hitBatch = i;
                    }
                }
            }
        }

        if (distance < query.maxDistance_)
        {
            RayQueryResult result;
            result.position_ = query.ray_.origin_ + distance * query.ray_.direction_;
            result.normal_ = normal;
            result.textureUV_ = geometryUV;
            result.distance_ = distance;
            result.drawable_ = this;
            result.node_ = node_;
            result.subObject_ = hitBatch;
            results.Push(result);
        }
        break;
    }
}
开发者ID:ClockTeam,项目名称:Clockwork,代码行数:57,代码来源:StaticModel.cpp

示例15: GetVertexSize

unsigned VertexBuffer::GetVertexSize(const PODVector<VertexElement>& elements)
{
    unsigned size = 0;

    for (unsigned i = 0; i < elements.Size(); ++i)
        size += ELEMENT_TYPESIZES[elements[i].type_];

    return size;
}
开发者ID:iSLC,项目名称:Urho3D,代码行数:9,代码来源:VertexBuffer.cpp


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