本文整理汇总了C++中GetCamera函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCamera函数的具体用法?C++ GetCamera怎么用?C++ GetCamera使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCamera函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCamera
bool BaseGame::IsInFrontOfCamera(const Vector3 &point) const
{
// Not work, why?
//const Matrix4 viewProjMatrix = GetCamera().getViewMatrix() * GetCamera().getProjectionMatrix();
//Vector4 result = Vector4(point.x, point.y, point.z, 1) * viewProjMatrix;
//
//// Is result in front?
//return result.z > result.w - GetCamera().getNearClipDistance();
const Vector3 eyeSpacePos = GetCamera().getViewMatrix() * point;
if (eyeSpacePos.z >= 0)
return false;
const Vector3 hcsPos = GetCamera().getProjectionMatrix() * eyeSpacePos;
if ((hcsPos.x < -1.0f) || (hcsPos.x > 1.0f) || (hcsPos.y < -1.0f) || (hcsPos.y > 1.0f))
return false;
return true;
}
示例2: GetCamera
void Scene::UpdateScene(float dt)
{
MyD3D10Code::Direct3D10Class::UpdateScene(dt);
// Update the camera
GetCamera().Update(dt);
// Update the box
m_Box.Update(dt);
}
示例3: GetCamera
void AtlasViewActor::Render()
{
SViewPort vp = { 0, 0, g_xres, g_yres };
CCamera& camera = GetCamera();
camera.SetViewPort(vp);
camera.SetProjection(2.f, 512.f, DEGTORAD(20.f));
camera.UpdateFrustum();
m_ActorViewer->Render();
Atlas_GLSwapBuffers((void*)g_AtlasGameLoop->glCanvas);
}
示例4: GetCamera
void Sky::draw(){
D3DXVECTOR3 eyePos = GetCamera().position();
// center Sky about eye in world space
Translate(eyePos.x, eyePos.y, eyePos.z);
HR(mfxCubeMapVar->SetResource(mCubeMap));
md3dDevice->IASetInputLayout(InputLayout::Pos);
md3dDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
GfxObj::draw();
}
示例5: CreateViewLight
//--------------------------------------------------------------------------------------
// ゲームステージクラス実体
//--------------------------------------------------------------------------------------
//ビューとライトの作成
void GameStage::CreateViewLight() {
auto PtrView = CreateView<SingleView>();
//ビューのカメラの設定
auto PtrCamera = PtrView->GetCamera();
PtrCamera->SetEye(Vec3(0.0f, 5.0f, -5.0f));
PtrCamera->SetAt(Vec3(0.0f, 0.0f, 0.0f));
//シングルライトの作成
auto PtrSingleLight = CreateLight<SingleLight>();
//ライトの設定
PtrSingleLight->GetLight().SetPositionToDirectional(-0.25f, 1.0f, -0.25f);
}
示例6: switch
LRESULT DeferredDemo::msgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
POINT mousePos;
int dx = 0;
int dy = 0;
switch(msg)
{
case WM_LBUTTONDOWN:
if( wParam & MK_LBUTTON )
{
SetCapture(mhMainWnd);
mOldMousePos.x = LOWORD(lParam);
mOldMousePos.y = HIWORD(lParam);
}
return 0;
case WM_LBUTTONUP:
ReleaseCapture();
return 0;
case WM_MOUSEMOVE:
if( wParam & MK_LBUTTON )
{
mousePos.x = (int)LOWORD(lParam);
mousePos.y = (int)HIWORD(lParam);
dx = mousePos.x - mOldMousePos.x;
dy = mousePos.y - mOldMousePos.y;
GetCamera().pitch( dy * 0.0087266f );
GetCamera().rotateY( dx * 0.0087266f );
mOldMousePos = mousePos;
}
return 0;
}
return D3DApp::msgProc(msg, wParam, lParam);
}
示例7: glClear
void Scene::Render()
{
for ( Layer* pLayer : mLayerList )
{
if ( pLayer->GetLayerDepth() & GetLayerMask() )
{
glClear(GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
Vector3 cPos = GetCamera()->GetPosition();
Vector3 cTgt = GetCamera()->GetTargetPosition();
if ( pLayer->IsBackground() )
{
Vector3 cDiff = cPos - cTgt;
gluLookAt(cDiff.x, cDiff.y, cDiff.z, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
}
else
{
gluLookAt(cPos.x, cPos.y, cPos.z, cTgt.x, cTgt.y, cTgt.z, 0.0f, 1.0f, 0.0f);
}
pLayer->Render();
}
}
for ( Layer* pLayerToDelete : mLayersToDelete )
{
for ( LayerList::iterator it = mLayerList.begin(), itEnd = mLayerList.end(); it != itEnd; )
{
if ( *it == pLayerToDelete )
{
delete *it;
it = mLayerList.erase( it );
}
else
it++;
}
}
mLayersToDelete.clear();
}
示例8: GetCamera
void Screen::UpdateY()
{
float x, y, z;
x = GetCamera().GetPosition().x;
y = GetCamera().GetPosition().y;
z = GetCamera().GetPosition().z;
mVelocityY -= mGravity*mDeltaTime;
if(mState == walking)
GetCamera().SetYPosition(mWorldHandler->GetHeight(x, z) + HeightOffset);
else
{
float newYPos = mWorldHandler->GetHeight(x, z) + HeightOffset;
if(y + (mVelocityY * mDeltaTime) <= newYPos)
{
//Reached ground
float lDeltaTime = (newYPos - y)/mVelocityY;
//Calculate new delta time
y += lDeltaTime*mVelocityY;
GetCamera().SetYPosition(y);
//Stop falling
mVelocityY = 0;
mState = walking;
return;
}
//Keep falling
y += mDeltaTime*mVelocityY;
GetCamera().SetYPosition(y);
}
}
示例9: GetConfigValue
void EngineStatePoolShowShot::TimerExpired()
{
// Play wav: cue hits ball
// TODO find decent wav
static const std::string sfx = Engine::Instance()->
GetConfigValue("golf_wav_11");
SoundFxManager::Instance()->PlayWav(sfx.c_str());
const PoolGameState::PlayerInfo::PoolStroke& gs =
GetEngine()->GetGameState()->GetCurrentPlayerInfo()->m_golfStroke;
EngineStatePoolSetUpShot::TakeShotNowImpl(gs.m_yRot, gs.m_vertVel, gs.m_horVel, gs.m_accel,
gs.m_english, gs.m_drawRoll);
// Stop user-controlled camera movement
GetCamera()->PlusUp(false);
GetCamera()->PlusDown(false);
GetCamera()->PlusLeft(false);
GetCamera()->PlusRight(false);
ChangeStateToShotInPlay();
}
示例10: sdNew
bool GameFlow::Initialize()
{
IGameApp::Initialize();
return cPres.Load("configs/game.config", [&](Presentation *, Viewport *aborted)
{
if (!aborted)
{
pSoundSystem->SetMusicVolume(0.6f);
pSoundSystem->SetSfxVolume(0.5f);
// Create the State Machine Data
gGameData = sdNew(GameData());
if (this->SaveSystemFlow())
pSaveSystem->Load(0, &gGameData->sPlayer, &gGameData->sOptions);
// Create the transitions
cMenuToGame.Initialize(&cMenu, &cOnGame, &cGame);
cMenuToOptions.Initialize(&cMenu, &cOnOptions, &cOptions);
cMenuToCredits.Initialize(&cMenu, &cOnCredits, &cCredits);
cOptionsToMenu.Initialize(&cOptions, &cOnMenu, &cMenu);
cCreditsToMenu.Initialize(&cCredits, &cOnMenu, &cMenu);
cGameToMenu.Initialize(&cGame, &cOnMenu, &cMenu);
cGameToLoad.Initialize(&cGame, &cOnLoad, &cLoad);
cLoadToGame.Initialize(&cLoad, &cOnGame, &cGame);
// Create the State Machine.
cFlow.RegisterTransition(&cMenuToGame);
cFlow.RegisterTransition(&cMenuToOptions);
cFlow.RegisterTransition(&cMenuToCredits);
cFlow.RegisterTransition(&cOptionsToMenu);
cFlow.RegisterTransition(&cCreditsToMenu);
cFlow.RegisterTransition(&cGameToMenu);
cFlow.RegisterTransition(&cGameToLoad);
cFlow.RegisterTransition(&cLoadToGame);
pSystem->AddListener(this);
pInput->AddKeyboardListener(this);
auto viewport = cPres.GetViewportByName("MainView");
pScene = viewport->GetScene();
pCamera = viewport->GetCamera();
sdNew(GuiManager());
gGui->Initialize();
pScene->Add(gGui->GetSceneObject());
cFlow.Initialize(&cMenu);
}
});
}
示例11: UpdateY
void Screen::Update()
{
UpdateY();
float lWalkingSpeed = gPlayerMovementSpeed;
if(GetAsyncKeyState(VK_LSHIFT) & 0x8000 && mState != falling)
lWalkingSpeed = gPlayerMovementSpeed*2;
KeyBoardMovement(lWalkingSpeed, mDeltaTime);
mWorldHandler->Update(mDeltaTime);
mParticleHandler->Update(mDeltaTime, mGameTime);
UpdateSunWVP();
mGameTimer->Tick();
mDeltaTime = mGameTimer->GetDeltaTime();
mGameTime = mGameTimer->GetGameTime();
//tror det är skillnaden i position i z ledet som ska in som offset, might be wrong, kör på 50 sålänge
GetCamera().BuildViewReflection(50.0f);
GetCamera().RebuildView();
}
示例12: GetCamera
void Tree::Draw()
{
D3DXMATRIXA16 a = GetCamera().GetViewMatrix() * GetCamera().GetProjectionMatrix();
mShaderObject->SetMatrix("viewProj", a);
mShaderObject->SetFloat3("eyePosW", GetCamera().GetPosition());
mDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_POINTLIST);
UINT stride = sizeof(BillboardVertex);
UINT offset = 0;
mDevice->IASetVertexBuffers(0, 1, &mVertexBuffer, &stride, &offset);
D3D10_TECHNIQUE_DESC techDesc;
mShaderObject->GetTechnique()->GetDesc( &techDesc );
for(UINT p = 0; p < techDesc.Passes; ++p)
{
mShaderObject->Render(p);
mDevice->Draw(1,0);
}
}
示例13: TurnCamera
void TurnCamera( float x,float y ){
void* pcam = GetCamera();
if( pcam ){
float xx = x*32/9;
float yy = y*32/9;
__asm{
mov ecx,pcam
push 0
push yy
push xx
call g_chTurnCamera.pEntryFunc
}
}
}
示例14: GetCamera
void
ViewerRenderer::Zoom(float delta)
{
float cameraPosition[3], cameraTarget[3], cameraUp[3];
GetCamera(cameraPosition, cameraTarget, cameraUp);
for (int i = 0; i < 3; i++)
{
cameraPosition[i] = cameraTarget[i] +
(delta + 1.f) * (cameraPosition[i] - cameraTarget[i]);
}
SetCamera(cameraPosition, cameraTarget, cameraUp);
}
示例15: OnMouseMove
int GNewObjectHandler::OnMouseMove(UINT nFlags, Point &point)
{
Point pw,pl;
Point p ;
view->World2Screen(GetCamera().target,p);
point.z = p.z; // which depth plane ??
MapPoint(point,pw,pl);
CString s;
s.Format("%g %g %g",pl.x,pl.y,pl.z);
UpdateDialogValue(s);
// TRACE("%s:OnMouseMove (%f %f %f) %x \n",this->ClassName(),point.x,point.y,point.z,nFlags);
return(EV_OK);
}