CrystalSpace

Public API Reference

ivideo/graph3d.h File Reference

3D graphics interface More...

#include "csutil/scf.h"
#include "csgeom/matrix4.h"
#include "csgeom/transfrm.h"
#include "csutil/flags.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  csGraphics3DCaps
 Information about 3d renderer capabilities. More...
struct  csSimpleRenderMesh
 A simple render mesh. More...
struct  iGraphics3D
 This is the standard 3D graphics interface. More...

Namespaces

namespace  CS
 

Main namespace for CrystalSpace.


namespace  CS::Graphics
 

Graphics and rendering related classes.


Defines

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 mode: Default modes

A set of commonly used mix modes.



#define CS_FX_ADD   (CS_MIXMODE_BLEND(ONE, ONE) | CS_MIXMODE_ALPHATEST_DISABLE)
 Additive blending. Formula: =SRC+DST.
#define CS_FX_ALPHA
 Alpha blending.
#define CS_FX_COPY   (CS_MIXMODE_TYPE_AUTO | CS_MIXMODE_ALPHATEST_AUTO)
 This mixmode uses alpha smooth blending, binary blending (ie enabled alpha test) and no blending depending on the contents of csRenderMesh::alphaMode.
#define CS_FX_DESTALPHAADD   (CS_MIXMODE_BLEND(DSTALPHA, ONE) | CS_MIXMODE_ALPHATEST_DISABLE)
 Multiply source color with destination alpha and add.
#define CS_FX_FLAT   (0x04000000)
 Flat shading flag.
#define CS_FX_MASK_ALPHA   (0x000000FF)
 Mixmode alpha part.
#define CS_FX_MASK_MIXMODE   (0xf8ffff00)
 Bit mask for bits relevant to mix mode comparison; contains type, alpha test flags and blending op factors.
#define CS_FX_MESH   (CS_MIXMODE_TYPE_MESH)
 Use the mix mode of the mesh mix mode.
#define CS_FX_MULTIPLY   (CS_MIXMODE_BLEND(DSTCOLOR, ZERO) | CS_MIXMODE_ALPHATEST_DISABLE)
 Multiplicative blending. Formula: =SRC*DST.
#define CS_FX_MULTIPLY2   (CS_MIXMODE_BLEND(DSTCOLOR, SRCCOLOR) | CS_MIXMODE_ALPHATEST_DISABLE)
 Multiplicative doubling blending. Formula: =2*SRC*DST.
#define CS_FX_PREMULTALPHA
 Multiply destination color with inverse source alpha and add source color.
#define CS_FX_SRCALPHAADD   (CS_MIXMODE_BLEND(SRCALPHA, ONE) | CS_MIXMODE_ALPHATEST_DISABLE)
 Multiply source color with source alpha and add.
#define CS_FX_TRANSPARENT   (CS_MIXMODE_BLEND(ZERO, ONE) | CS_MIXMODE_ALPHATEST_DISABLE)
 Transparent blending (keep framebuffer unmodified).
Mix mode: alpha helpers



#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).
Mix mode: Alpha test flags

Enabled alpha test (or binary alpha) means that a fragment is only drawn when its alpha component is above a certain threshold, and discarded otherwise.



#define CS_MIXMODE_ALPHATEST_AUTO   (0x00000000)
 Automatic alpha test.
#define CS_MIXMODE_ALPHATEST_DISABLE   (0x20000000)
 Unconditionally disable alpha test.
#define CS_MIXMODE_ALPHATEST_ENABLE   (0x10000000)
 Unconditionally enable alpha test.
#define CS_MIXMODE_ALPHATEST_MASK   (0x30000000)
 Bit mask to extract the alpha test flag from a mixmode specifier.
Mix mode: Blending mode helpers



#define CS_MIXMODE_BLEND(Src, Dst)
 Helper macro to construct a blending operation mixmode Src and Dst are blending op factors , however sans the CS_MIXMODE_FACT_ prefix.
#define CS_MIXMODE_BLEND_ALPHA(Src, Dst)
 Helper macro to construct alpha factoes for a blending operation mixmode Src and Dst are blending op factors , however sans the CS_MIXMODE_FACT_ prefix.
