Xors3d Engine
Graphics

Functions

void xAmbientLight (int red, int green, int blue, xWorld *world=NULL)
 Sets the ambient lighting colour.
void xAntiAlias (int state)
 Enables or disables antialiasing.
void xAppTitle (const char *title)
 Allows you to set the text of the program's title bar.
void xAppWindowFrame (int state)
 Allows you to enable / disable the frame of the window. Should be called before xGraphics3D(). By default window frame is enabled.
void * xBackBuffer ()
 Returns a backbuffer handle.
int xBufferHeight (int buffer=NULL)
 Returns specified buffer's height.
int xBufferWidth (int buffer=NULL)
 Returns specified buffer's width.
void xCaptureWorld ()
 Captures the properties (position, rotation, scale, alpha) of each entity in the 3D world.
void * xCatchTimestamp ()
 Creates and starts stopwatch, returns its handle.
void xClearWorld (bool entities=true, bool brushes=true, bool textures=true)
 Clears all entities, brushes and/or textures from the screen and from memory.
void xCls ()
 Clears rendering buffer.
void xClsColor (int red, int green, int blue, int alpha=255)
 Set clear color for xCls() command.
void xColor (int red, int green, int blue, int alpha=255)
 This command sets the drawing color (using ARGB values) for all subsequent drawing commands (xLine(), xRect(), xText(), etc.)
int xColorAlpha ()
 Returns the alpha component of the ARGB color of the current drawing color.
int xColorBlue ()
 Returns the blue component of the ARGB color of the current drawing color.
int xColorGreen ()
 Returns the green component of the ARGB color of the current drawing color.
int xColorRed ()
 Returns the red component of the ARGB color of the current drawing color.
void xCopyPixel (int sx, int sy, int sourceBuffer, int dx, int dy, int destinationBuffer)
 Copys a pixel from one buffer to other.
void xCopyPixelFast (int sx, int sy, int sourceBuffer, int dx, int dy, int destinationBuffer)
 Copys a pixel from one buffer to other.
void xCopyRect (int sx, int sy, int sw, int sh, int dx, int dy, int sourceBuffer, int destinationBuffer)
 Copies a rectangle of graphics from one buffer to another.
int xCountGfxModes ()
 Returns the number of video modes available on the selected graphics card, and sets up the info to be returned by xGfxModeWidth(), xGfxModeHeight(), xGfxModeDepth().
void xCreateDSS (int width, int height)
 Creates a depth-stencil surface.
void xDeleteDSS ()
 Deletes a depth-stencil surface.
int xDeltaTime (bool fromInit=false)
 Returns time in milliseconds elapsed since the engine initialization or last xFlip() call.
float xDeltaValue (float value, int time=0)
 Returns a value interpolated by elapsed time.
void xDestroyRenderWindow ()
 Destroys the window for rendering set by xSetRenderWindow()
int xDIPCounter ()
 Returns total number of DIP calls.
void xDither (int state)
 Enables or disables hardware dithering.
void xDrawBBox (bool draw, bool zOn, int red, int green, int blue, int alpha)
 Enables or disables rendering of entitys' bounding boxes.
void xDrawGrid (float x, float z, int gridSize, int range)
 Draws a grid in XOZ plane.
int xEntityRendered ()
 Returns total number of rendered entities.
void xFlip ()
 Switches the front buffer and back buffer.
DWORD xGetColor (int x, int y)
 This command works like a 'color picker' in paint program.
int xGetCurrentBuffer ()
 Returns current rendering buffer handle.
LPDIRECT3DDEVICE9 xGetDevice ()
 Returns a pointer to Direct3D device used by Xors3D.
float xGetElapsedTime (void *timeStamp)
 Returns time elapsed from stopwatch staring (in seconds) and delete it.
const char * xGetEngineSetting (const char *parameter)
 Returns the value of engine's parameter.
int xGetFPS ()
 Returns FPS (frames per second) counter.
int xGetMaxAntiAlias ()
 Returns max supported antialiasing level.
int xGetMaxTextureFiltering ()
 Returns the best supported texture filtering mode. See 'Texture filtering types'.
int xGetNumberRT ()
 Returns supported MRT number.
void * xGetPixels (int buffer=-1)
 Reads pixels data either the current buffer or the specified buffer.
HWND xGetRenderWindow ()
 Returns a pointer to Xors3D's rendering window.
int xGetShaderLayer ()
 Returns a global active shader layer for rendering.
int xGfxModeDepth (int mode)
 Returns the color depth of the video mode.
int xGfxModeExists (int width, int height, int depth)
 Returns true if the user's video card can use this graphic mode and false if not.
