CrystalSpace

Public API Reference

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

iGraphics3D Struct Reference
[3D]

This is the standard 3D graphics interface. More...

#include <graph3d.h>

Inheritance diagram for iGraphics3D:

iBase List of all members.

Public Methods

virtual bool Open ()=0
 Open the 3D graphics display.

virtual void Close ()=0
 Close the 3D graphics display.

virtual iGraphics2DGetDriver2D ()=0
 Retrieve the associated canvas.

virtual iTextureManagerGetTextureManager ()=0
 Retrieve the texture manager.

virtual void SetDimensions (int width, int height)=0
 Change the dimensions of the display.

virtual int GetWidth () const=0
 Get drawing buffer width.

virtual int GetHeight () const=0
 Get drawing buffer height.

virtual const csGraphics3DCapsGetCaps () const=0
 Get the current driver's capabilities.

virtual void SetPerspectiveCenter (int x, int y)=0
 Set center of projection for perspective projection.

virtual void GetPerspectiveCenter (int &x, int &y) const=0
 Get perspective center.

virtual void SetPerspectiveAspect (float aspect)=0
 Set aspect ratio for perspective projection.

virtual float GetPerspectiveAspect () const=0
 Get aspect ratio.

virtual void SetObjectToCamera (csReversibleTransform *o2c)=0
 Set object to camera transformation (currently only used by DrawTriangleMesh and DrawPolygonMesh).

virtual const csReversibleTransformGetObjectToCamera ()=0
 Get object to camera transformation.

virtual void SetRenderTarget (iTextureHandle *handle, bool persistent=false)=0
 Set the target of rendering.

virtual iTextureHandleGetRenderTarget () const=0
 Get the current render target (0 for screen).

virtual bool BeginDraw (int DrawFlags)=0
 Start a new frame (see CSDRAW_XXX bit flags).

virtual void FinishDraw ()=0
 End the frame and do a page swap.

virtual void Print (csRect const *area)=0
 Print the image in backbuffer.

virtual void DrawPixmap (iTextureHandle *hTex, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th, uint8 Alpha=0)=0
 Draw a pixmap using a rectangle from given texture.

virtual void DrawLine (const csVector3 &v1, const csVector3 &v2, float fov, int color)=0
 Draw a line in camera space.

virtual void SetClipper (iClipper2D *clipper, int cliptype)=0
 Set optional clipper to use.

virtual iClipper2DGetClipper ()=0
 Get clipper that was used.

virtual int GetClipType () const=0
 Return type of clipper.

virtual void SetNearPlane (const csPlane3 &pl)=0
 Set near clip plane.

