1al_draw_soft_triangle(3) al_draw_soft_triangle(3)
2
3
4
6 al_draw_soft_triangle - Allegro 5 API
7
9 #include <allegro5/allegro_primitives.h>
10
11 void al_draw_soft_triangle(
12 ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3, uintptr_t state,
13 void (*init)(uintptr_t, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*),
14 void (*first)(uintptr_t, int, int, int, int),
15 void (*step)(uintptr_t, int),
16 void (*draw)(uintptr_t, int, int, int))
17
19 Draws a triangle using the software rasterizer and user supplied pixel
20 functions. For help in understanding what these functions do, see the
21 implementation of the various shading routines in addons/primi‐
22 tives/tri_soft.c. The triangle is drawn in two segments, from top to
23 bottom. The segments are deliniated by the vertically middle vertex of
24 the triangle. One of the two segments may be absent if two vertices
25 are horizontally collinear.
26
27 Parameters:
28
29 • v1, v2, v3 - The three vertices of the triangle
30
31 • state - A pointer to a user supplied struct, this struct will be
32 passed to all the pixel functions
33
34 • init - Called once per call before any drawing is done. The three
35 points passed to it may be altered by clipping.
36
37 • first - Called twice per call, once per triangle segment. It is
38 passed 4 parameters, the first two are the coordinates of the initial
39 pixel drawn in the segment. The second two are the left minor and
40 the left major steps, respectively. They represent the sizes of two
41 steps taken by the rasterizer as it walks on the left side of the
42 triangle. From then on, each step will either be classified as a mi‐
43 nor or a major step, corresponding to the above values.
44
45 • step - Called once per scanline. The last parameter is set to 1 if
46 the step is a minor step, and 0 if it is a major step.
47
48 • draw - Called once per scanline. The function is expected to draw
49 the scanline starting with a point specified by the first two parame‐
50 ters (corresponding to x and y values) going to the right until it
51 reaches the value of the third parameter (the x value of the end
52 point). All coordinates are inclusive.
53
55 al_draw_triangle(3)
56
57
58
59Allegro reference manual al_draw_soft_triangle(3)