Update contrib.
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #include "geometrystructs.h"
30 The model class contains one or more shapes and some knowledge of how to
31 arrange and light them to create a scene. It knows how to do two things:
32 - change the resolution of the shapes in the scene, which involves
33 recalculating their vertices.
34 - draw the scene to a buffer by drawing, arranging and lighting the shapes
35 using Open GL ES commands.
37 It understands that these two operations may be happening in different
38 threads, so it serialises access to the model data (the vertices) with a mutex.
41 class CModel : public CBase
44 static CModel* NewL(EGLDisplay aDisplay, EGLSurface aSurface, TPtrC aBackgroundColor);
45 static CModel* NewL(EGLDisplay aDisplay, EGLSurface aSurface);
47 void PrecalculateOrbitL(TInt aOrbitingDistance, RArray<Vertex3F>& aVertices, TInt aPositionCount, TReal aAngle);
48 void SetResolutionL(TInt aResolution);
49 void DrawToBuffer(TInt aTime) const;
51 enum {ERed = 0, EGreen, EBlue, EAlpha};
54 CModel(EGLDisplay aDisplay, EGLSurface aSurface);
55 void ConstructL(TPtrC aBackgroundColor);
56 void SetShapes(CSolidSphere* aSun, CSolidSphere* aPlanet, CSolidSphere* aSatellite);
57 void InitialiseFrame() const;
58 void DrawModelData(TInt aTime) const;
65 CSolidSphere* iPlanet;
68 RArray<Vertex3F> iSunPositions;
69 RArray<Vertex3F> iMoonPositions;
70 GLclampf iBackgroundColor[4];