d3d_vertex_colour

Defines a primitive vertex with colour and alpha blending in 3D.

Syntax:

d3d_vertex_colour(x, y, z, 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.
col The colour to draw this vertex with.
alpha The alpha to draw this vertex with (0-1).


Returns: N/A


Description

This function defines the position of a vertex for a primitive, with its own colour and alpha setting. The final look of the primitive will depend on the primitive type chosen to draw and the order with which you add the vertexes to it (see d3d_primitive_begin for more information) and the vertexes with different colours and alphas will blend smoothly from one to the other. To end and draw the primitive you must call d3d_primitive_end.


Example:

d3d_primitive_begin(pr_trianglelist);
d3d_vertex_colour(100, 100, 0, c_blue, 0.1);
d3d_vertex_colour(100, 200, 0, c_blue, 0.1);
d3d_vertex_colour(150, 150, 200, c_red, 1);
d3d_vertex_colour(100, 200, 0, c_blue, 0.1);
d3d_vertex_colour(200, 200, 0, c_blue, 0.1);
d3d_vertex_colour(150, 150, 200, c_red, 1);
d3d_vertex_colour(200, 200, 0, c_blue, 0.1);
d3d_vertex_colour(100, 100, 0, c_blue, 0.1);
d3d_vertex_colour(150, 150, 200, c_red, 1);
d3d_vertex_colour(100, 100, 0, c_blue, 0.1);
d3d_vertex_colour(100, 200, 0, c_blue, 0.1);
d3d_vertex_colour(200, 200, 0, c_blue, 0.1);
d3d_primitive_end();

The above code will draw a tetrahedron standing on the z=0 plane with its top coloured red and fully opaque at z = 200, while its base will be blue and transparent.


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