本文整理汇总了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);