#define CS_MIXMODE_BLENDOP_ALPHA_DST(mode)   ((mode >> 8) & CS_MIXMODE_FACT_MASK)
 Helper macro to extract the alpha dstFactor from a blending op mixmode.
#define CS_MIXMODE_BLENDOP_ALPHA_SRC(mode)   ((mode >> 12) & CS_MIXMODE_FACT_MASK)
 Helper macro to extract the alpha srcFactor from a blending op mixmode.
#define CS_MIXMODE_BLENDOP_DST(mode)   ((mode >> 16) & CS_MIXMODE_FACT_MASK)
 Helper macro to extract the dstFactor from a blending op mixmode.
#define CS_MIXMODE_BLENDOP_SRC(mode)   ((mode >> 20) & CS_MIXMODE_FACT_MASK)
 Helper macro to extract the srcFactor from a blending op mixmode.
Mix mode: Types

The mix mode specifies how a shaded fragment (denoted as SRC) is mixed (or blended) with the framebuffer fragment (DST).



#define CS_MIXMODE_FLAG_BLENDOP_ALPHA   (0x08000000)
 When blending with a blending operation, signinify that separate factors for the alpha channel are present.
#define CS_MIXMODE_TYPE_AUTO   (0x00000000)
 Automatic blending mode.
#define CS_MIXMODE_TYPE_BLENDOP   (0x40000000)
 Blend with a blending operation.
#define CS_MIXMODE_TYPE_MASK   (0xc0000000)
 Bit mask to extract the type from a mixmode specifier.
#define CS_MIXMODE_TYPE_MESH   (0x80000000)
 Use the mix mode of the mesh mix mode.
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 ?
#define CSDRAW_NOCLIPCLEAR   0x00000040
 Ignore clipping rectangle when clearing?
#define CSDRAW_READBACK   0x00000080
 Trigger a read back of the render target once drawing is finished.

Enumerations

enum  {
  CS_MIXMODE_FACT_ZERO = 0x0, CS_MIXMODE_FACT_ONE = 0x1, CS_MIXMODE_FACT_SRCCOLOR = 0x2, CS_MIXMODE_FACT_SRCCOLOR_INV = 0x3,
  CS_MIXMODE_FACT_DSTCOLOR = 0x4, CS_MIXMODE_FACT_DSTCOLOR_INV = 0x5, CS_MIXMODE_FACT_SRCALPHA = 0x6, CS_MIXMODE_FACT_SRCALPHA_INV = 0x7,
  CS_MIXMODE_FACT_DSTALPHA = 0x8, CS_MIXMODE_FACT_DSTALPHA_INV = 0x9, CS_MIXMODE_FACT_COUNT = 0xa, CS_MIXMODE_FACT_MASK = 0xf
}
 

Mix mode: Blending op factors.

More...
enum  csOpenPortalFlags { CS_OPENPORTAL_ZFILL = 0x00000004, CS_OPENPORTAL_MIRROR = 0x00000010, CS_OPENPORTAL_FLOAT = 0x00000040 }
 

Flags to inform the renderer about properties of a portal when calling OpenPortal().

More...
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
}
 

Primitive type of a mesh.

More...
enum  csRenderTargetAttachment {
  rtaDepth, rtaColor0, rtaColor1, rtaColor2,
  rtaColor3, rtaColor4, rtaColor5, rtaColor6,
  rtaColor7, rtaColor8, rtaColor9, rtaColor10,
  rtaColor11, rtaColor12, rtaColor13, rtaColor14,
  rtaColor15, rtaNumAttachments, rtaNumColorAttachments = rtaNumAttachments - 1
}
 

Render target attachment - selects which result of the rasterization gets output to the given texture when setting a render target.

More...
enum  csSimpleMeshFlags { csSimpleMeshScreenspace = 0x01 }
 

Flags to influence the behaviour of DrawSimpleMesh().

