CrystalSpace

Public API Reference

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

graph3d.h File Reference

3D graphics interface More...

#include "csutil/scf.h"
#include "csgeom/transfrm.h"
#include "csutil/strset.h"
#include "ivideo/rndbuf.h"

Go to the source code of this file.

Classes

struct  csAlphaMode
 Describes how to deal with alpha values in textures. More...
struct  csFog
 Fog structure. More...
struct  csGraphics3DCaps
 Information about 3d renderer capabilities. More...
struct  csSimpleRenderMesh
 A simple render mesh. More...
struct  iGraphics3D
 This is the standard 3D graphics interface. More...

Clipping requirement for DrawTriangleMesh

#define CS_CLIP_NEEDED   1
 Clipping may be needed.
#define CS_CLIP_NOT   0
 No clipping required.

Type of clipper (for iGraphics3D::SetClipper())

#define CS_CLIPPER_NONE   -1
 There is no clipper.
#define CS_CLIPPER_OPTIONAL   0
 Clipper is optional.
#define CS_CLIPPER_REQUIRED   2
 Clipper is required.
#define CS_CLIPPER_TOPLEVEL   1
 Clipper is top-level.

Mix modes for DrawPolygonFX ()

The constants can be ORed together if they belong to different masks.

#define CS_FX_ADD   0x30000000
 =SRC+DST
#define CS_FX_ALPHA   0x40000000
 =(1-alpha)*SRC + alpha*DST
#define CS_FX_COPY   0x00000000
 =SRC
#define CS_FX_DESTALPHAADD   0x60000000
 =(dstalpha)*SRC + DST
#define CS_FX_FLAT   0x04000000
 Flat shading.
#define CS_FX_KEYCOLOR   0x08000000
 color 0 is transparent
#define CS_FX_MASK_ALPHA   0x000000FF
 alpha = 0..FF (opaque..transparent)
#define CS_FX_MASK_MIXMODE   0xF0000000
 SRC/DST mixing mode mask.
#define CS_FX_MESH   0xf0000000
 Use the mix mode of the mesh zmode.
#define CS_FX_MULTIPLY   0x10000000
 =SRC*DST
#define CS_FX_MULTIPLY2   0x20000000
 =2*SRC*DST
#define CS_FX_PREMULTALPHA   0x80000000
 =SRC + DST*(1-srcalpha)
#define CS_FX_SETALPHA(alpha)   (CS_FX_ALPHA | uint (alpha * CS_FX_MASK_ALPHA))
 Macro for setting of alpha bits into mixmode (alpha between 0 and 1).
#define CS_FX_SETALPHA_INT(alpha)   (CS_FX_ALPHA | uint (alpha & CS_FX_MASK_ALPHA))
 Macro for setting of alpha bits into mixmode (alpha between 0 and 255).
#define CS_FX_SRCALPHAADD   0x70000000
 =(srcalpha)*SRC + DST
#define CS_FX_TILING   0x02000000
 Tiling.
#define CS_FX_TRANSPARENT   0x50000000
 =DST

Light parameters

#define CS_LIGHTPARAM_ATTENUATION   3
 Attenuation of the light.
#define CS_LIGHTPARAM_DIFFUSE   1
 Diffuse color of the light.
#define CS_LIGHTPARAM_POSITION   0
 Position of the light.
#define CS_LIGHTPARAM_SPECULAR   2
 Specular color of the light.

Shadow states

#define CS_SHADOW_VOLUME_BEGIN   1
 Clear stencil.
#define CS_SHADOW_VOLUME_FAIL1   4
 Setup for carmack's reverse pass 1.
#define CS_SHADOW_VOLUME_FAIL2   5
 Setup for carmack's reverse pass 2.
#define CS_SHADOW_VOLUME_FINISH   7
 Restore states.
#define CS_SHADOW_VOLUME_PASS1   2
 Setup for pass 1.
#define CS_SHADOW_VOLUME_PASS2   3
 Setup for pass 2.
