00001
00003
00004
00005
00006
00007
00009
00010
00011
00013
00014 #ifndef __RAIN_CLOSE_DROPS_PARTICLES__
00015 #define __RAIN_CLOSE_DROPS_PARTICLES__
00016
00017
00018 #include "CommonRain.h"
00019 #include "RainTextureFrameListener.h"
00020 #include "RainManualHardwareBillboardMeshLoader.h"
00021 #include "RainLight.h"
00022
00023
00024
00025
00026
00027
00031 class CloseDropsParticles
00032 {
00033 private :
00034 SceneManager *mSceneMgr;
00035 RainLightManager *mRainLightMgr;
00036 SceneNode *mParticlesNode, *mParentCam, *mParentSyst;
00037
00038
00039 Ogre::Camera *mCamera;
00040 RenderTexture *dropsTexture;
00041 MaterialPtr dropsTexturesMaterial;
00042
00043
00044 int mActiveParticlesCount;
00045 RenderTexture *particlePosTexture, *particlePosTextureBackup;
00046
00047 BillboardSet *bbSet1, *bbSet2;
00048
00049
00050 public :
00052 float mRainWidth;
00054 float mRainStreaksHeight;
00055
00056
00064 CloseDropsParticles(SceneManager *sceneMgr, SceneNode *parentSyst, SceneNode *parentCam);
00065
00067 ~CloseDropsParticles();
00068
00070 void createLights();
00071
00073 RainLightManager *getLightManagerPtr();
00074
00076 void updateLights();
00077
00079 void definePosTextureAndBackup();
00080
00082 void makeControlOverlay();
00083
00085 void updatePositionTexture(bool primary);
00086
00088 void updateFragmentProgramParameter(const String &name, float value);
00090 void updateFragmentProgramParameter(const String &name, Ogre::Vector3 value);
00092 void updateFragmentProgramParameter(const String &name, Ogre::Vector4 value);
00096 void updateShaderParameters(float tslf, float rainBbSide, float streaksHeight, int nbLights,
00097 Vector3 viewPos, Vector3 viewDir, Vector3 fallVect, Vector3 boxMin, Vector3 boxMax, Vector3 lastMove, Vector3 randomMove, int useShader);
00098
00099
00101 void updateTimeSinceLastFrame(float tslf);
00103 void updateRainBilboardSideLength(float rainBbSide);
00105 void updateStreaksHeight(float streaksHeight);
00107 void updateLightCount(float nbLights);
00109 void updateViewPos(Vector3 viewPos);
00111 void updateViewDir(Vector3 viewDir);
00113 void updateFallVector(Vector3 fallVect);
00115 void updateBoxMin(Vector3 boxMin);
00117 void updateBoxMax(Vector3 boxMax);
00119 void updateLastMove(Vector3 lastMove);
00121 void updateRandomMove(Vector3 randomMove);
00122
00125 void hidePositionBillboards()
00126 {
00127 bbSet1->setVisible(false);
00128 bbSet2->setVisible(false);
00129 }
00132 void showPositionBillboards()
00133 {
00134 bbSet1->setVisible(true);
00135 bbSet2->setVisible(true);
00136 }
00137
00138 private :
00139
00141 void createMaterial(String name);
00142
00144 Camera* createDropsCamera();
00145
00147 void GPUmaterial();
00148
00150 void initializeBillboardsPositionTexture();
00151
00153 MeshPtr createHardwareBillboardMesh(String materialName, String meshName=BILLBOARD_MESH_NAME);
00154
00156 void modifyClonedHardwareBillboardMesh(MeshPtr msh, int partNumber);
00157
00159 void initParticles();
00160
00162 void createBillboardsPositionRenderTexture(RenderTexture *PSPosTexture, Vector3 nodePos, BillboardSet *bbSet);
00163
00165 void createBillboardsPositionTextureMaterial(String inputTextureName);
00166 };
00167
00168
00169
00170
00171 #endif // __RAIN_CLOSE_DROPS_PARTICLES__