In file libs/cs3d/software/soft_g3d.h:

class csGraphics3DSoftware : public IGraphics3D, public IHaloRasterizer


Inheritance:


Public Classes

struct csG3DSoftwareHaloInfo
Our internal representation of halos.
class csHaloDrawer
Actually draws a halo the the screen.
csHaloDrawer(IGraphics3D* piG3D, IGraphics2D* piG2D, float r, float g, float b)
~csHaloDrawer()
int mWidth
the width and height of the graphics context
IGraphics2D* mpiG2D
the 2D graphics context.
int mDim
the size to be drawn (the diameter of the halo)
float mRed
the color of the halo
float mRatioRed
the ratio of the color intensity vs the radius
int mx
the center coords.
unsigned short* mpBuffer
the buffer.
unsigned char* mpAlphaBuffer
the alpha buffer.
int mBufferWidth
the width of the buffer.
int red_shift
The number of bits to shift to get to red (depends on 555 or 565 mode).
int green_mask
The mask for green (depends on 555 or 565 mode).
int not_green_bits
The bits in one byte that are NOT used for green.

Public Fields

csIniFile* config
The configuration file
bool do_bilin_filt
Option variable: do very expensive bilinear filtering?
int do_interlaced
Do interlacing? (-1 - no, 0/1 - yes)
bool do_lighting
Option variable: do texture lighting?
bool do_perfect
Option variable: do perfect texture mapping?
bool do_texel_filt
Option variable: do expensive texel filtering?
bool do_textured
Option variable: render textures?
bool do_transp
Option variable: render transparent textures?
bool ilace_fastmove
For interlacing
IGraphics2D* m_piG2D
Low-level 2D graphics layer
ISystem* m_piSystem
The System interface.
bool rstate_gouraud
Do we want Gouraud Shaded polygons?
TextureCache* tcache
The texture cache.
csTextureManagerSoftware* txtmgr
The texture manager.
float zdist_mipmap1
Option variables: mipmap distances

Public Methods

