CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csTiledCoverageBuffer Class Reference

The tiled coverage Buffer. More...

#include <csgeom/tcovbuf.h>

Inheritance diagram for csTiledCoverageBuffer:

iBase List of all members.

Public Member Functions

 csTiledCoverageBuffer (int w, int h)
 Create a new coverage buffer with the given dimensions.
virtual ~csTiledCoverageBuffer ()
 Destroy the coverage buffer.
void Setup (int w, int h)
 Setup coverage buffer for given size.
void Initialize ()
 Initialize the coverage buffer to empty.
bool TestPolygon (csVector2 *verts, int num_verts, float min_depth)
 Test if a polygon would modify the coverage buffer if it was inserted.
void InsertPolygonInverted (csVector2 *verts, int num_verts, float max_depth)
 Insert an inverted polygon in the coverage buffer.
void InsertPolygonInvertedNoDepth (csVector2 *verts, int num_verts)
 Insert an inverted polygon in the coverage buffer.
int InsertPolygon (csVector2 *verts, int num_verts, float max_depth, csBox2Int &modified_bbox)
 Insert a polygon in the coverage buffer.
int InsertPolygonNoDepth (csVector2 *verts, int num_verts)
 Insert a polygon in the coverage buffer.
int InsertOutline (const csReversibleTransform &trans, float fov, float sx, float sy, csVector3 *verts, int num_verts, bool *used_verts, int *edges, int num_edges, bool splat_outline, csBox2Int &modified_bbox)
 Insert an outline in the coverage buffer.
bool PrepareTestRectangle (const csBox2 &rect, csTestRectData &data)
 Prepare data for TestRectangle.
bool TestRectangle (const csTestRectData &data, float min_depth)
 Test a rectangle with the coverage buffer.
bool QuickTestRectangle (const csTestRectData &data, float min_depth)
 Quickly test a rectangle with the coverage buffer.
void MarkCulledObject (const csTestRectData &data)
 Mark the given rectangle as being culled away.
int CountNotCulledObjects (const csBox2Int &bbox)
 Count the number of objects that were already culled away previously for the given rectangle.
int PrepareWriteQueueTest (const csTestRectData &data, float min_depth)
 Prepare a write queue test for the given rectangle.
int AddWriteQueueTest (const csTestRectData &maindata, const csTestRectData &data, bool &relevant)
 Add a rectangle for a write queue test.
bool TestPoint (const csVector2 &point, float min_depth)
 Test a point with the coverage buffer.
int StatusNoDepth ()
 Return status of coverage buffer (ignoring depth information).

Detailed Description

The tiled coverage Buffer.

This is a black-and-white bitmap represented by 32-bit ints arranged in rows. For example, a 128x128 bitmap is represented by 4 rows of 128 ints. Every int represents a column of 32 pixels. In addition there is also a maximum depth value for every 8x8 pixels. The screen buffer is divided into tiles of 64x32 or 32x64 pixels.

Definition at line 457 of file tcovbuf.h.


Constructor & Destructor Documentation

csTiledCoverageBuffer::csTiledCoverageBuffer int  w,
int  h
 

Create a new coverage buffer with the given dimensions.

virtual csTiledCoverageBuffer::~csTiledCoverageBuffer  )  [virtual]
 

Destroy the coverage buffer.


Member Function Documentation

int csTiledCoverageBuffer::AddWriteQueueTest const csTestRectData maindata,
const csTestRectData data,
bool &  relevant
 

Add a rectangle for a write queue test.

This returns the number of tiles that were covered. If 'relevant' is set to false by this function then that means the rectangle couldn't affect the result because it only affects tiles that are already fully covering the object we are testing.

int csTiledCoverageBuffer::CountNotCulledObjects const csBox2Int bbox  ) 
 

Count the number of objects that were already culled away previously for the given rectangle.

void csTiledCoverageBuffer::Initialize  ) 
 

Initialize the coverage buffer to empty.

int csTiledCoverageBuffer::InsertOutline const csReversibleTransform trans,
float  fov,
float  sx,
float  sy,
csVector3 verts,
int  num_verts,
bool *  used_verts,
int *  edges,
int  num_edges,
bool  splat_outline,
csBox2Int modified_bbox
 

