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

📄 simplecube.h

📁 这是在s60第五版上用Open GL开发的软件
💻 H
字号:
/*
* ==============================================================================
*  Name        : SimpleCube.h
*  Part of     : OpenGLEx / SimpleCube
*  Interface   : 
*  Description : 
*  Version     : 
*
*  Copyright (c) 2004-2006 Nokia Corporation.
*  This material, including documentation and any related 
*  computer programs, is protected by copyright controlled by 
*  Nokia Corporation.
* ==============================================================================
*/

#ifndef SIMPLECUBE_H
#define SIMPLECUBE_H

//  INCLUDES
#include <e32base.h> // for CBase definition
#include <GLES/gl.h> // OpenGL ES header file

/** Enumerated rendering mode for triangle and triangle fan based rendering. */
typedef enum { ETriangles, ETriangleFans } TRenderingMode;

#include "Direction.h"

class CSimpleCube;

// MACROS
#define FRUSTUM_LEFT   -1.f     //left vertical clipping plane
#define FRUSTUM_RIGHT   1.f     //right vertical clipping plane
#define FRUSTUM_BOTTOM -1.f     //bottom horizontal clipping plane
#define FRUSTUM_TOP     1.f     //top horizontal clipping plane
#define FRUSTUM_NEAR    3.f     //near depth clipping plane
#define FRUSTUM_FAR  1000.f     //far depth clipping plane

// CLASS DECLARATION

/**
 * Class that does the actual OpenGL ES rendering.
 */
class CSimpleCube : public CBase
    {
    public:  // Constructors and destructor
  
        /**
         * Factory method for creating a new CSimpleCube object.
         */
        static CSimpleCube* NewL( TUint aWidth, TUint aHeight);

        /**
         * Destructor. Does nothing.
         */
        virtual ~CSimpleCube();

    public: // New functions
        
        /**
         * Initializes OpenGL ES, sets the vertex and color
         * arrays and pointers. Also selects the shading mode.
         */
        void AppInit( void );
        
        /**
         * Called upon application exit. Does nothing.
         */
        void AppExit( void );
        
        /**
         * Draws a 3D box with triangles or triangle fans depending
         * on the current rendering mode.Scales the box to the given size using glScalef.
         * @param  aSizeX X-size of the box.
         * @param  aSizeY Y-size of the box.
         * @param  aSizeZ Z-size of the box.
         */
        void DrawBox( GLfloat aSizeX, GLfloat aSizeY, GLfloat aSizeZ );
        
        /**
         * Renders one frame.
         * @param aFrame Number of the frame to be rendered.
         */
        void AppCycle( TInt aFrame, TRotationDirection aDirection );
        
        /**
         * Sets the shading mode to flat.
         */
        void FlatShading( void );
        
        /**
         * Sets the shading to smooth (gradient).
         */
        void SmoothShading( void );
        
        /**
         * Sets the rendering to use triangles.
         */
        void TriangleMode( void );
        
        /**
         * Sets the rendering to use triangle fans.
         */
        void TriangleFanMode( void );
        
        /**
         * Notifies that the screen size has dynamically changed during execution of
         * this program. Resets the viewport to this new size.
         * @param aWidth New width of the screen.
         * @param aHeight New height of the screen.
         */
        void SetScreenSize( TUint aWidth, TUint aHeight );
        
    protected: // New functions
        
        /**
         * Standard constructor that must never Leave.
         * Stores the given screen width and height.
         * @param aWidth Width of the screen.
         * @param aHeight Height of the screen.
         */
        CSimpleCube( TUint aWidth, TUint aHeight);
        
        /**
         * Second phase contructor. Does nothing.
         */
        void ConstructL( void );
        
    private: // Data
        
        /** Width of the screen */
        TUint           iScreenWidth;
        
        /** Height of the screen */
        TUint           iScreenHeight;
        
        /** The current rendering mode */
        TRenderingMode  iDrawingMode;
        
        CSimpleCube* iCube;
    };
#endif // SIMPLECUBE_H

// End of File

⌨️ 快捷键说明

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