15%
import "Environment.h"
16%pointer_functions(
float, floatp);
17%array_functions(
double, double_array )
18SWIG_CSBODY_PROXY(
public,
public, SWIGTYPE)
19SWIG_CSBODY_TYPEWRAPPER(
public,
public,
public, SWIGTYPE)
22using namespace Triton;
38class ParticleSystemManager;
44class WaterModelInitializationParams;
60 , WAKE_SPRAY_PARTICLES
76 float real, imaginary;
109 bool enableBreakingWaves =
false,
OceanQuality quality = GOOD);
144 bool enableHeightTests =
false,
bool enableBreakingWaves =
false,
OceanQuality quality = GOOD);
182 virtual void TRITONAPI
Draw(
double time,
bool depthWrites =
true,
bool drawWater =
true,
bool drawParticles =
true,
void* context = 0,
const Camera* camera = 0);
226 virtual void TRITONAPI
DrawConcurrent(
double time,
bool depthWrites =
true,
bool drawWater =
true,
bool drawParticles =
true,
void* context = 0,
const Camera* camera = 0);
294 virtual bool TRITONAPI
SetPatchShader(
double time,
int vertexStride,
int positionOffset,
bool doublePrecisionVertices,
295 const double *modelMatrix = 0,
bool decalPass =
false,
void* context = 0,
const Camera* camera = 0);
329 virtual void TRITONAPI
UnsetPatchShader(
double time = 0.0,
const TBoundingBox* patchBounds = 0,
bool decalPass =
false,
void* context = 0,
const Camera* camera = 0);
338 virtual bool ReloadShaders(
const TRITON_VECTOR(
unsigned int)& shaders,
bool reloadSurface =
true,
339 bool reloadWakes =
true,
bool reloadSprays =
true,
bool reloadDecals =
true,
bool reloadGodRays =
true);
470 WakeManager * TRITONAPI GetWakeManager() {
475 DecalManager * TRITONAPI GetDecalManager() {
564 bool visualCorrelation =
true,
bool includeWakes =
true,
bool highResolution =
true,
565 bool threadSafe =
true,
Vector3 *intersectionPoint = 0,
bool autoFlip =
true,
const Camera* camera = 0);
622 TRITON_VECTOR(
Vector3)& normals, TRITON_VECTOR(
Vector3)& intersectionPoints,
623 bool visualCorrelation =
true,
bool includeWakes =
true,
bool highResolution =
true,
624 bool threadSafe =
true,
bool autoFlip =
true,
const Camera* camera = 0);
662 double precision = 0.1,
bool visualCorrelation =
true,
bool threadSafe =
true,
663 const Camera* camera = 0);
774 enableGodRays = enable;
779 return godRays != 0 && enableGodRays;
864 bool TRITONAPI GetRotorWashUseDecals(
void)
const;
886 void EnvironmentDeleted();
887 void NotifySwellsChanged();
888 void SetConfused(
bool);
890 GodRays *GetGodRays()
const {
return godRays; }
891 const TRITON_VECTOR(
unsigned int)& GetUserShaders()
const {
return userShaders;}
892 ProjectedGrid* GetProjectedGrid()
const {
return grid;}
894 typedef void(*GETOCEANHEIGHTPROC)(
const Vector3& point,
Vector3& normal,
float& height);
896 void TRITONAPI SetOceanHeightCB(GETOCEANHEIGHTPROC _oceanHeightCB) {
897 oceanHeightCB = _oceanHeightCB;
900 GETOCEANHEIGHTPROC TRITONAPI GetOceanHeightCB()
const {
901 return oceanHeightCB;
909 virtual bool CreateWaterSimulation();
910 void DestroyWaterSimulation();
912 void SetWaveHeading(
const Camera* camera);
914 void DrawInternal(
double time,
bool depthWrites,
bool drawWater,
bool drawParticles,
void* context,
const Camera* camera,
bool respectThreadSafe,
bool respectAvoidStalls);
916 bool isGlobal, initialized, heightReadsEnabled, enableGodRays;
922 WakeManager *wakeManager;
924 SprayManager *sprayManager;
926 DecalManager *decalManager;
932 bool sprayEnabled, enableKelvin;
934 double dampingDistance;
938 bool simulationUpdated;
942 double lastUpdateTime;
945 double timeAdjustment;
953 TRITON_VECTOR(
unsigned int) userShaders;
955 bool hasBreakingWaves, linearEnabled;
959 GETOCEANHEIGHTPROC oceanHeightCB;
961 WaterModelInitializationParams* watermodelparams;
963 double cameraMotionThreshold;
965 void createAndInitializeFallbackWaterModel(
void);
The public interface for setting Triton's environmental parameters.
Triton's Ocean model interface.
OceanQuality
Enumerates the ocean quality settings used in Ocean::SetQuality()
Definition: Ocean.h:66
WaterModelTypes
Enumerates the different water models available for simluating ocean waves.
Definition: Ocean.h:48
@ JONSWAP
An FFT-powered Pierson-Moskowitz wave spectrum.
Definition: Ocean.h:51
@ UNKNOWN_WATERMODEL
The most accurate wave model, which takes wind fetch length into account.
Definition: Ocean.h:52
@ PIERSON_MOSKOWITZ
Tessendorf's ocean wave model with the Phillips wave spectrum, using fast Fourier transforms to simul...
Definition: Ocean.h:50
Shaders
Enumerates the different shader programs used internally by Triton.
Definition: Ocean.h:56
An object that generates rotor wash wave and spray effects.
An object that generates a static wake wave in a given direction, such as that generated by a buoy in...
int ShaderHandle
A renderer-agnostic handle for a shader.
Definition: TritonCommon.h:54
void * DecalHandle
A renderer-agnostic handle for a decal.
Definition: TritonCommon.h:58
int TextureHandle
A renderer-agnostic handle for a texture.
Definition: TritonCommon.h:56
An object that generates a ship Kelvin wake as it moves.
Triton's public interface for specifying the camera properties.
Definition: Camera.h:37
Triton's public interface for specifying the environmental conditions and camera properties.
Definition: Environment.h:214
A simple 3x3 matrix class and its operations.
Definition: Matrix3.h:30
An implementation of a 4x4 matrix and some simple operations on it.
Definition: Matrix4.h:30
This base class for all Triton objects intercepts the new and delete operators, routing them through ...
Definition: MemAlloc.h:71
The Ocean class allows you to configure and draw Triton's water simulation.
Definition: Ocean.h:81
void TRITONAPI SetClipDistances(double nearClip, double farClip)
Tells Triton about the projected Z values at your near and far clipping planes.
static Ocean *TRITONAPI Create(Environment *env, const TRITON_VECTOR(unsigned int)&userShaders, WaterModelTypes type=JONSWAP, bool enableHeightTests=false, bool enableBreakingWaves=false, OceanQuality quality=GOOD)
Creates an Ocean instance tied to the given Environment, using additional user-supplied OpenGL shader...
bool TRITONAPI GetBatchHeight(const TRITON_VECTOR(Vector3) points, const TRITON_VECTOR(Vector3) directions, TRITON_VECTOR(float)&heights, TRITON_VECTOR(Vector3)&normals, TRITON_VECTOR(Vector3)&intersectionPoints, bool visualCorrelation=true, bool includeWakes=true, bool highResolution=true, bool threadSafe=true, bool autoFlip=true, const Camera *camera=0)
This is a batch version of Triton::Ocean::GetHeight(), which will avoid stalling the OpenGL pipeline ...
void TRITONAPI EnableGodRays(bool enable)
Turns the underwater crepuscular rays effect on or off.
Definition: Ocean.h:773
void TRITONAPI RemoveDecal(DecalHandle decal)
Removes a decal texture previously applied with AddDecal().
virtual bool TRITONAPI IsCameraAboveWater(const Camera *camera=0)
Returns whether the current camera position (from Environment::SetCameraMatrix()) is above the simula...
void TRITONAPI SetLinearColorSpace(bool linearOn)
Sets use of linear color space, in which the ocean color will be raised to the power of 2....
void TRITONAPI Unlock()
Explicitly locks the ocean's mutex previously locked by Ocean::Lock().
void TRITONAPI GetClipDistances(double &nearClip, double &farClip) const
Retrieves Triton's current assumptions about the projected Z values at your near and far clipping pla...
void TRITONAPI ClearFFTInputArray()
Stops using an overridden FFT wave input array as defined in Environment::OverrideFFTInputArray.
virtual void TRITONAPI DrawConcurrent(double time, bool depthWrites=true, bool drawWater=true, bool drawParticles=true, void *context=0, const Camera *camera=0)
Draws an infinite ocean surrounding the camera (as specified in the Environment object) for the simul...
void TRITONAPI ScaleDecal(DecalHandle decal, float scaleWidth, float scaleDepth)
Scales an existing decal in width and depth at runtime.
void TRITONAPI MoveDecal(DecalHandle decal, const Vector3 &position)
Moves an existing decal to the given location.
void TRITONAPI SetDepthOffset(float offset)
Applies a depth offset to the water, applied in the vertex program.
void TRITONAPI RotateDecal(DecalHandle decal, double radians)
Rotates an existing decal by the given amount in radians.
bool TRITONAPI SprayEnabled() const
Returns if spray particle effects on breaking waves are enabled, which they are by default.
Definition: Ocean.h:690
void TRITONAPI EnableSpray(bool enable)
Enables or disables spray particle effects on breaking waves.
float TRITONAPI GetDepthOffset() const
Retrieves the depth offset (if any) previously set via Triton::Ocean::SetDepthOffset(),...
bool TRITONAPI GetHeight(const Vector3 &point, const Vector3 &direction, float &height, Vector3 &normal, bool visualCorrelation=true, bool includeWakes=true, bool highResolution=true, bool threadSafe=true, Vector3 *intersectionPoint=0, bool autoFlip=true, const Camera *camera=0)
Retrieves the height and normal of the ocean surface at the intersection point of the given ray.
void TRITONAPI SetReflectionScale(float reflectionScale)
Scales the intensity of reflections on the water (environment, planar, and light reflections combined...
OceanQuality TRITONAPI GetQuality() const
Retrieve the current simulation quality setting, either set by Ocean::SetQuality() or the default val...
Definition: Ocean.h:803
float TRITONAPI GetChoppiness() const
Retrieves the choppiness setting of the Ocean, which controls how peaked the waves are.
virtual void TRITONAPI Draw(double time, bool depthWrites=true, bool drawWater=true, bool drawParticles=true, void *context=0, const Camera *camera=0)
Draws an infinite ocean surrounding the camera (as specified in the Environment object) for the simul...
void TRITONAPI SetQuality(OceanQuality quality)
Set a quality setting (GOOD, BETTER, or BEST.) Higher quality will result in finer wave resolution,...
bool TRITONAPI GetWavesIntersection(const Vector3 &point, const Vector3 &direction, Vector3 &normal, Vector3 &intersectionPoint, double precision=0.1, bool visualCorrelation=true, bool threadSafe=true, const Camera *camera=0)
Retrieves an intersection between a ray and the ocean surface, taking waves and wakes into account.
virtual bool TRITONAPI SetPatchMatrix(const double *modelMatrix, void *context=0, const Camera *camera=0)
If you are drawing many of your own water meshes using SetPatchShader() at once, it will be much fast...
void TRITONAPI SetRotorWashUseDecals(bool useDecals)
Toggle rotor wash decals at run time.
float TRITONAPI GetReflectionScale() const
Retrieves any reflection scale set previously by SetReflectionScale(), or 1.0 otherwise.
void TRITONAPI SetDepth(float depth, const Triton::Vector3 &floorNormal, const Camera *camera=0)
Sets the simulated depth of the water in world units at the camera position, and the slope of the sea...
bool TRITONAPI OverrideFFTInputArray(const TritComplex *H0, unsigned int size)
Explicitly overrides the H0 input array of wave amplitudes for given wavelengths and directions,...
static Ocean *TRITONAPI Create(Environment *env, WaterModelTypes type=JONSWAP, bool enableHeightTests=false, bool enableBreakingWaves=false, OceanQuality quality=GOOD)
Creates an Ocean instance tied to the given Environment, using the specified wave model.
void TRITONAPI EnableWireframe(bool wireframeOn)
Enables or disables wireframe rendering of the ocean's mesh.
virtual bool TRITONAPI SetPatchShader(double time, int vertexStride, int positionOffset, bool doublePrecisionVertices, const double *modelMatrix=0, bool decalPass=false, void *context=0, const Camera *camera=0)
Sets the shaders and state necessary for rendering a user-provided patch of geometry as water.
void TRITONAPI PostDrawConcurrent()
Method that must be called from the main thread after all Ocean::DrawConcurrent calls have completed ...
WaterModelTypes TRITONAPI GetWaterModel(void) const
Get the underlying water model.
const char *TRITONAPI GetFFTName() const
Returns a description of the FFT transform being used, if a FFT water model is active.
bool TRITONAPI GetLinearColorSpace() const
Gets whether linear color space rendering is enabled via SetLinearColorSpace().
virtual bool Initialize(void *context, const Camera *camera)
In OpenGL, this must be called with each set of context and camera that you intend to render with See...
const Vector3 &TRITONAPI GetRefractionColor() const
Returns the color of light refracted into the water.
float TRITONAPI GetGodRaysFade() const
Returns the god ray fading amount set in Ocean::FadeGodRays().
const Environment *TRITONAPI GetEnvironment() const
Retrieves the environment this ocean is attached to.
Definition: Ocean.h:747
void TRITONAPI SetRefractionColor(const Vector3 &refractionColor)
Modifies the color used for refracted light rays that go into deep water.
float TRITONAPI GetWaveHeading() const
Retrieves the wave direction.
Definition: Ocean.h:679
virtual void TRITONAPI UpdateSimulation(double time, const Camera *camera=0)
Updates the underlying wave simulation; calling this is optional and only necessary if you wish to pe...
bool TRITONAPI GetIntersection(const Vector3 &point, const Vector3 &direction, Vector3 &intersection, const Camera *camera=0)
Retrieves the intersection, if any, between a ray and the ocean surface.
unsigned int TRITONAPI GetNumTriangles() const
Returns the number of triangles rendered by the underlying projected grid.
float TRITONAPI GetPlanarReflectionBlend() const
Retrieves the current blend percentage for planar reflections.
void TRITONAPI SetGodRaysFade(float fadeAmount)
Fades out the underwater crepuscular rays effect by the specified amount (0 = no fading,...
void TRITONAPI Lock()
Explicitly locks the mutex used to ensure thread safety between the draw, update, and height query me...
void TRITONAPI SetDecalAlpha(DecalHandle decal, float alpha)
Sets a decal's alpha blending amount (default is 1.0.)
double TRITONAPI GetMaximumWavePeriod() const
Retrieves the maximum wave period enforced regardless of wind conditions requested.
DecalHandle TRITONAPI AddDecal(TextureHandle texture, float size, const Vector3 &position)
Applies a decal texture to the dynamic ocean surface, useful for effects involving films,...
virtual ~Ocean()
Virtual destructor.
virtual void TRITONAPI UnsetPatchShader(double time=0.0, const TBoundingBox *patchBounds=0, bool decalPass=false, void *context=0, const Camera *camera=0)
Restores the graphics state prior to a previous call to Ocean::SetPatchShader().
void TRITONAPI SetMaximumWavePeriod(double maxPeriod)
Sets a maximum wave period in the simulated wave spectra, irrespective of the wind conditions request...
void TRITONAPI SetPlanarReflectionBlend(float blendPercent)
Sets the prominence of planar reflections on this ocean surface, if one was set using Triton::Environ...
virtual bool ReloadShaders(const TRITON_VECTOR(unsigned int)&shaders, bool reloadSurface=true, bool reloadWakes=true, bool reloadSprays=true, bool reloadDecals=true, bool reloadGodRays=true)
OpenGL only: Reload the underlying shader programs, linking in a new list of user-supplied shader obj...
ShaderHandle TRITONAPI GetShaderObject(Shaders shaderProgram, void *context=0, const Camera *camera=0) const
Retrieves an underlying shader object used to render the water.
void TRITONAPI SetWaterModel(WaterModelTypes waterModel)
Change the water model at run time.
void TRITONAPI SetLoopingPeriod(float loopingPeriod)
Set the looping period of the Ocean, which define time after which wave simulation repeats.
void TRITONAPI SetChoppiness(float chop)
Set the choppiness of the waves, which controls how peaked the waves are.
void TRITONAPI D3D9DeviceReset()
DirectX9 users must call D3D9DeviceReset() in response to device resets done in response to lost devi...
void TRITONAPI D3D9DeviceLost()
DirectX9 users must call D3D9DeviceLost() in response to lost devices, prior to resetting the device.
float TRITONAPI GetDepth(Triton::Vector3 &floorNormal, const Camera *camera=0) const
Retrieves the simulated depth of the water in world units, and the surface normal of the sea floor,...
bool TRITONAPI GodRaysEnabled() const
Returns whether the underwater crepuscular rays effect is enabled.
Definition: Ocean.h:778
double TRITONAPI GetDisplacementDampingDistance() const
Retrieves the distance at which 3D wave displacements are dampened to prevent aliasing when moving th...
bool TRITONAPI ComputeReflectionMatrices(Matrix4 &reflectionMatrix, Matrix3 &textureMatrix, const Camera *camera=0)
A helper function for using planar reflections with Triton.
float TRITONAPI GetLoopingPeriod() const
Retrieves the looping period of the Ocean, which define time after which wave simulation repeats.
void TRITONAPI SetDisplacementDampingDistance(double distance)
Sets the distance at which 3D wave displacements are dampened to prevent aliasing when moving the cam...
A RotorWash object will generate spray and circular waves on the ocean surface in the direction it is...
Definition: RotorWash.h:37
An static wake pointing in a given direction at a fixed location, for example from a buoy or bridge p...
Definition: TidalStreamWake.h:35
A structure describing a complex number, for use in Environment::OverrideFFTInputArray.
Definition: Ocean.h:74
A 3D double-precision Vector class and its operations.
Definition: Vector3.h:36
A WakeGenerator represents an object on the water that generates a wake as it moves,...
Definition: WakeGenerator.h:132