Xors3d Engine
Brushes

Functions

void xBrushAlpha (Brush *brush, float alpha)
 Sets the alpha level of a brush.
void xBrushBlend (Brush *brush, int blend)
 Sets the blending mode for a brush.
void xBrushColor (Brush *brush, int red, int green, int blue)
 Sets the colour of a brush.
void xBrushFX (Brush *brush, int FX)
 Sets miscellaneous effects for a brush.
void xBrushName (Brush *brush, const char *name)
 Sets brush name.
void xBrushShininess (Brush *brush, float shininess)
 Sets the specular shininess of a brush.
void xBrushTexture (Brush *brush, Texture *texture, int frame=0, int index=0)
 Assigns a texture to a brush.
Brush * xCreateBrush (float red=255.0f, float green=255.0f, float blue=255.0f)
 Creates a brush and returns a brush handle.
void xFreeBrush (Brush *brush)
 Frees up a brush.
float xGetBrushAlpha (Brush *brush)
 Returns brush alpha value.
int xGetBrushBlend (Brush *brush)
 Returns brush blend mode.
int xGetBrushBlue (Brush *brush)
 Returns brush blue diffuse color.
int xGetBrushFX (Brush *brush)
 Returns brush FX flags.
int xGetBrushGreen (Brush *brush)
 Returns brush green diffuse color.
const char * xGetBrushName (Brush *brush)
 Returns brush name.
int xGetBrushRed (Brush *brush)
 Returns brush red diffuse color.
float xGetBrushShininess (Brush *brush)
 Returns brush shininess value.
Texture * xGetBrushTexture (Brush *brush, int index=0)
 Returns texture assigned to brush.
Brush * xLoadBrush (const char *path, int flags=9, float xScale=1.0f, float yScale=1.0f)
 Creates a brush, loads and assigns a texture to it, and returns a brush handle.

Function Documentation

Brush* xLoadBrush ( const char *  path,
int  flags = 9,
float  xScale = 1.0f,
float  yScale = 1.0f 
)

Creates a brush, loads and assigns a texture to it, and returns a brush handle.

Parameters:
pathFilename of texture
flagsLoading flags. See 'Texture loading flags' for more information
xScaleBrush u scale
yScaleBrush v scale
Brush* xCreateBrush ( float  red = 255.0f,
float  green = 255.0f,
float  blue = 255.0f 
)

Creates a brush and returns a brush handle.

The green, red and blue values allow you to set the colour of the brush. Values should be in the range [0; 255]. If omitted the values default to 255. A brush is a collection of properties such as color, alpha, shininess, textures, etc that are all stored as part of the brush. Then, all these properties can be applied to an entity, mesh or surface at once just by using xPaintEntity(), xPaintMesh() or xPaintSurface(). When creating your own mesh, if you wish for certain surfaces to look differently from one another, then you will need to use brushes to paint individual surfaces. Using commands such as xEntityColor(), xEntityAlpha() will apply the effect to all surfaces at once, which may not be what you wish to achieve.

Parameters:
redBrush red value
greenBrush green value
blueBrush blue value
void xFreeBrush ( Brush *  brush)

Frees up a brush.

Parameters:
brushBrush handle
Texture* xGetBrushTexture ( Brush *  brush,
int  index = 0 
)

Returns texture assigned to brush.

Parameters:
brushBrush handle
indexTexture layer index. Must be in range 0-7
void xBrushColor ( Brush *  brush,
int  red,
int  green,
int  blue 
)

Sets the colour of a brush.

The green, red and blue values should be in the range [0; 255]. The default brush color is 255, 255, 255. Please note that if xEntityFX() or xBrushFX() flag FX_VERTEXCOLOR is being used, brush colour will have no effect and vertex colours will be used instead.

Parameters:
brushBrush handle
redRed value of brush
greenGreen value of brush
blueBlue value of brush
void xBrushAlpha ( Brush *  brush,
float  alpha 
)

Sets the alpha level of a brush.

The alpha value should be in the range [0.0; 1.0]. The default brush alpha setting is 1.0. The alpha level is how transparent an entity is. A value of 1.0 will mean the entity is non-transparent, i.e. opaque. A value of 0.0 will mean the entity is completely transparent, i.e. invisible. Values between 0.0 and 1.0 will cause varying amount of transparency accordingly, useful for imitating the look of objects such as glass and ice.

Parameters:
brushBrush handle
alphaAlpha level of brush
void xBrushShininess ( Brush *  brush,
float  shininess 
)

Sets the specular shininess of a brush.

The shininess value should be in the range [0.0; 1.0]. The default shininess setting is 0.0 Shininess is how much brighter certain areas of an object will appear to be when a light is shone directly at them. Setting a shininess value of 1.0 for a medium to high poly sphere, combined with the creation of a light shining in the direction of it, will give it the appearance of a shiny snooker ball

Parameters:
brushBrush handle
shininessShininess of brush
void xBrushBlend ( Brush *  brush,
int  blend 
)

Sets the blending mode for a brush.

Parameters:
brushBrush handle
blendBlending type. See 'Blending modes' for more infromation
void xBrushFX ( Brush *  brush,
int  FX 
)

Sets miscellaneous effects for a brush.

Flags can be added to combine two or more effects.

Parameters:
brushBrush handle
FXffects flags See 'FX flags' for more infromation
void xBrushTexture ( Brush *  brush,
Texture *  texture,
int  frame = 0,
int  index = 0 
)

Assigns a texture to a brush.

The optional frame parameter specifies which animation frame, if any exist, should be assigned to the brush. The optional index parameter specifies texture layer that the texture should be assigned to.

Parameters:
brushBrush handle
textureTexture handle
frameTexture frame
indexTexture layer
const char* xGetBrushName ( Brush *  brush)

Returns brush name.

Parameters:
brushBrush handle
void xBrushName ( Brush *  brush,
const char *  name 
)

Sets brush name.

Parameters:
brushBrush handle
nameNew brush name
float xGetBrushAlpha ( Brush *  brush)

Returns brush alpha value.

Parameters:
brushBrush handle
int xGetBrushBlend ( Brush *  brush)

Returns brush blend mode.

Parameters:
brushBrush handle
int xGetBrushRed ( Brush *  brush)

Returns brush red diffuse color.

Parameters:
brushBrush handle
int xGetBrushGreen ( Brush *  brush)

Returns brush green diffuse color.

Parameters:
brushBrush handle
int xGetBrushBlue ( Brush *  brush)

Returns brush blue diffuse color.

Parameters:
brushBrush handle
int xGetBrushFX ( Brush *  brush)

Returns brush FX flags.

Parameters:
brushBrush handle
float xGetBrushShininess ( Brush *  brush)

Returns brush shininess value.

Parameters:
brushBrush handle