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

📄 c3dbase.h

📁 S60 3D游戏引擎开发案例 S60 3D游戏引擎开发案例
💻 H
字号:
   /*
============================================================================
    * Name : C3DBase.h
    * Part of : Example3D
    * Description : Definition of C3DBase
    * Copyright (c) 2007 Nokia Corporation
============================================================================
    */

#ifndef __C3DBASE_H__
#define __C3DBASE_H__


// INCLUDES
#include <e32base.h>
#include "3DTypes.h"
   

// CLASS DECLARATION

/**
*  Base class for all 3D code
*  Purpose for this class is to contain
*  Functions and data common to many classes
*  in the 3D-Engine
*/


class C3DBase 
	: public CBase
	{
	public:

		/// Two-phased constructor
		/// @param aScreenSize drawing bitmap size for frustum calculation
		static C3DBase* NewL( const TSize& aScreenSize );

		/// Destructor
		~C3DBase();

	private:

		/// Default costructor
		/// @param aScreenSize drawing bitmap size for frustum calculation
		C3DBase( const TSize& aScreenSize );
		
		/// Second phase constructor
		void ConstructL();

	public: // New methods

		/// Inits view frustum ( clipping size ) with given screen size
		/// @param aScreenSize drawing bitmap size for frustum calculation
		void InitFrustum( const TSize& aScreenSize );


		/// address of cosine table
		TInt16*		CosTable();

		/// address of sinus table
		TInt16*		SinTable();

		/// the view frustum
		TFrustum&	ViewFrustum();

		/// quick sort entries of aZ with indexes aN
		/// between index aLow..aHigh
		void QSort( TInt* aZ, TInt* aN, TInt aLow, TInt aHigh );

		/// Basic 3D rotate functions
		/// These aren't really used by this engine
		/// but they are useful for game creators
		/// like rotating wheel positions with car angle
		TVertex RotateX( const TVertex& aVertex, TInt aAngle );
		TVertex RotateY( const TVertex& aVertex, TInt aAngle );
		TVertex RotateZ( const TVertex& aVertex, TInt aAngle );
		
		/// Get current polygon count
		TInt PolygonCount();
		
		/// Set polygon count to zero
		void ResetPolygonCount();
		
		/// Add aCount to polygon count
		void AddPolygonCount( TInt aCount );
		

	private: // Data

		TFrustum	iViewFrustum;
		TInt16*		iCos;
		TInt16*		iSin;

		TUint16*	iScreenAddress;
		TSize		iScreenSize;
		
		TInt		iPolygonCount;
	};


#endif

⌨️ 快捷键说明

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