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

90 lines
2.2 KiB
HTML

<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>PositionTexture texture,u_position#,v_position#</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
texture - texture handle
<br />
u_position# - u position of texture
<br />
v_position# - v position of texture
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Positions a texture at an absolute position.
<br />
<br />
This will have an immediate effect on all instances of the texture being used.
<br />
<br />
Positioning a texture is useful for performing scrolling texture effects, such as for water etc.
</td>
</tr>
</table>
<h1><a href=../3d_examples/PositionTexture.bb>Example</a></h1>
<table>
<tr>
<td>
; PositionTexture 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 />
; Texture cube
<br />
EntityTexture cube,tex
<br />
<br />
; Set initial uv position values
<br />
u_position#=1
<br />
v_position#=1
<br />
<br />
While Not KeyDown( 1 )
<br />
<br />
; Change uv position values depending on key pressed
<br />
If KeyDown( 208 )=True Then u_position#=u_position#-0.01
<br />
If KeyDown( 200 )=True Then u_position#=u_position#+0.01
<br />
If KeyDown( 203 )=True Then v_position#=v_position#-0.01
<br />
If KeyDown( 205 )=True Then v_position#=v_position#+0.01
<br />
<br />
; Position texture
<br />
PositionTexture tex,u_position#,v_position#
<br />
<br />
TurnEntity cube,0.1,0.1,0.1
<br />
<br />
RenderWorld
<br />
<br />
Text 0,0,"Use cursor keys to change uv position values"
<br />
Text 0,20,"u_position#="+u_position#
<br />
Text 0,40,"v_position#="+v_position#
<br />
<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=PositionTexture&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
</html>