本文整理汇总了C++中IVector::GetZ方法的典型用法代码示例。如果您正苦于以下问题:C++ IVector::GetZ方法的具体用法?C++ IVector::GetZ怎么用?C++ IVector::GetZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVector
的用法示例。
在下文中一共展示了IVector::GetZ方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawGLScene
void Application::DrawGLScene ()
{
int TimeDelta = GetTickCount () - gTime;
gTime = GetTickCount ();
// Do shaders
static float wave_movement = 0.0f;
wave_movement += 0.03f; // Increment our wave movement
if (wave_movement > 6.2831853071) // Prevent crashing
wave_movement = 0.0f;
cgGLSetParameter3f(mWave, wave_movement, 1.0f, 1.0f);
IVector SunDirection = mpEngine->GetSunlightVector ();
cgGLSetParameter3f (mSunVector, SunDirection.GetX (), SunDirection.GetY (),
SunDirection.GetZ ());
mpFog->Draw ();
mpEngine->Draw ();
mpEngine->GetParticleManager ()->UpdateAndDrawAll ();
mpSun->Draw ();
// Press 'F' for cloud dissipation or 'G' for cloud formation
if (Keys::FPressed == true)
{
mpCloudManager->Form (0.0f, 6000, 10000);
}
if (Keys::GPressed == true)
{
mpCloudManager->Form (100.0f, 6000, 10000);
}
// Turn wind on or off
static bool MovedL = false;
if (Keys::LeftPressed == true && MovedL == false)
{
mpSceneManager->mWind.MoveX (-2.0f);
MovedL = true;
}
static bool MovedR = false;
if (Keys::RightPressed == true && MovedR == false)
{
mpSceneManager->mWind.SetXYZ (0.0f, 0.0f, 0.0f);
MovedR = true;
}
// Make our two boxes crash into each other
if (mpPolyObj0->Collision (mpPolyObj1) == false)
{
mpPolyObj0->Translate (0.0f, 0.0f, -0.1f);
mpPolyObj1->Translate (0.0f, 0.0f, 0.5f);
}
// Experimental - move some vertices around after the collision
else
mpPolyObj0->MoveVerticesByBoneId(static_cast<char> (0), 0.0f, 0.0f, 0.001f);
IVector FountainPos = mpEngine->GetTerrain ()->GetWorldPositionAtCoord (134, 190);
mpFountain->SetOrigin (FountainPos);
// Watch the terrain rise like yeast!
static float MaxTerrainHeight = -1.5f;
static bool CloudsAdded = false;
MaxTerrainHeight += 0.05f;
if (MaxTerrainHeight < 20.0f)
{
mpEngine->GetTerrain ()->SetMaxHeight
((MaxTerrainHeight >= 1.0f) ? MaxTerrainHeight : 1.0f);
}
else
{
mpEngine->GetLightManager ()->Translate (gLightNumber, 0.0f, 0.0f, 0.5f);
if (!CloudsAdded)
{
mpCloudManager->AddCloudPuff (50, FountainPos, 1.0f);
CloudsAdded = true;
}
}
mpCloudManager->Draw (mpEngine->GetCamera ());
// Make our pixmap fade away
static unsigned char c = 255;
if (c > 0) c--;
mpPixmap->SetOpaqueness (c);
//mpPixmap->Draw ();
mpFpsCounter->Draw ();
mpTimeOfDay->Update (TimeDelta);
mpTimeOfDay->Draw ();
mpEngine->UpdateProceduralSkybox (mpTimeOfDay);
mpEngine->Update (TimeDelta);
// Draw a frames per second counter
mpFpsCounter->Update (TimeDelta);
mpFpsCounter->Draw ();
}
示例2: Draw
void Skybox::Draw (Camera* rpCamera)
{
glPushMatrix ();
glDisable (GL_FOG);
glEnable (GL_TEXTURE_2D);
IVector v = rpCamera->GetPosition ();
glTranslatef (v.GetX (), v.GetY (), v.GetZ ());
glColor3f (1.0f, 1.0f, 1.0f);
unsigned char LightingOn = glIsEnabled (GL_LIGHTING);
if (LightingOn == GL_TRUE)
{
glDisable (GL_LIGHTING);
}
mpTextureManager->LoadTexture (mTextureU);
glBegin (GL_QUADS);
glTexCoord2f (1.0f, 0.0f);
glVertex3f ( 100.0f, 100.0f, -100.0f);
glTexCoord2f (1.0f, 1.0f);
glVertex3f ( 100.0f, 100.0f, 100.0f);
glTexCoord2f (0.0f, 1.0f);
glVertex3f (-100.0f, 100.0f, 100.0f);
glTexCoord2f (0.0f, 0.0f);
glVertex3f (-100.0f, 100.0f, -100.0f);
glEnd ();
mpTextureManager->LoadTexture (mTextureD);
glBegin (GL_QUADS);
glTexCoord2f (1.0f, 1.0f);
glVertex3f (-100.0f, -100.0f, 100.0f);
glTexCoord2f (0.0f, 1.0f);
glVertex3f ( 100.0f, -100.0f, 100.0f);
glTexCoord2f (0.0f, 0.0f);
glVertex3f ( 100.0f, -100.0f, -100.0f);
glTexCoord2f (1.0f, 0.0f);
glVertex3f (-100.0f, -100.0f, -100.0f);
glEnd ();
mpTextureManager->LoadTexture (mTextureL);
glBegin (GL_QUADS);
glTexCoord2f (1.0f, 1.0f);
glVertex3f (-100.0f, 100.0f, -100.0f);
glTexCoord2f (0.0f, 1.0f);
glVertex3f (-100.0f, 100.0f, 100.0f);
glTexCoord2f (0.0f, 0.0f);
glVertex3f (-100.0f, -100.0f, 100.0f);
glTexCoord2f (1.0f, 0.0f);
glVertex3f (-100.0f, -100.0f, -100.0f);
glEnd ();
mpTextureManager->LoadTexture (mTextureR);
glBegin (GL_QUADS);
glTexCoord2f (0.0f, 0.0f);
glVertex3f ( 100.0f, -100.0f, -100.0f);
glTexCoord2f (1.0f, 0.0f);
glVertex3f ( 100.0f, -100.0f, 100.0f);
glTexCoord2f (1.0f, 1.0f);
glVertex3f ( 100.0f, 100.0f, 100.0f);
glTexCoord2f (0.0f, 1.0f);
glVertex3f ( 100.0f, 100.0f, -100.0f);
glEnd ();
mpTextureManager->LoadTexture (mTextureF);
glBegin (GL_QUADS);
glTexCoord2f (0.0f, 0.0f);
glVertex3f (-100.0f, -100.0f, -100.0f);
glTexCoord2f (1.0f, 0.0f);
glVertex3f ( 100.0f, -100.0f, -100.0f);
glTexCoord2f (1.0f, 1.0f);
glVertex3f ( 100.0f, 100.0f, -100.0f);
glTexCoord2f (0.0f, 1.0f);
glVertex3f (-100.0f, 100.0f, -100.0f);
glEnd ();
mpTextureManager->LoadTexture (mTextureB);
glBegin (GL_QUADS);
glTexCoord2f (1.0f, 1.0f);
glVertex3f (-100.0f, 100.0f, 100.0f);
glTexCoord2f (0.0f, 1.0f);
glVertex3f ( 100.0f, 100.0f, 100.0f);
glTexCoord2f (0.0f, 0.0f);
glVertex3f ( 100.0f, -100.0f, 100.0f);
glTexCoord2f (1.0f, 0.0f);
glVertex3f (-100.0f, -100.0f, 100.0f);
glEnd ();
glDisable (GL_TEXTURE_2D);
glEnable (GL_FOG);
if (LightingOn == GL_TRUE)
{
glEnable (GL_LIGHTING);
}
glPopMatrix ();
}
示例3: Draw
void Sun::Draw ()
{
glPushMatrix ();
glDisable (GL_FOG);
glEnable (GL_TEXTURE_2D);
unsigned char LightingOn = glIsEnabled (GL_LIGHTING);
if (LightingOn == GL_TRUE)
{
glDisable (GL_LIGHTING);
}
glEnable (GL_ALPHA_TEST);
glDisable (GL_CULL_FACE);
glAlphaFunc (GL_GREATER, 0.0f);
// Sun should always be 90.0 feet away from camera
IVector camPos = mpEngine->GetCamera ()->GetPosition ();
glTranslatef (camPos.GetX (), camPos.GetY (), camPos.GetZ ());
IVector sunPos = mpEngine->GetSunlightVector ().GetReverseVector ();
sunPos *= 90.0f;
const float sunRadius = 10.0f;
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
// Draw the sun
mpTextureManager->LoadTexture (mTextureKey);
glBegin (GL_QUADS);
glColor3f (1.0f, 1.0f, 1.0f);
glTexCoord2f (0.0f, 0.0f);
glVertex3f (sunPos.GetX () - sunRadius, sunPos.GetY () - sunRadius, sunPos.GetZ ());
glTexCoord2f (1.0f, 0.0f);
glVertex3f (sunPos.GetX () + sunRadius, sunPos.GetY () - sunRadius, sunPos.GetZ ());
glTexCoord2f (1.0f, 1.0f);
glVertex3f (sunPos.GetX () + sunRadius, sunPos.GetY () + sunRadius, sunPos.GetZ ());
glTexCoord2f (0.0f, 1.0f);
glVertex3f (sunPos.GetX () - sunRadius, sunPos.GetY () + sunRadius, sunPos.GetZ ());
glEnd ();
mFlareTextureKey = -1;
// Draw the lens flare
if (mFlareTextureKey != -1)
{
IVector flareOffset = sunPos - mpEngine->GetCamera ()->GetForwardVector ();
IVector flarePos = sunPos + 1.0f / sunPos.DotProduct (mpEngine->GetCamera ()->GetForwardVector ()) * flareOffset;
flarePos.SetZ (flarePos.GetZ () + 10.0f);
float flareRadius = 10.0f;
mpTextureManager->LoadTexture (mFlareTextureKey);
glBegin (GL_QUADS);
glTexCoord2f (0.0f, 0.0f);
glVertex3f (flarePos.GetX () - flareRadius, flarePos.GetY () - flareRadius, flarePos.GetZ ());
glTexCoord2f (1.0f, 0.0f);
glVertex3f (flarePos.GetX () + flareRadius, flarePos.GetY () - flareRadius, flarePos.GetZ ());
glTexCoord2f (1.0f, 1.0f);
glVertex3f (flarePos.GetX () + flareRadius, flarePos.GetY () + flareRadius, flarePos.GetZ ());
glTexCoord2f (0.0f, 1.0f);
glVertex3f (flarePos.GetX () - flareRadius, flarePos.GetY () + flareRadius, flarePos.GetZ ());
glEnd ();
}
glAlphaFunc (GL_ALWAYS, 0.0f);
glDisable (GL_BLEND);
glDisable (GL_ALPHA_TEST);
glDisable (GL_TEXTURE_2D);
glEnable (GL_CULL_FACE);
glEnable (GL_FOG);
if (LightingOn == GL_TRUE)
{
glEnable (GL_LIGHTING);
}
glPopMatrix ();
}