1 /* This File Automatically Generated by the build system */
8 * $Source: x:/prj/tech/libsrc/r3d/RCS/xfrmtab.h $
11 * $Date: 1998/06/18 11:27:33 $
13 * Transform and projection definitions
17 typedef struct _r3s_xform_tab
{
18 void (*rotate_block
)(int n
,r3s_point dst
[],mxs_vector src
[]);
19 void (*project_block
)(int n
,r3s_point p
[]);
20 void (*transform_block
)(int n
,r3s_point dst
[],mxs_vector src
[]);
23 EXTERN r3s_xform_tab
*r3d_xform_ftabs
[];
25 // $Header: x:/prj/tech/libsrc/r3d/RCS/xform.h 1.9 1998/06/18 11:27:29 JAEMZ Exp $
26 // Transform and projection definitions
28 // define to dereference global f pointer
29 #define R3_XFORM(x) (*((r3d_glob.xform_tab).x))
31 // The basic set of transformers and projectors are as follows. The
32 // project class of functions just projects, stuffing the sx,sy, and w
33 // values into the 2d part of the point. The rotate class of functions
36 // some of these will be function pointers
37 EXTERN
void r3_transform_block(int n
,r3s_point dst
[],mxs_vector src
[]);
38 #define r3_rotate_block(n,dst,src) (R3_XFORM(rotate_block)((n),(dst),(src)))
39 #define r3_project_block(n,p) (R3_XFORM(project_block)((n),(p)))
40 #define r3_transform_block_func R3_XFORM(transform_block)
42 EXTERN
void r3_transform_list(int n
,r3s_phandle dst
[],mxs_vector
*src
[]);
43 EXTERN
void r3_rotate_list(int n
,r3s_phandle dst
[],mxs_vector
*src
[]);
44 EXTERN
void r3_project_list(int n
,r3s_phandle p
[]);
46 #define r3_transform_point(dst,src) r3_transform_block(1,(dst),(src))
47 #define r3_rotate_point(dst,src) (R3_XFORM(rotate_block)(1,(dst),(src)))
48 #define r3_project_point(p) (R3_XFORM(project_block)(1,(p)))
50 // This is the preferred model, especially since every tile renderer is
51 // fixed anyway it gets you the delta to add to your transformed points.
52 // It stuffs the delta into dst.
54 EXTERN
void r3_get_delta(mxs_vector
*dst
,mxs_vector
*src
);
55 EXTERN
void r3_copy_add_delta(r3s_point
*dst
,r3s_point
*src
,mxs_vector
*delta
);
57 // $Header: x:/prj/tech/libsrc/r3d/RCS/clip.h 1.13 1998/06/18 11:25:48 JAEMZ Exp $
66 R3_CLIP
, // do all clipping
67 R3_NO_CLIP
, // do no clipping
68 R3_USER_CLIP
// don't view clip, but do user clipping
71 EXTERN
void r3_set_clipmode(r3e_clipmode e
);
72 EXTERN r3e_clipmode
r3_get_clipmode();
73 EXTERN
void r3_set_clip_flags(int flags
);
74 EXTERN
void r3_set_near_plane(mxs_real dist
);
75 EXTERN mxs_real
r3_get_near_plane();
77 // force recalculation of internal clip state
78 EXTERN
void r3_set_clip(void);
80 EXTERN
void r3_std_code_points(int n
, r3s_point
*src
);
82 // $Header: x:/prj/tech/libsrc/r3d/RCS/clipcon.h 1.8 1998/06/30 18:45:55 buzzard Exp $
86 mxs_plane world_clip
[5];
89 int clip_flags
; // which u,v coordinate type stuff to clip
90 mxs_real near_plane
; // in view space
91 r3e_clipmode clip_mode
;
99 #define R3_CLIP_RGB (1+8+16) // store RGB as I,*,*,H,D
101 // $Header: x:/prj/tech/libsrc/r3d/RCS/clipplan.h 1.3 1998/06/18 11:25:49 JAEMZ Exp $
103 EXTERN
void r3_clear_clip_planes(void);
104 EXTERN
void r3_pop_clip_plane(void);
105 EXTERN
void r3_push_clip_plane(mxs_plane
*p
);
107 // $Header: x:/prj/tech/libsrc/r3d/RCS/clipprim.h 1.10 1998/06/18 11:25:50 JAEMZ Exp $ Internal clipping of primitives
112 // clip a polygon against the active clip planes
113 EXTERN
int r3_clip_polygon(int n
,r3s_phandle
*src
,r3s_phandle
**dest
);
115 // generate an or'd together clipcode of the polygon.
116 // r3d_ccodes_or & r3d_ccodes_and are updated as well; see below
117 EXTERN
int r3_code_polygon(int n
, r3s_phandle
*src
);
119 // clip a polygon against the view planes regardless of clip mode
120 EXTERN
int r3_raw_clip_polygon(int n
,r3s_phandle
*src
,r3s_phandle
**dest
);
122 // clip a line against the view planes
123 EXTERN
bool r3_clip_line(r3s_phandle
*src
, r3s_phandle
**dest
);
125 // The following values are stuffed, but never cleared, in
126 // certain cases. Basically, the user clears them, calls
127 // one or more functions that cumulatively stuffs them, then
128 // does whatever with the result.
130 EXTERN ulong r3d_ccodes_or
, r3d_ccodes_and
;
131 // Here are the functions that stuff them:
134 // r3_transform_block() in project space only
144 // Functions marked [*] aren't written yet.
146 // This routine clips a bounding box in world space.
147 // It returns the and_ccode of all the clip codes and
148 // stuffs the or_code. Since it returns and_ccode you can use it as a
149 // branch for trivial reject if non-zero.
150 EXTERN
int r3_clip_bbox(mxs_vector
*bmin
,mxs_vector
*bmax
,int *or_code
);
152 // This routine clips a bouding sphere in world space.
153 // It returns the and_ccode of all the clip codes and
154 // stuffs the or_code. Since it returns and_ccode you can use it as a
155 // branch for trivial reject if non-zero.
156 EXTERN
int r3_clip_sphere(mxs_vector
*cen
,float rad
,int *or_code
);
158 // This routine clip codes a point in world space.
159 // It returns the code
160 EXTERN
int r3_clip_point(mxs_vector
*cen
);
163 EXTERN
void r3_compute_camera_planes(void);
167 // $Header: x:/prj/tech/libsrc/r3d/RCS/primcon.h 1.5 1996/06/06 19:08:43 JAEMZ Exp $
173 r3s_texture bm
; // default texture if poly
175 // flags which indicate what function we use
182 uchar bm_type
; // plus transparency flag
185 // $Header: x:/prj/tech/libsrc/r3d/RCS/prim.h 1.12 1998/06/30 18:45:54 buzzard Exp $
187 EXTERN
void r3_set_2d_clip(bool context
);
188 EXTERN
void r3_set_color(int color
);
189 EXTERN
void r3_set_point_context(int context
);
190 EXTERN
void r3_set_line_context(int context
);
191 EXTERN
void r3_set_polygon_context(int context
);
192 EXTERN
void r3_set_texture(r3s_texture id
);
193 EXTERN
void r3_force_texture(r3s_texture id
);
195 // force recalculation of all internal primitve state
196 EXTERN
void r3_set_prim(void);
198 EXTERN
int r3_draw_point(r3s_phandle p
);
199 EXTERN
int r3_draw_line(r3s_phandle p0
,r3s_phandle p1
);
200 EXTERN
int r3_bitmap (r3s_texture bm
, r3s_phandle p
);
202 #define r3_draw_poly (r3d_glob.prim_tab.draw_3d_poly)
203 #define r3_draw_tmap (r3d_glob.prim_tab.draw_3d_tmap)
204 EXTERN BOOL r3d_do_setup
;
206 // flags for draw_point context
207 #define R3_PT_TRANSLUCENT 1
208 #define R3_PT_ANTI_ALIAS 2
210 // flags for draw_line context
212 #define R3_LN_RGB_GOURAUD 1
213 #define R3_LN_CLUT_GOURUAD 2
214 #define R3_LN_PALETTE_GOURAUD 3
216 // flags for polygon drawing
218 // primary drawing mode
219 #define R3_PL_POLYGON 0
220 #define R3_PL_TRISTRIP 1
221 #define R3_PL_TRIFAN 2
222 #define R3_PL_QUADSTRIP 3
225 #define R3_PL_UNLIT 0
226 #define R3_PL_GOURAUD 4
227 #define R3_PL_RGB_GOURAUD 8
228 #define R3_PL_PALETTE_GOURAUD 12
231 #define R3_PL_SOLID 0
232 #define R3_PL_TRANSLUCENT 16
233 #define R3_PL_TEXTURE 32
234 #define R3_PL_TEXTURE_LINEAR 48
236 // outline in wireframe as well as draw normally
237 #define R3_PL_WIRE 64
239 // check facing using vertices
240 #define R3_PL_CHECK_FACING 128
242 #define R3_PL_MODE_MASK 3
243 #define R3_PL_LIGHT_MASK 12
244 #define R3_PL_TEXTURE_MASK 48
246 // $Header: x:/prj/tech/libsrc/r3d/RCS/primtab.h 1.7 1997/10/03 13:03:29 KEVIN Exp $
248 // primitive function table type
250 typedef struct grs_vertex grs_vertex
;
253 int (*draw_3d_poly
) (int n
, r3s_phandle
*vp
);
254 int (*draw_3d_tmap
) (int n
, r3s_phandle
*vp
, r3s_texture bm
);
255 int (*draw_2d_poly
) (int n
, r3s_phandle
*vp
);
256 void (*draw_2d_tmap
) (r3s_texture bm
); // actually, just setup
257 int (*draw_2d_line
) (r3s_phandle p0
, r3s_phandle p1
);
258 int (*draw_2d_point
)(r3s_phandle p0
);
261 // $Header: x:/prj/tech/libsrc/r3d/RCS/primface.h 1.4 1998/06/18 11:26:51 JAEMZ Exp $
263 // check three pts to see if forward facing
264 EXTERN
bool r3_check_facing_3(r3s_phandle
*vp
);
266 // find first 3 non-colinear points and check if forward facing
267 EXTERN
bool r3_check_facing_n(int n
, r3s_phandle
*vp
);
269 // check viewspace pt & normal to see if forward facing
270 EXTERN
bool r3_check_v_normal_vec(mxs_vector
*p
, mxs_vector
*n
);
272 // check worldspace pt & normal to see if forward facing
273 EXTERN
bool r3_check_w_normal_vec(mxs_vector
*p
, mxs_vector
*n
);
275 // check object space pt & normal to see if forward facing
276 EXTERN
bool r3_check_o_normal_vec(mxs_vector
*p
, mxs_vector
*n
);
278 // check 3d point & normal to see if forward facing
280 #define r3_check_v_normal_pt(a,b) r3_check_v_normal_vec(&(a)->p, b)
282 // $Header: x:/prj/tech/libsrc/r3d/RCS/primconv.h 1.6 1998/06/18 11:26:46 JAEMZ Exp $
284 //////// convert between 3d points and 2d points ////////
286 EXTERN
void r3_phandle_to_vertex_list(int n
, r3s_phandle
*src
, grs_point
**vp
);
287 // convert an array of phandles into an array vertices
288 // this automatically reverses the winding in a left-handed space
290 #define r3_phandle_to_vertex(src) (&((src)->grp))
291 // convert a phandle into a grs_vertex *
293 EXTERN
void r3_reverse_vertex_list(int n
, grs_point
**src
);
294 // reverse 2d vertex list by hand
296 EXTERN
void r3_maybe_reverse_vertex_list(int n
, grs_point
**src
);
297 // reverse 2d vertex list if we're in a left-handed space
299 // $Header: x:/prj/tech/libsrc/r3d/RCS/ctxts.h 1.14 1998/06/18 11:26:17 JAEMZ Exp $
301 typedef struct grs_canvas grs_canvas
;
303 // these really belong with the h files that take these
305 // typedef enum for camera spaces
306 // clipping is optimized for clipping alot
307 // project is optimizd for fast projection
308 // unscaled is slow at projection and clipping
309 // linear is super fast but only good for far objects
321 R3_YXZ
=18, //01 00 10
322 R3_YZX
=24, //01 10 00
323 R3_ZXY
=33, //10 00 01
324 R3_ZYX
=36, //10 01 00
325 R3_DEFANG
=6 //00 01 10
328 // Special transform that contains explicit handedness info
329 typedef struct _r3s_trans
{
330 mxs_trans t
; // transform part of it
331 int left
; // is it left handed or not
332 // if an mxs_real is a double, we need 4 bytes more padding
335 // this is the transform context
336 // it has all the goodies for the stack and the like
337 typedef struct _r3s_xform_context
{
338 // all the mxs_real-sized stuff
339 mxs_vector cspace_vec
; // camera space vector
340 r3s_trans world
; // custom world to 3d world space transform
341 r3s_trans o2w
; // object to world
342 r3s_trans w2v
; // world to viewer, no cspace, built from world and in(view trans);
343 r3s_trans w2c
; // world to camera with cspace added, built from w2v, and space_vec
344 r3s_trans o2c
; // object to camera space
345 r3s_trans view_trans
; // raw view pos and matrix, for getting
346 r3s_trans lin_trans
; // linear trans
347 mxs_vector vino
; // viewer coords in object space
348 r3s_trans
*stack_cur
; // pointer to next entry on stack
349 r3s_trans
*stack_base
; // pointer to base of stack
350 int stack_size
; // current size of stack, ie, number of elements
351 int stack_max
; // maximum num elements on stack
353 mxs_real zoom
; // zoom factor 90 degrees horizontal = 1
354 mxs_real aspect
; // aspect ratio height/width
355 mxs_vector lin_cen
; // center of linear space
356 mxs_real lin_width
; // linear screen width or zero if using lin_cen
357 mxs_real lin_w
; // linear w value
358 float bias_x
; // x bias to the right of center of the viewer
359 float bias_y
; // y bias down of center of the viewer
360 int stride
; // point size for block operations
362 mxs_angvec view_ang
; // raw view angles
363 r3e_space cspace
; // camera space
364 bool w2c_invalid
; // w2v invalid, need to reconcatenate before cur
365 bool o2c_invalid
; // set when cur is invalid
366 bool world_set
; // set if the user has set world
369 typedef struct _r3s_context
{
370 // canvas and related processed information
371 grs_canvas
*cnv
; // 2d canvas to render to
372 r3s_xform_context trans
; // transform context structure har har
373 r3s_clip_context clip
; // clip context structure har
374 r3s_prim_context prim
; // primitive context
375 // context management info
376 int flags
; // yea, ok, here they are. neat, huh?
379 // global context that doesn't get copied
381 r3s_context
*cur_con
; // current context, null when none
382 int trans_depth
; // default nesting of transform stack
383 int clip_planes
; // default number of clipping planes above the basic 5
384 r3s_trans world
; // default world coordinates
385 int stride
; // default size of points for block operations
386 // context stack info
387 r3s_context
**ctxt_stack
;
388 int stack_depth
, stack_pos
;
389 // move to bottom for alignment
390 r3e_space space
; // default camera space
391 bool in_block
; // am I in a block
394 // global context that gets changed by current context
396 // move to top to align if they're doubles
397 mxs_real x_prj
; // x projection constant
398 mxs_real y_prj
; // y projection constant
399 mxs_real x_clip
; // x clip constant
400 mxs_real y_clip
; // y clip constant
402 fix x_off
; // screen x offset constant
403 fix y_off
; // screen y offset constant
404 int cur_stride
; // point size for block operations
406 // note that fields above this line should be easy to access from assembly
407 r3s_xform_tab xform_tab
; // transform function tables
408 r3s_prim_tab prim_tab
; // primitive dispatch tables
409 // move to bottom for alignment
410 r3e_space cur_space
; // current space
411 } r3s_global_context
;
413 EXTERN r3s_global_state r3d_state
; // global state
414 EXTERN r3s_global_context r3d_glob
; // global context
416 // everyone will hate this, as the debugger wont know what it is
417 // cause life is so darn sad
418 // so i guess we wont do it
419 // #define r3d_context (r3d_state.cur_con)
421 //------- flags for r3s_context
422 // flags for dealing with having a stack/multicontext model
423 #define R3F_CTXT_CURRENT (1<<0) // current context?
424 #define R3F_CTXT_ACTIVE (1<<1) // currently started/in progress?
425 #define R3F_CTXT_ONSTACK (1<<2) // on the stack?
426 #define R3F_CTXT_USEDONE (1<<3) // in a use/done block?
427 // flag for bonus internal/external memory fun
428 #define R3F_CTXT_ALLOCED (1<<4) // memory that r3d allocated?
429 #define R3F_CTXT_IAM1ST (1<<5) // secret interal 1st context memory
430 // flags for allowing persistant canvii
431 #define R3F_CTXT_PERSIST (1<<6) // a persistant context?
432 #define R3F_CTXT_RELOAD2D (1<<7) // reload canvas from 2d each frame?
433 // flag we need if context drives start and end frame
434 #define R3F_CTXT_PRIMARY (1<<8) // "primary, frame rate" context?
435 // not set means a "background" context
437 // $Header: x:/prj/tech/libsrc/r3d/RCS/object.h 1.6 1998/06/18 11:26:24 JAEMZ Exp $
438 // object stack routines
440 // Starts an object coordinate system, with no orientation. What happens
441 // is the object stack is incremented, and the new transform is
442 // calculated. Sets o2c_invalid. All of them do.
444 EXTERN
void r3_start_object(mxs_vector
*v
);
445 EXTERN
void r3_start_object_angles(mxs_vector
*v
, mxs_angvec
*a
,r3e_order o
);
446 EXTERN
void r3_start_object_trans(mxs_trans
*t
);
448 // takes a number representing which axis to rotate about 0=x,1=y,2=z
449 // real angs are in radian, if you didn't know
450 EXTERN
void r3_start_object_n(mxs_vector
*v
,mxs_ang ang
, int n
);
452 // These next three are useful for retardo-vision objects, and internally
453 // for bsp objects that are hinged.
455 #define r3_start_object_x(vecptr,realang) r3_start_object_n((vecptr),(realang),0)
456 #define r3_start_object_y(vecptr,realang) r3_start_object_n((vecptr),(realang),1)
457 #define r3_start_object_z(vecptr,realang) r3_start_object_n((vecptr),(realang),2)
459 // Pops the transform stack
461 EXTERN
void r3_end_object();
465 // The other transforms are to go from object to world, on a point by
466 // point basis. These are considered pathological, and so, aren't
467 // implemented as block calls or anything like that.
469 // Rotate a vector from object space to camera space,
470 // meaning this is non-orthogonal, beware
471 EXTERN
void r3_rotate_o2c(mxs_vector
*dst
,mxs_vector
*src
);
473 EXTERN
void r3_transform_o2w(mxs_vector
*dst
, mxs_vector
*src
);
474 EXTERN
void r3_rotate_o2w(mxs_vector
*dst
, mxs_vector
*src
);
476 // this definitely assumes o2w is always orthogonal. Because it uses
477 // transpose as inverse.
478 EXTERN
void r3_transform_w2o(mxs_vector
*dst
, mxs_vector
*src
);
479 EXTERN
void r3_rotate_w2o(mxs_vector
*dst
, mxs_vector
*src
);
481 // $Header: x:/prj/tech/libsrc/r3d/RCS/space.h 1.15 1998/06/18 11:27:14 JAEMZ Exp $
482 // Camera Space related functions
484 // Changes the world coordinate system to the one pointed at. This is for
485 // losers who want to change for a given context after its built, or for doing
486 // wacky world inversion or maybe mirrors. The handedness bit
488 EXTERN
void r3_set_world(mxs_trans
*w
);
489 EXTERN mxs_trans
*r3_get_world();
491 // Changes all the function pointers for xform and clipping, sets cspace and
492 // cspace_vec, and sets o2c_invalid, and w2c_invalid.
494 EXTERN
void r3_set_space(r3e_space s
);
495 EXTERN r3e_space
r3_get_space();
497 // Let's the user sneakily change the space for their own custom
498 // transform wackiness. Note that this does not do anything to the
499 // clippers or any of that, so they better set it back again.
501 EXTERN
void r3_set_space_vector(mxs_vector
*v
);
502 EXTERN mxs_vector
*r3_get_space_vector();
504 // Routine to set the linear space mode center in world space
505 EXTERN
void r3_set_linear_center(mxs_vector
*v
);
507 // Routine to set the linear space projected from the center of the
508 // screen making the screen width be world space size w
509 // used for top down or anything like that view
510 EXTERN
void r3_set_linear_screen_width(mxs_real w
);
512 // get the pixel size of something x wide at z distance from the camera,
513 // assumes it's centered, h means horizontal. You can get z from a
514 // transformed points z, since we're so groovy and don't scale it
515 // Useful for LOD calculations
516 EXTERN mxs_real
r3_get_hsize(mxs_real z
,mxs_real h
);
517 EXTERN mxs_real
r3_get_vsize(mxs_real z
,mxs_real v
);
519 // Return the scaling factor with which you get screen size. You multiply
520 // by height and divide by distance to get pixel size
521 // Useful for LOD calculations
522 EXTERN mxs_real
r3_get_hscale();
523 EXTERN mxs_real
r3_get_vscale();
525 // Unproject points into camera space, just give it screen coords
526 // and the distance at which you want it from the camera
527 EXTERN
void r3_unproject(mxs_vector
*v
,float z
,float sx
,float sy
);
529 // Takes field of view in degrees, and the screen width in pixels
530 EXTERN mxs_real
r3_fov_2_zoom(mxs_real degrees
);
532 // Returns necessary zoom to get the number of pixels for that
533 // width and distance. Basically opposite of r3_get_hsize
534 // z and w are in world coords, pixw is in screen pixels
535 EXTERN mxs_real
r3_hsize_2_zoom(mxs_real z
,mxs_real w
,mxs_real pixw
);
537 // Get the pixel accuracy of linear space about a world point
538 // and radius. This represents worst possible popping in screen
540 EXTERN mxs_real
r3_linear_accuracy(mxs_vector
*wcen
,mxs_real rad
);
542 // Transform a plane from world space to world space, preserving dot product
543 // equals zero. Assumes w2v is unitary, but the csp vector doesn't have to
545 // Also, you must be outside of a block
546 EXTERN
void r3_w2c_plane(mxs_plane
*dst
,mxs_plane
*src
);
548 // Returns the mag2 of a rotated/tranformed point
549 // ie, a point in camera space
550 EXTERN
float r3_camera_mag2(r3s_point
*p
);
553 * $Source: x:/prj/tech/libsrc/r3d/RCS/view.h $
556 * $Date: 1998/06/18 11:27:15 $
558 * View point related functions
562 // Sets the view position, position only. Note that orientationless cameras
563 // and objects all are assumed to be heading==0 pitch==0 bank==0, meaning that
564 // under the default world space, you all point down the x a Also,
565 // o2c_invalid, and w2c_invalid get set.
567 EXTERN
void r3_set_view(mxs_vector
*v
);
568 EXTERN mxs_trans
*r3_get_view_trans();
570 // Sets the view transform pretty damn directly. The meaning of it is the
571 // position in world space, and the columns of the matrix point along the
572 // viewer x, y, and z directions.
574 EXTERN
void r3_set_view_trans(mxs_trans
*t
);
576 // Takes an angvec for angles about the x,y,z axes, and and order which
577 // indicates from left to right how the angles should be applied. There
578 // is a default, which is XYZ which means bank the thing first, pitch i
580 EXTERN
void r3_set_view_angles(mxs_vector
*v
, mxs_angvec
*a
,r3e_order o
);
582 // Gets the view position in world space, and the angles in world space
584 EXTERN mxs_vector
*r3_get_view_pos();
585 EXTERN mxs_angvec
*r3_get_view_ang();
587 // This gives you the current viewer position in object space. This
588 // must be in a block. Or at least after a block and before any other
589 // space changing call.
591 EXTERN mxs_vector
*r3_get_view_in_obj();
593 // These are always true, don't need to be in or out of a block
594 // The slew function gets you the slew matrix of the viewer. That is,
595 // the first column, would be the vector to move you one unit in the
596 // viewer x, ie forward, the second column is y, ie, left, the third
599 EXTERN mxs_matrix
*r3_get_slew_matrix();
600 EXTERN mxs_vector
*r3_get_forward_slew();
601 EXTERN mxs_vector
*r3_get_left_slew();
602 EXTERN mxs_vector
*r3_get_up_slew();
604 // get the view pyramid in world space
605 // as a set of planes that get stuffed
606 // you need space for five planes,
607 // left,top,right,bottom, front
609 EXTERN
void r3_get_view_pyr_planes(mxs_plane
*planes
);
611 // get the view pyramid as 4 vectors
612 // upper left, upper right, lower right, lower left
613 // Note that these are deltas in world space off of the viewer position
615 EXTERN
void r3_get_view_pyr_vecs(mxs_vector
*vecs
);
617 // Stuff a world space vector into dst describing a vector
618 // at screen coordinates, sx, and sy. dst->z is equal to one
619 // can call at any time during a context
620 EXTERN
void r3_get_view_vec(mxs_vector
*dst
,mxs_real sx
,mxs_real sy
);
622 // get and set zoom factors, defaults to 1.0 = 90 degrees
623 // need a current context, not in a block
625 EXTERN
void r3_set_zoom(mxs_real zoom
);
626 EXTERN mxs_real
r3_get_zoom();
628 // set and get aspect ratio, since you may want to change
629 // it, and the 2d has no aspect per canvas
630 // note aspect ratio is defined as height of pixel over
633 EXTERN
void r3_set_aspect(mxs_real aspect
);
634 EXTERN mxs_real
r3_get_aspect();
636 // set and get the current view canvas, this is also called internally
637 // assumes in context, and not in block.
639 EXTERN
void r3_set_view_canvas(grs_canvas
*canv
);
640 EXTERN grs_canvas
*r3_get_view_canvas();
644 EXTERN
void r3_start_block();
645 EXTERN
void r3_end_block();
647 // $Header: x:/prj/tech/libsrc/r3d/RCS/r3dctxt.h 1.7 1998/06/18 11:27:11 JAEMZ Exp $
648 // public functions for the context system
650 // super basic start and end frame, implicitly create, set and destroy a context
651 EXTERN r3s_context
*r3_start_frame(void);
652 EXTERN
bool r3_end_frame(void);
653 // for using a context you have built to start a frame
654 EXTERN
bool r3_start_frame_context(r3s_context
*ctxt
);
656 // basic special context support, for building and playing with persistant contexts
657 EXTERN r3s_context
*r3_alloc_context(r3s_context
*ctxt
,ulong flags
);
658 EXTERN
bool r3_use_context(r3s_context
*ctxt
);
659 EXTERN
bool r3_done_with_context(void);
660 EXTERN
bool r3_free_context(r3s_context
*ctxt
);
662 // fancy pants context stuff for cool people who use multicontext support
663 EXTERN
bool r3_switch_context(r3s_context
*dst
);
664 EXTERN
bool r3_push_context(r3s_context
*dst
);
665 EXTERN
bool r3_pop_context(void);
666 EXTERN
bool r3_abort_context(r3s_context
*ctxt
);
668 // driver switching calls. Currently this state is not context related.
669 EXTERN
void r3_use_g2(void); // use g2, the default driver.
670 EXTERN
void r3_use_lgd3d(void); // use lgd3d, the looking glass direct 3d interface.
671 EXTERN
void r3_use_null(void); // use null driver; i.e. no rasteriztion.
673 // Initializing commands
675 EXTERN
void r3_init_defaults(int trans_depth
,int clip_planes
,r3e_space space
,int ctxt_cnt
,int stride
);
677 // simple init call that most users will use, that just uses all the default
678 EXTERN
void r3_init(void);
680 EXTERN
void r3_close(void);
682 // Sets a world coord system inherited by all subsequent context creations.
683 // The default is the identity transform. As well, the handedness bit is set
684 // in the transform. If you have a current context.
686 EXTERN
void r3_set_default_world(mxs_trans
*w
);
688 EXTERN mxs_trans
*r3_get_default_world();
690 // Sets the default camera space that all new contexts inherit. The default
693 EXTERN
void r3_set_default_space(r3e_space s
);
695 EXTERN r3e_space
r3_get_default_space();
697 #define R3C_OFF_LEFT 1
698 #define R3C_OFF_RIGHT 2
699 #define R3C_OFF_TOP 4
700 #define R3C_OFF_BOTTOM 8
701 #define R3C_BEHIND 16