d3d_vertex_normal_colour

Defines a vertex for a primitive in 3D along with its corresponding normal, colour blending and alpha.

Syntax:

d3d_vertex_normal(x, y, z, nx, ny, nz, col, alpha)


Argument Description
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.
col The colour to blend with the vertex (c_white or -1 is no blend).
alpha The alpha of the vertex (0 - 1).


Returns: N/A


Description

This function defines the position of a vertex for a primitive, assigns a normal to that vertex for the purposes of lighting, and permits you to set a blend colour and an alpha value too. The final look of the primitive 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_primitive_begin for more information on primitives. To end and draw the primitive you must call d3d_primitive_end.


Example:

d3d_primitive_begin(pr_trianglelist);
d3d_vertex_normal_colour(-128, 0, -48, 0, 0.5, -0.5, c_red, 0.5);
d3d_vertex_normal_colour(-128, 96, 48, 0, 0.5, -0.5, c_red, 0.5);
d3d_vertex_normal_colour(128, 0, -48, 0, 0.5, -0.5, c_red, 0.5);
d3d_vertex_normal_colour(128, 0, -48, 0, 0.5, -0.5, c_red, 0.5);
d3d_vertex_normal_colour(-128, 96, 48, 0, 0.5, -0.5, c_red, 0.5);
d3d_vertex_normal_colour(128, 96, 48, 0, 0.5, -0.5, c_red, 0.5);
d3d_primitive_end();

The above code will draw a sloped rectangle with the correct normal vectors for lighting, blended with the colour red and made semi-transparent with an alpha value of 0.5.


Back: 3D Drawing
Next: d3d_vertex_normal_texture
© Copyright YoYo Games Ltd. 2018 All Rights Reserved