|
Public Member Functions |
| RayCaster (Data &aData, Gradient &aGradient, Size s=Size(1, 1), Color bgColor=Color(0, 0, 0, 255), RenderMode renderMode=RM_FrontToBack, InterpolationMode interpolationMode=IM_NearestNeighbour) |
| ~RayCaster () |
void | setViewerPosition (const Vector<> &A, const Vector<> &B, const Vector<> &C) |
void | setImageSize (const Size &s) |
virtual Color | getPixelColor (unsigned int x, unsigned int y) |
| Gets the color of a specified screen pixel.
|
virtual Size | getImageSize () const |
| Gets the intrinsic size of the image per the current settings.
|
virtual void | render (unsigned char *buffer) |
| Render the image into a provided buffer, in RGBA (native-endian) format.
|
void | setRenderMode (RenderMode newRenderMode) |
RenderMode | getRenderMode () const |
void | setInterpolationMode (InterpolationMode newInterpolationMode) |
InterpolationMode | getInterpolationMode () const |
void | setBGColor (Color newBGColor) |
Color | getBGColor () const |
void | setSampleRate (float newRate) |
float | getSampleRate () const |
void | enableLighting () |
void | disableLighting () |
bool | isLightingEnabled () const |
Lighting * | lighting () |
Protected Member Functions |
Color | applyTransferFunctions (unsigned short aDataValue, const Vector<> &gradient) const |
Private Member Functions |
void | calcVectors () |
std::auto_ptr< Vector<> > | intersectRayWithNearestPlane (const Vector<> &startPos, const Vector<> &direction) const |
| Calculates the position where our viewing ray leaves the box of mData (if any).
|
std::auto_ptr< Vector<> > | intersectRayWithFarthestPlane (const Vector<> &startPos, const Vector<> &direction) const |
unsigned short | getDataAt (float x, float y, float z) const |
| Gets the data at the specified float position.
|
unsigned short | getDataTrilinearInterpolated (float x, float y, float z) |
Vector | getGradientAt (float x, float y, float z) const |
Vector | getGradientTrilinearInterpolated (float x, float y, float z) |
Color | getPixelColor_FrontToBack (unsigned int x, unsigned int y) |
Color | getPixelColor_BackToFront (unsigned int x, unsigned int y) |
void | render_FrontToBack (unsigned char *buffer) |
void | render_BackToFront (unsigned char *buffer) |
void | compositeBackToFront (Color &dest, const Color &src) |
| Composites one color onto another.
|
void | compositeFrontToBack (Color &dest, const Color &src) |
Private Attributes |
Data & | mData |
Gradient & | mGradient |
Size | mImageSize |
Vector | mTopLeft |
Vector | mTopRight |
Vector | mLowerRight |
Vector | mViewingDirection |
Vector | mRightVec |
Vector | mDownVec |
Lighting | mLighting |
Color | mBGColor |
RenderMode | mRenderMode |
InterpolationMode | mInterpolationMode |
float | mSampleRate |
bool | mEnableLighting |
const Vector | mMaxDataVector |
const Plane | mFrontPlane |
const Plane | mBackPlane |
const Plane | mTopPlane |
const Plane | mBottomPlane |
const Plane | mLeftPlane |
const Plane | mRightPlane |
It is constructed using a reference to a data class, which has to outlive the renderer.
The viewing rectangle is specified using three points (A, B, C, as indicated in the ASCII art below). The viewing vector is calculated automatically as the cross product of two vectors of the sides of the rect.