#define CS_SHADOW_VOLUME_USE   6
 Setup for shadow masking.

iGraphics3D::BeginDraw() flags

#define CSDRAW_2DGRAPHICS   0x00000001
 We're going to draw 2D graphics.
#define CSDRAW_3DGRAPHICS   0x00000002
 We're going to draw 3D graphics.
#define CSDRAW_CLEARSCREEN   0x00000020
 Clear frame buffer ?
#define CSDRAW_CLEARZBUFFER   0x00000010
 Clear Z-buffer ?

Defines

#define CS_VATTRIB_GENERIC_FIRST   100
#define CS_VATTRIB_GENERIC_LAST   (CS_VATTRIB_GENERIC_FIRST + 15)
#define CS_VATTRIB_IS_GENERIC(va)   ((va >= CS_VATTRIB_GENERIC_FIRST) && (va <=CS_VATTRIB_GENERIC_LAST))
#define CS_VATTRIB_IS_SPECIFIC(va)   ((va >= CS_VATTRIB_SPECIFIC_FIRST) && (va <=CS_VATTRIB_SPECIFIC_LAST))
#define CS_VATTRIB_SPECIFIC_FIRST   0
#define CS_VATTRIB_SPECIFIC_LAST   15

Enumerations

enum  csFogMode
enum  csRenderMeshType {
  CS_MESHTYPE_TRIANGLES, CS_MESHTYPE_QUADS, CS_MESHTYPE_TRIANGLESTRIP, CS_MESHTYPE_TRIANGLEFAN,
  CS_MESHTYPE_POINTS, CS_MESHTYPE_POINT_SPRITES, CS_MESHTYPE_LINES, CS_MESHTYPE_LINESTRIP,
  CS_MESHTYPE_POLYGON
}
 Primitive type of a mesh. More...
enum  csSimpleMeshFlags { csSimpleMeshScreenspace = 0x01 }
 Flags to influence the behaviour of DrawSimpleMesh(). More...
enum  csVertexAttrib {
  CS_VATTRIB_POSITION = CS_VATTRIB_SPECIFIC_FIRST + 0, CS_VATTRIB_WEIGHT = CS_VATTRIB_SPECIFIC_FIRST + 1, CS_VATTRIB_NORMAL = CS_VATTRIB_SPECIFIC_FIRST + 2, CS_VATTRIB_COLOR = CS_VATTRIB_SPECIFIC_FIRST + 3,
  CS_VATTRIB_PRIMARY_COLOR = CS_VATTRIB_SPECIFIC_FIRST + 3, CS_VATTRIB_SECONDARY_COLOR = CS_VATTRIB_SPECIFIC_FIRST + 4, CS_VATTRIB_FOGCOORD = CS_VATTRIB_SPECIFIC_FIRST + 5, CS_VATTRIB_TEXCOORD = CS_VATTRIB_SPECIFIC_FIRST + 8,
  CS_VATTRIB_TEXCOORD0 = CS_VATTRIB_SPECIFIC_FIRST + 8, CS_VATTRIB_TEXCOORD1 = CS_VATTRIB_SPECIFIC_FIRST + 9, CS_VATTRIB_TEXCOORD2 = CS_VATTRIB_SPECIFIC_FIRST + 10, CS_VATTRIB_TEXCOORD3 = CS_VATTRIB_SPECIFIC_FIRST + 11,
  CS_VATTRIB_TEXCOORD4 = CS_VATTRIB_SPECIFIC_FIRST + 12, CS_VATTRIB_TEXCOORD5 = CS_VATTRIB_SPECIFIC_FIRST + 13, CS_VATTRIB_TEXCOORD6 = CS_VATTRIB_SPECIFIC_FIRST + 14, CS_VATTRIB_TEXCOORD7 = CS_VATTRIB_SPECIFIC_FIRST + 15,
  CS_VATTRIB_0 = CS_VATTRIB_GENERIC_FIRST + 0, CS_VATTRIB_1 = CS_VATTRIB_GENERIC_FIRST + 1, CS_VATTRIB_2 = CS_VATTRIB_GENERIC_FIRST + 2, CS_VATTRIB_3 = CS_VATTRIB_GENERIC_FIRST + 3,
  CS_VATTRIB_4 = CS_VATTRIB_GENERIC_FIRST + 4, CS_VATTRIB_5 = CS_VATTRIB_GENERIC_FIRST + 5, CS_VATTRIB_6 = CS_VATTRIB_GENERIC_FIRST + 6, CS_VATTRIB_7 = CS_VATTRIB_GENERIC_FIRST + 7,
  CS_VATTRIB_8 = CS_VATTRIB_GENERIC_FIRST + 8, CS_VATTRIB_9 = CS_VATTRIB_GENERIC_FIRST + 9, CS_VATTRIB_10 = CS_VATTRIB_GENERIC_FIRST + 10, CS_VATTRIB_11 = CS_VATTRIB_GENERIC_FIRST + 11,
  CS_VATTRIB_12 = CS_VATTRIB_GENERIC_FIRST + 12, CS_VATTRIB_13 = CS_VATTRIB_GENERIC_FIRST + 13, CS_VATTRIB_14 = CS_VATTRIB_GENERIC_FIRST + 14
}
 For NR: Vertex attributes. More...