More...
enum  csVertexAttrib {
  CS_VATTRIB_UNUSED = -2, CS_VATTRIB_INVALID = -1, 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, CS_VATTRIB_15 = CS_VATTRIB_GENERIC_FIRST + 15, CS_IATTRIB_OBJECT2WORLD = CS_IATTRIB_FIRST + 0
}
 

Vertex attributes.

More...
enum  csZBufMode {
  CS_ZBUF_NONE = 0x00000000, CS_ZBUF_FILL = 0x00000001, CS_ZBUF_TEST = 0x00000002, CS_ZBUF_USE = 0x00000003,
  CS_ZBUF_EQUAL = 0x00000004, CS_ZBUF_INVERT = 0x00000005, CS_ZBUF_MESH = 0x80000000, CS_ZBUF_MESH2 = 0x80000001
}
 

Z-buffer modes.

More...
enum  G3D_RENDERSTATEOPTION { G3DRENDERSTATE_EDGES }
 

Graphics3D render state options.

More...

Detailed Description

3D graphics interface

Definition in file graph3d.h.


Define Documentation

#define CS_SHADOW_VOLUME_BEGIN   1

Clear stencil.

Definition at line 500 of file graph3d.h.

#define CS_SHADOW_VOLUME_FAIL1   4

Setup for carmack's reverse pass 1.

Definition at line 506 of file graph3d.h.

#define CS_SHADOW_VOLUME_FAIL2   5

Setup for carmack's reverse pass 2.

Definition at line 508 of file graph3d.h.

#define CS_SHADOW_VOLUME_FINISH   7

Restore states.

Definition at line 512 of file graph3d.h.

#define CS_SHADOW_VOLUME_PASS1   2

Setup for pass 1.

Definition at line 502 of file graph3d.h.

#define CS_SHADOW_VOLUME_PASS2   3

Setup for pass 2.

Definition at line 504 of file graph3d.h.

#define CS_SHADOW_VOLUME_USE   6

Setup for shadow masking.

Definition at line 510 of file graph3d.h.


Enumeration Type Documentation

Flags to inform the renderer about properties of a portal when calling OpenPortal().

Enumerator:
CS_OPENPORTAL_ZFILL 

If this flag is set then renderer must do a Z-fill after rendering the portal contents.

This is mainly useful for floating portals where it is possible that there is geometry in the same sector that will be rendered behind the portal (and does could accidently get written in the portal sector because the Z-buffer cannot be trusted).

CS_OPENPORTAL_MIRROR 

If this flag is set then this portal mirrors space (changes order of the vertices of polygons).

CS_OPENPORTAL_FLOAT 

If this flag is used then the portal must use possible available stencil buffer on the hardware to do good clipping.

This flag should be used if you have a portal that is not at the boundary of the sector and that can be covered (or itself covers) other objects. It is usually used in combination with CS_OPENPORTAL_ZFILL.

Definition at line 611 of file graph3d.h.

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.

Definition at line 550 of file graph3d.h.

Render target attachment - selects which result of the rasterization gets output to the given texture when setting a render target.

Enumerator:
rtaDepth 

Depth.

rtaColor0 

Color 0.

rtaColor1 

Color 1.

rtaColor2 

Color 2.

rtaColor3 

Color 3.

rtaColor4 

Color 4.

rtaColor5 

Color 5.

rtaColor6 

Color 6.

rtaColor7 

Color 7.

rtaColor8 

Color 8.

rtaColor9 

Color 9.

rtaColor10 

Color 10.

rtaColor11 

Color 11.

rtaColor12 

Color 12.

rtaColor13 

Color 13.

rtaColor14 

Color 14.

rtaColor15 

Color 15.

rtaNumAttachments 

Number of supported attachments.

rtaNumColorAttachments 

Number of supported color attachment points.

Definition at line 724 of file graph3d.h.

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 596 of file graph3d.h.

Graphics3D render state options.

Enumerator:
G3DRENDERSTATE_EDGES 

Enable/disable edge drawing (debugging) (parameter is a bool).

Definition at line 516 of file graph3d.h.


Generated for Crystal Space 2.0 by doxygen 1.6.1