|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUIPROCEDURALMESH_H__ |
|
21 #define __HUIPROCEDURALMESH_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <gdi.h> |
|
26 |
|
27 #include <uiacceltk/HuiImage.h> |
|
28 #include <uiacceltk/HuiTimedValue.h> |
|
29 #include <uiacceltk/HuiMaterial.h> |
|
30 #include <uiacceltk/HuiSessionObject.h> |
|
31 #include <uiacceltk/HuiMesh.h> |
|
32 |
|
33 |
|
34 /* Forward declarations. */ |
|
35 class CHuiGc; |
|
36 |
|
37 |
|
38 /** |
|
39 * CHuiProceduralMesh is the base class for renderer-specific implementations |
|
40 * of 3D triangle meshes. It also defines the public interface that |
|
41 * applications can use to manipulate meshes. It is possible to instantiate |
|
42 * CHuiProceduralMesh itself, but the resulting mesh instance will have no |
|
43 * functionality. |
|
44 */ |
|
45 class CHuiProceduralMesh : public CHuiMesh |
|
46 { |
|
47 public: |
|
48 |
|
49 /* Constructors and destructors. */ |
|
50 |
|
51 /** |
|
52 * Default constructor. |
|
53 */ |
|
54 IMPORT_C CHuiProceduralMesh(); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 IMPORT_C ~CHuiProceduralMesh(); |
|
60 |
|
61 |
|
62 /* Methods. */ |
|
63 |
|
64 /** |
|
65 * Resets the mesh. All contents are destroyed. |
|
66 */ |
|
67 IMPORT_C virtual void Reset(); |
|
68 |
|
69 /** |
|
70 * Creates a cube mesh. |
|
71 * |
|
72 * @param aSizeX |
|
73 * @param aSizeY |
|
74 * @param aSizeZ |
|
75 * @param aEdgeRadius |
|
76 */ |
|
77 IMPORT_C virtual void MakeCubeL(TReal32 aSizeX, TReal32 aSizeY, TReal32 aSizeZ, |
|
78 TReal32 aEdgeRadius) __SOFTFP; |
|
79 |
|
80 /** |
|
81 * Creates a sphere mesh. |
|
82 * |
|
83 * @param aRadius |
|
84 * @param aColumns |
|
85 * @param aRows |
|
86 */ |
|
87 IMPORT_C virtual void MakeSphereL(TReal32 aRadius, TInt aColumns, TInt aRows) __SOFTFP; |
|
88 |
|
89 /** |
|
90 * Creates a torus mesh. |
|
91 * |
|
92 * @param aMainRadius |
|
93 * @param aOuterRadius |
|
94 * @param aMainSegments |
|
95 * @param aOuterSegments |
|
96 * @param aSegmentAngleOffset |
|
97 */ |
|
98 IMPORT_C virtual void MakeTorusL(TReal32 aMainRadius, TReal32 aOuterRadius, |
|
99 TInt aMainSegments, TInt aOuterSegments, |
|
100 TReal32 aSegmentAngleOffset = 0) __SOFTFP; |
|
101 |
|
102 /** |
|
103 * Stretch the mesh uniformly along the X, Y, and Z axes. Negative side |
|
104 * of each axis is offseted negatively. Positive side of each side is |
|
105 * offseted positively. Normals are not affected. |
|
106 * |
|
107 * @param aXLimit |
|
108 * @param aXOffset |
|
109 * @param aYLimit |
|
110 * @param aYOffset |
|
111 * @param aZLimit |
|
112 * @param aZOffset |
|
113 */ |
|
114 IMPORT_C virtual void StretchUniformly(TReal32 aXLimit, TReal32 aXOffset, |
|
115 TReal32 aYLimit, TReal32 aYOffset, |
|
116 TReal32 aZLimit, TReal32 aZOffset) __SOFTFP; |
|
117 |
|
118 /** |
|
119 * Scale the mesh uniformly along each axis. Normals are also scaled and |
|
120 * renormalized. |
|
121 * |
|
122 * @param aX X scaling factor. |
|
123 * @param aY Y scaling factor. |
|
124 * @param aZ Z scaling factor. |
|
125 */ |
|
126 IMPORT_C virtual void ScaleUniformly(TReal32 aX, TReal32 aY, TReal32 aZ) __SOFTFP; |
|
127 |
|
128 /** |
|
129 * Updates the surface material of the mesh. |
|
130 * Generate new texture coordinates based on the angles. |
|
131 * |
|
132 * @param aYaw Angle around object Y axis. |
|
133 * @param aPitch Angle around object X axis. |
|
134 */ |
|
135 IMPORT_C virtual void UpdateSurface(TReal32 aYaw, TReal32 aPitch) __SOFTFP; |
|
136 |
|
137 /** |
|
138 * Draw the mesh. |
|
139 */ |
|
140 IMPORT_C virtual void Draw(CHuiGc& aGc, const THuiImage* aImage = 0, |
|
141 const THuiImage* aSecondaryImage = 0, |
|
142 TReal32 aSecondaryAlpha = 0.0) const __SOFTFP; |
|
143 |
|
144 |
|
145 protected: // New methods |
|
146 |
|
147 /** |
|
148 * Provides expandability, helps keeping the binary compatibility. Since virtual |
|
149 * table is now exported and this class is dll derivable and the implementation |
|
150 * is more difficult to change, hence this method, which can provide additional |
|
151 * extension APIs. |
|
152 * |
|
153 * @param aExtensionUid UID, which is being used for recognizing the extension |
|
154 * @param aExtensionParams Return pointer to the extension API, once recognized from the extension uid |
|
155 */ |
|
156 IMPORT_C virtual void ProceduralMeshExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
157 |
|
158 |
|
159 public: |
|
160 |
|
161 /** Appearance properties. */ |
|
162 THuiMaterial iMaterial; |
|
163 |
|
164 private: |
|
165 |
|
166 /** Spare member to help keeping binary compatibility, since |
|
167 HuiProceduralMesh is now dll derivable **/ |
|
168 TInt iSpare; |
|
169 |
|
170 }; |
|
171 |
|
172 #endif // __HUIPROCEDURALMESH_H__ |