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.
14 * $Source: /cvs/cvsroot/d2x/3d/matrix.c,v $
17 * $Date: 2001-10-31 03:54:51 $
19 * Matrix setup & manipulation routines
21 * $Log: not supported by cvs2svn $
22 * Revision 1.2 2001/01/31 15:17:48 bradleyb
23 * Makefile and conf.h fixes
25 * Revision 1.1.1.1 2001/01/19 03:29:58 bradleyb
28 * Revision 1.1.1.1 1999/06/14 21:57:48 donut
29 * Import of d1x 1.37 source.
31 * Revision 1.1 1995/05/05 08:52:11 allender
34 * Revision 1.1 1995/04/17 04:14:34 matt
45 static char rcsid[] = "$Id: matrix.c,v 1.3 2001-10-31 03:54:51 bradleyb Exp $";
51 void scale_matrix(void);
53 //set view from x,y,z & p,b,h, zoom. Must call one of g3_set_view_*()
54 void g3_set_view_angles(vms_vector *view_pos,vms_angvec *view_orient,fix zoom)
57 View_position = *view_pos;
59 vm_angles_2_matrix(&View_matrix,view_orient);
62 Win32_set_view_matrix ();
68 //set view from x,y,z, viewer matrix, and zoom. Must call one of g3_set_view_*()
69 void g3_set_view_matrix(vms_vector *view_pos,vms_matrix *view_matrix,fix zoom)
72 View_position = *view_pos;
74 View_matrix = *view_matrix;
77 Win32_set_view_matrix ();
83 //performs aspect scaling on global view matrix
84 void scale_matrix(void)
86 Unscaled_matrix = View_matrix; //so we can use unscaled if we want
88 Matrix_scale = Window_scale;
90 if (View_zoom <= f1_0) //zoom in by scaling z
92 Matrix_scale.z = fixmul(Matrix_scale.z,View_zoom);
94 else { //zoom out by scaling x&y
96 fix s = fixdiv(f1_0,View_zoom);
98 Matrix_scale.x = fixmul(Matrix_scale.x,s);
99 Matrix_scale.y = fixmul(Matrix_scale.y,s);
102 //now scale matrix elements
104 vm_vec_scale(&View_matrix.rvec,Matrix_scale.x);
105 vm_vec_scale(&View_matrix.uvec,Matrix_scale.y);
106 vm_vec_scale(&View_matrix.fvec,Matrix_scale.z);