int xGfxModeHeight (int mode)
 Returns the height of the video mode.
int xGfxModeWidth (int mode)
 Returns the width of the video mode.
void xGraphics3D (int width=1024, int height=768, int depth=0, int mode=0, int vsync=1)
 Sets 3D Graphics mode.
void xGraphicsAspectRatio (float aspectRatio)
 Sets the aspect ratio of the screen.
void xGraphicsBorderColor (int red, int green, int blue)
 Sets the color of the virtual viewport border which is seen if a not native aspect ratio is set. See xGraphicsAspectRatio().
int xGraphicsBuffer ()
 Returns handle of current rendering buffer.
int xGraphicsDepth ()
 Returns the color depth of the screen.
int xGraphicsHeight (bool isVirtual=true)
 Returns the height of the screen or the virtual viewport. See details.
int xGraphicsWidth (bool isVirtual=true)
 Returns the width of the screen or the virtual viewport. See details.
void xGridColor (int centerRed, int centerGreen, int centerBlue, int gridRed, int gridGreen, int gridBlue)
 Sets the color for a grid.
void xHidePointer ()
 Hides mouse pointer.
int xHWInstancingAvailable ()
 Returns true if hardware instancing is supported.
void xKey (const char *key)
 Activates a full Xors3D version.
void xLine (int x1, int y1, int x2, int y2)
 Draws a line, in the current drawing color.
void xLoadBuffer (int buffer, const char *path)
 Loads and image into specified buffer.
void xLockBuffer (int buffer=NULL)
 Locks specified buffer.
int xMaxClipPlanes ()
 Returns max number of suppoted clip planes.
int xMillisecs ()
 Returns current time in millicesonds.
void xOrigin (int x, int y)
 Sets a point of origin for all subsequent drawing commands.
void xOval (int x, int y, int width, int height, bool solid=false)
 Draws an oval shape at the screen coordinates of your choice.
DWORD xReadPixel (int x, int y, int buffer=NULL)
 Reads a color value from either the current buffer or the specified buffer.
DWORD xReadPixelFast (int x, int y, int buffer=-1)
 Reads a color value from either the current buffer or the specified buffer.
void xRect (int x, int y, int width, int height, bool solid=false)
 Draws a rectangle in the current drawing color starting at the location specified.
int xRectsOverlap (int x1, int y1, int width1, int height1, int x2, int y2, int width2, int height2)
 Checks if two rectangles are overlapping.
void xReleaseGraphics ()
 Releases graphics device and clears all resources which are used by it.
void xRenderEntity (Camera *camera, Entity *entity, float tween=1.0f)
 Renders the specified entity to the current rendering buffer onto the rectangle defined by specified camera xCameraViewport().
void xRenderWorld (float tween=1.0f, bool renderShadows=false)
 Renders the current scene to the current rendering buffer onto the rectangle defined by each cameras xCameraViewport().
void xSaveBuffer (int buffer, const char *path)
 Save buffer into file.
void xSetAntiAliasType (int typeID)
 Sets anitaliasing type.
void xSetAutoTB (bool flag)
 Sets global flag which shows if Xors3d should automatically generate tangents and binormals for loaded mesh or animmesh.
void xSetBuffer (int buffer=NULL)
 Sets the current drawing buffer.
void xSetEngineSetting (const char *parameter, const char *value)
 Sets the value for engine's parameter.
void xSetMRT (Texture *buffer, int frame, int index)
 Sets texture as a channel of MRT.
void xSetRenderWindow (HWND window)
 Sets the window for rendering.
void xSetShaderLayer (int layer)
 Sets a global active shader layer for rendering.
void xSetSkinningMethod (int skinMethod)
 Sets skinning type.
void xSetTextureFilter (Texture *texture, int mode)
 Sets texture filtering method.
void xSetTextureFiltering (int filter)
 Sets global texture filtering method.
void xSetTopWindow (HWND window)
 Sets the top-level window for input devices.
void xSetWND (HWND window)
 For Blitz3D only. Pass Blitz's rendering window to destroy it.
int xShaderInstancingAvailable ()
 Returns true if shader instancing emulation is supported.
void xShowPointer ()
 Shows the windows pointer after it's been hidden (via xHidePointer()).
void xStretchBackBuffer (Texture *texture, int x, int y, int width, int height, int filter)
 Copys data from back buffer to texture using hardware accelerated method.
int xSurfRendered ()
 Returns total number of rendered surfaces.
DWORD xTrisRendered ()
 Returns the number of triangles rendered during last rendering cycle.
void xUnlockBuffer (int buffer=NULL)
 Unlocks locked buffer.
