d3d_model_vertex_normal(ind, x, y, z, nx, ny, nz)
Argument | Description |
---|---|
ind | The index of the model to add the primitive to. |
x | The x coordinate of the vertex. |
y | The y coordinate of the vertex. |
z | The z coordinate of the vertex. |
xn | The x component of the normal vector. |
yn | The y component of the normal vector. |
zn | The z component of the normal vector. |
Returns: N/A
This function defines the position of a primitive vertex for a
model, and assigns a normal to that vertex for the purposes of
lighting. The final look of the model will depend on the primitive
type chosen to draw, the order with which you add the vertexes to
it, and the normal that you define for it as well as the lighting.
See d3d_model_primitive_begin
for more information on primitives. To end and draw the primitive
you must call d3d_model_primitive_end.
m = d3d_model_create();
d3d_model_primitive_begin(m, pr_trianglelist);
d3d_model_vertex_normal(m, -128, 0, -48, 0, 0.5, -0.5);
d3d_model_vertex_normal(m, -128, 96, 48, 0, 0.5, -0.5);
d3d_model_vertex_normal(m, 128, 0, -48, 0, 0.5, -0.5);
d3d_model_vertex_normal(m, 128, 0, -48, 0, 0.5, -0.5);
d3d_model_vertex_normal(m, -128, 96, 48, 0, 0.5, -0.5);
d3d_model_vertex_normal(m, 128, 96, 48, 0, 0.5, -0.5);
d3d_model_primitive_end(m);
The above code will add a sloped rectangle with the correct normal vectors for lighting to the selected model.