本文整理汇总了C++中SimObject::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ SimObject::Initialize方法的具体用法?C++ SimObject::Initialize怎么用?C++ SimObject::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimObject
的用法示例。
在下文中一共展示了SimObject::Initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
unsigned int SceneTest::Initialize()
{
////////////////////////
//////////// Ground Level
m_groundLevel = 0.0f;
////////////////////////
/////////// Objects
glm::vec3 tPos, tRot, tScl, tPosMin, tPosMax;
glm::vec4 tCol;
SimObject* ground = new SimObject();
ground->Initialize("Ground");
tPos = (glm::vec3(0.0f, m_groundLevel - 0.1f, 0.0f));
tRot = (glm::vec3(-3.14f / 2.0f, 0.0f, 0.0f));
tScl = (glm::vec3(100.0f, 100.0f, 100.0f));
tCol = (glm::vec4(0.8f, 0.8f, 0.9f, 1.0f));
Transform* groundTransform = new Transform(ground);
groundTransform->Initialize();
groundTransform->SetPosition(&tPos);
groundTransform->SetRotation(&tRot);
groundTransform->SetScale(&tScl);
ground->SetTransform(groundTransform);
MeshGLRect* triangle = new MeshGLRect(ground, &tCol);
triangle->Initialize();
triangle->SetGloss(100.0f);
triangle->SetSpecular(0.8f);
triangle->SetTextureID(ResourceManager::GetInstance()->GetTextureWhite());
ground->AddMesh(triangle);
tPosMin = glm::vec3(-0.5f, -100000.0f, -0.5f);
tPosMax = glm::vec3(0.5f, 0.001f, 0.5f);
BoxAACollider* gCollider = PhysicsManager::GetInstance()->CreateBoxAACollider(ground, &tPosMin, &tPosMax);
ground->AddCollider(gCollider);
AddObject(ground);
SimObject* testObj = new SimObject();
testObj->Initialize("testObj");
tPos = (glm::vec3(0.0f, 2.5f, 0.0f));
tScl = (glm::vec3(1.0f, 1.0f, 1.0f));
tCol = (glm::vec4(0.4f, 0.7f, 0.9f, 1.0f));
Transform* testObjTransform = new Transform(testObj);
testObjTransform->Initialize();
testObjTransform->SetPosition(&tPos);
testObjTransform->SetScale(&tScl);
testObj->SetTransform(testObjTransform);
MeshGLSphere* sph = new MeshGLSphere(testObj, 2.0f, 16, 16, &tCol);
sph->Initialize();
sph->SetGloss(20.0f);
sph->SetSpecular(0.6f);
sph->SetTextureID(ResourceManager::GetInstance()->GetTextureWhite());
testObj->AddMesh(sph);
tPosMin = (glm::vec3(0.0f, 0.0f, 0.0f));
SphereCollider* tObjCollider = PhysicsManager::GetInstance()->CreateSphereCollider(testObj, &tPosMin, 2.0f);
testObj->AddCollider(tObjCollider);
AddObject(testObj);
// and here goes box
SimObject* testObjBox = new SimObject();
testObjBox->Initialize("testObjBox");
tPos = (glm::vec3(0.0f, 999.0f, 0.0f));
tScl = (glm::vec3(1.0f, 1.0f, 1.0f));
tCol = (glm::vec4(0.4f, 0.7f, 0.9f, 1.0f));
Transform* testObjBoxTransform = new Transform(testObjBox);
testObjBoxTransform->Initialize();
testObjBoxTransform->SetPosition(&tPos);
testObjBoxTransform->SetScale(&tScl);
testObjBox->SetTransform(testObjBoxTransform);
tCol = glm::vec4(0.2f, 0.2f, 0.8f, 1.0f);
MeshGLBox* box = new MeshGLBox(testObjBox, 4.0f, 3.0f, 3.0f, &tCol);
box->Initialize();
box->SetGloss(100.0f);
box->SetSpecular(0.5f);
box->SetTextureID(ResourceManager::GetInstance()->GetTextureWhite());
testObjBox->AddMesh(box);
tPosMin = glm::vec3(-2.0f, -1.5f, -1.5f);
tPosMax = glm::vec3(2.0f, 1.5f, 1.5f);
BoxAACollider* tObjBoxCollider = PhysicsManager::GetInstance()->CreateBoxAACollider(testObjBox, &tPosMin, &tPosMax);
testObjBox->AddCollider(tObjBoxCollider);
AddObject(testObjBox);
//.........这里部分代码省略.........