本文整理汇总了C++中GetCamera函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCamera函数的具体用法?C++ GetCamera怎么用?C++ GetCamera使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCamera函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:likeleon,项目名称:RocketCommanderOgre,代码行数:19,代码来源:BaseGame.cpp
示例2: GetCamera
void Scene::UpdateScene(float dt)
{
MyD3D10Code::Direct3D10Class::UpdateScene(dt);
// Update the camera
GetCamera().Update(dt);
// Update the box
m_Box.Update(dt);
}
开发者ID:JonathanSimonJones,项目名称:Year3Sem2,代码行数:10,代码来源:Scene.cpp
示例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);
}
开发者ID:Moralitycore,项目名称:0ad,代码行数:11,代码来源:View.cpp
示例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();
}
开发者ID:jcrm,项目名称:DX,代码行数:11,代码来源:Sky.cpp
示例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);
}
开发者ID:WiZFramework,项目名称:BaseCross,代码行数:15,代码来源:GameStage.cpp
示例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);
}
开发者ID:benloong,项目名称:Deferred-Rendering-Demo,代码行数:41,代码来源:DeferredDemo.cpp
示例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();
}
开发者ID:lalalaring,项目名称:Genesis,代码行数:41,代码来源:scene.cpp
示例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);
}
}
开发者ID:Meraz,项目名称:3D2_Project,代码行数:31,代码来源:Screen.cpp
示例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();
}
开发者ID:jason-amju,项目名称:amju-scp,代码行数:22,代码来源:EngineStatePoolShowShot.cpp
示例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);
}
});
}
开发者ID:ggj,项目名称:reapers,代码行数:51,代码来源:gameflow.cpp
示例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();
}
开发者ID:Meraz,项目名称:3D2_Project,代码行数:23,代码来源:Screen.cpp
示例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);
}
}
开发者ID:Meraz,项目名称:3D2_Project,代码行数:23,代码来源:Tree.cpp
示例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
}
}
}
开发者ID:JohnCrash,项目名称:wowhack,代码行数:14,代码来源:wowentry.cpp
示例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);
}
开发者ID:binhpt,项目名称:vltest,代码行数:14,代码来源:ViewerRenderer.cpp
示例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);
}
开发者ID:deepmatrix,项目名称:blaxxun-cc3d,代码行数:14,代码来源:gedit.cpp
示例16: CreateDefaultRenderTargets
//ビュー類の作成
void GameStage::CreateViews(){
//最初にデフォルトのレンダリングターゲット類を作成する
CreateDefaultRenderTargets();
//マルチビューコンポーネントの取得
auto PtrMultiView = GetComponent<MultiView>();
//マルチビューにビューの追加
auto PtrView = PtrMultiView->AddView();
//ビューの矩形を設定(ゲームサイズ全体)
Rect2D<float> rect(0, 0, (float)App::GetApp()->GetGameWidth(), (float)App::GetApp()->GetGameHeight());
//最初のビューにパラメータの設定
PtrView->ResetParamaters<LookAtCamera, MultiLight>(rect, Color4(0.0f, 0.125f, 0.3f, 1.0f), 1, 0.0f, 1.0f);
auto PtrCamera = PtrView->GetCamera();
PtrCamera->SetEye(Vector3(0.0f, 2.0f, -5.0f));
PtrCamera->SetAt(Vector3(0.0f, 0.0f, 0.0f));
}
开发者ID:WiZFramework,项目名称:DxBase2015,代码行数:16,代码来源:GameStage.cpp
示例17: Projection
void MyScene::Projection()
{
if (GetCamera()->projection)
{
gluPerspective(60.0, (GLdouble)windowWidth / (GLdouble)windowHeight, 1.0, 100000.0);
//printf("pers\n");
}
else
{
//printf("orth\n");
glOrtho(-1000, 1000, -1000, 1000, 10, 10000);
}
}
开发者ID:danng007,项目名称:GRACW,代码行数:15,代码来源:MyScene.cpp
示例18: InitCamera
void EditDialog::InitCamera(const ee::SprPtr& spr) const
{
auto canvas = std::dynamic_pointer_cast<ee::CameraCanvas>(m_stage->GetCanvas());
auto cam = canvas->GetCamera();
if (cam->Type() == s2::CAM_PSEUDO3D) {
return;
}
wxSize sz = GetSize();
sm::vec2 r_sz = spr->GetBounding().GetSize().Size();
float scale = std::min(sz.GetWidth() / r_sz.x, sz.GetHeight() / r_sz.y);
auto ortho_cam = std::dynamic_pointer_cast<s2::OrthoCamera>(cam);
ortho_cam->Set(sm::vec2(0, 0), 1 / scale);
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:15,代码来源:EditDialog.cpp
示例19: sizeof
void Terrain::draw(const D3DXMATRIX& world)
{
md3dDevice->IASetInputLayout(InputLayout::PosNormalTex);
UINT stride = sizeof(TerrainVertex);
UINT offset = 0;
md3dDevice->IASetVertexBuffers(0, 1, &mVB, &stride, &offset);
md3dDevice->IASetIndexBuffer(mIB, DXGI_FORMAT_R32_UINT, 0);
D3DXMATRIX view = GetCamera().view();
D3DXMATRIX proj = GetCamera().proj();
D3DXMATRIX WVP = world*view*proj;
mfxWVPVar->SetMatrix((float*)&WVP);
mfxWorldVar->SetMatrix((float*)&world);
mfxLayer0Var->SetResource(mLayer0);
mfxLayer1Var->SetResource(mLayer1);
mfxLayer2Var->SetResource(mLayer2);
mfxLayer3Var->SetResource(mLayer3);
mfxLayer4Var->SetResource(mLayer4);
mfxBlendMapVar->SetResource(mBlendMap);
D3D10_TECHNIQUE_DESC techDesc;
mTech->GetDesc( &techDesc );
for(UINT i = 0; i < techDesc.Passes; ++i)
{
ID3D10EffectPass* pass = mTech->GetPassByIndex(i);
pass->Apply(0);
md3dDevice->DrawIndexed(mNumFaces*3, 0, 0);
}
}
开发者ID:JonathanSimonJones,项目名称:Year3Sem2,代码行数:36,代码来源:Terrain.cpp
示例20: GetEngine
void EngineRunningBase::DrawLensflare()
{
// Lensflare: draw if the sparkling sun is on screen.
if (!m_pLevel->IsCurrentRoomIndoors() &&
GetEngine()->GetDayNightSky()->IsSparkleVisible())
{
// Make a bounding sphere around the sun coords.
Vec3f sunPos = GetEngine()->GetDayNightSky()->GetSunPosition();
BoundingSphere sunBs(sunPos, 50.0f); // sun's "radius"
// Find out if the sun intersects the view frustum
if (Frustum::Instance()->Contains(sunBs))
{
PCamera pCam = GetCamera();
Assert(pCam.GetPtr());
Vec3f eyePos(pCam->GetOrientation()->GetX(),
pCam->GetOrientation()->GetY(),
pCam->GetOrientation()->GetZ());
// We have to draw the lens flare, unless the sun is obscured by part of
// the scene.
// Test the line from camera to sun for obstructions.
//Mgc::Segment3 seg;
//seg.Origin() = Mgc::Vector3(eyePos.x, eyePos.y, eyePos.z);
//seg.Direction() = Mgc::Vector3(
// sunPos.x - eyePos.x,
// sunPos.y - eyePos.y,
// sunPos.z - eyePos.z);
// Do intersection test on the scenery for the current room.
if (m_pLevel->GetScene()->LineIntersects(eyePos, sunPos, 1.0f /* some radius */ ))
{
return; // Sun is obscured.
}
// We should draw the lens flare. Get the Camera eye position and
// "look at" position (some point along the line we are pointing at).
GetEngine()->PushColour(1.0f, 1.0f, 1.0f, 1.0f);
//GetEngine()->GetLensflare()->Draw(
// GetEngine()->GetDayNightSky()->GetSunPosition(),
// eyePos,
// pCam->GetLookAtPos() );
GetEngine()->PopColour();
}
}
}
开发者ID:jason-amju,项目名称:amju-scp,代码行数:48,代码来源:EngineRunningBase.cpp
注:本文中的GetCamera函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论