DXGfxLib.Billboard Class Reference

Billboards are texture quad always watching the camera. They are some time useful as impostors when you don't want to render a very complex object. Texture displayed by billboard should have an alpha channel in order not to occlude everything behind. The library will sort them approiately from back to front before rendering them with alpha. This class inherits from TexturedPlane, main differences are that TexturePlanes don't always look at the camera and are not necessarily rendered using alpha blending. More...

Inherits DXGfxLib::TexturedPlane, and DXGfxLib::TexturedPlane.

Collaboration diagram for DXGfxLib.Billboard:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Billboard (Device d3ddevice, int width, int heigth, int numVertX, int numVertZ, string texturefile)
 In order to create a billboard instance we want the device to which it will be associated, its dimension the number or vertices to put along each dimension and the file name of the texture to use.
 Billboard (Device d3ddevice, Billboard srcBillBoard)
 This construction creates a billboard from another billboard.
override int CompareTo (Object obj)
 Billboards need to be sorted back to front, this method will be used by our sorted list to determine where a specific billboard instance should be put in the list.
override void Update (Frustrum frustrum, double appTime, float elapsedTime)
 The usual upadte method implemented by each SceneObject or derived class. For the Billboard this method is used to position the billboard facing the camera. When you instanciate a billboard you need to either add it to the scene or to call this method yourself. If neither is done it is not ensured the billboard will face the camera nor that its distance to the frustrum near plane is computed which might result in very strange visual effects (and most probably unwanted).
override void Draw (Device device)
 The usual draw method.
 Billboard (Device d3ddevice, int width, int heigth, int numVertX, int numVertZ, string texturefile)
 In order to create a billboard instance we want the device to which it will be associated, its dimension the number or vertices to put along each dimension and the file name of the texture to use.
 Billboard (Device d3ddevice, Billboard srcBillBoard)
 This construction creates a billboard from another billboard.
override int CompareTo (Object obj)
 Billboards need to be sorted back to front, this method will be used by our sorted list to determine where a specific billboard instance should be put in the list.
override void Update (Frustrum frustrum, double appTime, float elapsedTime)
 The usual upadte method implemented by each SceneObject or derived class. For the Billboard this method is used to position the billboard facing the camera. When you instanciate a billboard you need to either add it to the scene or to call this method yourself. If neither is done it is not ensured the billboard will face the camera nor that its distance to the frustrum near plane is computed which might result in very strange visual effects (and most probably unwanted).
override void Draw (Device device)
 The usual draw method.

Public Attributes

double distToNearPlane = 1000.0f
 The distance to the viewing frustrum near plane in calculated in the Update phase. The value is keep in this member variable. The default value is 1000 so everything works all right if you don't plan to render objects farther than that (let's say the far plance distance to eye point is 1000). If you plan to render objects farther away from the viewpoint you will have to change this value. If you don't billbard instances might be rendering in an incorrect order for the alpha blending to provide the desired result.

Static Public Attributes

static Matrix currentFrameBillboardRot
static double lastRotUpdate = -1
static StateBlock billboardRenderState = null
 All instances of this class are anticipated to use the same RenderState so let's keep that one in this member variable.


Detailed Description

Billboards are texture quad always watching the camera. They are some time useful as impostors when you don't want to render a very complex object. Texture displayed by billboard should have an alpha channel in order not to occlude everything behind. The library will sort them approiately from back to front before rendering them with alpha. This class inherits from TexturedPlane, main differences are that TexturePlanes don't always look at the camera and are not necessarily rendered using alpha blending.

Definition at line 34 of file Billboard.cs.


Constructor & Destructor Documentation

DXGfxLib.Billboard.Billboard ( Device  d3ddevice,
int  width,
int  heigth,
int  numVertX,
int  numVertZ,
string  texturefile 
)

In order to create a billboard instance we want the device to which it will be associated, its dimension the number or vertices to put along each dimension and the file name of the texture to use.

Parameters:
d3ddevice A valid Direct3D device to which the billboard will be rendered.
width 
heigth 
numVertX 
numVertZ 
texturefile The texture to be mapped on out Billboard quad.

Definition at line 64 of file Billboard.cs.

DXGfxLib.Billboard.Billboard ( Device  d3ddevice,
Billboard  srcBillBoard 
)

This construction creates a billboard from another billboard.

