亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ccamera.cpp

?? 一個DXD制作的讀取QUAKE的BSP結構的Demo可以參考
?? CPP
字號:
/*
   Class Name:

      CCamera.

   Created by:

      Allen Sherrod (Programming Ace of www.UltimateGameProgramming.com).

   Description:

      This class represents a camera in a 3D scene.
*/


#include"CCamera.h"


CCamera::CCamera()
{
   // Initialize variables...
   mPos = CVector4(0.0f, 0.0f, 0.0f);
   mView = CVector4(0.0f, 0.0f, 0.0f);
   mUp = CVector4(0.0f, 0.0f, 0.0f);
   mStrafe = CVector4(0.0f, 0.0f, 0.0f);

   currentRotationAngle = 0.0f;
}


void CCamera::SetCamera(float x, float y, float z,
                        float xv, float yv, float zv,
                        float xu, float yu, float zu)
{
   // Here we set the camera to the values sent in to us.  This is mostly used to set up a
   // default position.
   mPos = CVector4(x, y, z);
   mView = CVector4(xv, yv, zv);
   mUp = CVector4(xu, yu, zu);
}

void CCamera::GetDirection(CVector4 &Direction)
{
   // The look direction is the view (where we are looking) minus the position (where we are).
   Direction = mView - mPos;
}


void CCamera::MoveCamera(float speed)
{
   // Moving the camera requires a little more then adding 1 to the z or subracting 1.
   // First we need to get the direction at which we are looking.
   CVector4 Direction;

   // Get the direction and store it in the object Direction.
   GetDirection(Direction);

   Direction.Normal();

   // Call UpdateCamera to move our camera in the direction we want.
   UpdateCamera(Direction, speed);

   // NOTE if the camera moves too slow try increasing the UP and DOWN values in the header.
   // The camera is frame based so it will move differently for you.
}


void CCamera::UpdateCamera(CVector4 Direction, float speed)
{
   // Move the camera on the X and Z axis.
	mPos.x += Direction.x * speed;
   mPos.y += Direction.y * speed;
	mPos.z += Direction.z * speed;

   // Move the view along with the position
	mView.x += Direction.x * speed;
   mView.y += Direction.y * speed;
	mView.z += Direction.z * speed;
}


void CCamera::StrafeCam(float speed)
{
   CalculateStrafe();                           // Calculate the straft direction.
   UpdateCamera(mStrafe, speed);                // Then add it to the camera's position.
}


void CCamera::CalculateStrafe()
{
   CVector4 Direction;
   CVector4 Cross;
   float magnitude = 0.0;

   // Strafing is just like moving the camera forward and backward.  First we will get the
   // direction we are looking.
   GetDirection(Direction);

   // Now if we were to call UpdateCamera() we will be moving the camera foward or backwards.
   // We don't want that here.  We want to strafe.  To do so we have to get the cross product
   // of our direction and Up direction view.  The up was set in SetCamera to be 1 positive
   // y.  That is because anything positive on the y is considered up.  After we get the
   // cross product we can save it to the strafe variables so that can be added to the
   // camera using UpdateCamera().

   // Get the cross product of the direction we are looking and the up direction.
   Cross.CrossProduct(Direction, mUp);

   // Normalize it.
   Cross.Normal();

   // Save our strafe (cross product) values in the mStrafe object.
   mStrafe = Cross;
}


void CCamera::RotateCamera(float AngleDir, CVector4 Speed)
{
   CVector4 newDir;
   CVector4 LookDirection;
   float CosineAngle, SineAngle = 0.0;

   // First we will need to calculate the cos and sine of our angle.  I created two macros to
   // do this in the CCamera.h header file called GET_COS and GET_SINE.  To use the macros
   // we just send in the variable we ant to store the results and the angle we need to
   // calculate.
	GET_COS(CosineAngle, AngleDir);
   GET_SINE(SineAngle, AngleDir);

	// Next get the look direction (where we are looking) just like in the move camera function.
   GetDirection(LookDirection);

	// Calculate the new X position.
	newDir.x = (CosineAngle + (1 - CosineAngle) * Speed.x) * LookDirection.x;
	newDir.x += ((1 - CosineAngle) * Speed.x * Speed.y - Speed.z * SineAngle)* LookDirection.y;
	newDir.x += ((1 - CosineAngle) * Speed.x * Speed.z + Speed.y * SineAngle) * LookDirection.z;

	// Calculate the new Y position.
	newDir.y = ((1 - CosineAngle) * Speed.x * Speed.y + Speed.z * SineAngle) * LookDirection.x;
	newDir.y += (CosineAngle + (1 - CosineAngle) * Speed.y) * LookDirection.y;
	newDir.y += ((1 - CosineAngle) * Speed.y * Speed.z - Speed.x * SineAngle) * LookDirection.z;

	// Calculate the new Z position.
	newDir.z = ((1 - CosineAngle) * Speed.x * Speed.z - Speed.y * SineAngle) * LookDirection.x;
	newDir.z += ((1 - CosineAngle) * Speed.y * Speed.z + Speed.x * SineAngle) * LookDirection.y;
	newDir.z += (CosineAngle + (1 - CosineAngle) * Speed.z) * LookDirection.z;


	// Last we add the new rotations to the old view to correctly rotate the camera.
   mView = mPos + newDir;
}


