Hilfe
VertexNZ
Aufruf
Parameter
Rückgabewert
Beschreibung
Beispiel
Siehe auch
z# = VertexNZ# (surface%, vertex%)
Parameter
surface% | Identität einer Gitteroberfläche (surface) |
vertex% | Indexnummer eines Vertexpunktes |
Rückgabewert
Z-Koordinate der Normale des Vertex.
Beschreibung
Die Funktion VertexNZ liefert die Z-Koordinate eines Normals zurück. Mit VertexNormal kann man die Koordinate ändern.
Normals werden hauptsächlich für Lichtschattierungen benötigt.
Beispiel
Dieses Beispiel verdeutlicht den Umgang mit den Normalenbefehlen eines Vertex
Graphics3D 800, 600, 16, 2
camera = CreateCamera()
MoveEntity camera, 0, 0, - 2
light = CreateLight(1)
TurnEntity light, 45, 45, 45
sphere = CreateSphere(20)
EntityFX sphere, 4
surface = GetSurface(sphere, 1)
While Not KeyHit(1)
TurnEntity sphere, 0, 0.1, 0
If KeyHit(57)
For i = 0 To CountVertices(surface) - 1
nx# = - VertexNX(surface, i)
ny# = - VertexNY(surface, i)
nz# = - VertexNZ(surface, i)
VertexNormal surface, i, nx, ny, nz
Next
EndIf
RenderWorld
Flip
Wend
End
camera = CreateCamera()
MoveEntity camera, 0, 0, - 2
light = CreateLight(1)
TurnEntity light, 45, 45, 45
sphere = CreateSphere(20)
EntityFX sphere, 4
surface = GetSurface(sphere, 1)
While Not KeyHit(1)
TurnEntity sphere, 0, 0.1, 0
If KeyHit(57)
For i = 0 To CountVertices(surface) - 1
nx# = - VertexNX(surface, i)
ny# = - VertexNY(surface, i)
nz# = - VertexNZ(surface, i)
VertexNormal surface, i, nx, ny, nz
Next
EndIf
RenderWorld
Flip
Wend
End
Siehe auch