void xUnSetMRT ()
 Unsets all MRT channels.
void xUpdateWorld (float speed=1.0f)
 Animates all entities in the world, and performs collision checking. The speed parameter allows you affect the animation speed of all entities at once. A value of 1.0 will animate entities at their usual animation speed, a value of 2.0 will animate entities at double their animation speed, and so on. For best results use this command once per main loop, just before calling xRenderWorld().
void xViewport (int x, int y, int width, int height)
 Sets viewport form 2D rendering.
int xWinMessage (const char *message)
 Returns true if specified windows message occurs.
void xWireframe (int state)
 Enables or disables wireframe rendering. This will show the outline of each polygon on the screen, with no shaded-in areas.
void xWritePixel (int x, int y, DWORD argb, int buffer=NULL)
 Writes a color value to either the current buffer or the specified buffer.
void xWritePixelFast (int x, int y, DWORD argb, int buffer=-1)
 Writes a color value to either the current buffer or the specified buffer.

Function Documentation

int xWinMessage ( const char *  message)

Returns true if specified windows message occurs.

Parameters:
messageWindows message to be checked. "WM_CLOSE" is the only proper message presently.
void xLine ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draws a line, in the current drawing color.

Parameters:
x1Starting x location of the line
y1Starting y location of the line
x2Ending x location of the line
y2Ending y location of the line
void xRect ( int  x,
int  y,
int  width,
int  height,
bool  solid = false 
)

Draws a rectangle in the current drawing color starting at the location specified.

Parameters:
xx coordinate to begin drawing the rectangle
yy coordinate to begin drawing the rectangle
widthHow wide to make the rectangle in pixels
heightHow tall to make the rectangle in pixels
solidFalse for unfilled and true for filled
int xRectsOverlap ( int  x1,
int  y1,
int  width1,
int  height1,
int  x2,
int  y2,
int  width2,
int  height2 
)

Checks if two rectangles are overlapping.

Parameters:
x1X coordinate of the left upper corner of the first rectangle
y1Y coordinate of the left upper corner of the first rectangle
width1Width of the first rectangle
height1Height of the first rectangle
x2X coordinate of the left upper corner of the second rectangle
y2Y coordinate of the left upper corner of the second rectangle
width2Width of the second rectangle
height2Height of the second rectangle
void xViewport ( int  x,
int  y,
int  width,
int  height 
)

Sets viewport form 2D rendering.

Parameters:
xThe topmost left corner to start the port x coordinate
yThe topmost left corner to start the port y coordinate
widthHow wide the port is (in pixels)
heightHow tall the port is (in pixels)
void xOval ( int  x,
int  y,
int  width,
int  height,
bool  solid = false 
)

Draws an oval shape at the screen coordinates of your choice.

You can make the oval solid or hollow.

Parameters:
xx coordinate on the screen to draw the oval
yy coordinate on the screen to draw the oval
widthHow wide to make the oval
heightHow high to make the oval
solidTrue to make the oval solid, false for hollow
void xOrigin ( int  x,
int  y 
)

Sets a point of origin for all subsequent drawing commands.

Parameters:
xx offset value
yy offset value
int xGetMaxAntiAlias ( )

Returns max supported antialiasing level.

int xGetMaxTextureFiltering ( )

Returns the best supported texture filtering mode. See 'Texture filtering types'.

void xSetAntiAliasType ( int  typeID)

Sets anitaliasing type.

This command must be called before xGaphics3D()

Parameters:
typeIDAntialias type. See 'AntiAliasing types' and 'xGetMaxAntiAlias()' for more information.
void xAppTitle ( const char *  title)

Allows you to set the text of the program's title bar.

Parameters:
titleThe text that will be displayed in the title bar of the program window
void xSetWND ( HWND  window)

For Blitz3D only. Pass Blitz's rendering window to destroy it.

Parameters:
windowBlitz3D window, may be get by SystemProperty("AppHWND")
void xSetRenderWindow ( HWND  window)

Sets the window for rendering.

It may be used by map editor or other tools to render into some gadgets.

Parameters:
windowPointer to rendering window
void xSetTopWindow ( HWND  window)

Sets the top-level window for input devices.

If the rendering window set by xSetRenderWindow is not a top-level window you should specify a valid top-level window to allow Xors3d manage input devices successfully.

Parameters:
windowTop-level window HWND.
void xDestroyRenderWindow ( )

Destroys the window for rendering set by xSetRenderWindow()

It may be useful if xGraphics3d() is called several times during runtime.

void xFlip ( )

Switches the front buffer and back buffer.

