c3dbase.h

来自「一个基于symbian s60 3rd 的3D汽车游戏演示程序,模拟器上编译通过」· C头文件 代码 · 共 102 行

H
102
字号
   /*
============================================================================
    * 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 + =
减小字号Ctrl + -
显示快捷键?