WaterWaves Class Reference

#include <WaterWaves.h>

List of all members.

Public Member Functions

 WaterWaves ()
virtual ~WaterWaves ()
void generateWaves (float waterHeight, ProgressCounter *counter=0)
void draw (Water2Patches &currentPatch)
void simulate (float frameTime)

Protected Member Functions

void findPoints (WaterWaveContext *context, float waterHeight, ProgressCounter *counter)
bool findNextPath (WaterWaveContext *context, float waterHeight, ProgressCounter *counter)
void findPath (WaterWaveContext *context, std::vector< Vector > &points, int x, int y, ProgressCounter *counter)
void constructLines (WaterWaveContext *context, float waterHeight, std::vector< Vector > &points)
void drawBoxes (Water2Patches &currentPatch, float totalTime, Vector &windDir, std::vector< WaterWaveEntry > &paths)

Protected Attributes

GLTexture wavesTexture1_
GLTexture wavesTexture2_
Vector wavesColor_
std::vector
< WaterWaveEntry
paths1_
std::vector
< WaterWaveEntry
paths2_
float totalTime_

Classes

struct  WaterWaveContext
struct  WaterWaveEntry


Detailed Description

Definition at line 30 of file WaterWaves.h.


Constructor & Destructor Documentation

WaterWaves::WaterWaves (  ) 

Definition at line 35 of file WaterWaves.cpp.

WaterWaves::~WaterWaves (  )  [virtual]

Definition at line 42 of file WaterWaves.cpp.


Member Function Documentation

void WaterWaves::generateWaves ( float  waterHeight,
ProgressCounter counter = 0 
)

Definition at line 46 of file WaterWaves.cpp.

References GLTexture::create(), findNextPath(), findPoints(), S3D::getDataFile(), ScorchedContext::getLandscapeMaps(), ScorchedClient::instance(), OptionsDisplay::instance(), LANG_RESOURCE, ImageFactory::loadAlphaImageHandle(), WaterWaves::WaterWaveContext::mapHeight, WaterWaves::WaterWaveContext::mapWidth, paths1_, paths2_, WaterWaves::WaterWaveContext::pointCount, WaterWaves::WaterWaveContext::pointsHeight, WaterWaves::WaterWaveContext::pointsMult, WaterWaves::WaterWaveContext::pointsWidth, WaterWaves::WaterWaveContext::removedCount, ProgressCounter::setNewOp(), WaterWaves::WaterWaveContext::wavePoints, wavesTexture1_, and wavesTexture2_.

Referenced by Water::generate().

void WaterWaves::draw ( Water2Patches currentPatch  ) 

Definition at line 271 of file WaterWaves.cpp.

References FixedVector::asVector(), GLState::BLEND_ON, GLTexture::draw(), drawBoxes(), ScorchedContext::getOptionsTransient(), OptionsTransient::getWindDirection(), GL_FALSE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_TRUE, glBlendFunc(), glDepthMask(), ScorchedClient::instance(), Vector::Normalize(), paths1_, paths2_, GLState::TEXTURE_ON, totalTime_, wavesTexture1_, and wavesTexture2_.

Referenced by Water2Renderer::draw().

void WaterWaves::simulate ( float  frameTime  ) 

Definition at line 265 of file WaterWaves.cpp.

References totalTime_.

Referenced by Water::simulate().

void WaterWaves::findPoints ( WaterWaveContext context,
float  waterHeight,
ProgressCounter counter 
) [protected]

Definition at line 90 of file WaterWaves.cpp.

References ScorchedContext::getLandscapeMaps(), ScorchedClient::instance(), WaterWaves::WaterWaveContext::pointCount, WaterWaves::WaterWaveContext::pointsHeight, WaterWaves::WaterWaveContext::pointsMult, WaterWaves::WaterWaveContext::pointsWidth, ProgressCounter::setNewPercentage(), and WaterWaves::WaterWaveContext::wavePoints.

Referenced by generateWaves().

bool WaterWaves::findNextPath ( WaterWaveContext context,
float  waterHeight,
ProgressCounter counter 
) [protected]

Definition at line 142 of file WaterWaves.cpp.

References constructLines(), findPath(), WaterWaves::WaterWaveContext::pointsHeight, WaterWaves::WaterWaveContext::pointsWidth, and WaterWaves::WaterWaveContext::wavePoints.

Referenced by generateWaves().

void WaterWaves::findPath ( WaterWaveContext context,
std::vector< Vector > &  points,
int  x,
int  y,
ProgressCounter counter 
) [protected]

Definition at line 163 of file WaterWaves.cpp.

References WaterWaves::WaterWaveContext::pointCount, WaterWaves::WaterWaveContext::pointsHeight, WaterWaves::WaterWaveContext::pointsMult, WaterWaves::WaterWaveContext::pointsWidth, WaterWaves::WaterWaveContext::removedCount, ProgressCounter::setNewPercentage(), and WaterWaves::WaterWaveContext::wavePoints.

Referenced by findNextPath().

void WaterWaves::constructLines ( WaterWaveContext context,
float  waterHeight,
std::vector< Vector > &  points 
) [protected]

Definition at line 203 of file WaterWaves.cpp.

References Vector::get2DPerp(), getHeight(), ScorchedClient::instance(), int(), WaterWaves::WaterWaveContext::mapHeight, WaterWaves::WaterWaveContext::mapWidth, Vector::Normalize2D(), paths1_, paths2_, WaterWaves::WaterWaveEntry::perp, WaterWaves::WaterWaveEntry::ptA, WaterWaves::WaterWaveEntry::ptB, WaterWaves::WaterWaveEntry::ptC, WaterWaves::WaterWaveEntry::ptD, and RAND.

Referenced by findNextPath().

void WaterWaves::drawBoxes ( Water2Patches currentPatch,
float  totalTime,
Vector windDir,
std::vector< WaterWaveEntry > &  paths 
) [protected]

Definition at line 297 of file WaterWaves.cpp.

References GLInfo::addNoTriangles(), Water2Patches::getPoint(), GL_QUADS, glBegin(), glColor4f(), glEnd(), glTexCoord2f(), glVertex3fv(), WaterWaves::WaterWaveEntry::perp, WaterWaves::WaterWaveEntry::ptC, WaterWaves::WaterWaveEntry::ptD, wavesColor_, and Water2Patch::Data::z.

Referenced by draw().


Member Data Documentation

GLTexture WaterWaves::wavesTexture1_ [protected]

Definition at line 61 of file WaterWaves.h.

Referenced by draw(), and generateWaves().

GLTexture WaterWaves::wavesTexture2_ [protected]

Definition at line 62 of file WaterWaves.h.

Referenced by draw(), and generateWaves().

Vector WaterWaves::wavesColor_ [protected]

Definition at line 63 of file WaterWaves.h.

Referenced by drawBoxes().

std::vector<WaterWaveEntry> WaterWaves::paths1_ [protected]

Definition at line 65 of file WaterWaves.h.

Referenced by constructLines(), draw(), and generateWaves().

std::vector<WaterWaveEntry> WaterWaves::paths2_ [protected]

Definition at line 66 of file WaterWaves.h.

Referenced by constructLines(), draw(), and generateWaves().

float WaterWaves::totalTime_ [protected]

Definition at line 67 of file WaterWaves.h.

Referenced by draw(), and simulate().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:08 2009 for Scorched3D by  doxygen 1.5.3