iWaveOcean
3ds Max ocean simulation plugin
Ambient Class Reference

#include <Ambient.h>

Inheritance diagram for Ambient:
Grid

Public Member Functions

 Ambient (float width, float length, int widthSegs, int lengthSegs, unsigned long rngSeed, float phaseDuration, float accelerationGravity)
 
void Simulate (float time, float speed, float direction, float scale, float waveSizeLimit, float desiredMaxHeight)
 
- Public Member Functions inherited from Grid
 Grid (float width, float length, int widthSegs, int lengthSegs)
 
 Grid (float width, float length, int widthSegs, int lengthSegs, float *vertexHeights)
 
float GetWidth () const
 
float GetLength () const
 
int GetWidthSegs () const
 
int GetLengthSegs () const
 
int GetWidthVertices () const
 
int GetLengthVertices () const
 
int GetTotalVertices () const
 
float * GetVertexHeights () const
 
void Clear ()
 

Static Public Attributes

static const float GRAVITY_METRIC = 9.81
 
static const float GRAVITY_US = 386.1
 

Additional Inherited Members

- Protected Attributes inherited from Grid
const float _width
 
const float _length
 
const int _widthSegs
 
const int _lengthSegs
 
const int _widthVtex
 
const int _lengthVtex
 
float * _vertices
 

Detailed Description

A class that simulates ocean waves at a given time using Tessendorf's wave equations and the FFT method. The equations referenced by the documentation comments are those in "Simulating Ocean Waves", (c) 1999-2001 Jerry Tessendorf (SIGGRAPH Course Notes 2002). This class assumes the 3ds Max coordinate system, i.e. X- and Y-axes are in the horizontal plane and the Z-axis goes up and down.

Constructor & Destructor Documentation

Ambient::Ambient ( float  width,
float  length,
int  widthSegs,
int  lengthSegs,
unsigned long  rngSeed,
float  phaseDuration,
float  accelerationGravity 
)

Creates a new Tessendorf wave simulation at a specified time, given the specified parameters.

Parameters
widththe width along the X-axis
lengththe length along the Y-axis
widthSegsthe number of faces along the X-axis
lengthSegsthe number of faces along the Y-axis
rngSeedseed for the pseudorandom number generator
phaseDurationduration of one phase (in s)
accelerationGravityacceleration due to gravity; e.g. if using metric units, 9.8 m/s^2 and if using US customary, 386.1 in/s^2

Member Function Documentation

void Ambient::Simulate ( float  time,
float  speed,
float  direction,
float  scale,
float  waveSizeLimit,
float  desiredMaxHeight 
)

Generates the wave surface and performs Fast Fourier Transforms (FFTs) to calculate the displacement.

Parameters
timetime (in s)
speedwind speed (in distance/s)
directiondirection of wind
scalesimulated length of plane along X-axis; Y-scale is automatically generated from this value
waveSizeLimitsize limit that waves must surpass to be rendered
desiredMaxHeightheight of the tallest wave

Member Data Documentation

const float Ambient::GRAVITY_METRIC = 9.81
static

The constant g in m/s^2.

const float Ambient::GRAVITY_US = 386.1
static

Gravity in America. (Just kidding – it's the constant g in in/s^2.)


The documentation for this class was generated from the following files: