![]() |
Xors3d Engine
|
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. |
int 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. |
void 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 |
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.
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 |
int 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 |
void 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) |
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.
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 |
void xOrigin | ( | int | x, |
int | y | ||
) |
Sets a point of origin for all subsequent drawing commands.
x | x offset value |
y | y 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()
typeID | Antialias 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.
title | The 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.
window | Blitz3D 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.
window | Pointer 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.
window | Top-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.
buffer | Buffer handle |
void xUnlockBuffer | ( | int | buffer = NULL | ) |
Unlocks locked buffer.
buffer | Buffer 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
x | x-coordinate of pixel |
y | y-coordinate of pixel |
argb | ARGB color value of pixel (alpha, red, green, blue) |
buffer | Buffer 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()
x | x coordinate of pixel |
y | y coordinate of pixel |
buffer | Handle 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.
buffer | Handle 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.
buffer | Buffer handle (xBackBuffer(), xImageBuffer(), xTextureBuffer()) |
path | File name for buffer saving |
int xGetCurrentBuffer | ( | ) |
Returns current rendering buffer handle.
int xBufferWidth | ( | int | buffer = NULL | ) |
Returns specified buffer's width.
buffer | Buffer handle (xBackBuffer(), xImageBuffer(), xTextureBuffer()) |
int xBufferHeight | ( | int | buffer = NULL | ) |
Returns specified buffer's height.
buffer | Buffer 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.
timeStamp | Stopwatch handle |
void xSetBuffer | ( | int | buffer = NULL | ) |
Sets the current drawing buffer.
If buffer is not specified, back buffer is used.
buffer | Buffer 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.
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) |
void xUnSetMRT | ( | ) |
Unsets all MRT channels.
This function is used for clearing MRT channel and return rendering to backbuffer.
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
buffer | Buffer handle (xbackBuffer(), xImageBuffer() or xTextureBuffer()) |
path | String 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.
x | x-coordinate of pixel |
y | y-coordinate of pixel |
argb | ARGB color value of pixel (alpha, red, green, blue) |
buffer | Buffer handle |
void 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 |
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().
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 |
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
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 |
int xGraphicsBuffer | ( | ) |
Returns handle of current rendering buffer.
DWORD 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 |
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()
x | x coordinate of pixel |
y | y coordinate of pixel |
buffer | Handle 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().
isVirtual | If 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().
isVirtual | If 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.
red | Red clear color value |
green | Green clear color value |
blue | Blue clear color value |
alpha | Alpha 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.
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 |
void xColor | ( | int | red, |
int | green, | ||
int | blue, | ||
int | alpha = 255 |
||
) |
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().
speed | A 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.
camera | Rendering camera |
entity | Rendered entity |
tween | Tweening 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.
tween | Tweening parameter (1.0 by default) |
renderShadows | Enable 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.
flag | True 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.
state | True 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
state | True 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
skinMethod | Skinning 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.
int xSurfRendered | ( | ) |
Returns total number of rendered surfaces.
Counter updates during xFlip() call.
int xEntityRendered | ( | ) |
Returns total number of rendered entities.
Counter updates during xFlip() call.
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.
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. |
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.
state | True 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.
filter | Filtering 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.
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 |
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.
width | Depth-stencil surface width |
height | Depth-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.
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 |
void 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 |
void 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 |
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.
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 |
void 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). |
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().
red | Red value of the border color. |
green | Green value of the border color. |
blue | Blue 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.
key | License key of Xors3D |
void xSetEngineSetting | ( | const char * | parameter, |
const char * | value | ||
) |
Sets the value for engine's parameter.
parameter | Engine parameter name |
value | Engine parameter value |
const char* xGetEngineSetting | ( | const char * | parameter | ) |
Returns the value of engine's parameter.
parameter | Engine'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.
mode | An 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.
mode | An 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.
mode | An 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.
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) |
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.
state | True to enable window frame. False to disable. |
int xMillisecs | ( | ) |
Returns current time in millicesonds.
int xDeltaTime | ( | bool | fromInit = false | ) |
float 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) |
void xSetTextureFilter | ( | Texture * | texture, |
int | mode | ||
) |
Sets texture filtering method.
texture | Texture handle |
mode | Filtering type. See 'Texture filtering types' for more information |