This command should be used when you are using double buffering. Double buffering is a technique used to ensure that screen updates are not visible to the user. If you draw directly to the front buffer, the display may appear flickery as the updates are drawn directly to the screen. If you draw to the back buffer, the updates are drawn in memory. xFlip() is then used to make the back buffer the front buffer, and hence show the updates on screen in one go. At the same time, the front buffer becomes the back buffer, allowing you to draw the next screen update on the back buffer before flipping again.

void* xBackBuffer ( )

Returns a backbuffer handle.

This is a value usually used with xSetBuffer() to denote the secondary non-visible drawing buffer called the Back Buffer. In MOST gaming situations, you will want to be using the xBackBuffer() for drawing operations then using xFlip() to bring that buffer to the front buffer where it can be seen. There are other uses for the command, but this is the biggie. See xSetBuffer() for more info. Once again - if you set drawing operations to the xBackBuffer() you will NOT see any of them until you call xFlip().

void xLockBuffer ( int  buffer = NULL)

Locks specified buffer.

You must UnlockBuffer before using other graphics commands or API calls, and you are advised to only keep the buffer locked for as long as it is needed.

Parameters:
bufferBuffer handle
void xUnlockBuffer ( int  buffer = NULL)

Unlocks locked buffer.

Parameters:
bufferBuffer handle
void xWritePixelFast ( int  x,
int  y,
DWORD  argb,
int  buffer = -1 
)

Writes a color value to either the current buffer or the specified buffer.

You must use this command on a locked buffer, otherwise the command will fail

Parameters:
xx-coordinate of pixel
yy-coordinate of pixel
argbARGB color value of pixel (alpha, red, green, blue)
bufferBuffer handle
DWORD xReadPixelFast ( int  x,
int  y,
int  buffer = -1 
)

Reads a color value from either the current buffer or the specified buffer.

The returned colour value is in the form of an integer that contains the alpha, red, green and blue values of the pixel. You must use this command on a locked buffer, otherwise the command will fail. See xLockBuffer()

Parameters:
xx coordinate of pixel
yy coordinate of pixel
bufferHandle of buffer to read colour value from
void* xGetPixels ( int  buffer = -1)

Reads pixels data either the current buffer or the specified buffer.

This command must be used with locked buffers, pixels data losts after buffer unlock.

Parameters:
bufferHandle of buffer to read colour value from
void xSaveBuffer ( int  buffer,
const char *  path 
)

Save buffer into file.

Typically, this is used to take a screen snapshot. The buffer can be saved in BMP, PNG, JPG, DDS, TGA depending on the file extension.

Parameters:
bufferBuffer handle (xBackBuffer(), xImageBuffer(), xTextureBuffer())
pathFile name for buffer saving
int xGetCurrentBuffer ( )

Returns current rendering buffer handle.

int xBufferWidth ( int  buffer = NULL)

Returns specified buffer's width.

Parameters:
bufferBuffer handle (xBackBuffer(), xImageBuffer(), xTextureBuffer())
int xBufferHeight ( int  buffer = NULL)

Returns specified buffer's height.

Parameters:
bufferBuffer handle (xBackBuffer(), xImageBuffer(), xTextureBuffer())
void* xCatchTimestamp ( )

Creates and starts stopwatch, returns its handle.

float xGetElapsedTime ( void *  timeStamp)

Returns time elapsed from stopwatch staring (in seconds) and delete it.

Parameters:
timeStampStopwatch handle
void xSetBuffer ( int  buffer = NULL)

Sets the current drawing buffer.

If buffer is not specified, back buffer is used.

Parameters:
bufferBuffer handle
void xSetMRT ( Texture *  buffer,
int  frame,
int  index 
)

Sets texture as a channel of MRT.

This function is used for MRT realization, it sets a texture as one of MRT channels.

Parameters:
bufferTexture which is needed to be set as MRT channel
frameFrame of texture which is needed to be set as MRT channel
indexMRT channel index (from 0 to xGetNumberRT() - 1)
See also:
xUnSetMRT()
void xUnSetMRT ( )

Unsets all MRT channels.

This function is used for clearing MRT channel and return rendering to backbuffer.

See also:
xSetMRT()
int xGetNumberRT ( )

Returns supported MRT number.

MRT (Multiple Render Targets) refers to the ability to render to multiple textures with a single draw call. These textures can be created independently of each other. It may be used for deferred shading or other effects.

void xLoadBuffer ( int  buffer,
const char *  path 
)

Loads and image into specified buffer.

There are a hundred and one uses for this command, but probably most often used would be to display a title screen or some other 'one time viewing only' image to the back buffer