virtual void ResetNearPlane ()=0
 Reset near clip plane (i.e.

virtual const csPlane3GetNearPlane () const=0
 Get near clip plane.

virtual bool HasNearPlane () const=0
 Return true if we have a near plane.

virtual bool SetRenderState (G3D_RENDERSTATEOPTION op, long val)=0
 Set a renderstate value.

virtual long GetRenderState (G3D_RENDERSTATEOPTION op) const=0
 Get a renderstate value.

virtual bool SetOption (const char *, const char *)=0
 Set a renderer specific option.

virtual csPtr< iRenderBufferCreateRenderBuffer (int size, csRenderBufferType type, csRenderBufferComponentType componentType, int componentCount, bool index)=0
 Create a renderbuffer.

virtual void CreateInterleavedRenderBuffers (int size, csRenderBufferType type, int count, csArray< iRenderBuffer * > &buffers)=0
 Create an interleaved renderbuffer (You would use this then set stride to determine offset and stride of the interleaved buffer.

virtual void SetBufferState (csVertexAttrib *attribs, iRenderBuffer **buffers, int count)=0
 Activate or deactivate all given buffers depending on the value of 'buffers' for that index.

virtual void SetTextureState (int *units, iTextureHandle **textures, int count)=0
 Activate or deactivate all given textures depending on the value of 'textures' for that unit (i.e.

virtual void DrawMesh (const csCoreRenderMesh *mymesh, const csRenderMeshModes &modes, const csArray< csArray< csShaderVariable * > > &stacks)=0
 Drawroutine. Only way to draw stuff.

virtual void SetWriteMask (bool red, bool green, bool blue, bool alpha)=0
 Set the masking of color and/or alpha values to framebuffer.

virtual void GetWriteMask (bool &red, bool &green, bool &blue, bool &alpha) const=0
 Get the masking of color and/or alpha values to framebuffer.

virtual void SetZMode (csZBufMode mode)=0
 Set the z buffer write/test mode.

virtual void EnableZOffset ()=0
 Enables offsetting of Z values.

virtual void DisableZOffset ()=0
 Disables offsetting of Z values.

virtual void SetShadowState (int state)=0
 Controls shadow drawing.

virtual uint32GetZBuffAt (int x, int y)=0
 Debugging only: get a pointer to Z-buffer at some location.

virtual float GetZBuffValue (int x, int y)=0
 Get Z-buffer value at given X,Y position.

virtual void DrawPolygon (G3DPolygonDP &poly)=0
 Draw the projected polygon with light and texture.

virtual void DrawPolygonDebug (G3DPolygonDP &poly)=0
 Draw the projected polygon with light and texture.

virtual void DrawPolygonFX (G3DPolygonDPFX &poly)=0
 Draw a polygon with special effects.

virtual void DrawTriangleMesh (G3DTriangleMesh &mesh)=0
 Draw a triangle mesh using features similar to DrawPolygonFX.

virtual void DrawPolygonMesh (G3DPolygonMesh &mesh)=0
 Draw a triangle mesh using features similar to DrawPolygon.

virtual void OpenFogObject (CS_ID id, csFog *fog)=0
 Initiate a volumetric fog object.

virtual void DrawFogPolygon (CS_ID id, G3DPolygonDFP &poly, int fogtype)=0
 Add a front or back-facing fog polygon in the current fog object.

virtual void CloseFogObject (CS_ID id)=0
 Close a volumetric fog object.

virtual void OpenPortal (size_t numVertices, const csVector2 *vertices, const csPlane3 &normal, bool floating)=0
 Enter a new portal.

virtual void ClosePortal (bool zfill_portal)=0
 Close a portal previously opened with OpenPortal().

virtual iHaloCreateHalo (float iR, float iG, float iB, unsigned char *iAlpha, int iWidth, int iHeight)=0
 Create a halo of the specified color and return a handle.

virtual void DumpCache ()=0
 Dump the texture cache.

virtual void ClearCache ()=0
 Clear the texture cache.

virtual void RemoveFromCache (iRendererLightmap *rlm)=0
 Remove some polygon from the cache.

virtual iVertexBufferManagerGetVertexBufferManager ()=0
 Get the vertex buffer manager.

virtual bool IsLightmapOK (int lmw, int lmh, int lightCellSize)=0
 Check if renderer can handle a lightmap.

virtual void DrawSimpleMesh (const csSimpleRenderMesh &mesh, uint flags=0)=0
 Draw a csSimpleRenderMesh on the screen.

virtual csZBufMode GetZMode ()=0
 Get the z buffer write/test mode.


Detailed Description

This is the standard 3D graphics interface.

All 3D graphics rasterizer servers for Crystal Space should implement this interface, as well as the iGraphics2D interface. The standard implementation is csGraphics3DSoftware.

Main creators of instances implementing this interface:

Main ways to get pointers to this interface:

Definition at line 798 of file graph3d.h.


Member Function Documentation

virtual bool iGraphics3D::BeginDraw int    DrawFlags [pure virtual]
 

Start a new frame (see CSDRAW_XXX bit flags).

virtual void iGraphics3D::ClearCache   [pure virtual]
 

Clear the texture cache.

virtual void iGraphics3D::Close   [pure virtual]
 

Close the 3D graphics display.

virtual void iGraphics3D::CloseFogObject CS_ID    id [pure virtual]
 

Close a volumetric fog object.

After the volumetric object is closed it should be rendered on screen (whether you do it here or in DrawFogPolygon is not important).

virtual void iGraphics3D::ClosePortal bool    zfill_portal [pure virtual]
 

Close a portal previously opened with OpenPortal().

If 'zfill_portal' then the portal area will be zfilled.

virtual iHalo* iGraphics3D::CreateHalo float    iR,
float    iG,
float    iB,
unsigned char *    iAlpha,
int    iWidth,
int    iHeight
[pure virtual]
 

Create a halo of the specified color and return a handle.

virtual void iGraphics3D::CreateInterleavedRenderBuffers int    size,
csRenderBufferType    type,
int    count,
csArray< iRenderBuffer * > &    buffers
[pure virtual]
 

Create an interleaved renderbuffer (You would use this then set stride to determine offset and stride of the interleaved buffer.

Parameters:
size  Size of the buffer in bytes
count  Number of renderbuffers you want

virtual csPtr<iRenderBuffer> iGraphics3D::CreateRenderBuffer int    size,
csRenderBufferType    type,
csRenderBufferComponentType    componentType,
int    componentCount,
bool    index
[pure virtual]
 

Create a renderbuffer.

Parameters:
size  Size of the buffer in bytes.
type  Type of buffer; CS_BUF_DYNAMIC or CS_BUF_STATIC
componentType  Components Types; CS_BUFCOMP_BYTE, CS_BUFCOMP_INT, etc
componentCount  Number of components per element (e.g. 4 for RGBA)
index  True if this buffer will contain indices. (Triangle buffer)

virtual void iGraphics3D::DisableZOffset   [pure virtual]
 

Disables offsetting of Z values.

virtual void iGraphics3D::DrawFogPolygon CS_ID    id,
G3DPolygonDFP   poly,
int    fogtype
[pure virtual]
 

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:

  • CS_FOG_FRONT: a front-facing polygon
  • CS_FOG_BACK: a back-facing polygon
  • CS_FOG_VIEW: the view-plane

virtual void iGraphics3D::DrawLine const csVector3   v1,
const csVector3   v2,
float    fov,
int    color
[pure virtual]
 

Draw a line in camera space.

Warning! This is a 2D operation and must be called while in BeginDraw(CSDRAW_2DGRAPHICS)!

virtual void iGraphics3D::DrawMesh const csCoreRenderMesh   mymesh,
const csRenderMeshModes   modes,
const csArray< csArray< csShaderVariable * > > &    stacks
[pure virtual]
 

Drawroutine. Only way to draw stuff.

virtual void iGraphics3D::DrawPixmap iTextureHandle   hTex,
int    sx,
int    sy,
int    sw,
int    sh,
int    tx,
int    ty,
int    tw,
int    th,
uint8    Alpha = 0
[pure virtual]
 

Draw a pixmap using a rectangle from given texture.

The sx,sy(sw,sh) rectangle defines the screen rectangle within which the drawing is performed (clipping rectangle is also taken into account). The tx,ty(tw,th) rectangle defines a subrectangle from texture which should be painted. If the subrectangle exceeds the actual texture size, texture coordinates are wrapped around (e.g. the texture is tiled). The Alpha parameter defines the transparency of the drawing operation, 0 means opaque, 255 means fully transparent.

WARNING: Tiling works only with textures that have power-of-two sizes! That is, both width and height should be a power-of-two, although not neccessarily equal.

virtual void iGraphics3D::DrawPolygon G3DPolygonDP   poly [pure virtual]
 

Draw the projected polygon with light and texture.

virtual void iGraphics3D::DrawPolygonDebug G3DPolygonDP   poly [pure virtual]
 

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.

virtual void iGraphics3D::DrawPolygonFX G3DPolygonDPFX   poly [pure virtual]
 

Draw a polygon with special effects.

This is the most rich and slowest variant of DrawPolygonXxx. (If you use these features)

Warning! Do not rely on this method to handle Color keying under all circumstances. Color Keying will only work reliable in Mixmodes FX_Copy, FX_Add and FX_Transparent. When using FX_Multiply and FX_Multiply2, it depends very much on the driver if it works or not. For example the RivaTNT Detonator 0.48 driver can display Multiply with color keying, while newer versions can't. They will then not display anything at all. It is always safer to use a texture where transparent sections are white or 50% gray if you want to achieve transparent sections in Multiply, Multiply2. There are also some drivers (which I would consider buggy...), that won't display FX_Alpha correctly with Color Keying. I can't provide a valid workaround for that except using FX_Multiplay and FX_Add, to manually create the image, but that would be very expensive.

virtual void iGraphics3D::DrawPolygonMesh G3DPolygonMesh   mesh [pure virtual]
 

Draw a triangle mesh using features similar to DrawPolygon.

virtual void iGraphics3D::DrawSimpleMesh const csSimpleRenderMesh   mesh,
uint    flags = 0
[pure virtual]
 

Draw a csSimpleRenderMesh on the screen.

Simple render meshes are intended for cases where setting up a render mesh and juggling with render buffers would be too much effort - e.g. when you want to draw a single polygon on the screen.

DrawSimpleMesh () hides the complexity of csRenderMesh, it cares about setting up render buffers, activating the texture etc. Note that you can still provide shaders and shader variables, but those are optional.

virtual void iGraphics3D::DrawTriangleMesh G3DTriangleMesh   mesh [pure virtual]
 

Draw a triangle mesh using features similar to DrawPolygonFX.

virtual void iGraphics3D::DumpCache   [pure virtual]
 

Dump the texture cache.

virtual void iGraphics3D::EnableZOffset   [pure virtual]
 

Enables offsetting of Z values.

virtual void iGraphics3D::FinishDraw   [pure virtual]
 

End the frame and do a page swap.

virtual const csGraphics3DCaps* iGraphics3D::GetCaps   [pure virtual]
 

Get the current driver's capabilities.

Each driver implements their own function.

virtual iClipper2D* iGraphics3D::GetClipper   [pure virtual]
 

Get clipper that was used.

virtual int iGraphics3D::GetClipType   [pure virtual]
 

Return type of clipper.

virtual iGraphics2D* iGraphics3D::GetDriver2D   [pure virtual]
 

Retrieve the associated canvas.

Remarks:
This will return a valid canvas only after csInitializer::OpenApplication() has been invoked (and if the canvas plugin loaded and initialized successfully); otherwise it will return null.

virtual int iGraphics3D::GetHeight   [pure virtual]
 

Get drawing buffer height.

virtual const csPlane3& iGraphics3D::GetNearPlane   [pure virtual]
 

Get near clip plane.

virtual const csReversibleTransform& iGraphics3D::GetObjectToCamera   [pure virtual]
 

Get object to camera transformation.

virtual float iGraphics3D::GetPerspectiveAspect   [pure virtual]
 

Get aspect ratio.

virtual void iGraphics3D::GetPerspectiveCenter int &    x,
int &    y
const [pure virtual]
 

Get perspective center.

virtual long iGraphics3D::GetRenderState G3D_RENDERSTATEOPTION    op const [pure virtual]
 

Get a renderstate value.

virtual iTextureHandle* iGraphics3D::GetRenderTarget   [pure virtual]
 

Get the current render target (0 for screen).

virtual iTextureManager* iGraphics3D::GetTextureManager   [pure virtual]
 

Retrieve the texture manager.

Remarks:
This will return a valid texture manager only after csInitializer::OpenApplication() has been invoked; otherwise it will return null.

virtual iVertexBufferManager* iGraphics3D::GetVertexBufferManager   [pure virtual]
 

Get the vertex buffer manager.

This will not increment the ref count of the vertex buffer manager!

virtual int iGraphics3D::GetWidth   [pure virtual]
 

Get drawing buffer width.

virtual void iGraphics3D::GetWriteMask bool &    red,
bool &    green,
bool &    blue,
bool &    alpha
const [pure virtual]
 

Get the masking of color and/or alpha values to framebuffer.

virtual uint32* iGraphics3D::GetZBuffAt int    x,
int    y
[pure virtual]
 

Debugging only: get a pointer to Z-buffer at some location.

virtual float iGraphics3D::GetZBuffValue int    x,
int    y
[pure virtual]
 

Get Z-buffer value at given X,Y position.

virtual csZBufMode iGraphics3D::GetZMode   [pure virtual]
 

Get the z buffer write/test mode.

virtual bool iGraphics3D::HasNearPlane   [pure virtual]
 

Return true if we have a near plane.

virtual bool iGraphics3D::IsLightmapOK int    lmw,
int    lmh,
int    lightCellSize
[pure virtual]
 

Check if renderer can handle a lightmap.

Returns true if it can, false if not.

virtual bool iGraphics3D::Open   [pure virtual]
 

Open the 3D graphics display.

virtual void iGraphics3D::OpenFogObject CS_ID    id,
csFog   fog
[pure virtual]
 

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.

virtual void iGraphics3D::OpenPortal size_t    numVertices,
const csVector2   vertices,
const csPlane3   normal,
bool    floating
[pure virtual]
 

Enter a new portal.

If 'floating' is true then this routine will restrict all further drawing to the given 2D area and it will also respect the current contents of the Z-buffer so that geometry will only render where the Z-buffer allows it (even if zfill or znone is used). Remember to close a portal later using ClosePortal(). Basically this represents a stacked layer of portals. Each subsequent portal must be fully contained in the previous ones.

virtual void iGraphics3D::Print csRect const *    area [pure virtual]
 

Print the image in backbuffer.

The area parameter is only a hint to the renderer. Changes outside the rectangle may or may not be printed as well.

virtual void iGraphics3D::RemoveFromCache iRendererLightmap   rlm [pure virtual]
 

Remove some polygon from the cache.

You have to call this function before deleting a polygon (csPolygon3D destructor will do that).

virtual void iGraphics3D::ResetNearPlane   [pure virtual]
 

Reset near clip plane (i.e.

disable it).

virtual void iGraphics3D::SetBufferState csVertexAttrib   attribs,
iRenderBuffer **    buffers,
int    count
[pure virtual]
 

Activate or deactivate all given buffers depending on the value of 'buffers' for that index.

virtual void iGraphics3D::SetClipper iClipper2D   clipper,
int    cliptype
[pure virtual]
 

Set optional clipper to use.

If clipper == null then there is no clipper. Currently only used by DrawTriangleMesh.

virtual void iGraphics3D::SetDimensions int    width,
int    height
[pure virtual]
 

Change the dimensions of the display.

virtual void iGraphics3D::SetNearPlane const csPlane3   pl [pure virtual]
 

Set near clip plane.

Currently only used by DrawTriangleMesh.

virtual void iGraphics3D::SetObjectToCamera csReversibleTransform   o2c [pure virtual]
 

Set object to camera transformation (currently only used by DrawTriangleMesh and DrawPolygonMesh).

virtual bool iGraphics3D::SetOption const char *   ,
const char *   
[pure virtual]
 

Set a renderer specific option.

Returns false if renderer doesn't support that option.

virtual void iGraphics3D::SetPerspectiveAspect float    aspect [pure virtual]
 

Set aspect ratio for perspective projection.

virtual void iGraphics3D::SetPerspectiveCenter int    x,
int    y
[pure virtual]
 

Set center of projection for perspective projection.

Center is set in screen space coordinates.

virtual bool iGraphics3D::SetRenderState G3D_RENDERSTATEOPTION    op,
long    val
[pure virtual]
 

Set a renderstate value.

virtual void iGraphics3D::SetRenderTarget iTextureHandle   handle,
bool    persistent = false
[pure virtual]
 

Set the target of rendering.

If this is 0 then the target will be the main screen. Otherwise it is a texture. After calling g3d->FinishDraw() the target will automatically be reset to 0 (main screen). Note that on some implementions rendering on a texture will overwrite the screen. So you should only do this BEFORE you start rendering your frame.

If 'persistent' is true then the current contents of the texture will be copied on screen before drawing occurs (in the first call to BeginDraw). Otherwise it is assumed that you fully render the texture.

virtual void iGraphics3D::SetShadowState int    state [pure virtual]
 

Controls shadow drawing.

virtual void iGraphics3D::SetTextureState int *    units,
iTextureHandle **    textures,
int    count
[pure virtual]
 

Activate or deactivate all given textures depending on the value of 'textures' for that unit (i.e.

deactivate if 0).

virtual void iGraphics3D::SetWriteMask bool    red,
bool    green,
bool    blue,
bool    alpha
[pure virtual]
 

Set the masking of color and/or alpha values to framebuffer.

virtual void iGraphics3D::SetZMode csZBufMode    mode [pure virtual]
 

Set the z buffer write/test mode.


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