1 // $Header: x:/prj/tech/libsrc/r3d/RCS/space.h 1.15 1998/06/18 11:27:14 JAEMZ Exp $
2 // Camera Space related functions
10 // Changes the world coordinate system to the one pointed at. This is for
11 // losers who want to change for a given context after its built, or for doing
12 // wacky world inversion or maybe mirrors. The handedness bit
14 EXTERN
void r3_set_world(mxs_trans
*w
);
15 EXTERN mxs_trans
*r3_get_world();
17 // Changes all the function pointers for xform and clipping, sets cspace and
18 // cspace_vec, and sets o2c_invalid, and w2c_invalid.
20 EXTERN
void r3_set_space(r3e_space s
);
21 EXTERN r3e_space
r3_get_space();
23 // Let's the user sneakily change the space for their own custom
24 // transform wackiness. Note that this does not do anything to the
25 // clippers or any of that, so they better set it back again.
27 EXTERN
void r3_set_space_vector(mxs_vector
*v
);
28 EXTERN mxs_vector
*r3_get_space_vector();
30 // Routine to set the linear space mode center in world space
31 EXTERN
void r3_set_linear_center(mxs_vector
*v
);
33 // Routine to set the linear space projected from the center of the
34 // screen making the screen width be world space size w
35 // used for top down or anything like that view
36 EXTERN
void r3_set_linear_screen_width(mxs_real w
);
38 // get the pixel size of something x wide at z distance from the camera,
39 // assumes it's centered, h means horizontal. You can get z from a
40 // transformed points z, since we're so groovy and don't scale it
41 // Useful for LOD calculations
42 EXTERN mxs_real
r3_get_hsize(mxs_real z
,mxs_real h
);
43 EXTERN mxs_real
r3_get_vsize(mxs_real z
,mxs_real v
);
46 // Return the scaling factor with which you get screen size. You multiply
47 // by height and divide by distance to get pixel size
48 // Useful for LOD calculations
49 EXTERN mxs_real
r3_get_hscale();
50 EXTERN mxs_real
r3_get_vscale();
53 // Unproject points into camera space, just give it screen coords
54 // and the distance at which you want it from the camera
55 EXTERN
void r3_unproject(mxs_vector
*v
,float z
,float sx
,float sy
);
58 // Takes field of view in degrees, and the screen width in pixels
59 EXTERN mxs_real
r3_fov_2_zoom(mxs_real degrees
);
61 // Returns necessary zoom to get the number of pixels for that
62 // width and distance. Basically opposite of r3_get_hsize
63 // z and w are in world coords, pixw is in screen pixels
64 EXTERN mxs_real
r3_hsize_2_zoom(mxs_real z
,mxs_real w
,mxs_real pixw
);
67 // Get the pixel accuracy of linear space about a world point
68 // and radius. This represents worst possible popping in screen
70 EXTERN mxs_real
r3_linear_accuracy(mxs_vector
*wcen
,mxs_real rad
);
72 // Transform a plane from world space to world space, preserving dot product
73 // equals zero. Assumes w2v is unitary, but the csp vector doesn't have to
75 // Also, you must be outside of a block
76 EXTERN
void r3_w2c_plane(mxs_plane
*dst
,mxs_plane
*src
);
78 // Returns the mag2 of a rotated/tranformed point
79 // ie, a point in camera space
80 EXTERN
float r3_camera_mag2(r3s_point
*p
);