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


C++ SimObject::AddComponent方法代码示例

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


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

示例1: Initialize


//.........这里部分代码省略.........
    testObjBox->SetVisible(false);
    testObjBox->SetEnabled(false);

    m_currentObjectID = 1;

    /*
    SimObject* colObj = new SimObject();
    colObj->Initialize("colObj");

    tPos = (glm::vec3(3.0f, 2.5f, -8.0f));
    tScl = (glm::vec3(1.0f, 1.0f, 1.0f));
    tCol = (glm::vec4(0.8f, 0.2f, 0.2f, 1.0f));
    tPosMin = (glm::vec3(-0.5f, -0.5f, -0.5f));
    tPosMax = (glm::vec3(0.5f, 0.5f, 0.5f));

    Transform* colObjTransform = new Transform(colObj);
    colObjTransform->Initialize();
    colObjTransform->SetPosition(&tPos);
    colObjTransform->SetScale(&tScl);
    colObj->SetTransform(colObjTransform);
    MeshGLBox* colBox = new MeshGLBox(colObj, 1.0f, 1.0f, 1.0f, &tCol);
    colBox->Initialize();
    colBox->SetGloss(60.0f);
    colBox->SetSpecular(1.0f);
    colBox->SetTextureID(ResourceManager::GetInstance()->GetTextureWhite());
    colObj->AddMesh(colBox);
    BoxAACollider* cObjCollider = PhysicsManager::GetInstance()->CreateBoxAACollider(colObj, &tPosMin, &tPosMax);
    colObj->AddCollider(cObjCollider);

    RotateMe* rm = new RotateMe(colObj);
    rm->Initialize();
    tRot = glm::vec3(0.0f, 0.003f, 0.0f);
    rm->SetRotation(&tRot);
    colObj->AddComponent(rm);

    AddObject(colObj);
    */

    SimObject* testCloth = new SimObject();
    testCloth->Initialize("testCloth");

    tPos = (glm::vec3(0.0f, 10.0f, 0.0f));
    tScl = (glm::vec3(1.0f, 1.0f, 1.0f));
    tCol = glm::vec4(1.0f, 0.5f, 0.7f, 1.0f);

    Transform* testClothTransform = new Transform(testCloth);
    testClothTransform->Initialize();
    testClothTransform->SetPosition(&tPos);
    testClothTransform->SetScale(&tScl);
    testClothTransform->Update();
    testCloth->SetTransform(testClothTransform);

    ClothSimulator* cSim = new ClothSimulator(testCloth);
    testCloth->AddComponent(cSim);
    cSim->Initialize(); // !!!!!!!!!!!!!!

    AddObject(testCloth);

    ////////////////////////
    /////////// Camera

    Camera* testCam = new Camera(nullptr, CSSET_WINDOW_FOV, CSSET_WINDOW_NEAR, CSSET_WINDOW_FAR);
    testCam->Initialize();

    tPos = glm::vec3(-8.0f, 15.0f, 15.0f) * 2.0f;
    testCam->SetPosition(&tPos);
开发者ID:ACPLMaverick,项目名称:MAVNET,代码行数:67,代码来源:SceneTest.cpp


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