|
1 /* |
|
2 * Copyright (c) 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: Procedural mesh definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_ALFPROCEDURALMESH_H |
|
21 #define C_ALFPROCEDURALMESH_H |
|
22 |
|
23 #include <alf/alfmesh.h> |
|
24 |
|
25 /** |
|
26 * Procedural mesh support. |
|
27 * |
|
28 * This is a CAlfMesh - derived mesh implementation that provides support |
|
29 * for procedural meshes. There are collection of shapes that can be procedurally |
|
30 * constructed using this object. This mesh can be used through CAlfMeshVisual |
|
31 * and created with CAlfMeshVisual::CreateMeshL() method with argument EAlfMeshTypeProcedural. |
|
32 * Usage: |
|
33 * @code |
|
34 * //Create Procedural Mesh and get it from Mesh Visual |
|
35 * meshVisual->CreateMeshL( EAlfMeshTypeProcedural ); |
|
36 * CAlfProceduralMesh* mesh = meshVisual->ProceduralMesh(); |
|
37 * |
|
38 * //Make a cube |
|
39 * int sizeX = 30000; |
|
40 * int sizeY = 20000; |
|
41 * int sizeZ = 25000; |
|
42 * int edgeRadius = 3000; |
|
43 * mesh->MakeCubeL( sizeX, sizeY, sizeZ, edgeRadius ); |
|
44 * |
|
45 * //Make a sphere |
|
46 * int radius = 15000; |
|
47 * int columns = 20; |
|
48 * int rows = 20; |
|
49 * mesh->MakeSphereL( radius, columns, rows ); |
|
50 * |
|
51 * //Make a Torus |
|
52 * int mainRadius = 15000; |
|
53 * int outerRadius = 2000; |
|
54 * int mainSegments = 20; |
|
55 * int outerSegments = 20; |
|
56 * float segmentAngleOffset = 0.0; |
|
57 * mesh->MakeTorusL( mainRadius, outerRadius, mainSegments, outerSegments, segmentAngleOffset ); |
|
58 * |
|
59 * //Material setting |
|
60 * TAlfMaterial material; |
|
61 * material.iColor = Color( 128 ); |
|
62 * material.iPreset = EAlfMaterialShadow; |
|
63 * const float KValueNow = 0.2; |
|
64 * const float KTargetValue = 0.5; |
|
65 * TAlfTimedValue tv( KValueNow ); |
|
66 * tv.SetTarget( KTargetValue, 500 ); |
|
67 * material.iSpecular = tv; |
|
68 * mesh->SetMaterial( material ); |
|
69 * |
|
70 * //Set glass preset with speculer image set. |
|
71 * material.iSpecularImage = TAlfImage(); |
|
72 * material.iPreset = EAlfMaterialGlass; |
|
73 * mesh->SetMaterial(material); |
|
74 * |
|
75 * @endcode |
|
76 * @see TAlfMaterial |
|
77 * @lib alfclient.lib |
|
78 * @since S60 v3.2 |
|
79 */ |
|
80 NONSHARABLE_CLASS( CAlfProceduralMesh ): public CAlfMesh |
|
81 { |
|
82 |
|
83 public: |
|
84 |
|
85 /** |
|
86 * Constructs a new CAlfProceduralMesh instance. |
|
87 */ |
|
88 static CAlfProceduralMesh* NewL( CAlfGenComponent& aComms ); |
|
89 |
|
90 /** |
|
91 * Destructor |
|
92 */ |
|
93 ~CAlfProceduralMesh(); |
|
94 |
|
95 /** |
|
96 * Creates a cube mesh. |
|
97 * @todo move. |
|
98 * @param aSizeX |
|
99 * @param aSizeY |
|
100 * @param aSizeZ |
|
101 * @param aEdgeRadius |
|
102 */ |
|
103 IMPORT_C void MakeCubeL( |
|
104 TReal32 aSizeX, |
|
105 TReal32 aSizeY, |
|
106 TReal32 aSizeZ, |
|
107 TReal32 aEdgeRadius) __SOFTFP; |
|
108 |
|
109 /** |
|
110 * Creates a sphere mesh. |
|
111 * @todo move |
|
112 * @param aRadius |
|
113 * @param aColumns |
|
114 * @param aRows |
|
115 */ |
|
116 IMPORT_C void MakeSphereL( |
|
117 TReal32 aRadius, |
|
118 TInt aColumns, |
|
119 TInt aRows) __SOFTFP; |
|
120 |
|
121 /** |
|
122 * Creates a torus mesh. |
|
123 * @todo move |
|
124 * @param aMainRadius |
|
125 * @param aOuterRadius |
|
126 * @param aMainSegments |
|
127 * @param aOuterSegments |
|
128 * @param aSegmentAngleOffset |
|
129 */ |
|
130 IMPORT_C void MakeTorusL( |
|
131 TReal32 aMainRadius, |
|
132 TReal32 aOuterRadius, |
|
133 TInt aMainSegments, |
|
134 TInt aOuterSegments, |
|
135 TReal32 aSegmentAngleOffset = 0) __SOFTFP; |
|
136 |
|
137 /** |
|
138 * Returns the material definition used by this procedural mesh. |
|
139 * |
|
140 * @return TAlfMaterial material definition. |
|
141 */ |
|
142 IMPORT_C const TAlfMaterial& Material() const; |
|
143 |
|
144 /** |
|
145 * Sets the material definition used by this procedural mesh. |
|
146 * |
|
147 * @param aMaterial Material definition to be applied to this mesh. |
|
148 */ |
|
149 IMPORT_C void SetMaterial( const TAlfMaterial& aMaterial ); |
|
150 |
|
151 /** |
|
152 * Sets the specular image of the mesh material. |
|
153 */ |
|
154 void SetSpecularImage(const TAlfImage& aImage); |
|
155 |
|
156 private: |
|
157 |
|
158 /** |
|
159 * Constructor |
|
160 */ |
|
161 CAlfProceduralMesh(); |
|
162 |
|
163 /** |
|
164 * Second phase constructor |
|
165 */ |
|
166 void ConstructL( CAlfGenComponent& aComms ); |
|
167 |
|
168 private: // data |
|
169 |
|
170 struct TProceduralMeshPrivateData; |
|
171 TProceduralMeshPrivateData* iData; |
|
172 |
|
173 }; |
|
174 |
|
175 |
|
176 #endif // C_ALFPROCEDURALMESH_H |