|
1 /* |
|
2 * Copyright (c) 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 C_ALFMESH_H |
|
21 #define C_ALFMESH_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <alf/alfmaterial.h> |
|
25 |
|
26 class CAlfGenComponent; |
|
27 class TAlfImage; |
|
28 |
|
29 /** |
|
30 * Mesh types. |
|
31 * These types identify concrete mesh - derived object types. |
|
32 */ |
|
33 enum TAlfMeshType |
|
34 { |
|
35 /** Procedural mesh. @see CAlfProceduralMesh */ |
|
36 EAlfMeshTypeProcedural, |
|
37 |
|
38 /** M3G mesh. @see CAlfM3GMesh */ |
|
39 EAlfMeshTypeM3G |
|
40 }; |
|
41 |
|
42 |
|
43 /** |
|
44 * Mesh class. |
|
45 * Base class for M3G and Procedural Mesh |
|
46 * |
|
47 * Usage: |
|
48 * @code |
|
49 * //Create procedural Mesh |
|
50 * meshVisual->CreateMeshL( EAlfMeshTypeProcedural ); |
|
51 * CAlfProceduralMesh* mesh = meshVisual->ProceduralMesh(); |
|
52 * |
|
53 * //Make it a cube |
|
54 * mesh->MakeCubeL( 30000, 20000, 25000, 3000 ); |
|
55 * |
|
56 * //Stretch Mesh |
|
57 * mesh->StretchUniformly( xLimit, xOffset, yLimit, yOffset, zLimit, zOffset ); |
|
58 * |
|
59 * @endcode |
|
60 * |
|
61 * @see CAlfMeshVisual::CreateMeshL() |
|
62 * @see CAlfProceduralMesh |
|
63 * @see CAlfM3GMesh |
|
64 * |
|
65 * @lib alfclient.lib |
|
66 * @since S60 v3.2 |
|
67 */ |
|
68 NONSHARABLE_CLASS( CAlfMesh ): public CBase |
|
69 { |
|
70 |
|
71 public: |
|
72 |
|
73 static CAlfMesh* NewL( CAlfGenComponent& aComms ); |
|
74 |
|
75 ~CAlfMesh(); |
|
76 |
|
77 /** |
|
78 * Determines the concrete mesh type this CAlfMesh instance implements. |
|
79 * |
|
80 * @return TAlfMeshType The mesh type implemented by this object, |
|
81 * possible values are e.g EAlfMeshTypeProcedural and EAlfMeshTypeM3G, but |
|
82 * in the future also other types may be supported. |
|
83 */ |
|
84 IMPORT_C TInt MeshType() const; |
|
85 |
|
86 /** |
|
87 * Resets the mesh. All contents are destroyed. |
|
88 */ |
|
89 IMPORT_C void Reset(); |
|
90 |
|
91 /** |
|
92 * Stretch the mesh uniformly along the X, Y, and Z axes. Negative side |
|
93 * of each axis is offseted negatively. Positive side of each side is |
|
94 * offseted positively. Normals are not affected. |
|
95 * |
|
96 * @param aXLimit |
|
97 * @param aXOffset |
|
98 * @param aYLimit |
|
99 * @param aYOffset |
|
100 * @param aZLimit |
|
101 * @param aZOffset |
|
102 */ |
|
103 IMPORT_C void StretchUniformly( |
|
104 TReal32 aXLimit, |
|
105 TReal32 aXOffset, |
|
106 TReal32 aYLimit, |
|
107 TReal32 aYOffset, |
|
108 TReal32 aZLimit, |
|
109 TReal32 aZOffset) __SOFTFP; |
|
110 |
|
111 /** |
|
112 * Scale the mesh uniformly along each axis. Normals are also scaled and |
|
113 * renormalized. |
|
114 * |
|
115 * @param aX X scaling factor. |
|
116 * @param aY Y scaling factor. |
|
117 * @param aZ Z scaling factor. |
|
118 */ |
|
119 IMPORT_C void ScaleUniformly(TReal32 aX, TReal32 aY, TReal32 aZ) __SOFTFP; |
|
120 |
|
121 /** |
|
122 * Returns number of ALF animation controllers |
|
123 */ |
|
124 IMPORT_C virtual TInt AnimationControllerCount() const; |
|
125 |
|
126 /** |
|
127 * Set position of animation in animation controller. |
|
128 * |
|
129 * @param aControllerId ID of the controller. |
|
130 * @param aTarget Target position in the timeline (seconds) |
|
131 * @param aTime Time to be used in animation |
|
132 */ |
|
133 IMPORT_C virtual void SetAnimationPosition(TInt aControllerId, TReal32 aTarget, TInt aTime) __SOFTFP; |
|
134 |
|
135 /** |
|
136 * Start animation of the controller |
|
137 * |
|
138 * @param aControllerId ID of the animation controller. |
|
139 */ |
|
140 IMPORT_C virtual void StartAnimationController(TInt aControllerId); |
|
141 |
|
142 /** |
|
143 * Stop animation of the controller |
|
144 * |
|
145 * @param aControllerId ID of the animation controller. |
|
146 */ |
|
147 IMPORT_C virtual void StopAnimationController(TInt aControllerId); |
|
148 |
|
149 |
|
150 protected: |
|
151 |
|
152 CAlfMesh(); |
|
153 |
|
154 /** |
|
155 * The second phase constructor. CAlfMesh - derived objects |
|
156 * have to pass the mesh type they represent in a call to |
|
157 * this method. |
|
158 */ |
|
159 void ConstructL( CAlfGenComponent& aComms, TInt aMeshType = EAlfMeshTypeProcedural ); |
|
160 |
|
161 private: |
|
162 |
|
163 void StretchUniformlyL( |
|
164 TReal32 aXLimit, |
|
165 TReal32 aXOffset, |
|
166 TReal32 aYLimit, |
|
167 TReal32 aYOffset, |
|
168 TReal32 aZLimit, |
|
169 TReal32 aZOffset); |
|
170 |
|
171 void ScaleUniformlyL(TReal32 aX, TReal32 aY, TReal32 aZ); |
|
172 |
|
173 virtual TInt DoAnimationControllerCount() const; |
|
174 |
|
175 virtual void SetAnimationPositionL(TInt aControllerId, TReal32 aTarget, TInt aTime); |
|
176 |
|
177 virtual void StartAnimationControllerL(TInt aControllerId); |
|
178 |
|
179 virtual void StopAnimationControllerL(TInt aControllerId); |
|
180 |
|
181 |
|
182 private: // data |
|
183 |
|
184 struct TMeshPrivateData; |
|
185 TMeshPrivateData* iData; |
|
186 |
|
187 }; |
|
188 |
|
189 |
|
190 #endif // C_ALFMESH_H |