STDMETHODIMP AddFogPolygon(CS_ID id, G3DPolygonAFP& poly, int fogtype)
Add a front or back-facing fog polygon in the current fog object
STDMETHODIMP BeginDraw(int DrawFlags)
Start a new frame (see CSDRAW_XXX bit flags)
void CacheInitTexture(IPolygonTexture* texture)
Give a texture to csGraphics3DSoftware to initialize the cache for it
void CacheRectTexture(IPolygonTexture* texture, int minu, int minv, int maxu, int maxv)
Give a rectangle to csGraphics3DSoftware so that all sub-textures in this rectangle are cached
void CacheSubTexture(IPolygonTexture* texture, int u, int v)
Give a sub-texture to csGraphics3DSoftware to cache it.
STDMETHODIMP CacheTexture(IPolygonTexture* texture)
Give a texture to csGraphics3DSoftware to cache it.
STDMETHODIMP ClearCache(void)
Clear the texture cache.
STDMETHODIMP Close()
STDMETHODIMP CloseFogObject(CS_ID id)
Close a volumetric fog object
STDMETHODIMP CreateHalo(float r, float g, float b, HALOINFO* pRetVal)
Create a halo of the specified color. This must be destroyed using DestroyHalo.
csGraphics3DSoftware(ISystem* piSystem)
STDMETHODIMP DestroyHalo(HALOINFO haloInfo)
Destroy the halo.
STDMETHODIMP DrawHalo(csVector3* pCenter, float fIntensity, HALOINFO haloInfo)
Draw the halo given a center point and an intensity.
STDMETHODIMP DrawLine(csVector3& v1, csVector3& v2, float fov, int color)
Draw a line in camera space.
STDMETHODIMP DrawPolygon(G3DPolygonDP& poly)
Draw the projected polygon with light and texture.
STDMETHODIMP DrawPolygonDebug(G3DPolygonDP& poly)
Draw the projected polygon with light and texture
STDMETHODIMP DrawPolygonFX(G3DPolygonDPFX& poly)
Draw a polygon with special effects.
STDMETHODIMP DumpCache(void)
Dump the texture cache.
STDMETHODIMP FinishDraw()
End the frame and do a page swap.
STDMETHODIMP FinishPolygonFX()
Finish a series of DrawPolygonFX
STDMETHODIMP Get2dDriver(IGraphics2D** pi)
Get the IGraphics2D driver.
STDMETHODIMP GetCaps(G3D_CAPS *caps)
Get the current driver's capabilities
STDMETHODIMP GetColormapFormat(G3D_COLORMAPFORMAT& retval)
Get the colorformat you want.
STDMETHODIMP GetFogMode(G3D_FOGMETHOD& retval)
Get the fog mode.
STDMETHODIMP GetHeight(int& retval)
Get drawing buffer height
STDMETHODIMP GetMaximumAspectRatio(int& retval)
Returns the maximum aspect ratio of maps.
STDMETHODIMP GetRenderState(G3D_RENDERSTATEOPTION op, long& val)
Get a renderstate value.
STDMETHODIMP GetTextureManager(ITextureManager** pi)
Get the ITextureManager.
STDMETHODIMP GetWidth(int& retval)
Get drawing buffer width
STDMETHODIMP GetZBufPoint(int x, int y, unsigned long** retval)
Get address of Z-buffer at specific point
STDMETHODIMP Initialize()
STDMETHODIMP NeedsPO2Maps()
Returns S_OK if this driver requires all maps to be PO2.
STDMETHODIMP Open(char *Title)
STDMETHODIMP OpenFogObject(CS_ID id, csFog* fog)
Initiate a volumetric fog object
STDMETHODIMP Print(csRect *area)
Print the image in backbuffer
void ScanSetup()
Setup scanline drawing routines according to current bpp and setup flags
STDMETHODIMP SetDimensions(int width, int height)
Change the dimensions of the display.
STDMETHODIMP SetFogMode(G3D_FOGMETHOD fogm)
Get the fog mode.
STDMETHODIMP SetRenderState(G3D_RENDERSTATEOPTION op, long val)
Set a renderstate boolean.
STDMETHODIMP SetZBufMode(G3DZBufMode mode)
Set the mode for the Z buffer used for drawing the next polygon.
STDMETHODIMP StartPolygonFX(ITextureHandle* handle, UInt mode)
Start a series of DrawPolygonFX
STDMETHODIMP TestHalo(csVector3* pCenter)
Test to see if a halo would be visible (but don't attempt to draw it)
STDMETHODIMP UncacheTexture(IPolygonTexture* texture)
Release a texture from the cache.
virtual ~csGraphics3DSoftware()

Public

/// IHaloRasterizer Methods ////
struct csG3DSoftwareHaloInfo
Our internal representation of halos.

Private Fields

bool cpu_mmx
True if CPU has MMX instructions.
long dbg_current_polygon
For debugging: the current polygon number.
long dbg_max_polygons_to_draw
For debugging: the maximum number of polygons to draw in a frame.
bool do_mmx
True if 3D rendering should use MMX if available.
bool do_smaller_rendering
If true the we are really rendering with a smaller size inside a larger window
int DrawMode
DrawFlags on last BeginDraw ()
FogBuffer* fog_buffers
Fog buffers.
int height
Height of display.
int height2
Opt: height divided by 2.
UByte** line_table
Addresses of all lines for this frame
csPixelFormat pfmt
The pixel format of display
int pixel_shift
Number of bytes for every pixel (expressed in shifts)
bool rstate_dither
Do we want dithering? (dummy for now)
int rstate_mipmap
Do we want mipmaps?
bool rstate_specular
Do we want specular lighting? (dummy for now)
csDrawScanline* ScanProc[0x14]
draw_scanline_xxx routines
csDrawPIScanline* ScanProcPI[4]
draw_pi_scanline_xxx routines
csDrawPIScanlineGouraud* ScanProcPIFX[4]
draw_pi_scanline_fx_xxx routines
csDrawPIScanlineGouraud* ScanProcPIG[4]
draw_pi_scanline_gouraud_xxx routines
unsigned char* smaller_buffer
Buffer for smaller rendering.
int width
Width of display.
int width2
Opt: width divided by 2.
G3DZBufMode z_buf_mode
Z Buffer mode to use while rendering next polygon.
long z_buf_size
Size of Z buffer for software renderer.
unsigned long* z_buffer
Z buffer for software renderer only. Hardware rendering uses own Z buffer.

Private Methods

csDrawScanline* (*ScanProc_Alpha)(csGraphics3DSoftware *This, int alpha)
The routine for getting the address of needed scanline_xxx_alpha
unsigned char* BuildIndexedFogTable()
Build the table used for fog in paletted modes
HRESULT DrawPolygonFlat(G3DPolygonDPF& poly)
Same as DrawPolygon but no texture mapping
FogBuffer* find_fog_buffer(CS_ID id)
Look for a given fog buffer
static csDrawScanline* ScanProc_16_Alpha(csGraphics3DSoftware *This, int alpha)
ScanProc_Alpha for 16 bpp modes
static csDrawScanline* ScanProc_32_Alpha(csGraphics3DSoftware *This, int alpha)
ScanProc_Alpha for 32 bpp modes
static csDrawScanline* ScanProc_8_Alpha(csGraphics3DSoftware *This, int alpha)
ScanProc_Alpha for 8 bpp modes
void SetCacheSize(long size)
Set the texture cache size.

Private

struct
The dynamically built fog tables

Documentation

unsigned long* z_buffer
Z buffer for software renderer only. Hardware rendering uses own Z buffer.

long z_buf_size
Size of Z buffer for software renderer.

UByte** line_table
Addresses of all lines for this frame. This table is used to avoid calls to GetPixelAt in the main renderer loop. It is filled every frame (by BeginDraw()) because double buffering or other stuff can change the addresses.

bool do_smaller_rendering
If true the we are really rendering with a smaller size inside a larger window

unsigned char* smaller_buffer
Buffer for smaller rendering.

int pixel_shift
Number of bytes for every pixel (expressed in shifts). Also used in combination with line_table to calculate the in-screen offset.

long dbg_max_polygons_to_draw
For debugging: the maximum number of polygons to draw in a frame.

long dbg_current_polygon
For debugging: the current polygon number.

G3DZBufMode z_buf_mode
Z Buffer mode to use while rendering next polygon.

FogBuffer* fog_buffers
Fog buffers.

int width
Width of display.

int height
Height of display.

int width2
Opt: width divided by 2.

int height2
Opt: height divided by 2.

csPixelFormat pfmt
The pixel format of display

bool cpu_mmx
True if CPU has MMX instructions.

bool do_mmx
True if 3D rendering should use MMX if available.

bool rstate_dither
Do we want dithering? (dummy for now)

bool rstate_specular
Do we want specular lighting? (dummy for now)

int rstate_mipmap
Do we want mipmaps?

int DrawMode
DrawFlags on last BeginDraw ()

csDrawScanline* ScanProc[0x14]
draw_scanline_xxx routines

csDrawPIScanline* ScanProcPI[4]
draw_pi_scanline_xxx routines

csDrawPIScanlineGouraud* ScanProcPIG[4]
draw_pi_scanline_gouraud_xxx routines

csDrawPIScanlineGouraud* ScanProcPIFX[4]
draw_pi_scanline_fx_xxx routines

csDrawScanline* (*ScanProc_Alpha)(csGraphics3DSoftware *This, int alpha)
The routine for getting the address of needed scanline_xxx_alpha

static csDrawScanline* ScanProc_8_Alpha(csGraphics3DSoftware *This, int alpha)
ScanProc_Alpha for 8 bpp modes

static csDrawScanline* ScanProc_16_Alpha(csGraphics3DSoftware *This, int alpha)
ScanProc_Alpha for 16 bpp modes

static csDrawScanline* ScanProc_32_Alpha(csGraphics3DSoftware *This, int alpha)
ScanProc_Alpha for 32 bpp modes

FogBuffer* find_fog_buffer(CS_ID id)
Look for a given fog buffer

HRESULT DrawPolygonFlat(G3DPolygonDPF& poly)
Same as DrawPolygon but no texture mapping. (Flat drawing).

struct
The dynamically built fog tables

unsigned char* BuildIndexedFogTable()
Build the table used for fog in paletted modes

void SetCacheSize(long size)
Set the texture cache size.

IGraphics2D* m_piG2D
Low-level 2D graphics layer. csGraphics3DSoftware is in charge of creating and managing this.

csIniFile* config
The configuration file

csTextureManagerSoftware* txtmgr
The texture manager.

TextureCache* tcache
The texture cache.

ISystem* m_piSystem
The System interface.

bool do_lighting
Option variable: do texture lighting?

bool do_transp
Option variable: render transparent textures?

bool do_textured
Option variable: render textures?

bool do_texel_filt
Option variable: do expensive texel filtering?

bool do_bilin_filt
Option variable: do very expensive bilinear filtering?

bool do_perfect
Option variable: do perfect texture mapping?

float zdist_mipmap1
Option variables: mipmap distances

bool rstate_gouraud
Do we want Gouraud Shaded polygons?

int do_interlaced
Do interlacing? (-1 - no, 0/1 - yes)

bool ilace_fastmove
For interlacing. Temporary set to true if we moved quickly. This will decrease the bluriness a little.

csGraphics3DSoftware(ISystem* piSystem)

virtual ~csGraphics3DSoftware()

void ScanSetup()
Setup scanline drawing routines according to current bpp and setup flags

STDMETHODIMP Initialize()

STDMETHODIMP Open(char *Title)

STDMETHODIMP Close()

STDMETHODIMP SetDimensions(int width, int height)
Change the dimensions of the display.

STDMETHODIMP BeginDraw(int DrawFlags)
Start a new frame (see CSDRAW_XXX bit flags)

STDMETHODIMP FinishDraw()
End the frame and do a page swap.

STDMETHODIMP Print(csRect *area)
Print the image in backbuffer

STDMETHODIMP SetZBufMode(G3DZBufMode mode)
Set the mode for the Z buffer used for drawing the next polygon.

STDMETHODIMP DrawPolygon(G3DPolygonDP& poly)
Draw the projected polygon with light and texture.

STDMETHODIMP DrawPolygonDebug(G3DPolygonDP& poly)
Draw the projected polygon with light and texture. Debugging version. This one does not actually draw anything but it just prints debug information about what it would have done.

STDMETHODIMP GetFogMode(G3D_FOGMETHOD& retval)
Get the fog mode.

STDMETHODIMP SetFogMode(G3D_FOGMETHOD fogm)
Get the fog mode.

STDMETHODIMP OpenFogObject(CS_ID id, csFog* fog)
Initiate a volumetric fog object. This function will be called before front-facing and back-facing fog polygons are added to the object. The fog object will be convex but not necesarily closed. The given CS_ID can be used to identify multiple fog objects when multiple objects are started.

STDMETHODIMP AddFogPolygon(CS_ID id, G3DPolygonAFP& poly, int fogtype)
Add a front or back-facing fog polygon in the current fog object. Note that it is guaranteed that all back-facing fog polygons will have been added before the first front-facing polygon. fogtype can be:

STDMETHODIMP CloseFogObject(CS_ID id)
Close a volumetric fog object. After the volumetric object is closed it should be rendered on screen (whether you do it here or in DrawFrontFog/DrawBackFog is not important).

STDMETHODIMP DrawLine(csVector3& v1, csVector3& v2, float fov, int color)
Draw a line in camera space.

STDMETHODIMP StartPolygonFX(ITextureHandle* handle, UInt mode)
Start a series of DrawPolygonFX

STDMETHODIMP FinishPolygonFX()
Finish a series of DrawPolygonFX

STDMETHODIMP DrawPolygonFX(G3DPolygonDPFX& poly)
Draw a polygon with special effects.

STDMETHODIMP CacheTexture(IPolygonTexture* texture)
Give a texture to csGraphics3DSoftware to cache it.

void CacheInitTexture(IPolygonTexture* texture)
Give a texture to csGraphics3DSoftware to initialize the cache for it. This is used together with the sub-texture optimization and is meant to allocate the space in the cache but not do any actual calculations yet.

void CacheSubTexture(IPolygonTexture* texture, int u, int v)
Give a sub-texture to csGraphics3DSoftware to cache it.

void CacheRectTexture(IPolygonTexture* texture, int minu, int minv, int maxu, int maxv)
Give a rectangle to csGraphics3DSoftware so that all sub-textures in this rectangle are cached

STDMETHODIMP UncacheTexture(IPolygonTexture* texture)
Release a texture from the cache.

STDMETHODIMP SetRenderState(G3D_RENDERSTATEOPTION op, long val)
Set a renderstate boolean.

STDMETHODIMP GetRenderState(G3D_RENDERSTATEOPTION op, long& val)
Get a renderstate value.

STDMETHODIMP GetCaps(G3D_CAPS *caps)
Get the current driver's capabilities. Each driver implements their own function.

STDMETHODIMP GetZBufPoint(int x, int y, unsigned long** retval)
Get address of Z-buffer at specific point

STDMETHODIMP DumpCache(void)
Dump the texture cache.

STDMETHODIMP ClearCache(void)
Clear the texture cache.

STDMETHODIMP GetWidth(int& retval)
Get drawing buffer width

STDMETHODIMP GetHeight(int& retval)
Get drawing buffer height

STDMETHODIMP Get2dDriver(IGraphics2D** pi)
Get the IGraphics2D driver.

STDMETHODIMP GetTextureManager(ITextureManager** pi)
Get the ITextureManager.

STDMETHODIMP NeedsPO2Maps()
Returns S_OK if this driver requires all maps to be PO2.

STDMETHODIMP GetMaximumAspectRatio(int& retval)
Returns the maximum aspect ratio of maps.

STDMETHODIMP GetColormapFormat(G3D_COLORMAPFORMAT& retval)
Get the colorformat you want.

/// IHaloRasterizer Methods ////

STDMETHODIMP CreateHalo(float r, float g, float b, HALOINFO* pRetVal)
Create a halo of the specified color. This must be destroyed using DestroyHalo.

STDMETHODIMP DestroyHalo(HALOINFO haloInfo)
Destroy the halo.

STDMETHODIMP DrawHalo(csVector3* pCenter, float fIntensity, HALOINFO haloInfo)
Draw the halo given a center point and an intensity.

STDMETHODIMP TestHalo(csVector3* pCenter)
Test to see if a halo would be visible (but don't attempt to draw it)

struct csG3DSoftwareHaloInfo
Our internal representation of halos.

class csHaloDrawer
Actually draws a halo the the screen.

csHaloDrawer(IGraphics3D* piG3D, IGraphics2D* piG2D, float r, float g, float b)

~csHaloDrawer()

int mWidth
the width and height of the graphics context

IGraphics2D* mpiG2D
the 2D graphics context.

int mDim
the size to be drawn (the diameter of the halo)

float mRed
the color of the halo

float mRatioRed
the ratio of the color intensity vs the radius

int mx
the center coords.

unsigned short* mpBuffer
the buffer.

unsigned char* mpAlphaBuffer
the alpha buffer.

int mBufferWidth
the width of the buffer.

int red_shift
The number of bits to shift to get to red (depends on 555 or 565 mode).

int green_mask
The mask for green (depends on 555 or 565 mode).

int not_green_bits
The bits in one byte that are NOT used for green.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de