2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
15 * Matrix setup & manipulation routines
26 void scale_matrix(void);
28 //set view from x,y,z & p,b,h, zoom. Must call one of g3_set_view_*()
29 void g3_set_view_angles(vms_vector *view_pos,vms_angvec *view_orient,fix zoom)
32 View_position = *view_pos;
34 vm_angles_2_matrix(&View_matrix,view_orient);
39 //set view from x,y,z, viewer matrix, and zoom. Must call one of g3_set_view_*()
40 void g3_set_view_matrix(vms_vector *view_pos,vms_matrix *view_matrix,fix zoom)
43 View_position = *view_pos;
45 View_matrix = *view_matrix;
50 //performs aspect scaling on global view matrix
51 void scale_matrix(void)
53 Unscaled_matrix = View_matrix; //so we can use unscaled if we want
55 Matrix_scale = Window_scale;
57 if (View_zoom <= f1_0) //zoom in by scaling z
59 Matrix_scale.z = fixmul(Matrix_scale.z,View_zoom);
61 else { //zoom out by scaling x&y
63 fix s = fixdiv(f1_0,View_zoom);
65 Matrix_scale.x = fixmul(Matrix_scale.x,s);
66 Matrix_scale.y = fixmul(Matrix_scale.y,s);
69 //now scale matrix elements
71 vm_vec_scale(&View_matrix.rvec,Matrix_scale.x);
72 vm_vec_scale(&View_matrix.uvec,Matrix_scale.y);
73 vm_vec_scale(&View_matrix.fvec,Matrix_scale.z);