|
|
1.1 root 1: /*--------------------------------------------------------*\
2: SSTRUCT.H - 3D shape data structures
3: \*--------------------------------------------------------*/
4:
5: #define MAX_WINDOWS 8 /* max parent + child windows */
6: #define MAX_POINTS 100 /* max points per object */
7: #define MIN_SCALE 4 /* min scale multiplier */
8:
9: /*
10: 3D "OBJECT" Data Structure:
11:
12: Each object consists of a table of 3D points, a list of lines, and/or
13: a list of faces. When clipping is off, the list of lines are used and when
14: clipping is on, the list of faces are used to draw the shape.
15:
16: Each line consists of two points (indexes for the table of 3D points).
17: A list of lines is terminated by the line {-1,-1}.
18:
19: Each face consists of a list of the points on the perimeter, and optional
20: lists of points for patterns which appear on the face. If the face is
21: visible then the perimeter is drawn along with the optional patterns.
22: The points for the perimeter of the face are specified in counter clockwise
23: order as one views the shape from the outside. Each pattern is a list of
24: points which are to be connected by lines.
25: The following values are used to terminate the lists:
26: -1 end of perimeter or pattern
27: -2 end of face (and end of perimeter or pattern)
28: -3 end of object
29: */
30:
31: typedef struct { INT x, y, z; } POINT3D;
32: typedef struct { INT x, y; } POINT2D;
33: typedef struct { INT p1, p2; } LINE;
34: typedef INT FACE;
35:
36: typedef struct
37: {
38: INT cPoints; /* number of 3D points */
39: POINT3D *rgpt3; /* array of points */
40: LINE *rgline; /* array of lines */
41: FACE *rgface; /* array of faces */
42: }
43: OBJECT;
44:
45: typedef struct
46: {
47: LONG zViewDist; /* viewing distance for perspective */
48: POINT3D pt3Angle; /* initial angle of rotation */
49: POINT3D pt3AngVel; /* angular velocity for rotation */
50: POINT3D pt3SizeMid; /* initial size */
51: POINT3D pt3SizeMag; /* magnitude of sinusoidal size change */
52: POINT3D pt3SizeAng; /* initial angle for sinusoidal size change */
53: POINT3D pt3SizeVel; /* angular velocity of sinusoidal size change */
54: }
55: INIT;
56:
57: typedef struct
58: {
59: CHAR *szName; /* name of shape */
60: OBJECT *pobject; /* object definition */
61: INIT *pinit; /* initial parameters */
62: }
63: SHAPE;
64:
65:
66: /*
67: Each window (child or parent) has an associated SHAPEVARS structure.
68: In essence, these variables are local to the window.
69: */
70:
71: typedef struct
72: {
73: INT iShape; /* shape index */
74: HWND hwndFrame; /* Frame hwnd */
75: HWND hwndClient; /* Client hwnd */
76: HPS hpsClient; /* Client hps */
77: POINTL *rgptOld; /* previously drawn 2D points */
78: POINTL *rgptNew; /* next to be drawn 2D points */
79: BOOL fShaded; /* shaded flag */
80: BOOL fErased; /* window erased flag */
81: BOOL fClipping; /* clipping flag */
82: BOOL fVarySize; /* vary size flag */
83: BOOL fPerspective; /* perspective flag */
84: POINTL ptCentre; /* centre point in window */
85: LONG zViewDist; /* viewing distance (perspective) */
86: POINT2D pt2LightAng; /* light source angle (x/y rotations) */
87: POINT3D pt3Angle; /* shape's current angle of rotation */
88: POINT3D pt3AngVel; /* shape's angular velocity of rotation */
89: POINT3D pt3Size; /* current size */
90: POINT3D pt3SizeMid; /* middle size of sinusoidal size change */
91: POINT3D pt3SizeMag; /* magnitude of sinusoidal size change */
92: POINT3D pt3SizeAng; /* current angle for sinusoidal size change */
93: }
94: SHAPEVARS;
95:
96: typedef SHAPEVARS *PSV;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.