![]() |
Xors3d Engine
|
Functions | |
BBDECL void BBCALL | xClearTextureFilters () |
Clears the current texture filter list. | |
BBDECL Texture *BBCALL | xCreateTexture (int width, int height, int flags=9, int frames=1) |
Creates a texture and returns its handle. | |
BBDECL Texture *BBCALL | xCreateTextureFromData (void *pixelsData, int width, int height, int flags=9, int frames=1) |
Creates texture from user data. | |
BBDECL void BBCALL | xFreeTexture (Texture *texture) |
Frees up a texture. | |
BBDECL int BBCALL | xGetCubeFace (Texture *texture) |
Returns current cube face of a cubemap texture. | |
BBDECL int BBCALL | xGetCubeMode (Texture *texture) |
Returns the rendering mode of a cubemap texture. | |
BBDECL float BBCALL | xGetTextureAngle (Texture *texture) |
Returns the absolute angle of texture rotation. | |
BBDECL int BBCALL | xGetTextureBlend (Texture *texture) |
Returns the blending mode for a texture. | |
BBDECL int BBCALL | xGetTextureCoords (Texture *texture) |
Returns the coordinate set of a texture. | |
BBDECL void *BBCALL | xGetTextureData (Texture *texture, int frame=0) |
Returns texture pixels data. | |
BBDECL int BBCALL | xGetTextureDataPitch (Texture *texture, int frame=0) |
Returns texture pixels data pitch. | |
BBDECL int BBCALL | xGetTextureFrames (Texture *texture) |
Returns a count of texture frames. | |
BBDECL float BBCALL | xGetTextureScaleX (Texture *texture) |
Returns the absolute X (U) scale of a texture. | |
BBDECL float BBCALL | xGetTextureScaleY (Texture *texture) |
Returns the absolute Y (V) scale of a texture. | |
BBDECL LPDIRECT3DTEXTURE9 BBCALL | xGetTextureSurface (Texture *texture, int frame=0) |
Returns a pointer to Direct3D texture surface. | |
BBDECL float BBCALL | xGetTextureX (Texture *texture) |
Returns the absolute X (U) position of a texture. | |
BBDECL float BBCALL | xGetTextureY (Texture *texture) |
Returns the absolute Y (V) position of a texture. | |
BBDECL Texture *BBCALL | xLoadAnimTexture (const char *path, int flags, int width, int height, int startFrame, int frames) |
Loads an animated texture. | |
BBDECL Texture *BBCALL | xLoadTexture (const char *path, int flags=9) |
Loads a texture from an image file and returns the texture's handle. | |
BBDECL void BBCALL | xPositionTexture (Texture *texture, float x, float y) |
Positions a texture at an absolute position. | |
BBDECL void BBCALL | xRotateTexture (Texture *texture, float angle) |
Rotates a texture. | |
BBDECL void BBCALL | xScaleTexture (Texture *texture, float x, float y) |
Scales a texture by an absolute amount. | |
BBDECL void BBCALL | xSetCubeFace (Texture *texture, int face) |
Selects a cube face for direct rendering to a texture. | |
BBDECL void BBCALL | xSetCubeMode (Texture *texture, int mode) |
Sets the rendering mode of a cubemap texture. | |
BBDECL void BBCALL | xStretchRect (Texture *texture1, int x1, int y1, int width1, int height1, Texture *texture2, int x2, int y2, int width2, int height2, int filter) |
Copys data from one texture to another using hardware accelerated method. | |
BBDECL void BBCALL | xTextureBlend (Texture *texture, int blend) |
Sets the blending mode for a texture. | |
BBDECL TextureBuffer *BBCALL | xTextureBuffer (Texture *texture, int frame=0) |
Returns the handle of a texture's drawing buffer. | |
BBDECL void BBCALL | xTextureCoords (Texture *texture, int coords) |
Sets the texture coordinate mode for a texture. | |
BBDECL void BBCALL | xTextureFilter (const char *matchText, int flags) |
Sets texture filtering. | |
BBDECL int BBCALL | xTextureHeight (Texture *texture) |
Returns the height of a texture. | |
BBDECL const char *BBCALL | xTextureName (Texture *texture) |
Returns a texture's absolute filename. | |
BBDECL int BBCALL | xTextureWidth (Texture *texture) |
Returns the width of a texture. |
BBDECL TextureBuffer* BBCALL xTextureBuffer | ( | Texture * | texture, |
int | frame = 0 |
||
) |
Returns the handle of a texture's drawing buffer.
This can be used with xSetBuffer() to perform direct drawing operations to the texture
texture | Texture handle |
frame | Texture frame |
BBDECL void BBCALL xStretchRect | ( | Texture * | texture1, |
int | x1, | ||
int | y1, | ||
int | width1, | ||
int | height1, | ||
Texture * | texture2, | ||
int | x2, | ||
int | y2, | ||
int | width2, | ||
int | height2, | ||
int | filter | ||
) |
Copys data from one texture to another using hardware accelerated method.
texture1 | Source texture handle |
x1 | x coordinate of top left corner of source rectangle |
y1 | y coordinate of top left corner of source rectangle |
width1 | Width of source rectangle |
height1 | Height of source rectangle |
texture2 | Destination texture handle |
x2 | x coordinate of top left corner of destination rectangle |
y2 | y coordinate of top left corner of destination rectangle |
width2 | Width of destination rectangle |
height2 | Height of destination rectangle |
filter | Filtering method |
BBDECL int BBCALL xTextureWidth | ( | Texture * | texture | ) |
Returns the width of a texture.
texture | Texture handle |
BBDECL int BBCALL xTextureHeight | ( | Texture * | texture | ) |
Returns the height of a texture.
texture | Texture handle |
BBDECL Texture* BBCALL xCreateTexture | ( | int | width, |
int | height, | ||
int | flags = 9 , |
||
int | frames = 1 |
||
) |
Creates a texture and returns its handle.
Width and height are the size of the texture. Note that the actual texture size may be different from the width and height requested, as different types of 3D hardware support different sizes of texture. The optional flags parameter allows you to apply certain effects to the texture. Flags can be added to combine two or more effects. See 'Texture loading flags' for more information Once you have created a texture, use xSetBuffer(xTextureBuffer()) to draw to it. Xors3D supports direct rendering into textures.
width | Width of texture |
height | Height of texture |
flags | Texture creation flags |
frames | Number of frames texture will have |
BBDECL void BBCALL xFreeTexture | ( | Texture * | texture | ) |
Frees up a texture.
texture | Texture handle |
BBDECL void BBCALL xTextureBlend | ( | Texture * | texture, |
int | blend | ||
) |
Sets the blending mode for a texture.
The texture blend mode determines how the texture will blend with the texture or polygon which is 'below' it. Texture 0 will blend with the polygons of the entity it is applied to. Texture 1 will blend with texture 0. Texture 2 will blend with texture 1. And so on. Texture blending effectively takes the highest order texture (the one with the highest index) and it blends with the texture below it, then that result to the texture directly below again, and so on until texture 0 which is blended with the polygons of the entity it is applied to and thus the world, depending on the xEntityBlend() of the object. Each of the blend modes are identical to their xEntityBlend() counterparts.
texture | Texture handle |
blend | Blending mode. See 'Textures blending types' for more infromation |
BBDECL void BBCALL xTextureCoords | ( | Texture * | texture, |
int | coords | ||
) |
Sets the texture coordinate mode for a texture.
This determines where the UV values used to look up a texture come from
texture | Texture handle |
coords | UV coordinates number (0 or 1) |
BBDECL void BBCALL xTextureFilter | ( | const char * | matchText, |
int | flags | ||
) |
Sets texture filtering.
Loaded textures that contain text specified by 'matchText' in file name param will have the provided flags added.
matchText | Text string that, if found in texture filename, will activate certain filters. |
flags | Texture flags to be applied, see 'Texture loading flags' for more information. |
BBDECL void BBCALL xClearTextureFilters | ( | ) |
Clears the current texture filter list.
BBDECL Texture* BBCALL xLoadTexture | ( | const char * | path, |
int | flags = 9 |
||
) |
Loads a texture from an image file and returns the texture's handle.
The optional flags parameter allows you to apply certain effects to the texture. Flags can be added to combine two or more effects. See 'Texture loading flags' for more infromation. Supported file formats are: bmp, dds, dib, hdr, jpg, pfm, png, ppm, tga.
path | Filename of image file to be used as texture |
flags | Loading flags, see 'Texture loading flags' |
BBDECL const char* BBCALL xTextureName | ( | Texture * | texture | ) |
Returns a texture's absolute filename.
To find out just the name of the texture, you will need to parse the string returned by xTextureName().
texture | Texture handle |
BBDECL void BBCALL xPositionTexture | ( | Texture * | texture, |
float | x, | ||
float | y | ||
) |
Positions a texture at an absolute position.
This will have an immediate effect on all instances of the texture being used. Positioning a texture is useful for performing scrolling texture effects, such as for water etc.
texture | Texture handle |
x | u position of texture |
y | v position of texture |
BBDECL void BBCALL xScaleTexture | ( | Texture * | texture, |
float | x, | ||
float | y | ||
) |
Scales a texture by an absolute amount.
This will have an immediate effect on all instances of the texture being used
texture | Texture handle |
x | x scale of texture |
y | y scale of texture |
BBDECL void BBCALL xRotateTexture | ( | Texture * | texture, |
float | angle | ||
) |
Rotates a texture.
This will have an immediate effect on all instances of the texture being used. Rotating a texture is useful for performing swirling texture effects, such as for smoke etc
texture | Texture handle |
angle | Texture otation angle |
BBDECL Texture* BBCALL xLoadAnimTexture | ( | const char * | path, |
int | flags, | ||
int | width, | ||
int | height, | ||
int | startFrame, | ||
int | frames | ||
) |
Loads an animated texture.
The 'flags' parameter allows you to apply certain effects to the texture. Flags can be added to combine two or more effects. See 'Texture loading flags' for more infromation.
path | Name of image file |
flags | Loading flags |
width | Width in pixels of each frame in the texture |
height | Height in pixels of each frame in the texture |
startFrame | The frame to start with (usually 0) |
frames | How many frames you are using of the imagestrip |
BBDECL Texture* BBCALL xCreateTextureFromData | ( | void * | pixelsData, |
int | width, | ||
int | height, | ||
int | flags = 9 , |
||
int | frames = 1 |
||
) |
Creates texture from user data.
pixelsData | Pointer to pixels data |
width | Texture width |
height | Texture height |
flags | Texture creation flags. See '/ref tlflags' for more information |
frames | Number of texture frames |
BBDECL void* BBCALL xGetTextureData | ( | Texture * | texture, |
int | frame = 0 |
||
) |
Returns texture pixels data.
NOTE: You may get pixels data only from locked texture frames
texture | Texture handle |
frame | Frame index |
BBDECL int BBCALL xGetTextureDataPitch | ( | Texture * | texture, |
int | frame = 0 |
||
) |
Returns texture pixels data pitch.
You must use this value for computing pixel position instead texture width (e.g. value = pixels[y * xGetTextureDataPitch() + x]) if you use non power-of-two textures.
NOTE: You can get pixels data only from locked texture frames
texture | Texture handle |
frame | Frame index |
BBDECL LPDIRECT3DTEXTURE9 BBCALL xGetTextureSurface | ( | Texture * | texture, |
int | frame = 0 |
||
) |
Returns a pointer to Direct3D texture surface.
texture | Texture handle |
frame | Frame index |
BBDECL int BBCALL xGetTextureFrames | ( | Texture * | texture | ) |
Returns a count of texture frames.
texture | Texture handle |
BBDECL void BBCALL xSetCubeFace | ( | Texture * | texture, |
int | face | ||
) |
Selects a cube face for direct rendering to a texture.
This command should only be used when you wish to draw directly to a cubemap texture in real-time. Otherwise, just loading a pre-rendered cubemap with a flag of FLAGS_CUBICENVMAP will suffice. To understand how this command works exactly it is important to recognise that Xors3D treats cubemap textures slightly differently to how it treats other textures. Here's how it works... A cubemap texture in Xors3D actually consists of six images, each of which must be square 'power' of two size - e.g. 32, 64, 128 etc. Each corresponds to a particular cube face. These images are stored internally by Xors3D, and the texture handle that is returned by xLoadTexture()/xCreateTexture() when specifying the cubemap flag, only provides access to one of these six images at once (by default the first one, or 'FACE_FORWARD' face). How do we get access to the other five images? This is where xSetCubeFace() comes in. It will tell Xors3D that whenever you next draw to a cubemap texture, to draw to the particular image representing the face you have specified with the face parameter.
texture | Texture handle |
face | Cubemap face. See 'Cubemap faces' for more infromation |
BBDECL void BBCALL xSetCubeMode | ( | Texture * | texture, |
int | mode | ||
) |
Sets the rendering mode of a cubemap texture.
texture | Texture handle |
mode | Rendering mode. See 'Cubemap rendering modes' for more infromation |
BBDECL int BBCALL xGetTextureBlend | ( | Texture * | texture | ) |
Returns the blending mode for a texture.
For more details see xTextureBlend.
texture | Texture handle |
BBDECL float BBCALL xGetTextureX | ( | Texture * | texture | ) |
Returns the absolute X (U) position of a texture.
For more details see xPositionTexture.
texture | Texture handle |
BBDECL float BBCALL xGetTextureY | ( | Texture * | texture | ) |
Returns the absolute Y (V) position of a texture.
For more details see xPositionTexture.
texture | Texture handle |
BBDECL float BBCALL xGetTextureScaleX | ( | Texture * | texture | ) |
Returns the absolute X (U) scale of a texture.
For more details see xScaleTexture.
texture | Texture handle |
BBDECL float BBCALL xGetTextureScaleY | ( | Texture * | texture | ) |
Returns the absolute Y (V) scale of a texture.
For more details see xScaleTexture.
texture | Texture handle |
BBDECL float BBCALL xGetTextureAngle | ( | Texture * | texture | ) |
Returns the absolute angle of texture rotation.
For more details see xRotateTexture.
texture | Texture handle |
BBDECL int BBCALL xGetTextureCoords | ( | Texture * | texture | ) |
Returns the coordinate set of a texture.
For more details see xTextureCoords.
texture | Texture handle |
BBDECL int BBCALL xGetCubeFace | ( | Texture * | texture | ) |
Returns current cube face of a cubemap texture.
For more details see xSetCubeFace.
texture | Texture handle |
BBDECL int BBCALL xGetCubeMode | ( | Texture * | texture | ) |
Returns the rendering mode of a cubemap texture.
For more details see xSetCubeMode.
texture | Texture handle |