118 lines
2.0 KiB
C
118 lines
2.0 KiB
C
#pragma once
|
|
|
|
#include <d3dx9.h>
|
|
|
|
/*
|
|
void homeCam()
|
|
{
|
|
g_CamPos.x= 0.0f;
|
|
g_CamPos.y= 60.0f;
|
|
g_CamPos.z= 75.0f;
|
|
g_CamRot.x= 3.14f;
|
|
g_CamRot.y= 0.65f;
|
|
g_CamRot.z= 0.0f;
|
|
|
|
#ifdef MESHTESTER
|
|
g_CamPos.x= 0.0f;
|
|
g_CamPos.y= 1.0f;
|
|
g_CamPos.z= -5.0f;
|
|
g_CamRot.x= 0.0f;
|
|
g_CamRot.y= 0.0f;
|
|
g_CamRot.z= 0.0f;
|
|
#endif
|
|
|
|
#ifdef PUPPETTESTER
|
|
g_CamPos.x= 0.0f;
|
|
g_CamPos.y= 1.0f;
|
|
g_CamPos.z= -5.0f;
|
|
g_CamRot.x= 0.0f;
|
|
g_CamRot.y= 0.0f;
|
|
g_CamRot.z= 0.0f;
|
|
#endif
|
|
|
|
#ifdef CURSOR3D
|
|
g_CursorPos.x= 0.0f;
|
|
g_CursorPos.y= 0.0f;
|
|
g_CursorPos.z= 0.0f;
|
|
#endif
|
|
}
|
|
|
|
void EditCam()
|
|
{
|
|
static POINT OldCurPos;
|
|
POINT CurPos;
|
|
GetCursorPos( &CurPos );
|
|
|
|
if( GetAsyncKeyState( VK_HOME ) )
|
|
{
|
|
homeCam();
|
|
}
|
|
|
|
if( GetAsyncKeyState( VK_MBUTTON ) || GetAsyncKeyState( VK_RBUTTON ) )
|
|
{
|
|
g_CamRot.x+= 0.002f * ( OldCurPos.x - CurPos.x );
|
|
g_CamRot.y-= 0.002f * ( OldCurPos.y - CurPos.y );
|
|
g_CamRot.y= max( g_CamRot.y, -1.56f );
|
|
g_CamRot.y= min( g_CamRot.y, 1.56f );
|
|
|
|
|
|
static float fSpeedA= 0.0f;
|
|
|
|
if( GetAsyncKeyState( VK_UP ) )
|
|
{
|
|
fSpeedA= max( fSpeedA, 0.0f );
|
|
fSpeedA+= 0.01f;
|
|
g_CamPos+= fSpeedA * g_CamFront;
|
|
}
|
|
else if( GetAsyncKeyState( VK_DOWN ) )
|
|
{
|
|
fSpeedA= min( fSpeedA, 0.0f );
|
|
fSpeedA-= 0.01f;
|
|
g_CamPos+= fSpeedA * g_CamFront;
|
|
}
|
|
else
|
|
{
|
|
fSpeedA= 0.0f;
|
|
}
|
|
|
|
static float fSpeedB= 0.0f;
|
|
|
|
if( GetAsyncKeyState( VK_RIGHT ) )
|
|
{
|
|
fSpeedB= max( fSpeedB, 0.0f );
|
|
fSpeedB+= 0.01f;
|
|
g_CamPos+= fSpeedB * g_CamRight;
|
|
}
|
|
else if( GetAsyncKeyState( VK_LEFT ) )
|
|
{
|
|
fSpeedB= min( fSpeedB, 0.0f );
|
|
fSpeedB-= 0.01f;
|
|
g_CamPos+= fSpeedB * g_CamRight;
|
|
}
|
|
else
|
|
{
|
|
fSpeedB= 0.0f;
|
|
}
|
|
static float fSpeedC= 0.0f;
|
|
|
|
if( GetAsyncKeyState( VK_NUMPAD1 ) )
|
|
{
|
|
fSpeedC= max( fSpeedC, 0.0f );
|
|
fSpeedC+= 0.01f;
|
|
g_CamPos.y+= fSpeedC;
|
|
}
|
|
else if( GetAsyncKeyState( VK_NUMPAD0 ) )
|
|
{
|
|
fSpeedC= min( fSpeedC, 0.0f );
|
|
fSpeedC-= 0.01f;
|
|
g_CamPos.y+= fSpeedC;
|
|
}
|
|
else
|
|
{
|
|
fSpeedC= 0.0f;
|
|
}
|
|
}
|
|
OldCurPos= CurPos;
|
|
}*/
|
|
|
|
void FillCameraMatrix( D3DXVECTOR3 v3Pos, D3DXVECTOR3 v3Rot, D3DXMATRIX* CamMat ); |