Visual simulation library for ocean rendering.

Intersection tests with Triton

Triton allows you to query the height and surface normals of the ocean at any given position; this allows you to simulate floating object in your application consistently with Triton's waves.

In order to use intersection tests, you must create your Ocean object with the enableHeightTests parameter of Triton::Ocean::Create() set to true. By default, intersection tests are disabled, which allows Triton to avoid the performance hit of reading data back from the GPU on some systems.

With a properly constructed Triton::Ocean, simply call the Triton::Ocean::GetHeight() method at runtime to query the height and normal of the ocean surface at the intersection of a given ray and the ocean surface. For example:

    Triton::Vector3 testPos(0.0, 100.0, 0.0);
    Triton::Vector3 down(0.0, -1.0, 0.0);
    Triton::Vector3 normal;
    float height = 0;
    if (ocean && ocean->GetHeight(testPos, down, height, normal, true)) {
        // do something with the height at this point...

The height returned will be accurate to within one grid vertex of the ocean mesh.

 All Classes Files Functions Variables Friends