Parameters:
d3ddevice 
srcBillBoard 

Definition at line 75 of file Billboard.cs.

DXGfxLib.Billboard.Billboard ( Device  d3ddevice,
int  width,
int  heigth,
int  numVertX,
int  numVertZ,
string  texturefile 
)

In order to create a billboard instance we want the device to which it will be associated, its dimension the number or vertices to put along each dimension and the file name of the texture to use.

Parameters:
d3ddevice A valid Direct3D device to which the billboard will be rendered.
width 
heigth 
numVertX 
numVertZ 
texturefile The texture to be mapped on out Billboard quad.

Definition at line 64 of file Billboard.cs.

DXGfxLib.Billboard.Billboard ( Device  d3ddevice,
Billboard  srcBillBoard 
)

This construction creates a billboard from another billboard.

Parameters:
d3ddevice 
srcBillBoard 

Definition at line 75 of file Billboard.cs.


Member Function Documentation

override int DXGfxLib.Billboard.CompareTo ( Object  obj  )  [virtual]

Billboards need to be sorted back to front, this method will be used by our sorted list to determine where a specific billboard instance should be put in the list.

Parameters:
obj 
Returns:

Reimplemented from DXGfxLib.SceneObject.

Definition at line 86 of file Billboard.cs.

override int DXGfxLib.Billboard.CompareTo ( Object  obj  )  [virtual]

Billboards need to be sorted back to front, this method will be used by our sorted list to determine where a specific billboard instance should be put in the list.

Parameters:
obj 
Returns:

Reimplemented from DXGfxLib.SceneObject.

Definition at line 86 of file Billboard.cs.

override void DXGfxLib.Billboard.Draw ( Device  device  )  [virtual]

The usual draw method.

Parameters:
device 

Reimplemented from DXGfxLib.TexturedPlane.

Definition at line 151 of file Billboard.cs.

override void DXGfxLib.Billboard.Draw ( Device  device  )  [virtual]

The usual draw method.

Parameters:
device 

Reimplemented from DXGfxLib.TexturedPlane.

Definition at line 151 of file Billboard.cs.

override void DXGfxLib.Billboard.Update ( Frustrum  frustrum,
double  appTime,
float  elapsedTime 
) [virtual]

The usual upadte method implemented by each SceneObject or derived class. For the Billboard this method is used to position the billboard facing the camera. When you instanciate a billboard you need to either add it to the scene or to call this method yourself. If neither is done it is not ensured the billboard will face the camera nor that its distance to the frustrum near plane is computed which might result in very strange visual effects (and most probably unwanted).

Parameters:
frustrum 
appTime 
elapsedTime 

Reimplemented from DXGfxLib.SceneObject.

Definition at line 112 of file Billboard.cs.

override void DXGfxLib.Billboard.Update ( Frustrum  frustrum,
double  appTime,
float  elapsedTime 
) [virtual]

The usual upadte method implemented by each SceneObject or derived class. For the Billboard this method is used to position the billboard facing the camera. When you instanciate a billboard you need to either add it to the scene or to call this method yourself. If neither is done it is not ensured the billboard will face the camera nor that its distance to the frustrum near plane is computed which might result in very strange visual effects (and most probably unwanted).

Parameters:
frustrum 
appTime 
elapsedTime 

Reimplemented from DXGfxLib.SceneObject.

Definition at line 112 of file Billboard.cs.


Member Data Documentation

static StateBlock DXGfxLib.Billboard::billboardRenderState = null [static]

All instances of this class are anticipated to use the same RenderState so let's keep that one in this member variable.

Definition at line 43 of file Billboard.cs.

Definition at line 36 of file Billboard.cs.

The distance to the viewing frustrum near plane in calculated in the Update phase. The value is keep in this member variable. The default value is 1000 so everything works all right if you don't plan to render objects farther than that (let's say the far plance distance to eye point is 1000). If you plan to render objects farther away from the viewpoint you will have to change this value. If you don't billbard instances might be rendering in an incorrect order for the alpha blending to provide the desired result.

Definition at line 52 of file Billboard.cs.

static double DXGfxLib.Billboard::lastRotUpdate = -1 [static]

Definition at line 37 of file Billboard.cs.


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

Generated on Thu Jan 8 20:48:36 2009 for DXGfx by  doxygen 1.5.8