本文整理汇总了C++中CFirstPersonCamera::SetEnablePositionMovement方法的典型用法代码示例。如果您正苦于以下问题:C++ CFirstPersonCamera::SetEnablePositionMovement方法的具体用法?C++ CFirstPersonCamera::SetEnablePositionMovement怎么用?C++ CFirstPersonCamera::SetEnablePositionMovement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFirstPersonCamera
的用法示例。
在下文中一共展示了CFirstPersonCamera::SetEnablePositionMovement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MouseProc
void CALLBACK MouseProc( bool bLeftButtonDown, bool bRightButtonDown, bool bMiddleButtonDown, bool bSideButton1Down,
bool bSideButton2Down, int nMouseWheelDelta, int xPos, int yPos, void* pUserContext )
{
bool bOldLeftButtonDown = g_bLeftButtonDown;
bool bOldRightButtonDown = g_bRightButtonDown;
bool bOldMiddleButtonDown = g_bMiddleButtonDown;
g_bLeftButtonDown = bLeftButtonDown;
g_bMiddleButtonDown = bMiddleButtonDown;
g_bRightButtonDown = bRightButtonDown;
//*
if( bOldLeftButtonDown && !g_bLeftButtonDown )
{
// Disable movement
g_Camera.SetEnablePositionMovement( false );
}
else if( !bOldLeftButtonDown && g_bLeftButtonDown )
{
// Enable movement
g_Camera.SetEnablePositionMovement( true );
}
else if( !bOldRightButtonDown && g_bRightButtonDown )
{
// Enable movement
g_Camera.SetEnablePositionMovement( false );
}
else if( !bOldMiddleButtonDown && g_bMiddleButtonDown )
{
// Enable movement
g_Camera.SetEnablePositionMovement( false );
}
// If no mouse button is down at all, enable camera movement.
if( !g_bLeftButtonDown && !g_bRightButtonDown && !g_bMiddleButtonDown )
g_Camera.SetEnablePositionMovement( true );
//*/
/*
if( bRightButtonDown )
{
float dx = (xPos - g_ptSourisPosition.x)/5.f;
float dy = (yPos - g_ptSourisPosition.y)/5.f;
g_ptSourisPosition.x = xPos;
g_ptSourisPosition.y = yPos;
//if ( g_bSourisDroite )
{
g_pCamera->m_fAngleH += -dx;
g_pCamera->m_fAngleV += dy;
}
}
//*/
}
示例2: MouseProc
//--------------------------------------------------------------------------------------
// Handle mouse buttons
//--------------------------------------------------------------------------------------
void CALLBACK MouseProc( bool bLeftButtonDown, bool bRightButtonDown,
bool bMiddleButtonDown, bool bSideButton1Down,
bool bSideButton2Down, int nMouseWheelDelta,
int xPos, int yPos, void* pUserContext )
{
bool bOldLeftButtonDown = g_bLeftButtonDown;
bool bOldRightButtonDown = g_bRightButtonDown;
bool bOldMiddleButtonDown = g_bMiddleButtonDown;
g_bLeftButtonDown = bLeftButtonDown;
g_bMiddleButtonDown = bMiddleButtonDown;
g_bRightButtonDown = bRightButtonDown;
if( bOldLeftButtonDown && !g_bLeftButtonDown )
g_Camera.SetEnablePositionMovement( false );
else if( !bOldLeftButtonDown && g_bLeftButtonDown )
g_Camera.SetEnablePositionMovement( true );
if( !bOldRightButtonDown && g_bRightButtonDown )
{
g_Camera.SetEnablePositionMovement( false );
}
if( bOldMiddleButtonDown && !g_bMiddleButtonDown )
{
g_LCamera.SetEnablePositionMovement( false );
}
else if( !bOldMiddleButtonDown && g_bMiddleButtonDown )
{
g_LCamera.SetEnablePositionMovement( true );
g_Camera.SetEnablePositionMovement( false );
}
// If no mouse button is down at all, enable camera movement.
if( !g_bLeftButtonDown && !g_bRightButtonDown && !g_bMiddleButtonDown )
g_Camera.SetEnablePositionMovement( true );
}
示例3: vecEye
//--------------------------------------------------------------------------------------
// Create any D3D11 resources that aren't dependant on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11CreateDevice(ID3D11Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext)
{
HRESULT hr;
DXUTTRACE(L"OnD3D11CreateDevice called\n");
SetCursor(LoadCursor(0, IDC_ARROW));
ID3D11DeviceContext* pd3dImmediateContext = DXUTGetD3D11DeviceContext(); // does not addref
V_RETURN( g_DialogResourceManager.OnD3D11CreateDevice(pd3dDevice, pd3dImmediateContext) );
V_RETURN( g_SettingsDlg.OnD3D11CreateDevice(pd3dDevice) );
g_pTxtHelper = new CDXUTTextHelper(pd3dDevice, pd3dImmediateContext, &g_DialogResourceManager, g_TextLineHeight);
// Setup orbital camera
D3DXVECTOR3 vecEye(0.0f, 2.0f, 0.0f);
D3DXVECTOR3 vecAt (0.0f, 0.0f, 0.0f);
g_OrbitalCamera.SetViewParams(&vecEye, &vecAt);
g_OrbitalCamera.SetRadius(1.5f, 0.01f);
// Setup first-person camera
D3DXVECTOR3 sibenikVecEye(0.0960150138f, 0.0273544509f, -0.0185411610f);
D3DXVECTOR3 sibenikVecAt (-0.623801112f, -0.649074197f, -0.174454257f);
g_FirstPersonCamera.SetViewParams(&sibenikVecEye, &sibenikVecAt);
g_FirstPersonCamera.SetEnablePositionMovement(1);
g_FirstPersonCamera.SetScalers(0.001f, 0.05f);
// Load Scene3D.fx
g_pSceneRenderer.OnCreateDevice(pd3dDevice);
// Load meshes and bin files
LoadScenes(pd3dDevice);
GFSDK_SSAO_Status status;
status = g_AORenderer.Create(pd3dDevice);
assert(status == GFSDK_SSAO_OK);
return S_OK;
}
示例4: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_D3DSettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 20;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += 26, 170, 22, VK_F3 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent ); iY = 10;
WCHAR sz[100];
iY += 24;
swprintf_s( sz, L"Patch Divisions: %2.1f", g_fSubdivs );
g_SampleUI.AddStatic( IDC_PATCH_SUBDIVS_STATIC, sz, 10, iY += 26, 150, 22 );
g_SampleUI.AddSlider( IDC_PATCH_SUBDIVS, 10, iY += 24, 150, 22, 10 * MIN_DIVS, 10 * MAX_DIVS, (int)(g_fSubdivs * 10) );
iY += 24;
g_SampleUI.AddCheckBox( IDC_TOGGLE_LINES, L"Toggle Wires", 20, iY += 26, 150, 22, g_bDrawWires );
iY += 24;
g_SampleUI.AddRadioButton( IDC_PARTITION_INTEGER, IDC_PARTITION_MODE, L"Integer", 20, iY += 26, 170, 22 );
g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_EVEN, IDC_PARTITION_MODE, L"Fractional Even", 20, iY += 26, 170, 22 );
g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_ODD, IDC_PARTITION_MODE, L"Fractional Odd", 20, iY += 26, 170, 22 );
g_SampleUI.GetRadioButton( IDC_PARTITION_INTEGER )->SetChecked( true );
// Setup the camera's view parameters
static const XMVECTORF32 s_vecEye = { 5.0f, 3.0f, -10.0f, 0.f };
static const XMVECTORF32 s_vecAt = { 5.0f, 0.0f, 0.0f, 0.f };
g_Camera.SetViewParams( s_vecEye, s_vecAt );
g_Camera.SetEnablePositionMovement(true);
g_Camera.SetEnableYAxisMovement(true);
}
示例5: vecEye
//--------------------------------------------------------------------------------------
// Create any D3D11 resources that aren't dependant on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11CreateDevice( ID3D11Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc,
void* pUserContext )
{
HRESULT hr;
ID3D11DeviceContext* pd3dImmediateContext = DXUTGetD3D11DeviceContext();
V_RETURN( g_DialogResourceManager.OnD3D11CreateDevice( pd3dDevice, pd3dImmediateContext ) );
V_RETURN( g_D3DSettingsDlg.OnD3D11CreateDevice( pd3dDevice ) );
g_pTxtHelper = new CDXUTTextHelper( pd3dDevice, pd3dImmediateContext, &g_DialogResourceManager, 15 );
// D3DXVECTOR3 vCenter( 0.25767413f, -28.503521f, 111.00689f );
FLOAT fObjectRadius = 378.15607f;
lightpos = D3DXVECTOR3(300,300,-200);
//test = new testing();
hr = test.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext);
hr = tessplane.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext);
hr = tesscube.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext,80,D3DXVECTOR3(300,50,-200));//D3DXVECTOR3(300,50,-200
hr = lightsphere.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext,10,lightpos);
hr = fuse.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext);
hr = board1.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext,D3DXVECTOR3(300,-300,-1000));
hr = deboard.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext,D3DXVECTOR3(-300,-300,-1000));
hr = geo_alien.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext);
hr = FirePart.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext,80,0); //0 = fire
hr = sky.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext,D3DXVECTOR3(0,0,0));
hr = buildings.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext);
hr = MissilePart.setup(pd3dDevice,pBackBufferSurfaceDesc,pUserContext,20,1);
g_LightControl.SetRadius( 2000 );
// Setup the camera's view parameters
D3DXVECTOR3 vecEye( 0.0f, 50.0f, -1000.0f );
D3DXVECTOR3 vecAt ( 0.0f, 0.0f, -0.0f );
g_Camera.SetRotateButtons(true,false,false);
g_Camera.SetViewParams( &vecEye, &vecAt );
g_Camera.SetEnablePositionMovement( true );
g_Camera.SetScalers( 0.005f, 500.0f );
D3D11_DEPTH_STENCIL_DESC descDS;
ZeroMemory(&descDS, sizeof(descDS));
descDS.DepthEnable = false;
descDS.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
descDS.DepthFunc = D3D11_COMPARISON_LESS;
descDS.StencilEnable = FALSE;
hr = pd3dDevice->CreateDepthStencilState( &descDS, &g_DepthState);
//setup stuff for post process
ID3DBlob* pVertexShaderBuffer = NULL;
V_RETURN( CompileShaderFromFile( L"PP1.hlsl", "VS", "vs_4_0", &pVertexShaderBuffer ) );
ID3DBlob* pPixelShaderBuffer = NULL;
V_RETURN( CompileShaderFromFile( L"PP1.hlsl", "PS", "ps_4_0", &pPixelShaderBuffer ) );
V_RETURN( pd3dDevice->CreateVertexShader( pVertexShaderBuffer->GetBufferPointer(),
pVertexShaderBuffer->GetBufferSize(), NULL, &VSPPFirstPass ) );
DXUT_SetDebugName( VSPPFirstPass, "VSPost1" );
V_RETURN( pd3dDevice->CreatePixelShader( pPixelShaderBuffer->GetBufferPointer(),
pPixelShaderBuffer->GetBufferSize(), NULL, &PSPPFirstPass ) );
DXUT_SetDebugName( PSPPFirstPass, "PSPost1" );
pVertexShaderBuffer = NULL;
V_RETURN( CompileShaderFromFile( L"Gaussblur.hlsl", "VS", "vs_4_0", &pVertexShaderBuffer ) );
pPixelShaderBuffer = NULL;
V_RETURN( CompileShaderFromFile( L"Gaussblur.hlsl", "PS", "ps_4_0", &pPixelShaderBuffer ) );
V_RETURN( pd3dDevice->CreateVertexShader( pVertexShaderBuffer->GetBufferPointer(),
pVertexShaderBuffer->GetBufferSize(), NULL, &VSPPBlur ) );
DXUT_SetDebugName( VSPPBlur, "VSBlur" );
V_RETURN( pd3dDevice->CreatePixelShader( pPixelShaderBuffer->GetBufferPointer(),
pPixelShaderBuffer->GetBufferSize(), NULL, &PSPPBlur ) );
DXUT_SetDebugName( PSPPBlur, "PSBlur" );
pVertexShaderBuffer = NULL;
V_RETURN( CompileShaderFromFile( L"bloom_combine.hlsl", "VS", "vs_4_0", &pVertexShaderBuffer ) );
pPixelShaderBuffer = NULL;
V_RETURN( CompileShaderFromFile( L"bloom_combine.hlsl", "PS", "ps_4_0", &pPixelShaderBuffer ) );
V_RETURN( pd3dDevice->CreateVertexShader( pVertexShaderBuffer->GetBufferPointer(),
pVertexShaderBuffer->GetBufferSize(), NULL, &VSPPComb ) );
DXUT_SetDebugName( VSPPComb, "VSComb" );
V_RETURN( pd3dDevice->CreatePixelShader( pPixelShaderBuffer->GetBufferPointer(),
pPixelShaderBuffer->GetBufferSize(), NULL, &PSPPComb ) );
DXUT_SetDebugName( PSPPComb, "PSComb" );
//.........这里部分代码省略.........