enum  csZBufMode {
  CS_ZBUF_NONE = 0x00000000, CS_ZBUF_FILL = 0x00000001, CS_ZBUF_TEST = 0x00000002, CS_ZBUF_USE = 0x00000003,
  CS_ZBUF_FILLONLY = 0x00000004, CS_ZBUF_EQUAL = 0x00000005, CS_ZBUF_INVERT = 0x00000006, CS_ZBUF_MESH = 0x00000007,
  CS_ZBUF_MESH2 = 0x00000008
}
 Z-buffer modes. More...
enum  G3D_RENDERSTATEOPTION {
  G3DRENDERSTATE_ZBUFFERMODE, G3DRENDERSTATE_DITHERENABLE, G3DRENDERSTATE_BILINEARMAPPINGENABLE, G3DRENDERSTATE_TRILINEARMAPPINGENABLE,
  G3DRENDERSTATE_TRANSPARENCYENABLE, G3DRENDERSTATE_MIPMAPENABLE, G3DRENDERSTATE_TEXTUREMAPPINGENABLE, G3DRENDERSTATE_LIGHTINGENABLE,
  G3DRENDERSTATE_INTERLACINGENABLE, G3DRENDERSTATE_MMXENABLE, G3DRENDERSTATE_INTERPOLATIONSTEP, G3DRENDERSTATE_MAXPOLYGONSTODRAW,
  G3DRENDERSTATE_GOURAUDENABLE, G3DRENDERSTATE_EDGES
}
 Graphics3D render state options. More...


Detailed Description

3D graphics interface

Definition in file graph3d.h.


Define Documentation

#define CS_CLIP_NEEDED   1
 

Clipping may be needed.

Depending on the type of the clipper (one of the CS_CLIPPER_??? flags) the renderer has to clip or not. (setting for clip_portal, clip_plane, or clip_z_plane).

Definition at line 107 of file graph3d.h.

#define CS_CLIP_NOT   0
 

No clipping required.

(setting for clip_portal, clip_plane, or clip_z_plane).

Definition at line 101 of file graph3d.h.

#define CS_CLIPPER_NONE   -1
 

There is no clipper.

Definition at line 80 of file graph3d.h.

#define CS_CLIPPER_OPTIONAL   0
 

Clipper is optional.

Definition at line 84 of file graph3d.h.

#define CS_CLIPPER_REQUIRED   2
 

Clipper is required.

Definition at line 92 of file graph3d.h.

#define CS_CLIPPER_TOPLEVEL   1
 

Clipper is top-level.

