本文整理汇总了C++中LookAt函数的典型用法代码示例。如果您正苦于以下问题:C++ LookAt函数的具体用法?C++ LookAt怎么用?C++ LookAt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LookAt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: display
void display(void)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glBindBuffer(GL_ARRAY_BUFFER,buffer);
mv = LookAt( eye, eye - n, up );
model_view = mv;
// for(int i= -5; i<=5; i++)
// for(int j= -5; j<=5; ++j)
{
// model_view = mv * Translate(i*3.0f,j*3.0f, 0.0f);
traverse(head);
}
glutSwapBuffers();
}
开发者ID:yuejoo,项目名称:opengl_example,代码行数:17,代码来源:main.cpp
示例2: mPos
Camera::Camera(float theta, float phi, float radius)
:
mPos(XMFLOAT3(0.0f,0.0f,0.0f)),
mTheta(theta),
mPhi(phi),
mRadius(radius),
mLook(XMFLOAT3(0.0f, 0.0f, 1.0f)),
mUp(XMFLOAT3(0.0f, 1.0f, 0.0f)),
mRight(XMFLOAT3(1.0f, 0.0f, 0.0f))
{
XMMATRIX I = XMMatrixIdentity();
XMStoreFloat4x4(&mView, I);
XMStoreFloat4x4(&mProj, I);
LookAt(mPos, mLook, mUp);
UpdateView();
}
开发者ID:RanTaimu,项目名称:SuperSolarSystem,代码行数:17,代码来源:Camera.cpp
示例3: Win_PassiveMotion
//----------------------------------------------------------------------------
// The passive motion callback for a window is called when the mouse moves within the window while no mouse buttons are pressed.
void Win_PassiveMotion(int x, int y) {
g_fPhi = (float)-M_PI*(x - HALF_SIZE)/(HALF_SIZE); // 轉換成 g_fPhi 介於 -PI 到 PI 之間 (-180 ~ 180 之間)
g_fTheta = (float)M_PI*(float)y/SCREEN_SIZE;
g_vEye.x = g_fRadius*sin(g_fTheta)*sin(g_fPhi);
g_vEye.y = g_fRadius*cos(g_fTheta);
g_vEye.z = g_fRadius*sin(g_fTheta)*cos(g_fPhi);
g_mxModelView = LookAt( g_vEye, g_vAt, g_vUp );
// Change ModelView Matrix
g_pFloor->SetModelViewMatrix(g_mxModelView);
g_pCube->SetModelViewMatrix(g_mxModelView);
g_pSphere->SetModelViewMatrix(g_mxModelView);
g_pLight->SetModelViewMatrix(g_mxModelView);
}
开发者ID:youweit,项目名称:CG-Final-Project,代码行数:19,代码来源:Example2.cpp
示例4: SetupRC
void SetupRC() {
glClearColor(0.1f, 0.2f, 0.3f, 0.0f);
shader = gltLoadShaderPairWithAttributes("pass_thru_shader.vp", "pass_thru_shader.fp",2, GLT_ATTRIBUTE_VERTEX, "vVertex", GLT_ATTRIBUTE_COLOR, "vColor");
fprintf(stdout, "GLT_ATTRIBUTE_VERTEX : %d\nGLT_ATTRIBUTE_COLOR : %d \n",GLT_ATTRIBUTE_VERTEX, GLT_ATTRIBUTE_COLOR);
MVPMatrixLocation = glGetUniformLocation(shader,"MVMatrix");
if(MVPMatrixLocation==-1) {
fprintf(stderr,"uniform MVMatrix could not be found\n");
}
M3DVector3f eye = {0.0f, -0.3f, 2.0f}; //Ustawienia kamery
M3DVector3f at = {0.0f, 1.0f, -1.0f};
M3DVector3f up = {1.0f, 1.0f, 0.0f};
LookAt(frame,eye,at,up);
}
开发者ID:Jerzu,项目名称:piramida,代码行数:17,代码来源:piramida.cpp
示例5: RenderScene
void RenderScene(void) {
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glUseProgram(shader);
glEnable(GL_CULL_FACE);
glFrontFace(GL_CW);
CStopWatch timer;
float angle = timer.GetElapsedSeconds()*3.14f;
M3DVector3f mAt={0,0,0};
M3DVector3f mUp={0,0,1};
M3DVector3f mEye;
mEye[0]=6.8f*cos(angle);
mEye[1]=6.0f*sin(angle);
mEye[2]=5.0f;
LookAt(mFrame,mEye,mAt,mUp);
mFrame.GetCameraMatrix(mCameraMatrix);
matrixStack.LoadMatrix(mFrustrum.GetProjectionMatrix());
matrixStack.MultMatrix(mCameraMatrix);
glUniformMatrix4fv(MVPMatrixLocation, 1, GL_FALSE, matrixStack.GetMatrix());
drawGrid();
matrixStack.Translate(1.0f,7.0f,0.0f);
matrixStack.Rotate(30.0f,0.0,0.0,1.0);
glUniformMatrix4fv(MVPMatrixLocation,1,GL_FALSE,matrixStack.GetMatrix());
drawPyramid();
matrixStack.PopMatrix();
matrixStack.Translate(-7.0f,0.0f,0.0f);
matrixStack.Scale(2.0f, 2.0f, 2.0f);
glUniformMatrix4fv(MVPMatrixLocation,1,GL_FALSE,matrixStack.GetMatrix());
drawPyramid();
matrixStack.PopMatrix();
// Perform the buffer swap to display back buffer
glutSwapBuffers();
glutPostRedisplay();
}
开发者ID:mateuszbartczak,项目名称:PPG1,代码行数:45,代码来源:triangle.cpp
示例6: AddChild
void DefenderManager::UpdateSpawning()
{
if(m_WaveTimer < 0.0f)
{
auto angleStep = 90.0f / (GSETTINGS->m_DefenderManagerSettings->m_SpotsPerQuarter + 1);
for(int i=0; i<4; ++i)
{
auto angleStart = 90.0f*i;
auto angleEnd = 90.0f*(i+1);
for (int j = 0; j < GSETTINGS->m_DefenderManagerSettings->m_CountPerWavePerQuarter; ++j)
{
auto spawnAngle = angleStart + angleStep*(m_RandomSpots.GetNext()+1);
auto spawnDir = Vector3::Create(Math::Cos(spawnAngle*Math::DegToRadFactor), Math::Sin(spawnAngle*Math::DegToRadFactor), 0.0f);
auto pos = spawnDir * GSETTINGS->m_DefenderManagerSettings->m_Radius;
auto range = GSETTINGS->m_DefenderManagerSettings->m_AngleRange;
auto angle = Random::GetFloat(-range, range);
auto dir = (-spawnDir).Rotate(Vector3::Up, angle * Math::DegToRadFactor);
// Spawn actor
auto newActor = static_cast<Defender*>(m_PreloadedActor->Copy());
AddChild(newActor);
newActor->SetPosition(pos);
newActor->LookAt(dir);
newActor->SwitchState(Defender::S_Hover);
newActor->InitActor(GSETTINGS->m_DefenderSettings);
m_lDefenders.push_back(newActor);
}
}
m_WaveTimer = GSETTINGS->m_DefenderManagerSettings->m_WaveFrequency;
}
else
m_WaveTimer -= g_fDeltaTime;
if (m_SpawnTimer < 0.0f)
{
SwitchState(S_Defending);
auto camera = EntityRenderer::Instance()->Get3DCamera();
if (camera == FOLLOWCAM)
FOLLOWCAM->OnDefendersSpawned();
}
else
m_SpawnTimer -= g_fDeltaTime;
}
开发者ID:aminere,项目名称:StarportsPublic,代码行数:45,代码来源:DefenderManager.cpp
示例7: init
void
init( void )
{
// Read model in
woman.LoadMesh( "woman" );
// Load shaders and use the resulting shader program
GLuint program = InitShader( "shaders/vshader.glsl", "shaders/fshader.glsl" );
glUseProgram( program );
GLuint loc;
// Initialize shader lighting parameters
point4 light_position( 0.0, 0.0, 1.0, 0.0 );
color4 light_ambient( 0.5, 0.5, 0.5, 1.0 );
color4 light_diffuse( 1.0, 1.0, 1.0, 1.0 );
// Calculate products
color4 ambient_product = light_ambient;
// Pass in light products
glUniform4fv( glGetUniformLocation( program, "AmbientProduct" ),
1, ambient_product );
glUniform4fv( glGetUniformLocation( program, "DiffuseProduct" ),
1, light_diffuse );
glUniform4fv( glGetUniformLocation( program, "LightPosition" ),
1, light_position );
MaterialColorLoc = glGetUniformLocation( program, "MaterialColor" );
// Set our vertex projection matrix
orthoProjection = Ortho( -20.0, 20.0, -20.0, 20.0, -20.0, 20.0 );
loc = glGetUniformLocation( program, "Projection" );
glUniformMatrix4fv( loc, 1, GL_TRUE, orthoProjection );
// Set up our camera
vec4 eye( 0.0, 0.0, 1.0, 1.0 );
vec4 at( 0.0, 0.0, 0.0, 1.0 );
vec4 up( 0.0, 1.0, 0.0, 0.0 );
N = LookAt( eye, at, up );
glUniformMatrix4fv( glGetUniformLocation( program, "ModelView" ),
1, GL_TRUE, N );
glEnable( GL_DEPTH );
glClearColor( 1.0, 1.0, 1.0, 1.0 ); // white background
}
开发者ID:Snamich,项目名称:the-library,代码行数:45,代码来源:lab6.cpp
示例8: NRealisticCamerasRing
NViewDataSet NRealisticCamerasRing(size_t nviews, size_t npoints,
const NViewDatasetConfigurator config)
{
// 设置相机参数
NViewDataSet d;
d.actual_camera_num_ = nviews;
d.camera_matrix_.resize(nviews);
d.rotation_matrix_.resize(nviews);
d.translation_vector_.resize(nviews);
d.camera_center_.resize(nviews);
d.projected_points_.resize(nviews);
d.projected_point_ids_.resize(nviews);
d.point_3d_.resize(3, npoints);
d.point_3d_.setRandom();
d.point_3d_ *= 0.6;
Vecu all_point_ids(npoints);
for (size_t j = 0; j < npoints; ++j)
all_point_ids[j] = j;
for (size_t i = 0; i < nviews; ++i) {
Vec3 camera_center, t, jitter, lookdir;
const double theta = i * 2 * M_PI / nviews;
// 圆的方程式
camera_center << sin(theta), 0.0, cos(theta); // Y axis UP
camera_center *= config._dist;
d.camera_center_[i] = camera_center;
jitter.setRandom();
jitter *= config._jitter_amount / camera_center.norm();
lookdir = -camera_center + jitter;
d.camera_matrix_[i] << config._fx, 0, config._cx,
0, config._fy, config._cy,
0, 0, 1;
d.rotation_matrix_[i] = LookAt(lookdir); // Y axis UP
d.translation_vector_[i] = -d.rotation_matrix_[i] * camera_center; // [t]=[-RC] Cf HZ.
d.projected_points_[i] = Project(d.P(i), d.point_3d_);
d.projected_point_ids_[i] = all_point_ids;
}
return d;
}
开发者ID:lucasa,项目名称:3DReconstruction,代码行数:44,代码来源:nview_data_sets.cpp
示例9: NRealisticCamerasRing
NViewDataSet NRealisticCamerasRing(size_t nviews, size_t npoints,
const nViewDatasetConfigurator config)
{
//-- Setup a camera circle rig.
NViewDataSet d;
d._n = nviews;
d._K.resize(nviews);
d._R.resize(nviews);
d._t.resize(nviews);
d.C.resize(nviews);
d._x.resize(nviews);
d._x_ids.resize(nviews);
d.X.resize(3, npoints);
d.X.setRandom();
d.X *= 0.6;
Vecu all_point_ids(npoints);
for (size_t j = 0; j < npoints; ++j)
all_point_ids[j] = j;
for (size_t i = 0; i < nviews; ++i) {
Vec3 camera_center, t, jitter, lookdir;
const double theta = i * 2 * M_PI / nviews;
//-- Circle equation
camera_center << sin(theta), 0.0, cos(theta); // Y axis UP
camera_center *= config._dist;
d.C[i] = camera_center;
jitter.setRandom();
jitter *= config._jitter_amount / camera_center.norm();
lookdir = -camera_center + jitter;
d._K[i] << config._fx, 0, config._cx,
0, config._fy, config._cy,
0, 0, 1;
d._R[i] = LookAt(lookdir); // Y axis UP
d._t[i] = -d._R[i] * camera_center; // [t]=[-RC] Cf HZ.
d._x[i] = Project(d.P(i), d.X);
d._x_ids[i] = all_point_ids;
}
return d;
}
开发者ID:Oliver001,项目名称:openMVG,代码行数:44,代码来源:test_data_sets.cpp
示例10: Camera
FocusCamera::FocusCamera(Level * level_, GameObject * focus_, Vec3 position_) : Camera(level_){
focus = focus_;
stateMachine.ChangeState(new ::Stare(this));
behaviour = LookState::Stare;
position = position_;
if (focus){
followDistance = Vec3::length(position - focus->position);
LookAt(focus->position);
MinCameraDistance = int(followDistance / 3.0f);
MaxCameraDistance = int(followDistance * 3.0f);
selfieStick = position - focus->position;
}
xInverted = 1;
yInverted = 1;
lookSpeed = 1.f;
}
开发者ID:xGhostShipIV,项目名称:Thomas,代码行数:19,代码来源:FocusCamera.cpp
示例11: RotateAround
void Pointer::Update(float timeStep_)
{
GameObject::Update(timeStep_);
position.y = ball->position.y;
if (Input->isKeyDown(SDLK_RIGHT) || Input->isKeyDown(SDLK_d))
{
RotateAround(ball->position, Vec3::BasisY(), 3 * timeStep_);
}
if (Input->isKeyDown(SDLK_LEFT) || Input->isKeyDown(SDLK_a))
{
RotateAround(ball->position, Vec3::BasisY(), -3 * timeStep_);
}
if (Input->isKeyReleased(SDLK_k))
followCam = !followCam;
if (Input->isMouseDown(SDL_BUTTON_RIGHT) && followCam)
{
//RotateAround(ball->position, Vec3::BasisY(), Input->deltaMouse().x * timeStep_);
PointAtBall();
}
if (((DIY_Level*)GAME->currentLevel)->levelState == DIY_Level_State::PLAYING &&
((DIY_Level*)GAME->currentLevel)->playingState == DIY_Level_Playing_State::SHOOTING)
{
if (!isEnabled)
{
PointAtBall();
}
isEnabled = true;
}
else
isEnabled = false;
renderer->isEnabled = isEnabled;
//position += (level->currentCamera->right() * 0.5f);
LookAt(ball->position);
Rotate(Quat(M_PI / 2, Vec3::BasisY()));
}
开发者ID:xGhostShipIV,项目名称:Thomas,代码行数:43,代码来源:Pointer.cpp
示例12: Enter
// Called when the state should become visible and start runnnig
void GameState::Enter()
{
// Create Camera
auto cameraNode = _scene->CreateChild("Camera");
auto camera = cameraNode->CreateComponent<Urho3D::Camera>();
auto soundListener = cameraNode->CreateComponent<Urho3D::SoundListener>();
cameraNode->SetPosition(Urho3D::Vector3(0.f, 10.f, -10.f));
cameraNode->LookAt(Urho3D::Vector3(0, 0, 0));
// Setup viewport
Urho3D::SharedPtr<Urho3D::Viewport> viewport(new Urho3D::Viewport(context_, _scene, camera));
GetSubsystem<Urho3D::Renderer>()->SetViewport(0, viewport);
GetSubsystem<Urho3D::Audio>()->SetListener(soundListener);
// Set debug camera view
_scene->GetComponent<Urho3D::DebugRenderer>()->SetView(camera);
}
开发者ID:thebluefish,项目名称:Projects,代码行数:20,代码来源:GameState.cpp
示例13: display
void
display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
// Create new eye vector from sphericaleye vector
eye.z = sphericaleye.x * cos(sphericaleye.y) * sin(sphericaleye.z);
eye.x = sphericaleye.x * sin(sphericaleye.y) * sin(sphericaleye.z);
eye.y = sphericaleye.x * cos(sphericaleye.z);
std::cout << "Eye: (" << eye.x << "," << eye.y << "," << eye.z << ") \t";
std::cout << "Spherical Eye: (" << sphericaleye.x << "," << sphericaleye.y << "," << sphericaleye.z << ")" << std::endl;
mat4 model_view = LookAt( eye, at, up );
glUniformMatrix4fv( ModelView, 1, GL_TRUE, model_view );
glDrawElements( GL_TRIANGLE_STRIP,sizeof(elems),GL_UNSIGNED_BYTE,NULL);
glutSwapBuffers();
}
开发者ID:FallDownT,项目名称:CS452-LAB4,代码行数:19,代码来源:lab4.cpp
示例14: RenderScene
void RenderScene(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glFrontFace(GL_CW);
glUseProgram(shader);
M3DVector3f at={0.0f, 0.0f, 0.0f};
M3DVector3f up={0.0f, 0.0f, 1.0f};
M3DVector3f eye;
float angle = timer.GetElapsedSeconds()*3.14159f/8;
eye[0]= 6.8f * cos(angle);
eye[1]= 6.0f * sin(angle);
eye[2]= 25.0f;
LookAt(cameraFrame,eye,at,up);
projection.LoadMatrix(viewFrustum.GetProjectionMatrix());
modelView.PushMatrix();
M3DMatrix44f mCamera;
cameraFrame.GetCameraMatrix(mCamera);
modelView.LoadMatrix(mCamera);
modelView.PushMatrix();
glUniformMatrix4fv(MVMatrixLocation,1,GL_FALSE,geometryPipeline.GetModelViewProjectionMatrix());
szachownica();
modelView.Translate(0.0f, 0.0f, 0.0f);
glUniformMatrix4fv(MVMatrixLocation,1,GL_FALSE,geometryPipeline.GetModelViewProjectionMatrix());
rysujPiramidke();
modelView.PopMatrix();
modelView.PushMatrix();
modelView.Translate(5.0f, 0.0f, 0.0f);
glUniformMatrix4fv(MVMatrixLocation,1,GL_FALSE,geometryPipeline.GetModelViewProjectionMatrix());
rysujPiramidke();
modelView.PopMatrix();
modelView.PushMatrix();
modelView.Translate(-5.0f, 0.0f, 0.0f);
modelView.Scale(2.0f, 2.0f, 2.0f);
glUniformMatrix4fv(MVMatrixLocation,1,GL_FALSE,geometryPipeline.GetModelViewProjectionMatrix());
rysujPiramidke();
modelView.PopMatrix();
modelView.PopMatrix();
glutSwapBuffers();
glutPostRedisplay();
}
开发者ID:adamcaban,项目名称:Adam-Caban,代码行数:42,代码来源:piramida.cpp
示例15: gPosition1
void Entity::rotate(glm::vec3 rotation)
{
this->_modelMatrix = glm::rotate(this->_modelMatrix, rotation.x, glm::vec3(1.0f, 0.0f, 0.0f));
this->_modelMatrix = glm::rotate(this->_modelMatrix, rotation.y, glm::vec3(0.0f, 1.0f, 0.0f));
this->_modelMatrix = glm::rotate(this->_modelMatrix, rotation.z, glm::vec3(0.0f, 0.0f, 1.0f));
//Quaternion to avoid Gimbol Lock
glm::vec3 gPosition1(-1.5f, 0.0f, 0.0f);
glm::vec3 gPosition2( 1.5f, 0.0f, 0.0f);
glm::vec3 desiredDir = gPosition1-gPosition2;
glm::vec3 desiredUp = glm::vec3(0.0f, 0.0f, 1.0f); // +Y
// Compute the desired orientation
glm::quat targetOrientation = glm::normalize(LookAt(desiredDir, desiredUp));
// And interpolate
glm::quat gOrientation2 = RotateTowards(gOrientation2, targetOrientation, 1.0f*0.5f);
}
开发者ID:NavneethRaj,项目名称:CS7033-Real-Time-Animation,代码行数:20,代码来源:Entity.cpp
示例16: XMVector3AngleBetweenVectors
void Camera::OrbitHorizontal(float angle)//correct
{
//get the angle between the up of the camera and the up of the world
//pitch the camaera by that angle
XMVECTOR offsetAngle = XMVector3AngleBetweenVectors(XMLoadFloat3(&XMFLOAT3(0.0, 1.0, 0.0)), XMLoadFloat3(&mUp) );
Pitch(XMVectorGetX(offsetAngle) + 0.001f);
XMMATRIX matrixRot = XMMatrixRotationY(angle); //add rotation to the matrix
XMStoreFloat3(&mPosition, XMVector3TransformNormal(XMLoadFloat3(&mPosition), matrixRot));
//XMVECTOR lookVector = XMLoadFloat3(&mPosition) - XMVectorZero();
//XMStoreFloat3(&mLook, lookVector);
XMStoreFloat3(&mLook, XMVector3TransformNormal(XMLoadFloat3(&mLook), matrixRot));
//XMStoreFloat3(&mUp, XMVector3TransformNormal(XMLoadFloat3(&mUp), matrixRot));
//look at the center
XMFLOAT3 zero(0.01, 0.01, 0.01);
LookAt(mPosition, zero, XMFLOAT3(0.0, 1.0, 0.0));
}
开发者ID:AlienJim,项目名称:3DMinesweeper,代码行数:21,代码来源:Camera.cpp
示例17: Pos
void
Camera::LookAt(const Point& target)
{
// No navel gazing:
if (target == Pos())
return;
Point tgt, tmp = target - Pos();
// Rotate into the view orientation:
tgt.x = (tmp * vrt());
tgt.y = (tmp * vup());
tgt.z = (tmp * vpn());
if (tgt.z == 0) {
Pitch(0.5);
Yaw(0.5);
LookAt(target);
return;
}
double az = atan(tgt.x/tgt.z);
double el = atan(tgt.y/tgt.z);
// if target is behind, offset by 180 degrees:
if (tgt.z < 0)
az -= PI;
Pitch(-el);
Yaw(az);
// roll to upright position:
double deflection = vrt().y;
while (fabs(deflection) > 0.001) {
double theta = asin(deflection/vrt().length());
Roll(-theta);
deflection = vrt().y;
}
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:40,代码来源:Camera.cpp
示例18: LookAt
bool CSDKBot::ThinkMelee() {
CBasePlayer* pEnemy = m_PlayerSearchInfo.CloseEnemy();
if (pEnemy) {
LookAt(pEnemy->Weapon_ShootPosition() + downToHead, m_pDifficult->m_flMeleeTurnLerp, m_pDifficult->m_flRandomAim);
}
if (m_flNextFireTime < gpGlobals->curtime && !IsAimingAtTeammate(m_PlayerSearchInfo.CloseEnemyDist())) {
m_curCmd.buttons |= IN_ATTACK;
}
DoMelee();
if (gpGlobals->curtime > m_flNextStrafeTime) {
CheckSwitchWeapon(); //check if we've fired and need to switch weapon
float randomStrafe = bot_randfloat();
if (randomStrafe < 0.45f) {
m_curCmd.buttons |= IN_LEFT;
m_curCmd.buttons &= ~IN_RIGHT;
} else if (randomStrafe < 0.9f) {
m_curCmd.buttons &= ~IN_LEFT;
m_curCmd.buttons |= IN_RIGHT;
} else {
m_curCmd.buttons &= ~IN_LEFT;
m_curCmd.buttons &= ~IN_RIGHT;
}
float randomForward = bot_randfloat();
//don't move forward if we're too close
if (m_PlayerSearchInfo.CloseEnemyDist() < m_flAdjustedMeleeRange) {
m_curCmd.buttons &= ~IN_FORWARD;
m_curCmd.buttons |= IN_BACK;
} else if (randomForward < 0.5f){
m_curCmd.buttons |= IN_FORWARD;
m_curCmd.buttons &= ~IN_BACK;
} else {
m_curCmd.buttons &= ~IN_FORWARD;
m_curCmd.buttons &= ~IN_BACK;
}
m_flNextStrafeTime += RandomFloat(0.05f, 0.2f);
}
return true;
}
开发者ID:BG2-Dev-Team,项目名称:BG2-Code,代码行数:40,代码来源:bg3_bot.cpp
示例19: display
void
display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
point4 eye( radius*sin(theta)*cos(phi),
radius*sin(theta)*sin(phi),
radius*cos(theta),
1.0 );
point4 at( 0.0, 0.0, 0.0, 1.0 );
vec4 up( 0.0, 1.0, 0.0, 0.0 );
mat4 mv = LookAt( eye, at, up );
glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
mat4 p = Frustum( left, right, bottom, top, zNear, zFar );
glUniformMatrix4fv( projection, 1, GL_TRUE, p );
glDrawArrays( GL_TRIANGLES, 0, NumVertices );
glutSwapBuffers();
}
开发者ID:jetblack87,项目名称:cs537,代码行数:22,代码来源:example2.cpp
示例20: Point3F
void Camera::ResetDefault(const Size2F& winSize, bool isOrtho /*= false*/)
{
mWinSize = winSize;
mIsOrtho = isOrtho;
float zEye = winSize.Height / 1.1566f;//this magic number will show the picture "pixel-to-pixel" on the screen
mEyePosition = Point3F(winSize.Width / 2.f, winSize.Height / 2.f, zEye);
mEyeTarget = Vector3F(winSize.Width / 2.f, winSize.Height / 2.f, 0.f);
mCameraUp=Vector3F(0.f,1.f,0.f);
if (mIsOrtho)
{
SetOrtho(mWinSize, 0.f, 2048.f);
}
else
{
mFovY = Math::ToRadian(60.f);
mNearZ = 0.1f;
mFarZ = zEye * 2;
SetPerspectiveFov(mWinSize,mFovY, mNearZ, mFarZ);
}
LookAt(mEyePosition,mEyeTarget,mCameraUp);
}
开发者ID:fjz13,项目名称:Medusa,代码行数:22,代码来源:Camera.cpp
注:本文中的LookAt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论