Parameters:
bufferBuffer handle (xbackBuffer(), xImageBuffer() or xTextureBuffer())
pathString containing filename of image
void xWritePixel ( int  x,
int  y,
DWORD  argb,
int  buffer = NULL 
)

Writes a color value to either the current buffer or the specified buffer.

You can use this command on a locked buffer for a slight speed-up.

Parameters:
xx-coordinate of pixel
yy-coordinate of pixel
argbARGB color value of pixel (alpha, red, green, blue)
bufferBuffer handle
void xCopyPixel ( int  sx,
int  sy,
int  sourceBuffer,
int  dx,
int  dy,
int  destinationBuffer 
)

Copys a pixel from one buffer to other.

Parameters:
sxx-coordinate of source pixel to copy from
syy-coordinate of source pixel to copy from
sourceBufferSource buffer handle
dxx-coordinate of destination pixel to copy to
dyy-coordinate of destination pixel to copy to
destinationBufferDestination buffer handle
void xCopyPixelFast ( int  sx,
int  sy,
int  sourceBuffer,
int  dx,
int  dy,
int  destinationBuffer 
)

Copys a pixel from one buffer to other.

You must use this command on a locked buffer, otherwise the command will fail. See xLockBuffer().

Parameters:
sxx-coordinate of source pixel to copy from
syy-coordinate of source pixel to copy from
sourceBufferSource buffer handle
dxx-coordinate of destination pixel to copy to
dyy-coordinate of destination pixel to copy to
destinationBufferDestination buffer handle
void xCopyRect ( int  sx,
int  sy,
int  sw,
int  sh,
int  dx,
int  dy,
int  sourceBuffer,
int  destinationBuffer 
)

Copies a rectangle of graphics from one buffer to another.

If a buffer is omitted, the current buffer is used

Parameters:
sxSource top left x location to begin copying from
sySource top left y location to begin copying from
swWidth of source area to copy
shHeight of source area to copy
dxDestination top left x location to copy to
dyDestination top left y location to copy to
sourceBufferHandle to the source buffer
destinationBufferHandle to the destination buffer
int xGraphicsBuffer ( )

Returns handle of current rendering buffer.

DWORD xGetColor ( int  x,
int  y 
)

This command works like a 'color picker' in paint program.

Parameters:
xx coordinate of pixel
yy coordinate of pixel
DWORD xReadPixel ( int  x,
int  y,
int  buffer = NULL 
)

Reads a color value from either the current buffer or the specified buffer.

The returned colour value is in the form of an integer that contains the alpha, red, green and blue values of the pixel. You can use this command on a locked buffer for a slight speed-up. See xLockBuffer()

Parameters:
xx coordinate of pixel
yy coordinate of pixel
bufferHandle of buffer to read colour value from
int xGraphicsWidth ( bool  isVirtual = true)

Returns the width of the screen or the virtual viewport. See details.

Generally the virtual viewport matches the screen. It differs if you use not native aspect ratio. In this case you probably need to know the dimensions of the virtual viewport. See xGraphicsAspectRatio().

Parameters:
isVirtualIf true the width of the virtual viewport is returned. Otherwise the real width of the screen is returned.
int xGraphicsHeight ( bool  isVirtual = true)

Returns the height of the screen or the virtual viewport. See details.

Generally the virtual viewport matches the screen. It differs if you use not native aspect ratio. In this case you probably need to know the dimensions of the virtual viewport. See xGraphicsAspectRatio().

Parameters:
isVirtualIf true the height of the virtual viewport is returned. Otherwise the real height of the screen is returned.
int xGraphicsDepth ( )

Returns the color depth of the screen.

int xColorAlpha ( )

Returns the alpha component of the ARGB color of the current drawing color.

int xColorRed ( )

Returns the red component of the ARGB color of the current drawing color.

int xColorGreen ( )

Returns the green component of the ARGB color of the current drawing color.

int xColorBlue ( )

Returns the blue component of the ARGB color of the current drawing color.

void xClsColor ( int  red,
int  green,
int  blue,
int  alpha = 255 
)

Set clear color for xCls() command.

This function changes the color and transparency for subsequent xCls() calls. Use this command when you need xCls() to 'clear' the screen with some other color than black.

Parameters:
redRed clear color value
greenGreen clear color value
blueBlue clear color value
alphaAlpha clear value
void xClearWorld ( bool  entities = true,
bool  brushes = true,
bool  textures = true 
)

Clears all entities, brushes and/or textures from the screen and from memory.

As soon as you clear something, you will not be able to use it again until you reload it. Trying to do so will cause a runtime error. This command is useful for when a level has finished and you wish to load a different level with new entities, brushes and textures.

