![]() |
Xors3d Engine
|
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. |
BBDECL int BBCALL xWinMessage | ( | const char * | message | ) |
Returns true if specified windows message occurs.
message | Windows 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.
x1 | Starting x location of the line |
y1 | Starting y location of the line |
x2 | Ending x location of the line |
y2 | Ending 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.
x | x coordinate to begin drawing the rectangle |
y | y coordinate to begin drawing the rectangle |
width | How wide to make the rectangle in pixels |
height | How tall to make the rectangle in pixels |
solid | False 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.
x1 | X coordinate of the left upper corner of the first rectangle |
y1 | Y coordinate of the left upper corner of the first rectangle |
width1 | Width of the first rectangle |
height1 | Height of the first rectangle |
x2 | X coordinate of the left upper corner of the second rectangle |
y2 | Y coordinate of the left upper corner of the second rectangle |
width2 | Width of the second rectangle |
height2 | Height of the second rectangle |
BBDECL void BBCALL xViewport | ( | int | x, |
int | y, | ||
int | width, | ||
int | height | ||
) |
Sets viewport form 2D rendering.
x | The topmost left corner to start the port x coordinate |
y | The topmost left corner to start the port y coordinate |
width | How wide the port is (in pixels) |
height | How 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.
x | x coordinate on the screen to draw the oval |
y | y coordinate on the screen to draw the oval |
width | How wide to make the oval |
height | How high to make the oval |
solid | True 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.
x | x offset value |
y | y 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()
typeID | Antialias 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.
title | The 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.
window | Blitz3D 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.
window | Pointer 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.
window | Top-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.
buffer | Buffer handle |
BBDECL void BBCALL xUnlockBuffer | ( | int | buffer = NULL | ) |
Unlocks locked buffer.
buffer | Buffer 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
x | x-coordinate of pixel |
y | y-coordinate of pixel |
argb | ARGB color value of pixel (alpha, red, green, blue) |
buffer | Buffer 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()
x | x coordinate of pixel |
y | y coordinate of pixel |
buffer | Handle 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.
buffer | Handle 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.
buffer | Buffer handle (xBackBuffer(), xImageBuffer(), xTextureBuffer()) |
path | File 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.
buffer | Buffer handle (xBackBuffer(), xImageBuffer(), xTextureBuffer()) |
BBDECL int BBCALL xBufferHeight | ( | int | buffer = NULL | ) |
Returns specified buffer's height.
buffer | Buffer 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.
timeStamp | Stopwatch handle |
BBDECL void BBCALL xSetBuffer | ( | int | buffer = NULL | ) |
Sets the current drawing buffer.
If buffer is not specified, back buffer is used.
buffer | Buffer 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.
buffer | Texture which is needed to be set as MRT channel |
frame | Frame of texture which is needed to be set as MRT channel |
index | MRT channel index (from 0 to xGetNumberRT() - 1) |
BBDECL void BBCALL xUnSetMRT | ( | ) |
Unsets all MRT channels.
This function is used for clearing MRT channel and return rendering to backbuffer.
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
buffer | Buffer handle (xbackBuffer(), xImageBuffer() or xTextureBuffer()) |
path | String 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.
x | x-coordinate of pixel |
y | y-coordinate of pixel |
argb | ARGB color value of pixel (alpha, red, green, blue) |
buffer | Buffer 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.
sx | x-coordinate of source pixel to copy from |
sy | y-coordinate of source pixel to copy from |
sourceBuffer | Source buffer handle |
dx | x-coordinate of destination pixel to copy to |
dy | y-coordinate of destination pixel to copy to |
destinationBuffer | Destination 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().
sx | x-coordinate of source pixel to copy from |
sy | y-coordinate of source pixel to copy from |
sourceBuffer | Source buffer handle |
dx | x-coordinate of destination pixel to copy to |
dy | y-coordinate of destination pixel to copy to |
destinationBuffer | Destination 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
sx | Source top left x location to begin copying from |
sy | Source top left y location to begin copying from |
sw | Width of source area to copy |
sh | Height of source area to copy |
dx | Destination top left x location to copy to |
dy | Destination top left y location to copy to |
sourceBuffer | Handle to the source buffer |
destinationBuffer | Handle 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.
x | x coordinate of pixel |
y | y 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()
x | x coordinate of pixel |
y | y coordinate of pixel |
buffer | Handle 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().
isVirtual | If 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().
isVirtual | If 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.
red | Red clear color value |
green | Green clear color value |
blue | Blue clear color value |
alpha | Alpha 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.
entities | True to clear all entities, false not to |
brushes | True to clear all brushes, false not to |
textures | True to clear all textures, false not to |
BBDECL void BBCALL xColor | ( | int | red, |
int | green, | ||
int | blue, | ||
int | alpha = 255 |
||
) |
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().
speed | A 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.
camera | Rendering camera |
entity | Rendered entity |
tween | Tweening 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.
tween | Tweening parameter (1.0 by default) |
renderShadows | Enable 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.
flag | True 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.
state | True 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
state | True 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
skinMethod | Skinning 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.
BBDECL int BBCALL xSurfRendered | ( | ) |
Returns total number of rendered surfaces.
Counter updates during xFlip() call.
BBDECL int BBCALL xEntityRendered | ( | ) |
Returns total number of rendered entities.
Counter updates during xFlip() call.
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.
red | Red ambient light value |
green | Green ambient light value |
blue | Blue ambient light value |
world | World 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.
state | True 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.
filter | Filtering 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.
texture | Texture handle |
x | x coordinate of top left corner of copied rectangle |
y | y coordinate of top left corner of copied rectangle |
width | Width of copied rectangle |
height | Height of copied rectangle |
filter | Filtering 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.
width | Depth-stencil surface width |
height | Depth-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.
centerRed | Red value of the center line |
centerGreen | Green value of the center line |
centerBlue | Blue value of the center line |
gridRed | Red value of the grid |
gridGreen | Green value of the grid |
gridBlue | Blue value of the grid |
BBDECL void BBCALL xDrawGrid | ( | float | x, |
float | z, | ||
int | gridSize, | ||
int | range | ||
) |
Draws a grid in XOZ plane.
x | Offset of the grid in x-axis |
z | Offset of the grid in z-axis |
gridSize | Cell size |
range | Number 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.
draw | True to enable bounding boxes rendering, false to disable |
zOn | True to enable z-buffeing when drawing bounding boxes, false to disable |
red | Red value of bounding boxes color |
green | Green value of bounding boxes color |
blue | Blue value of bounding boxes color |
alpha | Alpha 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.
width | Width of screen resolution |
height | Height of screen resolution |
depth | Colour depth of screen |
mode | True to enable fullscreen mode, false for windowed mode |
vsync | True to enable vertical synchronization, false to disable |
BBDECL void BBCALL xGraphicsAspectRatio | ( | float | aspectRatio | ) |
Sets the aspect ratio of the screen.
aspectRatio | The 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().
red | Red value of the border color. |
green | Green value of the border color. |
blue | Blue 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.
key | License key of Xors3D |
BBDECL void BBCALL xSetEngineSetting | ( | const char * | parameter, |
const char * | value | ||
) |
Sets the value for engine's parameter.
parameter | Engine parameter name |
value | Engine parameter value |
BBDECL const char* BBCALL xGetEngineSetting | ( | const char * | parameter | ) |
Returns the value of engine's parameter.
parameter | Engine'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.
mode | An 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.
mode | An 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.
mode | An 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.
width | Width of the screen in pixels (e.g. 1024) |
height | Height of the screen in pixels (e.g. 768) |
depth | Color 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.
state | True to enable window frame. False to disable. |
BBDECL int BBCALL xMillisecs | ( | ) |
Returns current time in millicesonds.
BBDECL int BBCALL xDeltaTime | ( | bool | fromInit = false | ) |
BBDECL float BBCALL xDeltaValue | ( | float | value, |
int | time = 0 |
||
) |
Returns a value interpolated by elapsed time.
value | The increment value for the second |
time | Time 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.
texture | Texture handle |
mode | Filtering type. See 'Texture filtering types' for more information |