2016-04-20 05:44:08 +00:00
|
|
|
#ifndef __URDE_CFLUIDPLANE_HPP__
|
|
|
|
#define __URDE_CFLUIDPLANE_HPP__
|
|
|
|
|
2016-11-20 21:53:15 +00:00
|
|
|
#include "RetroTypes.hpp"
|
2017-08-06 07:15:42 +00:00
|
|
|
#include "CToken.hpp"
|
|
|
|
#include "Graphics/CTexture.hpp"
|
|
|
|
#include "CFluidUVMotion.hpp"
|
|
|
|
#include "zeus/CAABox.hpp"
|
|
|
|
#include "zeus/CFrustum.hpp"
|
|
|
|
|
2016-04-20 05:44:08 +00:00
|
|
|
namespace urde
|
|
|
|
{
|
2016-11-20 21:53:15 +00:00
|
|
|
class CFluidUVMotion;
|
|
|
|
class CRippleManager;
|
2017-03-30 22:36:18 +00:00
|
|
|
class CScriptWater;
|
|
|
|
class CStateManager;
|
2017-08-14 03:55:06 +00:00
|
|
|
class CRipple;
|
2016-04-20 05:44:08 +00:00
|
|
|
class CFluidPlane
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum class EFluidType
|
2016-11-20 21:53:15 +00:00
|
|
|
{
|
2017-08-08 06:03:57 +00:00
|
|
|
NormalWater,
|
|
|
|
PoisonWater,
|
|
|
|
Lava,
|
2017-08-16 05:34:02 +00:00
|
|
|
PhazonFluid,
|
2016-11-20 21:53:15 +00:00
|
|
|
Four,
|
2017-08-16 05:34:02 +00:00
|
|
|
ThickLava
|
2016-11-20 21:53:15 +00:00
|
|
|
};
|
|
|
|
|
2017-08-08 06:03:57 +00:00
|
|
|
protected:
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId x4_texPattern1Id;
|
|
|
|
CAssetId x8_texPattern2Id;
|
|
|
|
CAssetId xc_texColorId;
|
2017-08-06 07:15:42 +00:00
|
|
|
std::experimental::optional<TLockedToken<CTexture>> x10_texPattern1;
|
|
|
|
std::experimental::optional<TLockedToken<CTexture>> x20_texPattern2;
|
|
|
|
std::experimental::optional<TLockedToken<CTexture>> x30_texColor;
|
|
|
|
float x40_alpha;
|
2017-06-12 04:23:34 +00:00
|
|
|
EFluidType x44_fluidType;
|
2017-08-13 07:56:35 +00:00
|
|
|
float x48_rippleIntensity;
|
2017-08-06 07:15:42 +00:00
|
|
|
CFluidUVMotion x4c_uvMotion;
|
2017-08-14 03:55:06 +00:00
|
|
|
float ProjectRippleVelocity(float baseI, float velDot) const;
|
|
|
|
float CalculateRippleIntensity(float baseI) const;
|
2016-11-20 21:53:15 +00:00
|
|
|
public:
|
2017-08-13 08:19:33 +00:00
|
|
|
CFluidPlane(CAssetId texPattern1, CAssetId texPattern2, CAssetId texColor, float alpha,
|
|
|
|
EFluidType fluidType, float rippleIntensity, const CFluidUVMotion& motion);
|
2016-11-20 21:53:15 +00:00
|
|
|
|
2017-08-14 03:55:06 +00:00
|
|
|
// Called by CPlayer, CMorphBall, CWeapon, CPuddleSpore, CMagdolite
|
|
|
|
virtual void AddRipple(float mag, TUniqueId rippler, const zeus::CVector3f& center,
|
|
|
|
CScriptWater& water, CStateManager& mgr);
|
|
|
|
|
|
|
|
// Called by CAi
|
|
|
|
virtual void AddRipple(float intensity, TUniqueId rippler, const zeus::CVector3f& center,
|
|
|
|
const zeus::CVector3f& velocity, const CScriptWater& water, CStateManager& mgr,
|
|
|
|
const zeus::CVector3f& upVec);
|
|
|
|
|
|
|
|
virtual void AddRipple(const CRipple& ripple, const CScriptWater& water, CStateManager& mgr);
|
|
|
|
|
2017-08-08 06:03:57 +00:00
|
|
|
virtual void Render(const CStateManager& mgr, float alpha, const zeus::CAABox& aabb, const zeus::CTransform& xf,
|
2017-08-10 23:13:25 +00:00
|
|
|
const zeus::CTransform& areaXf, bool noNormals, const zeus::CFrustum& frustum,
|
2017-08-06 07:15:42 +00:00
|
|
|
const std::experimental::optional<CRippleManager>& rippleManager, TUniqueId waterId,
|
|
|
|
const bool* gridFlags, u32 gridDimX, u32 gridDimY, const zeus::CVector3f& areaCenter) const {}
|
2017-08-14 03:55:06 +00:00
|
|
|
|
2017-08-06 07:15:42 +00:00
|
|
|
float GetAlpha() const { return x40_alpha; }
|
2017-06-12 04:23:34 +00:00
|
|
|
EFluidType GetFluidType() const { return x44_fluidType; }
|
2017-08-06 07:15:42 +00:00
|
|
|
const CFluidUVMotion& GetUVMotion() const { return x4c_uvMotion; }
|
|
|
|
const CTexture& GetColorTexture() const { return **x30_texColor; }
|
|
|
|
bool HasColorTexture() const { return x30_texColor.operator bool(); }
|
|
|
|
const CTexture& GetTexturePattern1() const { return **x10_texPattern1; }
|
|
|
|
bool HasTexturePattern1() const { return x10_texPattern1.operator bool(); }
|
|
|
|
const CTexture& GetTexturePattern2() const { return **x20_texPattern2; }
|
|
|
|
bool HasTexturePattern2() const { return x20_texPattern2.operator bool(); }
|
2016-04-20 05:44:08 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CFLUIDPLANE_HPP__
|