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


C++ IActor::GetObjects方法代码示例

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


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

示例1: CBox


//.........这里部分代码省略.........
            g_pSolidBoxModelRenderer->VAddMesh(iMesh, iMesh);
    }

    if (!g_pWireSphereModelRenderer)
    {
        g_pWireSphereModelRenderer = CDistributedObjectCreator::GetInstance()->CreateModelRenderer();
        g_pWireSphereModelRenderer->SetRenderMethod(E_RENDERMETHOD::WIREFRAMED);
        g_pWireSphereModelRenderer->SetRigidBodyFlag(E_RIGID_BODY_FLAG::DYNAMIC);

        CRawModel RawModel;
        RawModel.m_eRidigBodyFlag = E_RIGID_BODY_FLAG::DYNAMIC;
        RawModel.m_vScale = XMFLOAT3(fBoxSize, fBoxSize, fBoxSize);
        ContructSphereVertexBuffer(&RawModel);

        for (auto iMesh : RawModel.m_RawMeshes)
            g_pWireSphereModelRenderer->VAddMesh(iMesh, iMesh);
    }

    if (!g_pSolidSphereModelRenderer)
    {
        g_pSolidSphereModelRenderer = CDistributedObjectCreator::GetInstance()->CreateModelRenderer();
        g_pSolidSphereModelRenderer->SetRenderMethod(E_RENDERMETHOD::SOLID);
        g_pSolidSphereModelRenderer->SetRigidBodyFlag(E_RIGID_BODY_FLAG::DYNAMIC);

        CRawModel RawModel;
        RawModel.m_eRidigBodyFlag = E_RIGID_BODY_FLAG::DYNAMIC;
        RawModel.m_vScale = XMFLOAT3(fBoxSize, fBoxSize, fBoxSize);
        ContructSphereVertexBuffer(&RawModel);

        for (auto iMesh : RawModel.m_RawMeshes)
            g_pSolidSphereModelRenderer->VAddMesh(iMesh, iMesh);
    }

    if (!g_pWirePlaneModelRenderer)
    {
        g_pWirePlaneModelRenderer = CDistributedObjectCreator::GetInstance()->CreateModelRenderer();
        g_pWirePlaneModelRenderer->SetRenderMethod(E_RENDERMETHOD::WIREFRAMED);

        CRawModel RawModel;
        RawModel.m_vScale = XMFLOAT3(500.0f, 500.0f, 500.0f);
        ContructRegularGrid(XMINT2(5, 5), &RawModel);

        for (auto iMesh : RawModel.m_RawMeshes)
            g_pWirePlaneModelRenderer->VAddMesh(iMesh, iMesh);
    }

    if (!g_pSolidPlaneModelRenderer)
    {
        g_pSolidPlaneModelRenderer = CDistributedObjectCreator::GetInstance()->CreateModelRenderer();
        g_pSolidPlaneModelRenderer->SetRenderMethod(E_RENDERMETHOD::SOLID);

        CRawModel RawModel;
        RawModel.m_vScale = XMFLOAT3(500.0f, 500.0f, 500.0f);
        ContructRegularGrid(XMINT2(5, 5), &RawModel);

        for (auto iMesh : RawModel.m_RawMeshes)
            g_pSolidPlaneModelRenderer->VAddMesh(iMesh, iMesh);
    }

    IActor *pActor = nullptr;

    //CObject *pObject;

    switch (eActorType)
    {
    case E_ACTOR_TYPE::CUBE:
        {
            // g_pWireBoxModelRenderer g_pSolidBoxModelRenderer

        pActor = new CBox(xvPos - XMVectorReplicate(fBoxSize / 2), xvPos + XMVectorReplicate(fBoxSize / 2),
            g_pWireBoxModelRenderer);
        }
        break;
    case E_ACTOR_TYPE::SPHERE:
    {
        XMFLOAT3 vPos;
        XMStoreFloat3(&vPos, xvPos);

        pActor = new CSphere(vPos, 1.0f, g_pWireSphereModelRenderer);
    }
        break;
    case E_ACTOR_TYPE::PLANE:
        pActor = new CPlane(g_pSolidPlaneModelRenderer);
        ((CPlane *)pActor)->GetPlane().x = XMVectorGetX(xvPos);
        ((CPlane *)pActor)->GetPlane().y = XMVectorGetY(xvPos);
        ((CPlane *)pActor)->GetPlane().z = XMVectorGetZ(xvPos);
        ((CPlane *)pActor)->GetPlane().w = XMVectorGetW(xvPos);
        
        break;
    }

    pActor->VInit();

    for (auto iObject : pActor->GetObjects())
    {
        iObject->SetColor(Color);
    }

    return pActor;
}
开发者ID:Void13,项目名称:AnubisEngine,代码行数:101,代码来源:BasicObjects.cpp


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