⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 camera.h

📁 手机 GAME c++ 版
💻 H
字号:
////////////////////////////////////////////////////////////////////////
//
// Camera.h
//
// Copyright (c) 2003 Nokia Phones Ltd  All rights reserved.
//
////////////////////////////////////////////////////////////////////////

#ifndef _CAMERA_H
#define _CAMERA_H

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

#include "Geometry3D.h"

////////////////////////////////////////////////////////////////////////

class TClipFace;

////////////////////////////////////////////////////////////////////////

class TCamera
	{
	public:

		void SetFieldOfView(const TReal &aAngle,const TReal &aPixelSize);
		void SetBounds
			(
			TInt aLeftX, 
			TInt aTopY, 
			TInt aRightX, 
			TInt aBottomY, 
			TInt aCenterX, 
			TInt aCenterY
			);

		void SetAffine(TAffineTransform &aAffine);

		void TransformVerts
			(
			TInt aNumVerts, 
			const TVector3 * aSrcVertPtr, 
			TAffineTransform &aAffine, 
			TScreenVertex * aDestVertPtr, 
			TVector3 &aCameraInModelSpace 
			);

		TInt PerspectiveTransform(TInt &aInput, TInt &aDepth);

		void ClipAndRender
			( 
			TClipFace &aFaceA, 
			TClipFace &aFaceB, 
			TMathLookup &aMath, 
			TScanConverter &aScanConverter 
			);

		void PrepareForScreen(TScreenVertex &aVertex, TInt aBoundIndex);

	private:

		enum
		{
			depthTableSize	= 1024,
			//
			ratioUnityLog	= 14,
			ratioUnity		= ( 1 << ratioUnityLog ),
			//
			// resultUnityLog == number of fractional bits to be left in result (screen) coords:
			//
			resultUnityLog	= Geometry3D::screenCoordUnityLog,
			resultDownshift	= ( ratioUnityLog - resultUnityLog ),
			//
			// maxInput == largest input for which perspective calculation 
			// is guaranteed not to overflow:
			//
			maxTInt16		= 0x7fff,
			maxInput		= maxTInt16,
			maxRatio		= maxTInt16,
		};

		TInt				iMinDepth;
		TInt16				iDepthRatio[depthTableSize];

		TAffineTransform	iAffine;

		TInt				iCenterX;
		TInt				iCenterY;

		TInt				iScreenDepth;

		TPlane				iClipPlane[Geometry3D::numBounds];

		TInt				iLeftX;
		TInt				iRightX;
		TInt				iTopY;
		TInt				iBottomY;
	};

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

#endif

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -