本文整理汇总了C++中ISceneManager::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ ISceneManager::Draw方法的具体用法?C++ ISceneManager::Draw怎么用?C++ ISceneManager::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneManager
的用法示例。
在下文中一共展示了ISceneManager::Draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}
uint next_game_tick = GetTickCount();
int sleep_time = 0;
bool bQuit = false;
while (device->Run())
{
uint cur_time = GetTickCount();
sleep_time = next_game_tick - cur_time;
if (sleep_time <= 0)
{
if (event)
{
static int lastX;
static int lastY;
int currentX = event->GetMousePositonX();
int currentY = event->GetMousePositionY();
float rotY = (currentX - lastX) * 2.0f * PI / device->GetWindowWidth();
float rotX = (currentY - lastY) * 2.0f * PI / device->GetWindowHeight();
CVector3 camDir = camera->GetDirection();
CVector3 curRot = pSphere->GetRotation();
if (event->IsPress(EKP_MOUSE_LBUTTON))
{
if (!ISZERO(rotX) || !ISZERO(rotY))
{
CVector3 rot(rotX + curRot.x, curRot.y + rotY, 0);
pSphere->SetRotation(rot);
}
}
if (event->IsPress(EKP_MOUSE_RBUTTON))
{
if (!ISZERO(rotX) || !ISZERO(rotY))
{
camDir.rotateXZBy(-rotY);
CMatrix4 rotMat4;
rotMat4.SetRotationRadians(rotX, (-camDir).crossProduct(CVector3(0, 1.0f, 0)));
rotMat4.TransformVect(camDir);
camDir.normalize();
camera->SetDirection(camDir);
}
}
if (event->IsPress(EKP_KEYBOARD_A))
{
CVector3 leftDir = camDir;
leftDir.rotateXZBy(PI / 2);
pSphere->SetPosition(pSphere->GetPosition() + leftDir * 1.0f);
}
if (event->IsPress(EKP_KEYBOARD_D))
{
CVector3 rightDir = camDir;
rightDir.rotateXZBy(PI / 2);
pSphere->SetPosition(pSphere->GetPosition() - rightDir * 1.0f);
}
if (event->IsPress(EKP_KEYBOARD_W))
{
pSphere->SetPosition(pSphere->GetPosition() + camDir * 1.0f);
}
if (event->IsPress(EKP_KEYBOARD_S))
{
pSphere->SetPosition(pSphere->GetPosition() - camDir * 1.0f);
}
if (event->IsPress(EKP_KEYBOARD_ESC))
{
exit(1);
}
lastX = event->GetMousePositonX();
lastY = event->GetMousePositionY();
}
next_game_tick = GetTickCount() + SKIP_TICKS;
sceneManager->Update(SKIP_TICKS - sleep_time);
sceneManager->Draw();
device->SwapBuffers();
}
else
{
device->Sleep(sleep_time);
}
}
delete pSphere;
delete pRenderObject;
DestroyMagicX();
return 0;
}