本文整理汇总了C++中Mtx44::SetToLookAt方法的典型用法代码示例。如果您正苦于以下问题:C++ Mtx44::SetToLookAt方法的具体用法?C++ Mtx44::SetToLookAt怎么用?C++ Mtx44::SetToLookAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mtx44
的用法示例。
在下文中一共展示了Mtx44::SetToLookAt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LookAt
void MS::LookAt(double eyeX, double eyeY, double eyeZ,
double centerX, double centerY, double centerZ,
double upX, double upY, double upZ)
{
Mtx44 mat;
mat.SetToLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
ms.top() = ms.top() * mat;
}
示例2: Render
void SceneSkyBox::Render()
{
// Render VBO here
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//These will be replaced by matrix stack soon
Mtx44 model;
Mtx44 view;
Mtx44 projection;
model.SetToIdentity();
//Set view matrix using camera settings
view.SetToLookAt(
camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z
);
//Set projection matrix to perspective mode
projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.0f); //FOV, Aspect Ratio, Near plane, Far plane
viewStack.LoadIdentity();
viewStack.LookAt(camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z);
modelStack.LoadIdentity();
Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
RenderMesh(meshList[GEO_AXES], false);
modelStack.PushMatrix();
modelStack.Translate(light[0].position.x, light[0].position.y, light[0].position.z);
RenderMesh(meshList[GEO_LIGHTBALL], false);
modelStack.PopMatrix();
/*modelStack.PushMatrix();
modelStack.Scale(10, 10, 10);
RenderMesh(meshList[GEO_QUAD], false);
modelStack.PopMatrix();*/
//Loads the Skybox
RenderSkyBox();
//Mario
modelStack.PushMatrix();
modelStack.Scale(10, 10, 10);
modelStack.Translate(0.0f, 1.f, -0.4f);
modelStack.Rotate(90, 0.f, 1.f, 0.f);
modelStack.Rotate(90, 0.f, 0.f, 1.f);
RenderMesh(meshList[GEO_MARIO], false);
modelStack.PopMatrix();
}
示例3: GetViewMatrix
Mtx44 Camera::GetViewMatrix() const
{
Mtx44 view;
const Vector3 position = ReturnPosition();
const Vector3 target = ReturnTarget();
const Vector3 up = ReturnUp();
view.SetToLookAt(position.x, position.y, position.z, target.x, target.y, target.z, up.x, up.y, up.z);
return view;
}
示例4:
void Scene3::Render()
{
// Render VBO here
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//Temp variables
Mtx44 translate, rotate, scale;
Mtx44 MVP;
//These will be replaced by matrix stack soon
Mtx44 model;
Mtx44 view;
Mtx44 projection;
//Set all matrices to identity
translate.SetToIdentity();
rotate.SetToIdentity();
scale.SetToIdentity();
model.SetToIdentity();
//Set view matrix using camera settings
view.SetToLookAt(
camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z
);
//Set projection matrix to perspective mode
projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.0f); //FOV, Aspect Ratio, Near plane, Far plane
model.SetToIdentity();
MVP = projection * view * model;
glUniformMatrix4fv(m_parameters[U_MVP], 1, GL_FALSE, &MVP.a[0]);
meshList[GEO_AXES]->Render();
rotate.SetToRotation(rotateAngle, 0, 0, 1);
model = rotate;
MVP = projection * view * model;
glUniformMatrix4fv(m_parameters[U_MVP], 1, GL_FALSE, &MVP.a[0]);
/*meshList[GEO_CUBE]->Render();*/
meshList[GEO_SPHERE]->Render();
/*model.SetToIdentity();
MVP = projection * view * model;
glUniformMatrix4fv(m_parameters[U_MVP], 1, GL_FALSE, &MVP.a[0]);*/
/*meshList[GEO_CIRCLE]->Render();*/
/*meshList[GEO_RING]->Render();*/
}
示例5: Render
void MAINMENU::Render()
{
// Render VBO here
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//These will be replaced by matrix stack soon
Mtx44 model;
Mtx44 view;
Mtx44 projection;
model.SetToIdentity();
//Set view matrix using camera settings
view.SetToLookAt(
camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z
);
//Set projection matrix to perspective mode
projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.0f); //FOV, Aspect Ratio, Near plane, Far plane
viewStack.LoadIdentity();
viewStack.LookAt(camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z);
modelStack.LoadIdentity();
float i = 3;
for (st = menuList.rbegin(); st != menuList.rend(); ++st)
{
RenderTextOnScreen(meshList[TEXT], *st, Color(1, 1, 1), 3, 3, i ++);
}
if (c_UserInterface::GetEnum()->UI == START)
{
RenderTextOnScreen(meshList[TEXT], ">", Color(1, 1, 1), 3, 2, 5);
}
if (c_UserInterface::GetEnum()->UI == OPTIONS)
{
RenderTextOnScreen(meshList[TEXT], ">", Color(1, 1, 1), 3, 2, 4);
}
if (c_UserInterface::GetEnum()->UI == EXIT)
{
RenderTextOnScreen(meshList[TEXT], ">", Color(1, 1, 1), 3, 2, 3);
}
}
示例6: lightDir
void PLANET3::Render()
{
// Render VBO here
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//These will be replaced by matrix stack soon
Mtx44 model;
Mtx44 view;
Mtx44 projection;
model.SetToIdentity();
//Set view matrix using camera settings
view.SetToLookAt(
camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z
);
//Set projection matrix to perspective mode
projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.0f); //FOV, Aspect Ratio, Near plane, Far plane
viewStack.LoadIdentity();
viewStack.LookAt(camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z);
modelStack.LoadIdentity();
Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
Vector3 lightDir(light[1].position.x, light[1].position.y, light[1].position.z);
Vector3 lightDirection_cameraspace2 = viewStack.Top() * lightDir;
glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightDirection_cameraspace2.x);
RenderMesh(meshList[GEO_AXES], false);
modelStack.PushMatrix();
modelStack.Translate(light[0].position.x, light[0].position.y, light[0].position.z);
RenderMesh(meshList[GEO_LIGHTBALL], false);
modelStack.PopMatrix();
RenderSkyBox();
}
示例7: lightDir
void PLANET5::Render()
{
// Render VBO here
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//These will be replaced by matrix stack soon
Mtx44 model;
Mtx44 view;
Mtx44 projection;
model.SetToIdentity();
//Set view matrix using camera settings
view.SetToLookAt(
camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z
);
//Set projection matrix to perspective mode
projection.SetToPerspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.0f); //FOV, Aspect Ratio, Near plane, Far plane
viewStack.LoadIdentity();
viewStack.LookAt(camera.position.x, camera.position.y, camera.position.z,
camera.target.x, camera.target.y, camera.target.z,
camera.up.x, camera.up.y, camera.up.z);
modelStack.LoadIdentity();
Position lightPosition_cameraspace = viewStack.Top() * light[0].position;
glUniform3fv(m_parameters[U_LIGHT0_POSITION], 1, &lightPosition_cameraspace.x);
Vector3 lightDir(light[1].position.x, light[1].position.y, light[1].position.z);
Vector3 lightDirection_cameraspace2 = viewStack.Top() * lightDir;
glUniform3fv(m_parameters[U_LIGHT1_POSITION], 1, &lightDirection_cameraspace2.x);
RenderMesh(meshList[GEO_AXES], false);
/*modelStack.PushMatrix();
modelStack.Translate(light[0].position.x, light[0].position.y, light[0].position.z);
RenderMesh(meshList[GEO_LIGHTBALL], false);
modelStack.PopMatrix();
/* modelStack.PushMatrix();
modelStack.Translate(0.f, 0.f, 0.f);
RenderMesh(meshList[ASTEROID], false);
modelStack.PopMatrix();*/
std::ostringstream fps;
fps << camera.position.x << " " << camera.position.y << " " << camera.position.z;
std::ostringstream fpss;
fpss << camera.target.x << " " << camera.target.y << " " << camera.target.z;
RenderSkyBox();
modelStack.PushMatrix();
modelStack.Translate(0.0f, -35.0f, 0.f);
modelStack.Rotate(rotatespin - 45, 0, 1, 0);
modelStack.Scale(22.0f, 24.0f, 22.0f);
RenderMesh(meshList[SPIN], false);
modelStack.PopMatrix();
modelStack.PushMatrix();
modelStack.Translate(0.0f, 8.0f, 0.f);
modelStack.Scale(10.0f, 10.f, 10.f);
RenderMesh(meshList[SPINCAP], false);
modelStack.PopMatrix();
modelStack.PushMatrix();
modelStack.Translate(5.0f, translateButton - 6.f, 43.5f);
modelStack.Rotate(25.0f, 1, 0, 0);
modelStack.Scale(2.f, 3.0f, 2.f);
RenderMesh(meshList[BUTTON], false);
modelStack.PopMatrix();
modelStack.PushMatrix();
modelStack.Translate(5.0f, -6.0f, 45.0f);
modelStack.Rotate(-90.0f, 0, 1, 0);
modelStack.Scale(2.0f, 2.0f, 2.0f);
RenderMesh(meshList[BUTTONSTAND], false);
modelStack.PopMatrix();
//////////////////////GEMS ARE OUTRAGREOUS//////////////////////////
modelStack.PushMatrix();
modelStack.Translate(-50.0f, translategem1 - 5.7f, -81.5f);
modelStack.Rotate(22.0f, 1, 0, 0);
modelStack.Scale(2.f, 3.0f, 2.f);
RenderMesh(meshList[BUTTON], false);
modelStack.PopMatrix();
modelStack.PushMatrix();
modelStack.Translate(-50.0f, -6.0f, -80.0f);
modelStack.Rotate(-90.0f, 0, 1, 0);
modelStack.Scale(2.0f, 2.0f, 2.0f);
RenderMesh(meshList[BUTTONSTAND], false);
modelStack.PopMatrix();
modelStack.PushMatrix();
modelStack.Translate(-50.0f, flygem1, -90.0f);
modelStack.Rotate(rotategem1, 0, 1, 0);
//.........这里部分代码省略.........