Parameters:
entitiesTrue to clear all entities, false not to
brushesTrue to clear all brushes, false not to
texturesTrue to clear all textures, false not to
void xColor ( int  red,
int  green,
int  blue,
int  alpha = 255 
)

This command sets the drawing color (using ARGB values) for all subsequent drawing commands (xLine(), xRect(), xText(), etc.)

Parameters:
redRed value of drawing color
greenGreen value of drawing color
blueBlue value of drawing color
alphaAlpha value of drawing color
void xCls ( )

Clears rendering buffer.

This command will wipe the current drawing buffer clean of any graphics or text present and reset the drawing buffer back to the color defined in the xClsColor() command

void xUpdateWorld ( float  speed = 1.0f)

Animates all entities in the world, and performs collision checking. The speed parameter allows you affect the animation speed of all entities at once. A value of 1.0 will animate entities at their usual animation speed, a value of 2.0 will animate entities at double their animation speed, and so on. For best results use this command once per main loop, just before calling xRenderWorld().

Parameters:
speedA master control for animation speed
void xRenderEntity ( Camera *  camera,
Entity *  entity,
float  tween = 1.0f 
)

Renders the specified entity to the current rendering buffer onto the rectangle defined by specified camera xCameraViewport().

Xors3D supported directly rendering into images and textures.

Parameters:
cameraRendering camera
entityRendered entity
tweenTweening parameter (1.0 by default). See xRenderWorld for more details.
void xRenderWorld ( float  tween = 1.0f,
bool  renderShadows = false 
)

Renders the current scene to the current rendering buffer onto the rectangle defined by each cameras xCameraViewport().

Every camera not hidden by xHideEntity() or with a xCameraProjMode() of 0 is rendered. Xors3D supported directly rendering into images and textures. The optional tween parameter should only be specified when RenderWorld is used in conjunction with CaptureWorld. CaptureWorld is used to store the 'old' position, rotation and scale, alpha and colour of each entity in the game world, and a tween value of < 1 will interpolate between these 'old' values and the 'current' ones. A tween value of 0 will render all entities at their state when CaptureWorld was last called, and a tween value of 1 will render all entities at their current state.

Parameters:
tweenTweening parameter (1.0 by default)
renderShadowsEnable or disable shadows rendering (shadows engine must be initialized)
void xSetAutoTB ( bool  flag)

Sets global flag which shows if Xors3d should automatically generate tangents and binormals for loaded mesh or animmesh.

During mesh loading Xors3d generates tangents and binormals automatically by default. In some cases it's not necessary and may be turned off by using a false flag.

Parameters:
flagTrue to enable automatic TB generation, false to disable
int xMaxClipPlanes ( )

Returns max number of suppoted clip planes.

void xWireframe ( int  state)

Enables or disables wireframe rendering. This will show the outline of each polygon on the screen, with no shaded-in areas.

Parameters:
stateTrue to enable wireframe rendering, false to disable
void xDither ( int  state)

Enables or disables hardware dithering.

Hardware dithering is useful when running games in 16-bit colour mode. Due to the fact that 16-bit mode offers less colours than the human eye can detect, separate bands of colour are often noticeable on shaded objects. However, hardware dithering will dither the entire screen to give the impression that more colours are being used than is actually the case. Due to the fact that 32-bit offer more colours than the human eye can detect, hardware dithering is made pretty much redundant in this mode

Parameters:
stateTrue to enable dithering, false to disable
void xSetSkinningMethod ( int  skinMethod)

Sets skinning type.

If mesh is loaded by xLoadAnimMesh() it will use skinning method set by this function. You can switch skinning method before loading mesh if you need different skinning types for diffeent meshes

Parameters:
skinMethodSkinning method. See 'Skinning methods' for more infromation
DWORD xTrisRendered ( )

Returns the number of triangles rendered during last rendering cycle.

int xDIPCounter ( )

Returns total number of DIP calls.

Counter updates during xFlip() call.

See also:
xSurfRendered(), xEntityRendered(), xTrisRendered()
int xSurfRendered ( )

Returns total number of rendered surfaces.

Counter updates during xFlip() call.

See also:
xDIPCounter(), xEntityRendered(), xTrisRendered()
int xEntityRendered ( )

Returns total number of rendered entities.

Counter updates during xFlip() call.

See also:
xDIPCounter(), xSurfRendered(), xTrisRendered()
void xAmbientLight ( int  red,
int  green,
int  blue,
xWorld *  world = NULL 
)

Sets the ambient lighting colour.

