Visual simulation library for ocean rendering.
Applying decals to the water surface

Triton has the ability to apply decal textures to the water surface, which will appear to float on the water.

For example, you could provide Triton with a texture representing an oil film, and apply it over the water at a given location to create an oil slick effect.

Decal textures may be scaled and their blending adjusted at runtime.

Use the Triton::Ocean::AddDecal() method to add a decal to the water surface. You must pass it a texture to use for the decal, the original size of the decal, and its position on the water surface.

For example:

Triton::DecalHandle myDecal = ocean->AddDecal((Triton::TextureHandle)(openGLTextureID), 10.0f, Vector3(20.0, 0, 0));

will create a decal using a texture you previously loaded (indicated by openGLTextureID), that is 10 meters wide and deep, centered at (20, 0, 0). The TextureHandle given to AddDecal should be a GLuint, LPDIRECT3DTEXTURE9, or ID3D11ShaderResourceView* depending on whether you are using OpenGL, DirectX9, or DirectX11 respectively.

Triton::Ocean::ScaleDecal() and Triton::Ocean::SetDecalAlpha() may be used at runtime to adjust the decal, using the DecalHandle returned by AddDecal().

If the decal is no longer needed, use Triton::Ocean::RemoveDecal() to remove it from the scene. Decals do incur a performance cost, and should be used sparingly.

Note that using decals when rendering your own water geometry with Triton::Ocean::SetPatchShader() will require a second pass. See Rendering User-Defined Patches of Geometry for more information.