void CCamera::RotateByMouse(int mousePosX, int mousePosY, int midX, int midY)
{
	float yDirection = 0.0f;         // Direction angle.
	float yRotation = 0.0f;          // Rotation angle.

	// If the mouseX and mouseY are at the middle of the screen then we can't rotate the view.
	if((mousePosX == midX) && (mousePosY == midY))
      return;

	// Next we get the direction of each axis.  We divide by 1000 to get a smaller value back.
	yDirection = (float)((midX - mousePosX)) / 1000.0f;		
	yRotation = (float)((midY - mousePosY)) / 1000.0f;		

	// We use curentRotX to help use keep the camera from rotating too far in either direction.
	currentRotationAngle -= yRotation;  

	// Stop the camera from going to high...
	if(currentRotationAngle > 1.5f)
      {
		   currentRotationAngle = 1.5f;
         return;
      }

	// Stop the camera from going to low...
	if(currentRotationAngle < -1.5f)
		{
         currentRotationAngle = -1.5f;
         return;
      }

   // Next we get the axis which is a perpendicular vector of the view direction and up values.
   // We use the cross product of that to get the axis then we normalize it.
   CVector4 Axis;
   Axis.CrossProduct(mView - mPos, mUp);
   Axis.Normal();

   // Rotate the camera.
   RotateCamera(yRotation, CVector4(Axis.x, Axis.y, Axis.z));
   RotateCamera(-yDirection, CVector4(0, 1, 0));
}


