00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef DRAW_REQUEST_H_
00026 #define DRAW_REQUEST_H_
00027
00028 #include <Core/Container/ArrayList.h>
00029
00030 namespace Lamp{
00031
00032 class Fog;
00033 class Camera;
00034 class SceneNode;
00035 class Model;
00036 class Mesh;
00037 class MeshData;
00038 class Material;
00039 class LocalLight;
00040 class AmbientLight;
00041 class DirectionalLight;
00042
00043
00044
00045
00046
00047 class DrawRequest{
00048 friend class Renderer;
00049 public:
00050
00051
00052
00053
00054
00055
00056
00057 virtual Mesh* getMesh() const{ return mesh_; }
00058
00059
00060
00061
00062
00063 virtual bool isMeshChanged() const{ return (mesh_ != preMesh_); }
00064
00065
00066
00067
00068
00069 virtual SceneNode* getSceneNode() const{ return sceneNode_; }
00070
00071
00072
00073
00074
00075 virtual bool isSceneNodeChanged() const{
00076 return (sceneNode_ != preSceneNode_);
00077 }
00078
00079
00080
00081
00082
00083 virtual Model* getModel() const{ return model_; }
00084
00085
00086
00087
00088
00089 virtual bool isModelChanged() const{ return (model_ != preModel_); }
00090
00091
00092
00093
00094
00095 virtual MeshData* getMeshData() const{ return meshData_; }
00096
00097
00098
00099
00100
00101 virtual bool isMeshDataChanged() const{
00102 return (meshData_ != preMeshData_);
00103 }
00104
00105
00106
00107
00108
00109 virtual Material* getMaterial() const{ return material_; }
00110
00111
00112
00113
00114
00115 virtual Material* getPreMaterial() const{ return preMaterial_; }
00116
00117
00118
00119
00120
00121 virtual bool isMaterialChanged() const{
00122 return (material_ != preMaterial_);
00123 }
00124
00125
00126
00127
00128
00129 virtual bool requireNormalize() const;
00130
00131
00132
00133
00134
00135 virtual bool isPipelineModeChanged() const;
00136
00137
00138
00139
00140
00141
00142
00143
00144 virtual Fog* getFog() const{ return fog_; }
00145
00146
00147
00148
00149
00150
00151
00152
00153 virtual Camera* getCamera() const{ return camera_; }
00154
00155
00156
00157
00158
00159
00160
00161
00162 virtual int getAmbientLightCount() const{
00163 return ambientLights_.getCount();
00164 }
00165
00166
00167
00168
00169 virtual AmbientLight* getAmbientLight(int index) const{
00170 return ambientLights_.get(index);
00171 }
00172
00173
00174
00175
00176
00177 Color3f getAmbientColor() const;
00178
00179
00180
00181
00182
00183
00184
00185
00186 virtual int getDirectionalLightCount() const{
00187 return directionalLights_.getCount();
00188 }
00189
00190
00191
00192
00193 virtual DirectionalLight* getDirectionalLight(int index) const{
00194 return directionalLights_.get(index);
00195 }
00196
00197
00198
00199
00200
00201
00202
00203
00204 virtual void addLocalLight(LocalLight* localLight);
00205
00206
00207
00208
00209 virtual void clearLocalLights(){ localLights_.clear(); }
00210
00211
00212
00213
00214
00215 virtual int getLocalLightCount() const{ return localLights_.getCount(); }
00216
00217
00218
00219
00220 virtual LocalLight* getLocalLight(int index) const{
00221 return localLights_.get(index);
00222 }
00223
00224
00225
00226
00227 virtual void sortLocalLights(){
00228 localLights_.sort(sortLocalLightsCallback);
00229 }
00230
00231
00232
00233
00234
00235
00236
00237
00238 static int sortLocalLightsCallback(
00239 LocalLight* const* left, LocalLight* const* right);
00240
00241 protected:
00242
00243
00244
00245
00246
00247
00248 DrawRequest();
00249
00250
00251
00252
00253 virtual ~DrawRequest();
00254
00255
00256
00257
00258
00259 virtual void clear();
00260
00261
00262
00263
00264
00265
00266 virtual bool isBlendEnabled() const;
00267
00268
00269
00270
00271
00272
00273 virtual void setMesh(Mesh* mesh);
00274
00275
00276
00277
00278
00279
00280 virtual void setFog(Fog* fog){ fog_ = fog; }
00281
00282
00283
00284
00285
00286
00287 virtual void setCamera(Camera* camera){ camera_ = camera; }
00288
00289
00290
00291
00292
00293
00294 virtual void addAmbientLight(AmbientLight* ambientLight);
00295
00296
00297
00298
00299
00300 virtual void addDirectionalLight(DirectionalLight* directionalLight);
00301
00302
00303
00304
00305
00306 virtual int sortLocalLightsImprement(LocalLight* left, LocalLight* right);
00307
00308 private:
00309
00310
00311 DrawRequest(const DrawRequest& copy);
00312
00313
00314 void operator =(const DrawRequest& copy);
00315
00316
00317 static DrawRequest* instance_;
00318
00319 ArrayList<AmbientLight*> ambientLights_;
00320
00321 ArrayList<DirectionalLight*> directionalLights_;
00322
00323 ArrayList<LocalLight*> localLights_;
00324
00325 Fog* fog_;
00326
00327 Camera* camera_;
00328
00329 Mesh* mesh_;
00330
00331 SceneNode* sceneNode_;
00332
00333 Model* model_;
00334
00335 MeshData* meshData_;
00336
00337 Material* material_;
00338
00339 Mesh* preMesh_;
00340
00341 SceneNode* preSceneNode_;
00342
00343 Model* preModel_;
00344
00345 MeshData* preMeshData_;
00346
00347 Material* preMaterial_;
00348
00349 };
00350
00351
00352 }
00353 #endif // End of DRAW_REQUEST_H_
00354