コード例 #1
0
void CALLBACK OnFrameMove(_In_ double fTime, _In_ float fElapsedTime, _In_opt_ void* pUserContext)
{
	static float rot = 0.0f;
	rot += fElapsedTime;
	XMMATRIX mscale = XMMatrixScaling(1.0f, 1.0f, 1.0f);
	XMMATRIX mrot	= XMMatrixRotationRollPitchYaw(0.0f, 0.0f, rot);
	XMMATRIX mtrans = XMMatrixTranslation(20.0f, 50.0f, 0.0f);

	// gmesh 의 월드 매트릭스 -> XMMATRIX
	XMMATRIX mParent = XMLoadFloat4x4(&g_mesh->getWorld());

	g_matLight = (mscale * mtrans * mrot) * mParent;
	
	// 조명 메시 연결
	XMFLOAT4X4 mlit = XMFLOAT4X4();
	XMStoreFloat4x4(&mlit, g_matLight);
	g_meshLight->setWorld(mlit);


	g_camera.FrameMove(fElapsedTime);




}
コード例 #2
0
void CALLBACK OnFrameMove(double fTime, float fElapsedTime, void* pUserContext)
{
	g_input->Update();
	if (g_input->isKeyPressed(DIK_ESCAPE))
		DXUTShutdown();

	/*if (g_input->isKeyPressed(DIK_F1))
		DXUTToggleFullScreen();*/

	g_camera.FrameMove(fElapsedTime);
}
コード例 #3
0
//--------------------------------------------------------------------------------------
// Handle updates to the scene.  This is called regardless of which D3D API is used
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
    // Update position of collision objects
    Animate( fTime );

    // Compute collisions
    Collide();

    // Update the camera's position based on user input 
    g_Camera.FrameMove( fElapsedTime );
}
コード例 #4
0
ファイル: Tutorial13.cpp プロジェクト: KNeal/Oculus
//--------------------------------------------------------------------------------------
// Handle updates to the scene.  This is called regardless of which D3D API is used
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
    // Update the camera's position based on user input 
    g_Camera.FrameMove( fElapsedTime );

    if( g_bSpinning )
        D3DXMatrixRotationY( &g_World, 60.0f * DEG2RAD((float)fTime) );
    else
        D3DXMatrixRotationY( &g_World, DEG2RAD( 180.0f ) );

    D3DXMATRIX mRot;
    D3DXMatrixRotationX( &mRot, DEG2RAD( -90.0f ) );
    g_World = mRot * g_World;
}
コード例 #5
0
//--------------------------------------------------------------------------------------
// Handle updates to the scene.  This is called regardless of which D3D API is used
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove(double fTime, float fElapsedTime, void* pUserContext)
{
    SceneMesh *pSceneMesh = g_Scenes[g_CurrentSceneId].pMesh;
    g_UseOrbitalCamera = pSceneMesh && pSceneMesh->UseOrbitalCamera();

    if (g_UseOrbitalCamera)
    {
        g_OrbitalCamera.FrameMove(fElapsedTime);
    }
    else
    {
        g_FirstPersonCamera.FrameMove(fElapsedTime);
    }
}
コード例 #6
0
ファイル: LocalDeformablePRT.cpp プロジェクト: KNeal/Oculus
//--------------------------------------------------------------------------------------
// This callback function will be called once at the beginning of every frame. This is the
// best location for your application to handle updates to the scene, but is not 
// intended to contain actual rendering calls, which should instead be placed in the 
// OnFrameRender callback.  
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
    // Update the camera's position based on user input 
    g_Camera.FrameMove( fElapsedTime );

    UpdateLightingEnvironment();

    if( g_pAnimController != NULL )
    {
        g_pAnimController->SetTrackSpeed( 0, g_SampleUI.GetSlider( IDC_ANIMATION_SPEED )->GetValue() / 1000.0f );
        g_pAnimController->AdvanceTime( fElapsedTime, NULL );
    }

    UpdateFrameMatrices( g_pFrameRoot, g_Camera.GetWorldMatrix() );
}
コード例 #7
0
//--------------------------------------------------------------------------------------
// Handle updates to the scene.
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
    // Update the camera's position based on user input 
    g_Camera.FrameMove( fElapsedTime );

    if( g_bSpinning )
    {
        g_World = XMMatrixRotationY( 60.0f * XMConvertToRadians((float)fTime) );
    }
    else
    {
        g_World = XMMatrixRotationY( XMConvertToRadians( 180.f ) );
    }

    XMMATRIX mRot = XMMatrixRotationX( XMConvertToRadians( -90.0f ) );
    g_World = mRot * g_World;
}
コード例 #8
0
ファイル: CompiledEffect.cpp プロジェクト: KNeal/Oculus
//--------------------------------------------------------------------------------------
// Handle updates to the scene.  This is called regardless of which D3D API is used
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
    D3DXMATRIXA16 mWorld;
    D3DXMATRIXA16 mView;
    D3DXMATRIXA16 mProj;
    D3DXMATRIXA16 mWorldViewProjection;

    // Update the camera's position based on user input 
    g_Camera.FrameMove( fElapsedTime );

    // Get the projection & view matrix from the camera class
    mWorld = g_mCenterWorld * *g_Camera.GetWorldMatrix();
    mProj = *g_Camera.GetProjMatrix();
    mView = *g_Camera.GetViewMatrix();

    mWorldViewProjection = mWorld * mView * mProj;

    // Update the effect's variables 
    g_pEffect->SetMatrix( g_hWorldViewProjection, &mWorldViewProjection );
    g_pEffect->SetMatrix( g_hWorld, &mWorld );
    g_pEffect->SetFloat( g_hTime, ( float )fTime );
}
コード例 #9
0
void CALLBACK OnFrameMove(_In_ double fTime, _In_ float fElapsedTime, _In_opt_ void* pUserContext)
{

	// 앞뒤
	if (GetAsyncKeyState('W') & 0x8000 || GetAsyncKeyState('w') & 0x8000)
	{
		g_marine->moveForward(5.0f * fElapsedTime);
	}
	if (GetAsyncKeyState('S') & 0x8000 || GetAsyncKeyState('s') & 0x8000)
	{
		g_marine->moveForward(-5.0f * fElapsedTime);
	}

	if (GetAsyncKeyState('Q') & 0x8000 || GetAsyncKeyState('q') & 0x8000)
	{
		g_marine->moveStrafe(5.0f * fElapsedTime);
	}
	if (GetAsyncKeyState('E') & 0x8000 || GetAsyncKeyState('e') & 0x8000)
	{
		g_marine->moveStrafe(-5.0f * fElapsedTime);
	}

	// 좌우 회전
	if (GetAsyncKeyState('A') & 0x8000 || GetAsyncKeyState('a') & 0x8000)
	{
		g_marine->rotateYaw(-5.0f * fElapsedTime);
	}
	if (GetAsyncKeyState('D') & 0x8000 || GetAsyncKeyState('d') & 0x8000)
	{
		g_marine->rotateYaw(5.0f * fElapsedTime);
	}
	
	//g_marine->rotateYaw(1.0f * fElapsedTime);
	g_marine->UpdateMatrix();

	g_camera.FrameMove(fElapsedTime);
}
コード例 #10
0
//--------------------------------------------------------------------------------------
// Handle updates to the scene.  This is called regardless of which D3D API is used
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
    // Update the camera's position based on user input 
    g_Camera.FrameMove( fElapsedTime );
}
コード例 #11
0
//--------------------------------------------------------------------------------------
// Handle updates to the scene.  This is called regardless of which D3D API is used
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove(double fTime, float fElapsedTime, void* pUserContext)
{
	g_Camera.FrameMove(fElapsedTime);
}
コード例 #12
0
//--------------------------------------------------------------------------------------
// Handle updates to the scene.
//--------------------------------------------------------------------------------------
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
{
	g_camera.FrameMove(fElapsedTime);
	g_mesh.Update();
}