Insert an outline in the coverage buffer.

It will update the screen buffer. 'bbox' will contain the screen space box that was modified by this function. Function returns false if outline was not visible (i.e. screen buffer was not modified). The given array of edges is an array of two integers (vertex indices) per edge. The 'used_verts' contains true for all vertices that are used. If 'splat_outline' is true then outline splatting is used.

If this function returns the number of tiles that were modified.

int csTiledCoverageBuffer::InsertPolygon csVector2 verts,
int  num_verts,
float  max_depth,
csBox2Int modified_bbox
 

Insert a polygon in the coverage buffer.

This function will not do any backface culling and it will work perfectly in all orientations. Polygon has to be convex. It will update the screen buffer. 'modified_bbox' will be updated to contain the union of the previous contents of 'modified_bbox' and also the screen space box that was modified by this function.

If this function returns the number of tiles that were modified.

void csTiledCoverageBuffer::InsertPolygonInverted csVector2 verts,
int  num_verts,
float  max_depth
 

Insert an inverted polygon in the coverage buffer.

void csTiledCoverageBuffer::InsertPolygonInvertedNoDepth csVector2 verts,
int  num_verts
 

Insert an inverted polygon in the coverage buffer.

This function ignores depth in the depth buffer and should only be used if you don't plan to use depth information nor depend on it.

int csTiledCoverageBuffer::InsertPolygonNoDepth csVector2 verts,
int  num_verts
 

Insert a polygon in the coverage buffer.

This function will not do any backface culling and it will work perfectly in all orientations. Polygon has to be convex. It will update the screen buffer.

If this function returns the number of tiles that were modified.

This function ignores depth in the depth buffer and should only be used if you don't plan to use depth information nor depend on it.

void csTiledCoverageBuffer::MarkCulledObject const csTestRectData data  ) 
 

Mark the given rectangle as being culled away.

For every affected tile this will increase the objects_culled field.

bool csTiledCoverageBuffer::PrepareTestRectangle const csBox2 rect,
csTestRectData data
 

Prepare data for TestRectangle.

If this returns false you have an early exit since the rectangle cannot be visible regardless of depth and coverage buffer contents.

int csTiledCoverageBuffer::PrepareWriteQueueTest const csTestRectData data,
float  min_depth
 

Prepare a write queue test for the given rectangle.

This returns the number of uncovered tiles. Use AddWriteQueueTest() to add additional rectangles.

bool csTiledCoverageBuffer::QuickTestRectangle const csTestRectData data,
float  min_depth
 

Quickly test a rectangle with the coverage buffer.

This is only a very rough test but it is faster then TestRectangle(). If this function returns false then the rectangle is not visible. If this function returns true it is possible that the rectangle is visible.

void csTiledCoverageBuffer::Setup int  w,
int  h
 

Setup coverage buffer for given size.

int csTiledCoverageBuffer::StatusNoDepth  ) 
 

Return status of coverage buffer (ignoring depth information).

If this returns 1 the buffer is full. If it returns -1 the buffer is empty. If it returns 0 the buffer is partially full.

bool csTiledCoverageBuffer::TestPoint const csVector2 point,
float  min_depth
 

Test a point with the coverage buffer.

Function returns false if point was not visible (i.e. screen buffer would not have been modified).

bool csTiledCoverageBuffer::TestPolygon csVector2 verts,
int  num_verts,
float  min_depth
 

Test if a polygon would modify the coverage buffer if it was inserted.

This function will not do any backface culling and it will work perfectly in all orientations. Polygon has to be convex. It will NOT update the screen buffer. Function returns false if polygon was not visible (i.e. screen buffer was not modified).

bool csTiledCoverageBuffer::TestRectangle const csTestRectData data,
float  min_depth
 

Test a rectangle with the coverage buffer.

Function returns false if rectangle was not visible (i.e. screen buffer would not have been modified). Call PrepareTestRectangle() to fill in csTestRectData.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.3.9.1