Blitz3D+ Command Reference

BrushColor brush,red#,green#,blue#

Parameters

brush - brush handle
red# - red component of the colour, 0 to 255
green# - green component of the colour, 0 to 255
blue# - blue component of the colour, 0 to 255

Description

Sets the colour of a brush.

The colour tints everything the brush is painted onto. With a texture in the brush the two multiply together, so a white texture painted with a red brush comes out red - handy for team colours or damage tints from a single grey-scale texture. New brushes start white (255,255,255), which leaves textures unchanged.

The brush colour is ignored wherever vertex colours are switched on with BrushFX/EntityFX flag 2.

As with all brush settings, only geometry painted after the change picks it up - repaint to apply a new colour.

See also: CreateBrush, BrushAlpha, EntityColor, PaintMesh, BrushFX.

Example

; BrushColor Example
; ------------------

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()

light=CreateLight()
RotateEntity light,45,45,0

; A crate to paint. A brush is a 'paint recipe' applied with PaintEntity.
crate=CreateCube()
PositionEntity crate,0,0,5

brush=CreateBrush()

red=0
green=120
blue=255

While Not KeyDown(1)

    ; Keys 1/2, 3/4 and 5/6 lower/raise the red, green and blue values
    If KeyDown(2) And red>0 Then red=red-5
    If KeyDown(3) And red<255 Then red=red+5
    If KeyDown(4) And green>0 Then green=green-5
    If KeyDown(5) And green<255 Then green=green+5
    If KeyDown(6) And blue>0 Then blue=blue-5
    If KeyDown(7) And blue<255 Then blue=blue+5

    ; Set the brush colour, then repaint the crate so the change shows
    BrushColor brush,red,green,blue
    PaintEntity crate,brush

    TurnEntity crate,0,1,0

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Text 0,0,"1/2: red   3/4: green   5/6: blue   Arrows: camera   Esc: exit"
    Text 0,20,"BrushColor brush,"+red+","+green+","+blue

    Flip

Wend

End

Index