Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

DisplacementMap Class Reference

#include <dispmap.h>

List of all members.

Public Member Functions

void clear ()
 DisplacementMap (int w, int h)
void generate (DisplacementMapFunc func, void *info=NULL)
float getDisplacement (int x, int y) const
int getHeight () const
int getWidth () const
void setDisplacement (int x, int y, float d)
 ~DisplacementMap ()

Private Attributes

float * disp
int height
int width


Constructor & Destructor Documentation

DisplacementMap::DisplacementMap int  w,
int  h
 

Definition at line 13 of file dispmap.cpp.

References disp, height, and width.

00013                                              :
00014     width(w), height(h), disp(NULL)
00015 {
00016     disp = new float[width * height];
00017 }

DisplacementMap::~DisplacementMap  ) 
 

Definition at line 19 of file dispmap.cpp.

References disp.

00020 {
00021     if (disp != NULL)
00022         delete[] disp;
00023 }


Member Function Documentation

void DisplacementMap::clear  ) 
 

Definition at line 26 of file dispmap.cpp.

References disp, height, and width.

00027 {
00028     int size = width * height;
00029     for (int i = 0; i < size; i++)
00030         disp[i] = 0.0f;
00031 }

void DisplacementMap::generate DisplacementMapFunc  func,
void *  info = NULL
 

Definition at line 34 of file dispmap.cpp.

References disp, height, and width.

00035 {
00036     for (int i = 0; i < height; i++)
00037     {
00038         for (int j = 0; j < width; j++)
00039         {
00040             disp[i * width + j] = func((float) j / (float) width,
00041                                        (float) i / (float) height, info);
00042         }
00043     }
00044 }

float DisplacementMap::getDisplacement int  x,
int  y
const [inline]
 

Definition at line 40 of file dispmap.h.

References disp, and width.

00041 {
00042     return disp[y * width + x];
00043 }

int DisplacementMap::getHeight  )  const [inline]
 

Definition at line 25 of file dispmap.h.

References height.

00025 { return height; };

int DisplacementMap::getWidth  )  const [inline]
 

Definition at line 24 of file dispmap.h.

References width.

00024 { return width; };

void DisplacementMap::setDisplacement int  x,
int  y,
float  d
[inline]
 

Definition at line 45 of file dispmap.h.

References disp, and width.

00046 {
00047     disp[y * width + x] = d;
00048 }


Member Data Documentation

float* DisplacementMap::disp [private]
 

Definition at line 34 of file dispmap.h.

Referenced by clear(), DisplacementMap(), generate(), getDisplacement(), setDisplacement(), and ~DisplacementMap().

int DisplacementMap::height [private]
 

Definition at line 33 of file dispmap.h.

Referenced by clear(), DisplacementMap(), generate(), and getHeight().

int DisplacementMap::width [private]
 

Definition at line 32 of file dispmap.h.

Referenced by clear(), DisplacementMap(), generate(), getDisplacement(), getWidth(), and setDisplacement().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:17 2006 for Celestia by  doxygen 1.4.1