aboutsummaryrefslogtreecommitdiff
path: root/src/libparsec/include/od_rast.h
blob: 2d5e91b07c165945fc3302249976840e0a0cbb82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 * PARSEC HEADER (OBJECT)
 * Rasterization Types V1.70
 *
 * Copyright (c) Markus Hadwiger 1995-1999
 * All Rights Reserved.
 */

#ifndef _OD_RAST_H_
#define _OD_RAST_H_


// coordinate on actual screen (integral component on the integer lattice) ----
//
typedef dword	ugrid_t;		// unsigned!
typedef int32_t	sgrid_t;		// signed!
typedef rastv_t	fgrid_t;


// 2-D point in unsigned integer coordinates (always >= 0) --------------------
//
struct UPoint {

	ugrid_t		X;				// unsigned!
	ugrid_t		Y;				// unsigned!
};


// 2-D point in screen coordinates (used in vertex list for the edge tracer) --
//
struct SPoint {

	sgrid_t		X;				// signed!
	sgrid_t		Y;				// signed!
};


// extended version of SPoint structure; contains z and color info ------------
//
struct SPointEx {

	sgrid_t		X;				// signed!
	sgrid_t		Y;				// signed!
	depth_t		View_Z; 		// Z coordinate in view space (for buffer fill)
	dword		RGBA;			// RGBA color (8-bit channels)
};


// 2-D point in screen coordinates with fractional part -----------------------
//
struct FPoint {

	fgrid_t		X;				// 8 bytes
	fgrid_t		Y;
};


// defines a polygon that should by rendered and drawn to the screen; ---------
// created after projection of 3-D polygon; scaled to screen coordinates;
// used only by edge tracer (must be filled from the object structure)
//
struct SVertexList {

	dword		VCount; 		// number of vertices in list
	SPoint		Vertices[ 1 ];	// first element of vertex list (array)
};


// list of extended SPoints ---------------------------------------------------
//
struct SVertexExList {

	dword		VCount;			// number of vertices in list
	SPointEx	Vertices[ 1 ];	// first element of vertex list (array)
};


// defines single horizontal span; used for horizontal span list structure ----
// the span starts at XLeft and ends at XRight (inclusively)
//
struct HSpan {

	ugrid_t		XLeft;			// size is 8 bytes
	ugrid_t		XRight;
};


// extended version of HSpan structure; contains z and lighting info ----------
//
struct HSpanEx {

	ugrid_t		XLeft;			// size is 16 bytes
	ugrid_t		XRight;
	word		ZLeft;
	word		ILeft;
	word		ZRight;
	word		IRight;
};


// stores list of horizontal spans; created by polygon edge-tracer; -----------
// used by low level polygon drawing/rendering functions
//
struct HSpanList {

	dword		Height; 		// length of list (height of bounding rectangle)
	ugrid_t		TopY;			// lowest y coordinate of polygon vertices
	HSpan		HSpans[ 1 ];	// first element of horizontal span list (array)
};


// list of extended HSpans ----------------------------------------------------
//
struct HSpanExList {

	dword		Height;			// length of list (height of bounding rectangle)
	ugrid_t		TopY;			// lowest y coordinate of polygon vertices
	HSpanEx 	HSpans[ 1 ];	// first element of horizontal span list (array)
};


#endif // _OD_RAST_H_