Definition at line 88 of file graph3d.h.

#define CS_FX_ADD   0x30000000
 

=SRC+DST

Definition at line 257 of file graph3d.h.

#define CS_FX_ALPHA   0x40000000
 

=(1-alpha)*SRC + alpha*DST

Definition at line 259 of file graph3d.h.

#define CS_FX_COPY   0x00000000
 

=SRC

Definition at line 251 of file graph3d.h.

Referenced by csRenderMeshModes::csRenderMeshModes().

#define CS_FX_DESTALPHAADD   0x60000000
 

=(dstalpha)*SRC + DST

Definition at line 263 of file graph3d.h.

#define CS_FX_FLAT   0x04000000
 

Flat shading.

Definition at line 276 of file graph3d.h.

#define CS_FX_KEYCOLOR   0x08000000
 

color 0 is transparent

Definition at line 274 of file graph3d.h.

#define CS_FX_MASK_ALPHA   0x000000FF
 

alpha = 0..FF (opaque..transparent)

Definition at line 280 of file graph3d.h.

#define CS_FX_MASK_MIXMODE   0xF0000000
 

SRC/DST mixing mode mask.

Definition at line 249 of file graph3d.h.

#define CS_FX_MESH   0xf0000000
 

Use the mix mode of the mesh zmode.

(NOTE: NOT VALID AS MESH ZMODE - only for shader pass mixmodes)

Definition at line 272 of file graph3d.h.

#define CS_FX_MULTIPLY   0x10000000
 

=SRC*DST

Definition at line 253 of file graph3d.h.

#define CS_FX_MULTIPLY2   0x20000000
 

=2*SRC*DST

Definition at line 255 of file graph3d.h.

#define CS_FX_PREMULTALPHA   0x80000000
 

=SRC + DST*(1-srcalpha)

Definition at line 267 of file graph3d.h.

#define CS_FX_SETALPHA alpha   )     (CS_FX_ALPHA | uint (alpha * CS_FX_MASK_ALPHA))
 

Macro for setting of alpha bits into mixmode (alpha between 0 and 1).

Definition at line 283 of file graph3d.h.

Referenced by csNewParticleSystem::SetAlpha(), and csParticleSystem::SetAlpha().

#define CS_FX_SETALPHA_INT alpha   )     (CS_FX_ALPHA | uint (alpha & CS_FX_MASK_ALPHA))
 

Macro for setting of alpha bits into mixmode (alpha between 0 and 255).

Definition at line 286 of file graph3d.h.

#define CS_FX_SRCALPHAADD   0x70000000
 

=(srcalpha)*SRC + DST

Definition at line 265 of file graph3d.h.

#define CS_FX_TILING   0x02000000
 

Tiling.

Definition at line 278 of file graph3d.h.

#define CS_FX_TRANSPARENT   0x50000000
 

=DST

Definition at line 261 of file graph3d.h.

#define CS_LIGHTPARAM_ATTENUATION   3
 

Attenuation of the light.

Definition at line 325 of file graph3d.h.

#define CS_LIGHTPARAM_DIFFUSE   1
 

Diffuse color of the light.

Definition at line 321 of file graph3d.h.

#define CS_LIGHTPARAM_POSITION   0
 

Position of the light.

Definition at line 319 of file graph3d.h.

#define CS_LIGHTPARAM_SPECULAR   2
 

Specular color of the light.

Definition at line 323 of file graph3d.h.

#define CS_SHADOW_VOLUME_BEGIN   1
 

Clear stencil.

Definition at line 331 of file graph3d.h.

#define CS_SHADOW_VOLUME_FAIL1   4
 

Setup for carmack's reverse pass 1.

Definition at line 337 of file graph3d.h.

#define CS_SHADOW_VOLUME_FAIL2   5
 

Setup for carmack's reverse pass 2.

Definition at line 339 of file graph3d.h.

#define CS_SHADOW_VOLUME_FINISH   7
 

Restore states.

