Xors3d Engine
Graphics

Functions

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

BBDECL int BBCALL 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.
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL int BBCALL 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
BBDECL void BBCALL 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)
BBDECL void BBCALL 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
BBDECL void BBCALL xOrigin ( int  x,
int  y 
)

Sets a point of origin for all subsequent drawing commands.

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

Returns max supported antialiasing level.

BBDECL int BBCALL xGetMaxTextureFiltering ( )

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

BBDECL void BBCALL xSetAntiAliasType ( int  typeID)

Sets anitaliasing type.

This command must be called before xGaphics3D()

Parameters:
typeIDAntialias type. See 'AntiAliasing types' and 'xGetMaxAntiAlias()' for more information.
BBDECL void BBCALL 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
BBDECL void BBCALL xSetWND ( HWND  window)

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

Parameters:
windowBlitz3D window, may be get by SystemProperty("AppHWND")
BBDECL void BBCALL 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
BBDECL void BBCALL 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.
BBDECL void BBCALL xDestroyRenderWindow ( )

Destroys the window for rendering set by xSetRenderWindow()

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

BBDECL void BBCALL 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.

BBDECL void* BBCALL 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().

BBDECL void BBCALL 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
BBDECL void BBCALL xUnlockBuffer ( int  buffer = NULL)

Unlocks locked buffer.

Parameters:
bufferBuffer handle
BBDECL void BBCALL 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
BBDECL DWORD BBCALL 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
BBDECL void* BBCALL 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
BBDECL void BBCALL xSaveBuffer ( int  buffer,
const char *  path 
)

Save buffer into file.

Typically, this is used to take a screen snapshot. This will save the spcified buffer you specify to a .bmp file you specify.

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

Returns current rendering buffer handle.

BBDECL int BBCALL xBufferWidth ( int  buffer = NULL)

Returns specified buffer's width.

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

Returns specified buffer's height.

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

Creates and starts stopwatch, returns its handle.

BBDECL float BBCALL xGetElapsedTime ( void *  timeStamp)

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

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

Sets the current drawing buffer.

If buffer is not specified, back buffer is used.

Parameters:
bufferBuffer handle
BBDECL void BBCALL 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()
BBDECL void BBCALL xUnSetMRT ( )

Unsets all MRT channels.

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

See also:
xSetMRT()
BBDECL int BBCALL 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.

BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL int BBCALL xGraphicsBuffer ( )

Returns handle of current rendering buffer.

BBDECL DWORD BBCALL xGetColor ( int  x,
int  y 
)

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

Parameters:
xx coordinate of pixel
yy coordinate of pixel
BBDECL DWORD BBCALL 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
BBDECL int BBCALL 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.
BBDECL int BBCALL 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.
BBDECL int BBCALL xGraphicsDepth ( )

Returns the color depth of the screen.

BBDECL int BBCALL xColorAlpha ( )

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

BBDECL int BBCALL xColorRed ( )

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

BBDECL int BBCALL xColorGreen ( )

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

BBDECL int BBCALL xColorBlue ( )

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

BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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

BBDECL void BBCALL 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
BBDECL void BBCALL 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.
BBDECL void BBCALL 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)
BBDECL void BBCALL 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
BBDECL int BBCALL xMaxClipPlanes ( )

Returns max number of suppoted clip planes.

BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL DWORD BBCALL xTrisRendered ( )

Returns the number of triangles rendered during last rendering cycle.

BBDECL int BBCALL xDIPCounter ( )

Returns total number of DIP calls.

Counter updates during xFlip() call.

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

Returns total number of rendered surfaces.

Counter updates during xFlip() call.

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

Returns total number of rendered entities.

Counter updates during xFlip() call.

See also:
xDIPCounter(), xSurfRendered(), xTrisRendered()
BBDECL void BBCALL 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.
BBDECL int BBCALL xGetFPS ( )

Returns FPS (frames per second) counter.

BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL LPDIRECT3DDEVICE9 BBCALL xGetDevice ( )

Returns a pointer to Direct3D device used by Xors3D.

BBDECL void BBCALL xReleaseGraphics ( )

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

BBDECL void BBCALL xShowPointer ( )

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

BBDECL void BBCALL 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().

BBDECL void BBCALL 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
BBDECL void BBCALL xDeleteDSS ( )

Deletes a depth-stencil surface.

BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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
BBDECL void BBCALL 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).
BBDECL void BBCALL 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.
BBDECL HWND BBCALL xGetRenderWindow ( )

Returns a pointer to Xors3D's rendering window.

BBDECL void BBCALL xKey ( const char *  key)

Activates a full Xors3D version.

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

Sets the value for engine's parameter.

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

Returns the value of engine's parameter.

Parameters:
parameterEngine's parameter name
BBDECL int BBCALL xHWInstancingAvailable ( )

Returns true if hardware instancing is supported.

BBDECL int BBCALL xShaderInstancingAvailable ( )

Returns true if shader instancing emulation is supported.

BBDECL void BBCALL 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.

BBDECL int BBCALL xGetShaderLayer ( )

Returns a global active shader layer for rendering.

BBDECL void BBCALL 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.

BBDECL int BBCALL 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().

BBDECL int BBCALL 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]
BBDECL int BBCALL 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]
BBDECL int BBCALL 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]
BBDECL int BBCALL 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)
BBDECL void BBCALL 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.
BBDECL int BBCALL xMillisecs ( )

Returns current time in millicesonds.

BBDECL int BBCALL 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
BBDECL float BBCALL 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)
BBDECL void BBCALL xSetTextureFilter ( Texture *  texture,
int  mode 
)

Sets texture filtering method.

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