Files
BlitzNext/_release/help/commands/3d_commands/PaintMesh.htm
T
2014-12-08 12:43:20 +13:00

94 lines
2.3 KiB
HTML

<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>PaintMesh mesh,brush</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
mesh - mesh handle
<br />
brush - brush handle
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Paints a mesh with a brush.
<br />
<br />
This has the effect of instantly altering the visible appearance of the mesh, assuming the brush's properties are different to what was was applied to the surface before.
<br />
<br />
The reason for using PaintMesh to apply specific properties to a mesh using a brush rather than just using EntityTexture, EntityColor, EntityShininess etc, is that you can pre-define one brush, and then paint meshes over and over again using just the one command rather than lots of separate ones.
<br />
<br />
See also: PaintEntity, PaintSurface.
</td>
</tr>
</table>
<h1><a href=../3d_examples/PaintMesh.bb>Example</a></h1>
<table>
<tr>
<td>
; PaintMesh Example
<br />
; -----------------
<br />
<br />
Graphics3D 640,480
<br />
SetBuffer BackBuffer()
<br />
<br />
camera=CreateCamera()
<br />
<br />
light=CreateLight()
<br />
RotateEntity light,90,0,0
<br />
<br />
cube=CreateCube()
<br />
PositionEntity cube,0,0,5
<br />
<br />
; Load texture
<br />
tex=LoadTexture("media/b3dlogo.jpg")
<br />
<br />
; Create brush
<br />
brush=CreateBrush()
<br />
<br />
; Apply texture to brush
<br />
BrushTexture brush,tex
<br />
<br />
; And some other effects
<br />
BrushColor brush,0,0,255
<br />
BrushShininess brush,1
<br />
<br />
; Paint mesh with brush
<br />
PaintMesh cube,brush
<br />
<br />
While Not KeyDown( 1 )
<br />
<br />
pitch#=0
<br />
yaw#=0
<br />
roll#=0
<br />
<br />
If KeyDown( 208 )=True Then pitch#=-1
<br />
If KeyDown( 200 )=True Then pitch#=1
<br />
If KeyDown( 203 )=True Then yaw#=-1
<br />
If KeyDown( 205 )=True Then yaw#=1
<br />
If KeyDown( 45 )=True Then roll#=-1
<br />
If KeyDown( 44 )=True Then roll#=1
<br />
<br />
TurnEntity cube,pitch#,yaw#,roll#
<br />
<br />
RenderWorld
<br />
Flip
<br />
<br />
Wend
<br />
<br />
End
</td>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=PaintMesh&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
</html>