Definition at line 343 of file graph3d.h.

#define CS_SHADOW_VOLUME_PASS1   2
 

Setup for pass 1.

Definition at line 333 of file graph3d.h.

#define CS_SHADOW_VOLUME_PASS2   3
 

Setup for pass 2.

Definition at line 335 of file graph3d.h.

#define CS_SHADOW_VOLUME_USE   6
 

Setup for shadow masking.

Definition at line 341 of file graph3d.h.

#define CSDRAW_2DGRAPHICS   0x00000001
 

We're going to draw 2D graphics.

Definition at line 66 of file graph3d.h.

#define CSDRAW_3DGRAPHICS   0x00000002
 

We're going to draw 3D graphics.

Definition at line 68 of file graph3d.h.

#define CSDRAW_CLEARSCREEN   0x00000020
 

Clear frame buffer ?

Definition at line 72 of file graph3d.h.

#define CSDRAW_CLEARZBUFFER   0x00000010
 

Clear Z-buffer ?

Definition at line 70 of file graph3d.h.


Enumeration Type Documentation

enum csRenderMeshType
 

Primitive type of a mesh.

Enumerator:
CS_MESHTYPE_TRIANGLES  Triangles.
CS_MESHTYPE_QUADS  Quads.
CS_MESHTYPE_TRIANGLESTRIP  Triangle strip.

The OpenGL spec describes it pretty well: "A triangle strip is a series of triangles connected along shared edges. A triangle strip is specified by giving a series of defining vertices [...]. In this case, the first three vertices define the first triangle [...]. Each subsequent vertex defines a new triangle using that point along with two vertices from the previous triangle."

CS_MESHTYPE_TRIANGLEFAN  Triangle fan.

Similar to a triangle strip, however, a triangle is always defined with the first, previously added and the recently added vertex.

CS_MESHTYPE_POINTS  Points.
CS_MESHTYPE_POINT_SPRITES  Point sprites.

Note: only supported if the SupportsPointSprites member of the csGraphics3DCaps structure for this renderer is true.

CS_MESHTYPE_LINES  Lines.
CS_MESHTYPE_LINESTRIP  Line strip.

A line is defined from the prebviously and recently added vertex.

CS_MESHTYPE_POLYGON  Render polygons.

Note that you *must* supply geometry with the help of an iPolygonRenderer. In the common case, if you want to draw a polygon, you probably want to use CS_MESHTYPE_TRIANGLES or CS_MESHTYPE_TRIANGLEFAN and triangulate the poly yourself.

Definition at line 406 of file graph3d.h.

enum csSimpleMeshFlags
 

Flags to influence the behaviour of DrawSimpleMesh().

Enumerator:
csSimpleMeshScreenspace  Ignore the object2camera transform in the csSimpleRenderMesh struct and replace it with a transformation that effectively lets you specify the vertices in screen space.

The Z components of the mesh vertices should be set to 0 when this flag is specified.

Definition at line 459 of file graph3d.h.

enum csVertexAttrib
 

For NR: Vertex attributes.

