Custom render object that draws mirrors, water, and skies. More...
#include <W3DWater.h>
Inherits Snapshot, and RenderObjClass.
Classes | |
| struct | SEA_PATCH_VERTEX |
| struct | Setting |
| struct | WaterMeshData |
Public Member Functions | |
| WaterRenderObjClass (void) | |
| ~WaterRenderObjClass (void) | |
| virtual RenderObjClass * | Clone (void) const |
| virtual int | Class_ID (void) const |
| virtual void | Render (RenderInfoClass &rinfo) |
| virtual void | Get_Obj_Space_Bounding_Sphere (SphereClass &sphere) const |
| virtual void | Get_Obj_Space_Bounding_Box (AABoxClass &aabox) const |
| virtual int | Get_Sort_Level (void) const |
| virtual void | Set_Sort_Level (int level) |
| void | renderWater (void) |
| allocate W3D resources needed to render water | |
| Int | init (Real waterLevel, Real dx, Real dy, SceneClass *parentScene, WaterType type) |
| void | reset (void) |
| reset any resources we need to | |
| void | load (void) |
| load/setup any map dependent features | |
| void | update (void) |
| update phase of the water | |
| void | enableWaterGrid (Bool state) |
| used to active custom water for special maps. (i.e DAM). | |
| void | updateMapOverrides (void) |
| used to update any map specific map overrides for water appearance. | |
| void | setTimeOfDay (TimeOfDay tod) |
| change sky/water for time of day | |
| void | toggleCloudLayer (Bool state) |
| enables/disables the cloud layer | |
| void | updateRenderTargetTextures (CameraClass *cam) |
| renders into any required textures. | |
| void | ReleaseResources (void) |
| Release all dx8 resources so the device can be reset. | |
| void | ReAcquireResources (void) |
| Reacquire all resources after device reset. | |
| Real | getWaterHeight (Real x, Real y) |
| return water height at given point - for use by WB. | |
| void | setGridHeightClamps (Real minz, Real maxz) |
| set min/max height values alllowed in grid | |
| void | addVelocity (Real worldX, Real worldY, Real zVelocity, Real preferredHeight) |
| add velocity value | |
| void | changeGridHeight (Real x, Real y, Real delta) |
| change height of grid at world point including neighbors within falloff. | |
| void | setGridChangeAttenuationFactors (Real a, Real b, Real c, Real range) |
| adjust falloff parameters for grid change method. | |
| void | setGridTransform (Real angle, Real x, Real y, Real z) |
| positoin/orientation of grid in space | |
| void | setGridTransform (const Matrix3D *transform) |
| set transform by matrix | |
| void | getGridTransform (Matrix3D *transform) |
| get grid transform matrix | |
| void | setGridResolution (Real gridCellsX, Real gridCellsY, Real cellSize) |
| grid resolution and spacing | |
| void | getGridResolution (Real *gridCellsX, Real *gridCellsY, Real *cellSize) |
| get grid resolution params | |
| void | setGridVertexHeight (Int x, Int y, Real value) |
| void | getGridVertexHeight (Int x, Int y, Real *value) |
| Bool | worldToGridSpace (Real worldX, Real worldY, Real &gridX, Real &gridY) |
| convert from world coordinates to grid's local coordinate system. | |
| void | replaceSkyboxTexture (const AsciiString &oldTexName, const AsciiString &newTextName) |
Public Member Functions inherited from Snapshot | |
| Snapshot (void) | |
| ~Snapshot (void) | |
Public Member Functions inherited from RenderObjClass | |
| RenderObjClass (void) | |
| RenderObjClass (const RenderObjClass &src) | |
| RenderObjClass & | operator= (const RenderObjClass &) |
| virtual | ~RenderObjClass (void) |
| virtual const char * | Get_Name (void) const |
| virtual void | Set_Name (const char *name) |
| virtual const char * | Get_Base_Model_Name (void) const |
| virtual void | Set_Base_Model_Name (const char *name) |
| virtual int | Get_Num_Polys (void) const |
| virtual void | Special_Render (SpecialRenderInfoClass &rinfo) |
| virtual void | On_Frame_Update () |
| virtual void | Restart (void) |
| virtual void | Add (SceneClass *scene) |
| virtual void | Remove (void) |
| virtual SceneClass * | Get_Scene (void) |
| virtual SceneClass * | Peek_Scene (void) |
| virtual void | Set_Container (RenderObjClass *con) |
| virtual void | Validate_Transform (void) const |
| RenderObjClass * | Get_Container (void) const |
| virtual void | Set_Transform (const Matrix3D &m) |
| virtual void | Set_Position (const Vector3 &v) |
| const Matrix3D & | Get_Transform (void) const |
| const Matrix3D & | Get_Transform (bool &is_transform_identity) const |
| const Matrix3D & | Get_Transform_No_Validity_Check (void) const |
| const Matrix3D & | Get_Transform_No_Validity_Check (bool &is_transform_identity) const |
| bool | Is_Transform_Identity () const |
| bool | Is_Transform_Identity_No_Validity_Check () const |
| Vector3 | Get_Position (void) const |
| virtual void | Notify_Added (SceneClass *scene) |
| virtual void | Notify_Removed (SceneClass *scene) |
| virtual int | Get_Num_Sub_Objects (void) const |
| virtual RenderObjClass * | Get_Sub_Object (int index) const |
| virtual int | Add_Sub_Object (RenderObjClass *subobj) |
| virtual int | Remove_Sub_Object (RenderObjClass *robj) |
| virtual RenderObjClass * | Get_Sub_Object_By_Name (const char *name, int *index=NULL) const |
| virtual int | Get_Num_Sub_Objects_On_Bone (int boneindex) const |
| virtual RenderObjClass * | Get_Sub_Object_On_Bone (int index, int boneindex) const |
| virtual int | Get_Sub_Object_Bone_Index (RenderObjClass *subobj) const |
| virtual int | Get_Sub_Object_Bone_Index (int LodIndex, int ModelIndex) const |
| virtual int | Add_Sub_Object_To_Bone (RenderObjClass *subobj, int bone_index) |
| virtual int | Add_Sub_Object_To_Bone (RenderObjClass *subobj, const char *bname) |
| virtual int | Remove_Sub_Objects_From_Bone (int boneindex) |
| virtual int | Remove_Sub_Objects_From_Bone (const char *bname) |
| virtual void | Update_Sub_Object_Transforms (void) |
| virtual void | Set_Animation (void) |
| virtual void | Set_Animation (HAnimClass *motion, float frame, int anim_mode=ANIM_MODE_MANUAL) |
| virtual void | Set_Animation (HAnimClass *motion0, float frame0, HAnimClass *motion1, float frame1, float percentage) |
| virtual void | Set_Animation (HAnimComboClass *anim_combo) |
| virtual HAnimClass * | Peek_Animation (void) |
| virtual int | Get_Num_Bones (void) |
| virtual const char * | Get_Bone_Name (int bone_index) |
| virtual int | Get_Bone_Index (const char *bonename) |
| virtual const Matrix3D & | Get_Bone_Transform (const char *bonename) |
| virtual const Matrix3D & | Get_Bone_Transform (int boneindex) |
| virtual void | Capture_Bone (int bindex) |
| virtual void | Release_Bone (int bindex) |
| virtual bool | Is_Bone_Captured (int bindex) const |
| virtual void | Control_Bone (int bindex, const Matrix3D &objtm, bool world_space_translation=false) |
| virtual const HTreeClass * | Get_HTree (void) const |
| virtual bool | Cast_Ray (RayCollisionTestClass &raytest) |
| virtual bool | Cast_AABox (AABoxCollisionTestClass &boxtest) |
| virtual bool | Cast_OBBox (OBBoxCollisionTestClass &boxtest) |
| virtual bool | Intersect_AABox (AABoxIntersectionTestClass &boxtest) |
| virtual bool | Intersect_OBBox (OBBoxIntersectionTestClass &boxtest) |
| virtual bool | Intersect (IntersectionClass *Intersection, IntersectionResultClass *Final_Result) |
| virtual bool | Intersect_Sphere (IntersectionClass *Intersection, IntersectionResultClass *Final_Result) |
| virtual bool | Intersect_Sphere_Quick (IntersectionClass *Intersection, IntersectionResultClass *Final_Result) |
| virtual const SphereClass & | Get_Bounding_Sphere (void) const |
| virtual const AABoxClass & | Get_Bounding_Box (void) const |
| virtual void | Update_Obj_Space_Bounding_Volumes (void) |
| virtual void | Prepare_LOD (CameraClass &camera) |
| virtual void | Recalculate_Static_LOD_Factors (void) |
| virtual void | Increment_LOD (void) |
| virtual void | Decrement_LOD (void) |
| virtual float | Get_Cost (void) const |
| virtual float | Get_Value (void) const |
| virtual float | Get_Post_Increment_Value (void) const |
| virtual void | Set_LOD_Level (int lod) |
| virtual int | Get_LOD_Level (void) const |
| virtual int | Get_LOD_Count (void) const |
| virtual void | Set_LOD_Bias (float bias) |
| virtual int | Calculate_Cost_Value_Arrays (float screen_area, float *values, float *costs) const |
| virtual RenderObjClass * | Get_Current_LOD (void) |
| virtual bool | Build_Dependency_List (DynamicVectorClass< StringClass > &file_list, bool recursive=true) |
| virtual bool | Build_Texture_List (DynamicVectorClass< StringClass > &texture_file_list, bool recursive=true) |
| virtual void | Create_Decal (DecalGeneratorClass *generator) |
| virtual void | Delete_Decal (uint32 decal_id) |
| virtual MaterialInfoClass * | Get_Material_Info (void) |
| virtual void | Set_User_Data (void *value, bool recursive=false) |
| virtual void * | Get_User_Data () |
| virtual int | Get_Num_Snap_Points (void) |
| virtual void | Get_Snap_Point (int index, Vector3 *set) |
| virtual float | Get_Screen_Size (CameraClass &camera) |
| virtual void | Scale (float scale) |
| virtual void | Scale (float scalex, float scaley, float scalez) |
| virtual void | Set_ObjectScale (float scale) |
| const float | Get_ObjectScale (void) const |
| void | Set_ObjectColor (unsigned int color) |
| const unsigned int | Get_ObjectColor (void) const |
| virtual int | Is_Really_Visible (void) |
| virtual int | Is_Not_Hidden_At_All (void) |
| virtual int | Is_Visible (void) const |
| virtual void | Set_Visible (int onoff) |
| virtual int | Is_Hidden (void) const |
| virtual void | Set_Hidden (int onoff) |
| virtual int | Is_Animation_Hidden (void) const |
| virtual void | Set_Animation_Hidden (int onoff) |
| virtual int | Is_Force_Visible (void) const |
| virtual void | Set_Force_Visible (int onoff) |
| virtual int | Is_Translucent (void) const |
| virtual void | Set_Translucent (int onoff) |
| virtual int | Is_Alpha (void) const |
| virtual void | Set_Alpha (int onoff) |
| virtual int | Is_Additive (void) const |
| virtual void | Set_Additive (int onoff) |
| virtual int | Get_Collision_Type (void) const |
| virtual void | Set_Collision_Type (int type) |
| virtual bool | Is_Complete (void) |
| virtual bool | Is_In_Scene (void) |
| virtual float | Get_Native_Screen_Size (void) const |
| virtual void | Set_Native_Screen_Size (float screensize) |
| void | Set_Sub_Objects_Match_LOD (int onoff) |
| int | Is_Sub_Objects_Match_LOD_Enabled (void) |
| void | Set_Sub_Object_Transforms_Dirty (bool onoff) |
| bool | Are_Sub_Object_Transforms_Dirty (void) |
| void | Set_Ignore_LOD_Cost (bool onoff) |
| bool | Is_Ignoring_LOD_Cost (void) |
| void | Set_Is_Self_Shadowed () |
| void | Unset_Is_Self_Shadowed () |
| int | Is_Self_Shadowed () const |
| virtual const PersistFactoryClass & | Get_Factory (void) const |
| virtual bool | Save (ChunkSaveClass &csave) |
| virtual bool | Load (ChunkLoadClass &cload) |
| RenderHookClass * | Get_Render_Hook (void) |
| void | Set_Render_Hook (RenderHookClass *hook) |
Public Member Functions inherited from RefCountClass | |
| RefCountClass (void) | |
| RefCountClass (const RefCountClass &) | |
| void | Add_Ref (void) const |
| WWINLINE void | Release_Ref (void) const |
| int | Num_Refs (void) const |
| virtual void | Delete_This (void) |
Public Member Functions inherited from PostLoadableClass | |
| PostLoadableClass (void) | |
| virtual | ~PostLoadableClass (void) |
| virtual void | On_Post_Load (void) |
| bool | Is_Post_Load_Registered (void) |
| void | Set_Post_Load_Registered (bool onoff) |
Public Member Functions inherited from MultiListObjectClass | |
| MultiListObjectClass (void) | |
| virtual | ~MultiListObjectClass (void) |
| MultiListNodeClass * | Get_List_Node () const |
| void | Set_List_Node (MultiListNodeClass *node) |
Protected Types | |
| enum | WaterMeshStatus { AT_REST = 0x00 , IN_MOTION = 0x01 } |
Protected Types inherited from RenderObjClass | |
| enum | { COLL_TYPE_MASK = 0x000000FF , IS_VISIBLE = 0x00000100 , IS_NOT_HIDDEN = 0x00000200 , IS_NOT_ANIMATION_HIDDEN = 0x00000400 , IS_FORCE_VISIBLE = 0x00000800 , BOUNDING_VOLUMES_VALID = 0x00002000 , IS_TRANSLUCENT = 0x00004000 , IGNORE_LOD_COST = 0x00008000 , SUBOBJS_MATCH_LOD = 0x00010000 , SUBOBJ_TRANSFORMS_DIRTY = 0x00020000 , IS_ALPHA = 0x00040000 , IS_ADDITIVE = 0x00100000 , IS_SELF_SHADOWED = 0x00080000 , IS_CHEATER = 0x00100000 , IS_REALLY_VISIBLE = IS_VISIBLE | IS_NOT_HIDDEN | IS_NOT_ANIMATION_HIDDEN , IS_NOT_HIDDEN_AT_ALL = IS_NOT_HIDDEN | IS_NOT_ANIMATION_HIDDEN , DEFAULT_BITS = COLL_TYPE_ALL | IS_NOT_HIDDEN | IS_NOT_ANIMATION_HIDDEN } |
Protected Member Functions | |
| void | drawRiverWater (PolygonTrigger *pTrig) |
| void | drawTrapezoidWater (Vector3 points[4]) |
| void | loadSetting (Setting *skySetting, TimeOfDay timeOfDay) |
| init sky/water settings from GDF | |
| void | renderSky (void) |
| draw the sky layer (clouds, stars, etc.) | |
| void | testCurvedWater (void) |
| draw the sky layer (clouds, stars, etc.) | |
| void | renderSkyBody (Matrix3D *mat) |
| draw the sky body (sun, moon, etc.) | |
| void | renderWaterMesh (void) |
| draw the water surface mesh (deformed 3d mesh). | |
| HRESULT | initBumpMap (LPDIRECT3DTEXTURE8 *pTex, TextureClass *pBumpSource) |
| copies data into bump-map format. | |
| void | renderMirror (CameraClass *cam) |
| Draw reflected scene into texture. | |
| void | drawSea (RenderInfoClass &rinfo) |
| Bool | getClippedWaterPlane (CameraClass *cam, AABoxClass *box) |
| bounding box of frustum clipped polygon plane | |
| void | setupFlatWaterShader (void) |
| void | setupJbaWaterShader (void) |
| void | cleanupJbaWaterShader (void) |
| HRESULT | generateIndexBuffer (int sizeX, int sizeY) |
| Generate static index buufer. | |
| HRESULT | generateVertexBuffer (Int sizeX, Int sizeY, Int vertexSize, Bool doFill) |
| Generate static vertex buffer. | |
| virtual void | crc (Xfer *xfer) |
| virtual void | xfer (Xfer *xfer) |
| virtual void | loadPostProcess (void) |
Protected Member Functions inherited from RenderObjClass | |
| virtual void | Add_Dependencies_To_List (DynamicVectorClass< StringClass > &file_list, bool textures_only=false) |
| virtual void | Update_Cached_Bounding_Volumes (void) const |
| virtual void | Update_Sub_Object_Bits (void) |
| bool | Bounding_Volumes_Valid (void) const |
| void | Invalidate_Cached_Bounding_Volumes (void) const |
| void | Validate_Cached_Bounding_Volumes (void) const |
Protected Member Functions inherited from RefCountClass | |
| virtual | ~RefCountClass (void) |
Protected Attributes | |
| DX8IndexBufferClass * | m_indexBuffer |
| indices defining quad | |
| SceneClass * | m_parentScene |
| scene to be reflected | |
| ShaderClass | m_shaderClass |
| shader or rendering state for heightmap | |
| VertexMaterialClass * | m_vertexMaterialClass |
| vertex lighting material | |
| VertexMaterialClass * | m_meshVertexMaterialClass |
| vertex lighting marial for 3D water. | |
| LightClass * | m_meshLight |
| light used for 3D Mesh Water. | |
| TextureClass * | m_alphaClippingTexture |
| used for faked clipping using alpha | |
| Real | m_dx |
| x extent of water surface (offset from local center) | |
| Real | m_dy |
| y extent of water surface (offset from local center) | |
| Vector3 | m_planeNormal |
| water plane normal | |
| Real | m_planeDistance |
| water plane distance | |
| Real | m_level |
| level of water (hack for water) | |
| Real | m_uOffset |
| current texture offset on u axis | |
| Real | m_vOffset |
| current texture offset on v axis | |
| Real | m_uScrollPerMs |
| texels per/ms scroll rate in u direction | |
| Real | m_vScrollPerMs |
| texels per/ms scroll rate in v direction | |
| Int | m_LastUpdateTime |
| time of last cloud update | |
| Bool | m_useCloudLayer |
| flag if clouds are on/off | |
| WaterType | m_waterType |
| type of water being used | |
| Int | m_sortLevel |
| sort order after main scene is rendered | |
| LPDIRECT3DDEVICE8 | m_pDev |
| pointer to D3D Device | |
| LPDIRECT3DVERTEXBUFFER8 | m_vertexBufferD3D |
| D3D vertex buffer. | |
| LPDIRECT3DINDEXBUFFER8 | m_indexBufferD3D |
| D3D index buffer. | |
| Int | m_vertexBufferD3DOffset |
| location to start writing vertices | |
| DWORD | m_dwWavePixelShader |
| handle to D3D pixel shader | |
| DWORD | m_dwWaveVertexShader |
| handle to D3D vertex shader | |
| Int | m_numVertices |
| number of vertices in D3D vertex buffer | |
| Int | m_numIndices |
| number of indices in D3D index buffer | |
| LPDIRECT3DTEXTURE8 | m_pBumpTexture [NUM_BUMP_FRAMES] |
| animation frames | |
| LPDIRECT3DTEXTURE8 | m_pBumpTexture2 [NUM_BUMP_FRAMES] |
| animation frames | |
| Int | m_iBumpFrame |
| current animation frame | |
| Real | m_fBumpScale |
| scales bump map uv perturbation | |
| TextureClass * | m_pReflectionTexture |
| render target for reflection | |
| RenderObjClass * | m_skyBox |
| box around level | |
| WaterTracksRenderSystem * | m_waterTrackSystem |
| object responsible for rendering water wakes | |
| WaterMeshData * | m_meshData |
| heightmap data for 3D Mesh based water. | |
| UnsignedInt | m_meshDataSize |
| size of m_meshData | |
| Bool | m_meshInMotion |
| TRUE once we've messed with velocities and are in motion. | |
| Bool | m_doWaterGrid |
| allows/prevents water grid rendering. | |
| Vector2 | m_gridDirectionX |
| vector along water grid's x-axis (scaled to world-space) | |
| Vector2 | m_gridDirectionY |
| vector along water grid's y-axis (scaled to world-space) | |
| Vector2 | m_gridOrigin |
| unit vector along water grid's x-axis | |
| Real | m_gridWidth |
| object-space width of water grid | |
| Real | m_gridHeight |
| object-space width of water grid | |
| Real | m_minGridHeight |
| minimum height value allowed for water mesh | |
| Real | m_maxGridHeight |
| maximum height value allowed for water mesh | |
| Real | m_gridChangeMaxRange |
| maximum range of changeGridHeight() method | |
| Real | m_gridChangeAtt0 |
| Real | m_gridChangeAtt1 |
| Real | m_gridChangeAtt2 |
| Real | m_gridCellSize |
| world-space width/height of each cell. | |
| Int | m_gridCellsX |
| number of cells along width | |
| Int | m_gridCellsY |
| number of cells along height | |
| Real | m_riverVOrigin |
| TextureClass * | m_riverTexture |
| TextureClass * | m_whiteTexture |
| a texture containing only white used for NULL pixel shader stages. | |
| TextureClass * | m_waterNoiseTexture |
| DWORD | m_waterPixelShader |
| D3D handle to pixel shader. | |
| DWORD | m_riverWaterPixelShader |
| D3D handle to pixel shader. | |
| DWORD | m_trapezoidWaterPixelShader |
| handle to D3D vertex shader | |
| TextureClass * | m_waterSparklesTexture |
| Real | m_riverXOffset |
| Real | m_riverYOffset |
| Bool | m_drawingRiver |
| Bool | m_disableRiver |
| TextureClass * | m_riverAlphaEdge |
| TimeOfDay | m_tod |
| time of day setting for reflected cloud layer | |
| Setting | m_settings [TIME_OF_DAY_COUNT] |
| settings for each time of day | |
Protected Attributes inherited from RenderObjClass | |
| unsigned long | Bits |
| Matrix3D | Transform |
| float | ObjectScale |
| unsigned int | ObjectColor |
| SphereClass | CachedBoundingSphere |
| AABoxClass | CachedBoundingBox |
| float | NativeScreenSize |
| bool | IsTransformIdentity |
| SceneClass * | Scene |
| RenderObjClass * | Container |
| void * | User_Data |
| RenderHookClass * | RenderHook |
Additional Inherited Members | |
Static Public Member Functions inherited from RefCountClass | |
| static int | Total_Refs (void) |
| static RefCountClass * | Add_Active_Ref (RefCountClass *obj) |
| static RefCountClass * | Set_Ref_Owner (RefCountClass *obj, char *file, int line) |
| static void | Remove_Active_Ref (RefCountClass *obj) |
| static bool | Validate_Active_Ref (RefCountClass *obj) |
Public Attributes inherited from RefCountClass | |
| RefCountNodeClass | ActiveRefNode |
| ActiveRefStruct | ActiveRefInfo |
Static Public Attributes inherited from RenderObjClass | |
| static const float | AT_MIN_LOD = FLT_MAX |
| static const float | AT_MAX_LOD = -1.0f |
Static Public Attributes inherited from RefCountClass | |
| static RefCountListClass | ActiveRefList |
Custom render object that draws mirrors, water, and skies.
This render object handles drawing reflected W3D scenes. It will only work with rectangular planar surfaces and was tuned with an emphasis on water. Since skies are only visible in reflections, this code will also render clouds and sky bodies.
Definition at line 64 of file W3DWater.h.
|
protected |
| Enumerator | |
|---|---|
| AT_REST | |
| IN_MOTION | |
Definition at line 178 of file W3DWater.h.
| Enumerator | |
|---|---|
| WATER_TYPE_0_TRANSLUCENT | |
| WATER_TYPE_1_FB_REFLECTION | |
| WATER_TYPE_2_PVSHADER | |
| WATER_TYPE_3_GRIDMESH | |
| WATER_TYPE_MAX | |
Definition at line 70 of file W3DWater.h.
| WaterRenderObjClass::WaterRenderObjClass | ( | void | ) |
Constructor. Just nulls out some variables.
<D3D handle to pixel shader.
<D3D handle to pixel shader.
<D3D handle to pixel shader.
Definition at line 328 of file W3DWater.cpp.
| WaterRenderObjClass::~WaterRenderObjClass | ( | void | ) |
Destructor. Releases w3d assets.
Definition at line 280 of file W3DWater.cpp.
| void WaterRenderObjClass::addVelocity | ( | Real | worldX, |
| Real | worldY, | ||
| Real | zVelocity, | ||
| Real | preferredHeight ) |
add velocity value
Definition at line 2476 of file W3DWater.cpp.
change height of grid at world point including neighbors within falloff.
Definition at line 2542 of file W3DWater.cpp.
|
virtual |
returns the class id, so the scene can tell what kind of render object it has.
Reimplemented from RenderObjClass.
Definition at line 412 of file W3DWater.cpp.
|
protected |
|
virtual |
Not used, but required virtual method.
Implements RenderObjClass.
Definition at line 420 of file W3DWater.cpp.
|
protectedvirtual |
|
protected |
Definition at line 2714 of file W3DWater.cpp.
|
protected |
Draw the surface of the water
Draws the water surface using a custom D3D vertex/pixel shader and a reflection texture. Only tested to work on GeForce3.
Definition at line 1790 of file W3DWater.cpp.
|
protected |
Definition at line 3046 of file W3DWater.cpp.
| void WaterRenderObjClass::enableWaterGrid | ( | Bool | state | ) |
used to active custom water for special maps. (i.e DAM).
Definition at line 1185 of file W3DWater.cpp.
|
protected |
Generate static index buufer.
Create and fill a D3D index buffer with water surface strip indices
Definition at line 704 of file W3DWater.cpp.
|
protected |
Generate static vertex buffer.
Create and fill a D3D vertex buffer with water surface vertices
Definition at line 625 of file W3DWater.cpp.
|
virtual |
WW3D method that returns object bounding box used in collision detection
Reimplemented from RenderObjClass.
Definition at line 398 of file W3DWater.cpp.
|
virtual |
WW3D method that returns object bounding sphere used in frustum culling
Reimplemented from RenderObjClass.
Definition at line 384 of file W3DWater.cpp.
|
inlinevirtual |
Reimplemented from RenderObjClass.
Definition at line 98 of file W3DWater.h.
|
protected |
bounding box of frustum clipped polygon plane
Clips the water plane to the current camera frustum and returns a bounding box enclosing the clipped plane. Returns false if water plane is not visible.
Definition at line 1750 of file W3DWater.cpp.
| void WaterRenderObjClass::getGridResolution | ( | Real * | gridCellsX, |
| Real * | gridCellsY, | ||
| Real * | cellSize ) |
get grid resolution params
Definition at line 2654 of file W3DWater.cpp.
| void WaterRenderObjClass::getGridTransform | ( | Matrix3D * | transform | ) |
get grid transform matrix
Definition at line 2622 of file W3DWater.cpp.
Definition at line 125 of file W3DWater.h.
return water height at given point - for use by WB.
Utility function used to query water heights in a manner that works in both RTS and WB.
Definition at line 2674 of file W3DWater.cpp.
| Int WaterRenderObjClass::init | ( | Real | waterLevel, |
| Real | dx, | ||
| Real | dy, | ||
| SceneClass * | parentScene, | ||
| WaterType | type ) |
Initializes water with dimensions and parent scene. During rendering, we will render a water surface of given dimensions and reflect the parent scene in its surface. For now, waters are forced to be rectangles.
Hack for now
Definition at line 991 of file W3DWater.cpp.
|
protected |
copies data into bump-map format.
Copies raw bits from pBumpSrc (a regular grayscale texture) into a D3D bump-map format.
Definition at line 430 of file W3DWater.cpp.
| void WaterRenderObjClass::load | ( | void | ) |
load/setup any map dependent features
Definition at line 979 of file W3DWater.cpp.
|
protectedvirtual |
init sky/water settings from GDF
Copies GDF settings dealing with a particular time of day into our own structures. Also allocates any required W3D assets (textures).
Definition at line 1363 of file W3DWater.cpp.
| void WaterRenderObjClass::ReAcquireResources | ( | void | ) |
Reacquire all resources after device reset.
(Re)allocates all W3D assets after a reset..
Definition at line 843 of file W3DWater.cpp.
| void WaterRenderObjClass::ReleaseResources | ( | void | ) |
Release all dx8 resources so the device can be reset.
Releases all w3d assets, to prepare for Reset device call.
Definition at line 806 of file W3DWater.cpp.
|
virtual |
Renders (draws) the water. Algorithm: Draw reflected scene. Draw reflected sky layer(s) and bodies. Clear Zbuffer Fill Zbuffer by drawing water surface (allows proper sorting into regular scene). Draw non-reflected scene (done in regular app render loop).
This algorithm doesn't apply to translucent water, which is rendered into a texture and rendered at end of scene.
Implements RenderObjClass.
Definition at line 1523 of file W3DWater.cpp.
|
protected |
Draw reflected scene into texture.
Renders the reflected scene into an offscreen texture.
Definition at line 1435 of file W3DWater.cpp.
|
protected |
draw the sky layer (clouds, stars, etc.)
Renders (draws) the sky plane. Will apply current time-of-day settings including some simple UV scrolling animation.
Definition at line 2050 of file W3DWater.cpp.
|
protected |
draw the sky body (sun, moon, etc.)
Renders (draws) the sky body. Used for moon and sun. We rotate the image so that it always faces the camera. This removes perspective and helps hide that it's a flat image.
Definition at line 2139 of file W3DWater.cpp.
| void WaterRenderObjClass::renderWater | ( | void | ) |
allocate W3D resources needed to render water
draw the water surface (flat)
Renders (draws) the water surface.
Definition at line 2002 of file W3DWater.cpp.
|
protected |
draw the water surface mesh (deformed 3d mesh).
Renders (draws) the water surface mesh geometry. This is a work-in-progress! Do not use this code!
Definition at line 2242 of file W3DWater.cpp.
| void WaterRenderObjClass::replaceSkyboxTexture | ( | const AsciiString & | oldTexName, |
| const AsciiString & | newTextName ) |
Definition at line 1325 of file W3DWater.cpp.
| void WaterRenderObjClass::reset | ( | void | ) |
reset any resources we need to
Definition at line 1145 of file W3DWater.cpp.
|
inlinevirtual |
Reimplemented from RenderObjClass.
Definition at line 99 of file W3DWater.h.
adjust falloff parameters for grid change method.
Definition at line 2586 of file W3DWater.cpp.
set min/max height values alllowed in grid
Definition at line 2470 of file W3DWater.cpp.
grid resolution and spacing
Definition at line 2630 of file W3DWater.cpp.
| void WaterRenderObjClass::setGridTransform | ( | const Matrix3D * | transform | ) |
set transform by matrix
Definition at line 2614 of file W3DWater.cpp.
positoin/orientation of grid in space
Definition at line 2594 of file W3DWater.cpp.
Definition at line 2460 of file W3DWater.cpp.
| void WaterRenderObjClass::setTimeOfDay | ( | TimeOfDay | tod | ) |
change sky/water for time of day
Adjusts various water/sky rendering settings that depend on time of day.
Definition at line 1352 of file W3DWater.cpp.
|
protected |
Definition at line 2948 of file W3DWater.cpp.
|
protected |
Definition at line 197 of file W3DWater.cpp.
|
protected |
draw the sky layer (clouds, stars, etc.)
|
inline |
enables/disables the cloud layer
Definition at line 110 of file W3DWater.h.
| void WaterRenderObjClass::update | ( | void | ) |
update phase of the water
Update phase for water if we need it. This called once per client frame reguardless of how fast the logic framerate is running
< this is close enough to at rest
< when we're close enought to at rest height and velocity we will stop
< use with up force of 15.0
Definition at line 1217 of file W3DWater.cpp.
| void WaterRenderObjClass::updateMapOverrides | ( | void | ) |
used to update any map specific map overrides for water appearance.
Definition at line 1134 of file W3DWater.cpp.
| void WaterRenderObjClass::updateRenderTargetTextures | ( | CameraClass * | cam | ) |
renders into any required textures.
Our water may use effects that require run-time rendered textures. These textures need to be updated before we start rendering to the main screen render target because D3D doesn't multiple render targets.
Definition at line 1425 of file W3DWater.cpp.
|
inline |
convert from world coordinates to grid's local coordinate system.
Definition at line 272 of file W3DWater.h.
|
protectedvirtual |
Xfer Version Info: 1: Initial version
Implements Snapshot.
Definition at line 3456 of file W3DWater.cpp.
|
protected |
used for faked clipping using alpha
Definition at line 138 of file W3DWater.h.
|
protected |
Definition at line 221 of file W3DWater.h.
|
protected |
allows/prevents water grid rendering.
Definition at line 193 of file W3DWater.h.
|
protected |
Definition at line 220 of file W3DWater.h.
|
protected |
handle to D3D pixel shader
Definition at line 166 of file W3DWater.h.
|
protected |
handle to D3D vertex shader
Definition at line 167 of file W3DWater.h.
|
protected |
x extent of water surface (offset from local center)
Definition at line 139 of file W3DWater.h.
|
protected |
y extent of water surface (offset from local center)
Definition at line 140 of file W3DWater.h.
|
protected |
scales bump map uv perturbation
Definition at line 173 of file W3DWater.h.
|
protected |
world-space width/height of each cell.
Definition at line 206 of file W3DWater.h.
|
protected |
number of cells along width
Definition at line 207 of file W3DWater.h.
|
protected |
number of cells along height
Definition at line 208 of file W3DWater.h.
|
protected |
Definition at line 203 of file W3DWater.h.
|
protected |
Definition at line 204 of file W3DWater.h.
|
protected |
Definition at line 205 of file W3DWater.h.
|
protected |
maximum range of changeGridHeight() method
Definition at line 202 of file W3DWater.h.
|
protected |
vector along water grid's x-axis (scaled to world-space)
Definition at line 195 of file W3DWater.h.
|
protected |
vector along water grid's y-axis (scaled to world-space)
Definition at line 196 of file W3DWater.h.
|
protected |
object-space width of water grid
Definition at line 199 of file W3DWater.h.
|
protected |
unit vector along water grid's x-axis
Definition at line 197 of file W3DWater.h.
|
protected |
object-space width of water grid
Definition at line 198 of file W3DWater.h.
|
protected |
current animation frame
Definition at line 172 of file W3DWater.h.
|
protected |
indices defining quad
Definition at line 132 of file W3DWater.h.
|
protected |
D3D index buffer.
Definition at line 164 of file W3DWater.h.
|
protected |
time of last cloud update
Definition at line 148 of file W3DWater.h.
|
protected |
level of water (hack for water)
Definition at line 143 of file W3DWater.h.
|
protected |
maximum height value allowed for water mesh
Definition at line 201 of file W3DWater.h.
|
protected |
heightmap data for 3D Mesh based water.
Definition at line 190 of file W3DWater.h.
|
protected |
size of m_meshData
Definition at line 191 of file W3DWater.h.
|
protected |
TRUE once we've messed with velocities and are in motion.
Definition at line 192 of file W3DWater.h.
|
protected |
light used for 3D Mesh Water.
Definition at line 137 of file W3DWater.h.
|
protected |
vertex lighting marial for 3D water.
Definition at line 136 of file W3DWater.h.
|
protected |
minimum height value allowed for water mesh
Definition at line 200 of file W3DWater.h.
|
protected |
number of indices in D3D index buffer
Definition at line 169 of file W3DWater.h.
|
protected |
number of vertices in D3D vertex buffer
Definition at line 168 of file W3DWater.h.
|
protected |
scene to be reflected
Definition at line 133 of file W3DWater.h.
|
protected |
animation frames
Definition at line 170 of file W3DWater.h.
|
protected |
animation frames
Definition at line 171 of file W3DWater.h.
|
protected |
pointer to D3D Device
Definition at line 162 of file W3DWater.h.
|
protected |
water plane distance
Definition at line 142 of file W3DWater.h.
|
protected |
water plane normal
Definition at line 141 of file W3DWater.h.
|
protected |
render target for reflection
Definition at line 174 of file W3DWater.h.
|
protected |
Definition at line 222 of file W3DWater.h.
|
protected |
Definition at line 211 of file W3DWater.h.
|
protected |
Definition at line 210 of file W3DWater.h.
|
protected |
D3D handle to pixel shader.
Definition at line 215 of file W3DWater.h.
|
protected |
Definition at line 218 of file W3DWater.h.
|
protected |
Definition at line 219 of file W3DWater.h.
|
protected |
settings for each time of day
Definition at line 242 of file W3DWater.h.
|
protected |
shader or rendering state for heightmap
Definition at line 134 of file W3DWater.h.
|
protected |
box around level
Definition at line 175 of file W3DWater.h.
|
protected |
sort order after main scene is rendered
Definition at line 151 of file W3DWater.h.
|
protected |
time of day setting for reflected cloud layer
Definition at line 224 of file W3DWater.h.
|
protected |
handle to D3D vertex shader
Definition at line 216 of file W3DWater.h.
|
protected |
current texture offset on u axis
Definition at line 144 of file W3DWater.h.
|
protected |
texels per/ms scroll rate in u direction
Definition at line 146 of file W3DWater.h.
|
protected |
flag if clouds are on/off
Definition at line 149 of file W3DWater.h.
|
protected |
D3D vertex buffer.
Definition at line 163 of file W3DWater.h.
|
protected |
location to start writing vertices
Definition at line 165 of file W3DWater.h.
|
protected |
vertex lighting material
Definition at line 135 of file W3DWater.h.
|
protected |
current texture offset on v axis
Definition at line 145 of file W3DWater.h.
|
protected |
texels per/ms scroll rate in v direction
Definition at line 147 of file W3DWater.h.
|
protected |
Definition at line 213 of file W3DWater.h.
|
protected |
D3D handle to pixel shader.
Definition at line 214 of file W3DWater.h.
|
protected |
Definition at line 217 of file W3DWater.h.
|
protected |
object responsible for rendering water wakes
Definition at line 176 of file W3DWater.h.
|
protected |
type of water being used
Definition at line 150 of file W3DWater.h.
|
protected |
a texture containing only white used for NULL pixel shader stages.
Definition at line 212 of file W3DWater.h.