📄 c3drenderer.h
字号:
/*
*
============================================================================
* Name : CGame.h
* Part of : Example3D
* Created : 12/14/2003 by Forum Nokia
* Description:
* This is the project specification file for Example3D.
* Initial content was generated by Series 60 AppWizard.
*
* Version : 1.0.0
* Copyright: Forum Nokia
*
============================================================================
*/
#ifndef __C3DRENDERER__H__
#define __C3DRENDERER__H__
// INCLUDES
#include <e32base.h>
#include "C3DBase.h"
#include "TBitmap.h"
// FORWARD DECLARATIONS
class M3dObject;
// CLASS DECLARATION
/**
* C3DRenderer contains a list of M3DObject objects
* This class selects which objects to draw, where and in which order
* Every object to draw has to be added here with AddObject
* Every object position and angle change should be done via this class
*/
class C3DRenderer : public CBase
{
public:
/// Two-phased constructor
/// @param a3DBase pointer to C3DBase class
/// @param aMaxObjects maximum number of objects to add
static C3DRenderer* NewL( C3DBase* a3DBase, TInt aMaxObjects );
/// Destructor
~C3DRenderer();
private:
/// Second-phase constructor
void ConstructL();
/// Default constructor
C3DRenderer( C3DBase* a3DBase, TInt aMaxObjects );
public: // New methods
/// Add a M3DObject to drawlist
/// @param aObject object to add to drawlist
/// return added object's index
TInt AddObject( M3dObject* aObject );
/// Remove a M3DObject from drawlist
/// @param aIndex index from to remove
void RemoveObject( TInt aIndex );
/// Set object's position in 3D-space
/// @param aIndex object's index
/// @param aPosition new position for object
void SetObjectPosition( TInt aIndex, const TVertex& aPosition );
/// Set object's angle in 3D-space
/// @param aIndex object's index
/// @param aAngle object's new angle
void SetObjectAngle( TInt aIndex, const TVertex& aAngle );
/// Set object's "priority" in 3D-space
/// if you want some object to stay back
/// put here very big numbers
/// @param aIndex object's index
/// @param aPriority new priority for object
void SetObjectPriority( TInt aIndex, TInt aPriority );
/// Set camera's place in 3D-space
/// @param aPosition new position for camera
void SetCameraPosition( const TVertex& aPosition );
/// Set camera's angle in 3D-space
/// @param aAngle new angle for camera
void SetCameraAngle( const TVertex& aAngle );
/// Draw everything in drawlist
/// @param aScreen bitmap to draw everything
void Draw( const TBitmap& aScreen );
private: // Data
C3DBase* i3DBase;
TInt iMaxObjects; // maximum number of objects in drawlist
M3dObject** iObject; // the drawlist
TVertex* iObjectPosition; // list of object positions
TMatrix* iObjectMatrix; // list of object rotate matrices
TMatrix* iObjectRotMatrix; // list of object rotate matrices turned by camera
TInt* iObjectPriority; // list of object priorities
TInt* iObjectZ; // list of object distances from view plane
TInt* iObjectN; // object sort order
TVertex iCameraPosition; // camera position in 3D-space
TVertex iCameraAngle; // camera angle in 3D-space
TInt16* iCos; // pointer to cosine table
TInt16* iSin; // pointer to sinus table
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -