|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /* |
|
17 Function to calculate sine and cosine values for points of a circle |
|
18 composed of n segments. |
|
19 The function is taken from freeglut_geometry.cpp, which is distributed |
|
20 under the following terms: |
|
21 * |
|
22 * ****************************************************************** |
|
23 * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. |
|
24 * Written by Pawel W. Olszta, <olszta@sourceforge.net> |
|
25 * Creation date: Fri Dec 3 1999 |
|
26 * |
|
27 * Permission is hereby granted, free of charge, to any person obtaining a |
|
28 * copy of this software and associated documentation files (the "Software"), |
|
29 * to deal in the Software without restriction, including without limitation |
|
30 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
31 * and/or sell copies of the Software, and to permit persons to whom the |
|
32 * Software is furnished to do so, subject to the following conditions: |
|
33 * |
|
34 * The above copyright notice and this permission notice shall be included |
|
35 * in all copies or substantial portions of the Software. |
|
36 * ******************************************************************** |
|
37 * |
|
38 */ |
|
39 |
|
40 |
|
41 #ifndef GEOMETRYSTRUCTS_H_ |
|
42 #define GEOMETRYSTRUCTS_H_ |
|
43 |
|
44 |
|
45 #include <e32base.h> |
|
46 |
|
47 |
|
48 float sin(float x); |
|
49 float cos(float x); |
|
50 |
|
51 struct Vertex3F |
|
52 { |
|
53 Vertex3F(float x, float y, float z); |
|
54 Vertex3F(); |
|
55 float iX; |
|
56 float iY; |
|
57 float iZ; |
|
58 }; |
|
59 |
|
60 int fghCircleTable(float **sint,float **cost,const int n); |
|
61 |
|
62 |
|
63 class CSolidSphere : public CBase |
|
64 { |
|
65 public: |
|
66 static CSolidSphere* NewLC(TReal aRadius, TInt aSlices, TInt aStacks); |
|
67 ~CSolidSphere(); |
|
68 void Draw() const; |
|
69 |
|
70 private: |
|
71 CSolidSphere(TInt aSlices, TInt aStacks); |
|
72 void ConstructL(TReal aRadius); |
|
73 |
|
74 private: |
|
75 TInt iSlices; |
|
76 TInt iStacks; |
|
77 Vertex3F* iTopVertices; |
|
78 Vertex3F* iTopNormals; |
|
79 Vertex3F* iBottomVertices; |
|
80 Vertex3F* iBottomNormals; |
|
81 Vertex3F* iStackVertices; |
|
82 Vertex3F* iStackNormals; |
|
83 }; |
|
84 |
|
85 |
|
86 #endif /* GEOMETRYSTRUCTS_H_ */ |