资源简介
AtomicAlpha.zip
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include “camera.h“
void Fps::InitFps()
{
int i; for(i=0;i < 10;i++) g_tenframes[i] = 30;
}
float Fps::GetFps()
{
float fps = 0.0f;
int i;
int dt = timeGetTime() - g_lastTime;
g_lastTime = timeGetTime();
g_tenframes[g_frameCount] = dt;
g_frameCount = (g_frameCount + 1)%10;
for(i=0;i<10;i++){fps += (float)g_tenframes[i];}
fps = fps/10.0f;
fps = 1000.0f/fps;
return fps;
}
bool Camera::GetKey(int virtKeyCode)
{
if (GetAsyncKeyState(virtKeyCode) & 0x8000) return true;
return false;
}
bool Camera::Camera_Init()
{
MouseMove=false;
MCenX=0; MCenY=0;
accX=0; accY=0;
timeStamp = timeGetTime();
return true;
}
void Camera::frcam_update()
{
mouse_x = -accX;
mouse_y = -accY;
accX = 0; accY = 0;
}
void Camera::frcam_motion(int win_width int win_height)
{
int dx dy;
POINT pt;
GetCursorPos(&pt);
if (!MouseMove) {
MCenX = (win_width/2);
MCenY = (win_height/2);
SetCursorPos(MCenX MCenY);
accX = 0;
accY = 0;
MouseMove = true;
}
else
{
if (MCenX==pt.x && MCenY==pt.y){return;}
dx = MCenX -pt.x;
dy = MCenY -pt.y;
accX += dx;
accY += dy;
SetCursorPos(MCenX MCenY);
}
}
bool Camera::Camera_Update(int win_width int win_height)
{
frcam_update();
screen_width=win_width;
screen_height=win_height;
frcam_motion(screen_width screen_height);
float prev_XPos=XPos;
float prev_YPos=YPos;
float prev_ZPos=ZPos;
float prev_XZAngle=XZAngle;
float prev_YZAngle=YZAngle;
float prev_XYAngle=XYAngle;
float prev_speed=speed;
float prev_radius=radius;
int prev_timeStamp=timeStamp;
timeStamp = timeGetTime();
dt = timeStamp - prev_timeStamp;
dxyAngle=0;
AngleSpeed=0.2f;
dxzAngle = (float)mouse_x*g_maxTurnRate;
XZAngle = prev_XZAngle + dxzAngle;
if(XZAngle > 360.0f) XZAngle -= 360.f;
if(XZAngle < 0.0f) XZAngle += 360.f;
dyzAngle=(float)mouse_y*g_maxTurnRate;
YZAngle = prev_YZAngle - dyzAngle;
if(YZAngle > 360.0f) YZAngle -= 360.f;
if(YZAngle < 0.0f) YZAngle += 360.f;
if (GetKey(VK_LEFT)) dxyAngle +=0.5;
if (GetKey(VK_RIGHT)) dxyAngle -=0.5;
XYAngle = prev_XYAngle - dxyAngle;
if(XYAngle > 360.0f) XYAngle -= 360.f;
if(XYAngle < 0.0f) XYAngle += 360.f;
if ( (XYAngle > 5.0f) && (XYAngle < 45.0f)) XZAngle +=AngleSpeed;
if ( (XYAngle < 355.0f) && (XYAngle > 305.0f)) XZAngle -=AngleSpeed;
if (GetKey(VK_UP) || GetKey(‘A‘)) {speed = prev_speed - g_acceleration * (float)dt;}
if (GetKey(VK_DOWN) || GetKey(‘Z‘)) {speed = prev_speed + g_acceleration * (float)dt;}
if(speed > g_maxSpeed) speed = g_maxSpeed;
if(speed < -g_maxSpeed) speed = -g_maxSpeed;
XPos = prev_XPos + (float)dt * speed * (float)sin(-XZAngle/180.0*P_I) * (float)cos(YZAngle/180.0*P_I);
YPos = prev_YPos + (float)dt * speed * (float)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-03-04 15:36 AtomicAlpha\
文件 5156 2011-03-02 01:35 AtomicAlpha\AtomicAlpha.dsp
文件 530 2011-03-02 01:35 AtomicAlpha\AtomicAlpha.dsw
文件 99328 2011-03-04 15:36 AtomicAlpha\AtomicAlpha.ncb
文件 48640 2011-03-04 15:36 AtomicAlpha\AtomicAlpha.opt
文件 6407 2011-03-01 23:22 AtomicAlpha\camera.cpp
文件 1135 2005-11-10 14:36 AtomicAlpha\camera.h
文件 66614 2002-12-24 11:58 AtomicAlpha\Colour1024.bmp
文件 2599 2011-03-01 23:35 AtomicAlpha\Config.cpp
文件 762 2011-03-01 23:36 AtomicAlpha\Config.h
文件 475 2011-03-04 15:34 AtomicAlpha\config.ini
目录 0 2011-03-02 00:00 AtomicAlpha\data\
文件 1048576 2004-05-31 14:57 AtomicAlpha\data\1.raw
文件 1048576 2005-12-01 18:35 AtomicAlpha\data\vars.raw
目录 0 2011-03-01 23:59 AtomicAlpha\Debug\
文件 700473 2011-03-01 23:59 AtomicAlpha\Debug\AtomicAlpha.exe
文件 1021724 2011-03-01 23:59 AtomicAlpha\Debug\AtomicAlpha.ilk
文件 5803612 2011-03-01 23:59 AtomicAlpha\Debug\AtomicAlpha.pch
文件 1344512 2011-03-01 23:59 AtomicAlpha\Debug\AtomicAlpha.pdb
文件 26640 2011-03-01 23:50 AtomicAlpha\Debug\camera.obj
文件 298330 2011-03-01 23:36 AtomicAlpha\Debug\Config.obj
文件 17767 2011-03-01 23:47 AtomicAlpha\Debug\font.obj
文件 18557 2011-03-01 23:47 AtomicAlpha\Debug\glFrustum.obj
文件 40899 2011-03-01 23:58 AtomicAlpha\Debug\GLScene.obj
文件 31113 2011-03-01 23:56 AtomicAlpha\Debug\Launcher.obj
文件 57645 2011-03-01 23:59 AtomicAlpha\Debug\math3d.obj
文件 55635 2011-03-01 23:59 AtomicAlpha\Debug\Roam.obj
文件 30561 2011-03-01 23:41 AtomicAlpha\Debug\system.obj
文件 63261 2011-03-01 23:47 AtomicAlpha\Debug\texture.obj
文件 230400 2011-03-04 15:34 AtomicAlpha\Debug\vc60.idb
文件 167936 2011-03-01 23:59 AtomicAlpha\Debug\vc60.pdb
............此处省略17个文件信息
相关资源
- STM32_ucos.rar
- 4696670丝印方向及位置调整SKILL程序.
- 读取串口数据并画实时曲线成功改4
- MyElectCourse.rar
- johnny133_8851963.rar
- CP210x_Driver03.rar
- johnjobs_4652228.zip
- R语言与统计分析—汤银才.pdf
- libwebsockets-master.rar
- ERP管理源码MingRiERP.zip
- sourceFTP编程clientserver.rar
- EltimaSerialPortMonitor402281.rar
- PersonalPlatform.rar
- NetGPSMgr.rar
- MIMO系统中的天线选择和自适应传输
- jnjlc1_4985788.zip
- 多机调度(贪心算法).rar
- N皇后.rar
- EOS-Platform-7.0基础开发教程完整版.pd
- ADI高速、混合、微弱信号布线指南中
- db2驱动.zip
- (BlogYi)v1.7.5项目源文件.rar
- 自然资源一张图平台软件技术方案2
- 三调建库与管理系统使用手册2018102
- Maple教程.rar
- MediaTimer成功版.rar
- tf-faster-rcnn.rar
- WinHex.rar
- 30160830i6v7.gz
- ueditor.rar
评论
共有 条评论