Enumerator:
CS_VATTRIB_POSITION  Position vertex attribute.
CS_VATTRIB_WEIGHT  Vertex weight attribute.
CS_VATTRIB_NORMAL  Normal attribute.
CS_VATTRIB_COLOR  Primary color attribute.
CS_VATTRIB_PRIMARY_COLOR  Primary color attribute.
CS_VATTRIB_SECONDARY_COLOR  Secondary color attribute.
CS_VATTRIB_FOGCOORD  Fog coordinate attribute.
CS_VATTRIB_TEXCOORD  TU 0 texture coordinates.
CS_VATTRIB_TEXCOORD0  TU 0 texture coordinates.
CS_VATTRIB_TEXCOORD1  TU 1 texture coordinates.
CS_VATTRIB_TEXCOORD2  TU 2 texture coordinates.
CS_VATTRIB_TEXCOORD3  TU 3 texture coordinates.
CS_VATTRIB_TEXCOORD4  TU 4 texture coordinates.
CS_VATTRIB_TEXCOORD5  TU 5 texture coordinates.
CS_VATTRIB_TEXCOORD6  TU 6 texture coordinates.
CS_VATTRIB_TEXCOORD7  TU 7 texture coordinates.
CS_VATTRIB_0  General vertex attribute.
CS_VATTRIB_1  General vertex attribute.
CS_VATTRIB_2  General vertex attribute.
CS_VATTRIB_3  General vertex attribute.
CS_VATTRIB_4  General vertex attribute.
CS_VATTRIB_5  General vertex attribute.
CS_VATTRIB_6  General vertex attribute.
CS_VATTRIB_7  General vertex attribute.
CS_VATTRIB_8  General vertex attribute.
CS_VATTRIB_9  General vertex attribute.
CS_VATTRIB_10  General vertex attribute.
CS_VATTRIB_11  General vertex attribute.
CS_VATTRIB_12  General vertex attribute.
CS_VATTRIB_13  General vertex attribute.
CS_VATTRIB_14  General vertex attribute.

Definition at line 188 of file graph3d.h.

enum csZBufMode
 

Z-buffer modes.

Enumerator:
CS_ZBUF_NONE  Don't test/write.
CS_ZBUF_FILL  write
CS_ZBUF_TEST  test
CS_ZBUF_USE  write/test
CS_ZBUF_FILLONLY  only write
CS_ZBUF_EQUAL  test if equal
CS_ZBUF_INVERT  inverted test
CS_ZBUF_MESH  use the z mode of the mesh (NOTE: NOT VALID AS MESH ZMODE)
CS_ZBUF_MESH2  Use a z mode depending on the mesh zmode.

The mesh zmode is used a to choose a zmode that makes sure only pixels that are changed by the mesh zmode can be touched, e.g. if the mesh has a zmode of "zuse", zmesh2 will resolve to "ztest". This is useful for multi- pass stuff. (NOTE: NOT VALID AS MESH ZMODE)

Definition at line 142 of file graph3d.h.

enum G3D_RENDERSTATEOPTION
 

Graphics3D render state options.

Enumerator:
G3DRENDERSTATE_ZBUFFERMODE  Set Z-buffer fill/test/use mode (parameter is a csZBufMode).
G3DRENDERSTATE_DITHERENABLE  Enable/disable dithering (parameter is a bool).
G3DRENDERSTATE_BILINEARMAPPINGENABLE  Enable/disable bi-linear mapping (parameter is a bool).
G3DRENDERSTATE_TRILINEARMAPPINGENABLE  Enable/disable tri-linear mapping (parameter is a bool).
G3DRENDERSTATE_TRANSPARENCYENABLE  Enable/disable transparent textures (parameter is a bool).
G3DRENDERSTATE_MIPMAPENABLE  Enable/disable mip-mapping (parameter is a bool).
G3DRENDERSTATE_TEXTUREMAPPINGENABLE  Enable/disable textures (parameter is a bool).
G3DRENDERSTATE_LIGHTINGENABLE  Enable/disable lighting (parameter is a bool).
G3DRENDERSTATE_INTERLACINGENABLE  Enable/disable interlacing (parameter is a bool).
G3DRENDERSTATE_MMXENABLE  Enable/disable MMX instructions usage (parameter is a bool).
G3DRENDERSTATE_INTERPOLATIONSTEP  Set perspective-correction interpolation step (parameter is a int).
G3DRENDERSTATE_MAXPOLYGONSTODRAW  Set maximal number of polygons per frame to draw (parameter is a int).
G3DRENDERSTATE_GOURAUDENABLE  Enable/disable Gouraud shading (parameter is a bool).
G3DRENDERSTATE_EDGES  Enable/disable edge drawing (debugging) (parameter is a bool).

Definition at line 347 of file graph3d.h.


Generated for Crystal Space by doxygen 1.4.4