Ambient light is a light source that affects all points on a 3D object equally. So with ambient light only, all 3D objects will appear flat, as there will be no shading. Ambient light is useful for providing a certain level of light, before adding other lights to provide a realistic lighting effect. An ambient light level of (0, 0, 0) will result in no ambient light being displayed.

Parameters:
redRed ambient light value
greenGreen ambient light value
blueBlue ambient light value
worldWorld which takes a new ambient light. 0 to use an active world. Default value: 0.
int xGetFPS ( )

Returns FPS (frames per second) counter.

void xAntiAlias ( int  state)

Enables or disables antialiasing.

Antialiasing is a technique used to smooth out the entire screen, so that jagged lines are made less noticeable. You must set antialiasing level by xSetAntiAliasType() command before using antialiasing.

Parameters:
stateTrue to enable antialiasing, false to disable
void xSetTextureFiltering ( int  filter)

Sets global texture filtering method.

During texture loading the method set by this command will be assigned to this texture. If you use shaders you can change filtering type in shader's code.

Parameters:
filterFiltering type. See 'Texture filtering types' for more information
void xStretchBackBuffer ( Texture *  texture,
int  x,
int  y,
int  width,
int  height,
int  filter 
)

Copys data from back buffer to texture using hardware accelerated method.

Parameters:
textureTexture handle
xx coordinate of top left corner of copied rectangle
yy coordinate of top left corner of copied rectangle
widthWidth of copied rectangle
heightHeight of copied rectangle
filterFiltering method
LPDIRECT3DDEVICE9 xGetDevice ( )

Returns a pointer to Direct3D device used by Xors3D.

void xReleaseGraphics ( )

Releases graphics device and clears all resources which are used by it.

void xShowPointer ( )

Shows the windows pointer after it's been hidden (via xHidePointer()).

void xHidePointer ( )

Hides mouse pointer.

xHidePointer() is for use in windowed and fullscreen display modes. It hides the Windows pointer when it is moved over your application's window. You can bring it back via xShowPointer().

void xCreateDSS ( int  width,
int  height 
)

Creates a depth-stencil surface.

Depth-stencil surface is used for z-buffer technique. It's used to write the scene depth for clipping invisible pixels. By default DSS is used with backbuffer dimensions, but if you want to render to larger textures you must create DSS with an appropriate dimensions. E.g. if you use 800x600 mode, default DSS will be 800x600 too. If you want to render to 1024x1024 texture (e.g. for shadows), you must call xCreateDSS(1024, 1024) to make things work.

Parameters:
widthDepth-stencil surface width
heightDepth-stencil surface height
void xDeleteDSS ( )

Deletes a depth-stencil surface.

void xGridColor ( int  centerRed,
int  centerGreen,
int  centerBlue,
int  gridRed,
int  gridGreen,
int  gridBlue 
)

Sets the color for a grid.

Parameters:
centerRedRed value of the center line
centerGreenGreen value of the center line
centerBlueBlue value of the center line
gridRedRed value of the grid
gridGreenGreen value of the grid
gridBlueBlue value of the grid
void xDrawGrid ( float  x,
float  z,
int  gridSize,
int  range 
)

Draws a grid in XOZ plane.

Parameters:
xOffset of the grid in x-axis
zOffset of the grid in z-axis
gridSizeCell size
rangeNumber of rows and columns
void xDrawBBox ( bool  draw,
bool  zOn,
int  red,
int  green,
int  blue,
int  alpha 
)

Enables or disables rendering of entitys' bounding boxes.

Parameters:
drawTrue to enable bounding boxes rendering, false to disable
zOnTrue to enable z-buffeing when drawing bounding boxes, false to disable
redRed value of bounding boxes color
greenGreen value of bounding boxes color
blueBlue value of bounding boxes color
alphaAlpha value of bounding boxes color
void xGraphics3D ( int  width = 1024,
int  height = 768,
int  depth = 0,
int  mode = 0,
int  vsync = 1 
)

Sets 3D Graphics mode.

This command must be executed before any other 3D command, otherwise programs will return an error. Width and height set the resolution of the screen. The resolution must be compatible with the 3D card and monitor being used. If this value is set to 0, then current system resolution will be used. Depth sets the colour mode of the screen. If this value is omitted or set to 0, then current system colour depth available will be used. Other values usually available are 16 and 32. 16-bit colour mode displays the least amount of colours, 65536. 32-bit colour modes display over 16 million colours and as a result offer a better quality picture, although may result in slower programs than 16-bit.