// Copyright May 2003
// All Rights Reserved!
// Allen Sherrod
// ProgrammingAce@UltimateGameProgramming.com
// www.UltimateGameProgramming.com

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美福利视频一区| 一区二区三区中文字幕精品精品| 久久日韩粉嫩一区二区三区| 国产精品嫩草99a| 日日夜夜免费精品视频| youjizz久久| 26uuu久久综合| 日韩专区中文字幕一区二区| 91香蕉视频黄| 国产农村妇女精品| 国产专区综合网| 91精品蜜臀在线一区尤物| 亚洲日本va在线观看| 成人免费高清在线观看| 精品免费国产一区二区三区四区| 亚洲综合色自拍一区| 成人a免费在线看| 2020国产精品自拍| 日本伊人午夜精品| 欧美裸体bbwbbwbbw| 亚洲一区免费观看| 一本色道综合亚洲| 中文字幕视频一区二区三区久| 激情五月激情综合网| 欧美一区二区国产| 日韩av不卡在线观看| 欧美三级日韩在线| 亚洲h在线观看| 3d动漫精品啪啪| 秋霞av亚洲一区二区三| 日韩欧美国产一区在线观看| 日本亚洲最大的色成网站www| 欧美喷潮久久久xxxxx| 亚洲成人你懂的| 7777女厕盗摄久久久| 婷婷丁香激情综合| 日韩欧美中文一区二区| 久久成人麻豆午夜电影| 欧美v国产在线一区二区三区| 秋霞成人午夜伦在线观看| 欧美一区二区三区在线电影| 另类人妖一区二区av| 久久毛片高清国产| 国产成人丝袜美腿| 中文字幕综合网| 欧美日韩精品一区二区三区四区| 午夜精品久久久久影视| 3d动漫精品啪啪1区2区免费| 久久99精品网久久| 国产欧美日韩精品一区| 91视频xxxx| 日韩中文字幕不卡| 国产日韩欧美电影| 一本色道a无线码一区v| 一区二区三区欧美| 在线综合视频播放| 国产精品乡下勾搭老头1| 国产精品久久久久久久久免费相片| 91在线国产福利| 天堂va蜜桃一区二区三区漫画版| 精品国精品国产| 97久久久精品综合88久久| 亚洲成av人影院| 国产亚洲精品超碰| 色婷婷久久久亚洲一区二区三区| 日韩国产精品久久久久久亚洲| 久久综合色鬼综合色| 一本大道久久a久久精品综合| 日韩和的一区二区| 国产精品视频线看| 欧美一区2区视频在线观看| 国产麻豆欧美日韩一区| 一区二区三区中文在线| 久久亚洲精华国产精华液| 久久综合久色欧美综合狠狠| 欧洲一区二区av| 国产一区二区三区最好精华液| 一区二区视频在线| 精品国产一区二区三区av性色| 色婷婷综合在线| 国产一区二区h| 亚洲1区2区3区4区| 国产精品国产精品国产专区不蜜| 欧美一区二区三区影视| 91网上在线视频| 国产揄拍国内精品对白| 夜夜操天天操亚洲| 国产精品麻豆久久久| www欧美成人18+| 欧美精品日韩一区| 91在线精品秘密一区二区| 国产综合色产在线精品| 五月天亚洲精品| 亚洲精品免费在线| 国产欧美视频在线观看| 精品国产一区久久| 日韩一区二区三区三四区视频在线观看 | 日本高清不卡视频| 国产高清不卡二三区| 久久99精品久久久久久国产越南 | 丝袜诱惑亚洲看片| 亚洲综合成人网| 亚洲欧美日韩人成在线播放| 久久久精品国产免大香伊| 日韩三级免费观看| 91精品国模一区二区三区| 欧美日韩国产综合久久| 在线国产电影不卡| 久久国产成人午夜av影院| 青青青伊人色综合久久| 色婷婷狠狠综合| 日韩欧美的一区二区| 国产精品一二三区在线| 美女网站色91| 激情久久五月天| 韩日精品视频一区| 国产精品影视在线| 成人福利视频网站| 91香蕉视频mp4| 欧美午夜片在线观看| 欧美日韩一级片网站| 88在线观看91蜜桃国自产| 日韩欧美第一区| 国产视频不卡一区| 亚洲视频一二区| 一区二区激情视频| 亚洲国产精品久久一线不卡| 亚洲国产精品久久人人爱| 亚洲成在线观看| 蜜臀av性久久久久蜜臀aⅴ流畅 | 国产精品灌醉下药二区| 国产精品高清亚洲| 污片在线观看一区二区| 日本不卡视频在线| 国产成a人亚洲精品| 97精品国产露脸对白| 欧美日韩一区二区在线观看视频| 在线不卡欧美精品一区二区三区| 日韩精品一区二区三区在线观看 | 午夜精品久久久久久久| 日韩av成人高清| 激情国产一区二区| 国产999精品久久久久久绿帽| 91影院在线免费观看| 欧美麻豆精品久久久久久| 精品国产污污免费网站入口| 1024成人网| 日韩精品一级中文字幕精品视频免费观看 | 欧美三级电影网| 日韩欧美区一区二| 国产精品传媒入口麻豆| 日本vs亚洲vs韩国一区三区| 国产成人综合网| 欧美中文字幕亚洲一区二区va在线| 日韩一区二区在线看片| 国产精品电影一区二区三区| 日韩在线播放一区二区| 成人av电影在线| 日韩视频免费观看高清完整版| 国产精品久线在线观看| 免费成人av在线播放| 99久久免费国产| 精品久久久久久无| 亚洲成人在线免费| 成人avav在线| 精品福利在线导航| 亚洲香蕉伊在人在线观| 粉嫩av一区二区三区在线播放 | 日本黄色一区二区| 日韩国产高清在线| 99久久伊人精品| 久久久久久久久免费| 无吗不卡中文字幕| 色综合咪咪久久| 国产精品美女久久久久久| 毛片av一区二区三区| 欧美午夜宅男影院| 中文字幕一区二区三区不卡在线| 美女精品自拍一二三四| 欧美优质美女网站| 综合欧美亚洲日本| 粉嫩在线一区二区三区视频| 日韩美女主播在线视频一区二区三区| 一区二区三区在线免费| 成人综合婷婷国产精品久久 | 亚洲国产高清不卡| 国产很黄免费观看久久| 精品欧美黑人一区二区三区| 日本不卡视频在线观看| 欧美一区三区二区| 日韩福利视频导航| 91麻豆精品国产91久久久| 午夜精品久久一牛影视| 欧美日韩在线三级| 亚洲综合成人在线视频| 日本道色综合久久| 亚洲一区欧美一区| 欧美日韩国产一区| 性久久久久久久久久久久| 欧美日韩在线播放一区|