Vizard 8 » Command Index » Vizard objects » node3d » <node3d:onthefly>.setNormal
8.0

<node3d:onthefly>.setNormal

Modify a vertex normal

<node3d:onthefly>.setNormal(  
index  
[x,y,z]  
mode = viz.ABS_LOCAL # Positional argument
)  
index
0-based index of the vertex. Negative index can also be used to reference from end of vertex list.
[x,y,z]
Normal vector
mode = viz.ABS_LOCAL
One of the following modes:

Normal modes

viz.ABS_LOCAL

Set the raw normal vector.

viz.REL_LOCAL

Add the vector to the existing raw normal vector.

viz.ABS_PARENT

Set the normal vector in the coordinate frame of the parent node.

viz.REL_PARENT

Add the vector to the existing normal vector in the coordinate frame of the parent node.

viz.ABS_GLOBAL

Set the normal vector in the global coordinate frame.

viz.REL_GLOBAL

Add the vector to the existing normal vector in the global coordinate frame.

Remarks

This command allows you to modify the normal vector of a specific vertex in the On-The-Fly object. The index is a number that can start from 0 and go up to, but not including, the number of vertices in the object.

Note: If you are frequently changing the normal vector of a vertex, then use the <node3d:onthefly>.dynamic command to speed up rendering.

Return Value

None

Example

#Create a triangle
viz.startLayer(viz.TRIANGLES)

viz.normal(0,0,-1)
viz.vertex(-1,0,0)
viz.vertex(1,0,0)
viz.vertex(0,1,0)

triangle = viz.endLayer()

.
.
.

#Change the normal vector of the first vertex
triangle.setNormal(1,1,0,0)

#Set normal vector in global coordinates
normal = [0,1,0]
triangle.setNormal(0,normal,viz.ABS_GLOBAL)

See also

<node3d:onthefly>.setTexCoord
<node3d:onthefly>.setVertex
<node3d:onthefly>.setVertexColor