Note:
If the size of the window is equal to or greater than the size of desktop, it will be recalculated to fit the screen due to Windows' restrictions. In this case xGraphicsWidth() and xGraphicsHeight() probably won't match the specified width and height.
Parameters:
widthWidth of screen resolution
heightHeight of screen resolution
depthColour depth of screen
modeTrue to enable fullscreen mode, false for windowed mode
vsyncTrue to enable vertical synchronization, false to disable
void xGraphicsAspectRatio ( float  aspectRatio)

Sets the aspect ratio of the screen.

Parameters:
aspectRatioThe aspect ratio of the screen. E.g. (16.0 / 9.0) or (1.25).
void xGraphicsBorderColor ( int  red,
int  green,
int  blue 
)

Sets the color of the virtual viewport border which is seen if a not native aspect ratio is set. See xGraphicsAspectRatio().

Parameters:
redRed value of the border color.
greenGreen value of the border color.
blueBlue value of the border color.
HWND xGetRenderWindow ( )

Returns a pointer to Xors3D's rendering window.

void xKey ( const char *  key)

Activates a full Xors3D version.

Parameters:
keyLicense key of Xors3D
void xSetEngineSetting ( const char *  parameter,
const char *  value 
)

Sets the value for engine's parameter.

Parameters:
parameterEngine parameter name
valueEngine parameter value
const char* xGetEngineSetting ( const char *  parameter)

Returns the value of engine's parameter.

Parameters:
parameterEngine's parameter name
int xHWInstancingAvailable ( )

Returns true if hardware instancing is supported.

int xShaderInstancingAvailable ( )

Returns true if shader instancing emulation is supported.

void xSetShaderLayer ( int  layer)

Sets a global active shader layer for rendering.

In Xors3d a mesh or a surface can store up to 8 shaders at the same time. You can switch between them quickly by using this command.

int xGetShaderLayer ( )

Returns a global active shader layer for rendering.

void xCaptureWorld ( )

Captures the properties (position, rotation, scale, alpha) of each entity in the 3D world.

This is then used in conjunction with the xRenderWorld() tween parameter in order to render an interpolated frame between the captured state of each entity and the current state of each entity.

int xCountGfxModes ( )

Returns the number of video modes available on the selected graphics card, and sets up the info to be returned by xGfxModeWidth(), xGfxModeHeight(), xGfxModeDepth().

int xGfxModeWidth ( int  mode)

Returns the width of the video mode.

Once you determine the video modes available by the video card using xCountGFXModes(), you can iterate through them and determine the width, height, and color depth capabilities of each mode.
If mode is less than 0, the width of the current mode will be returned.

Parameters:
modeAn index of the video mode in range of [-1; xCountGfxModes() - 1]
int xGfxModeHeight ( int  mode)

Returns the height of the video mode.

Once you determine the video modes available by the video card using xCountGFXModes(), you can iterate through them and determine the width, height, and color depth capabilities of each mode. If mode is less than 0, the height of the current mode will be returned.

Parameters:
modeAn index of the video mode in range of [-1; xCountGfxModes() - 1]
int xGfxModeDepth ( int  mode)

Returns the color depth of the video mode.

Once you determine the video modes available by the video card using xCountGFXModes(), you can iterate through them and determine the width, height, and color depth capabilities of each mode. If mode is less than 0, the depth of the current mode will be returned.

Parameters:
modeAn index of the video mode in range of [-1; xCountGfxModes() - 1]
int xGfxModeExists ( int  width,
int  height,
int  depth 
)

Returns true if the user's video card can use this graphic mode and false if not.

Parameters:
widthWidth of the screen in pixels (e.g. 1024)
heightHeight of the screen in pixels (e.g. 768)
depthColor depth in bits (e.g. 32)
void xAppWindowFrame ( int  state)

Allows you to enable / disable the frame of the window. Should be called before xGraphics3D(). By default window frame is enabled.

Parameters:
stateTrue to enable window frame. False to disable.
int xMillisecs ( )

Returns current time in millicesonds.

int xDeltaTime ( bool  fromInit = false)

Returns time in milliseconds elapsed since the engine initialization or last xFlip() call.

Parameters:
fromInitTrue to get elapsed time since the engine initialization, False to get elapsed time since the last xFlip() call
float xDeltaValue ( float  value,
int  time = 0 
)

Returns a value interpolated by elapsed time.

Parameters:
valueThe increment value for the second
timeTime for the value interpolation. If 0 specified - used last xFlip() call time, if 1 - engine initialization time, other values used as time in milliseconds (e.g. returned by xMillisecs() command)
void xSetTextureFilter ( Texture *  texture,
int  mode 
)

Sets texture filtering method.

Parameters:
textureTexture handle
modeFiltering type. See 'Texture filtering types' for more information