home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #include <stdio.h>
- #include <gl.h>
- #include <device.h>
- #include <math.h>
- #include "defines.h"
- #include "event.h"
- #include "trackball.h"
- #include "scaleobj.h"
- #include "rotobj.h"
-
- extern Matrix view_matrix;
- extern Matrix R_view_matrix;
- extern Matrix identity_matrix;
-
- /* About the window... */
- extern long origin_x, origin_y, size_x, size_y;
-
- /* Mouse values in screen coords */
- static Scoord mx;
-
- /* Scaled mouse values (-1.0 to 1.0) */
- static Coord last_x, new_x;
-
- static Coord scale_center[3];
-
- void scale_object()
- {
- mx = getvaluator(MOUSEX) - origin_x;
- /* my = getvaluator(MOUSEY) - origin_y;*/
-
- /* Scale mouse values to square around -1.0 to 1.0 */
- last_x = 2.0*((Coord)mx/size_x - 0.5);
- /* last_y = 2.0*((Coord)my/size_y - 0.5); */
-
- compute_center(scale_center);
- }
-
-
- void update_object_scale(Matrix object_matrix)
- {
- float scale_factor;
-
- mx = getvaluator(MOUSEX) - origin_x;
- /* my = getvaluator(MOUSEY) - origin_y;*/
-
- /* Scale mouse values to square around -1.0 to 1.0 */
- new_x = 2.0*((Coord)mx/size_x - 0.5);
- /* new_y = 2.0*((Coord)my/size_y - 0.5); */
-
- scale_factor = 1.0 + new_x - last_x;
-
- last_x = new_x;
- /* last_y = new_y; */
-
- loadmatrix(identity_matrix);
-
- translate(scale_center[0],scale_center[1],scale_center[2]);
- multmatrix(R_view_matrix);
- scale(scale_factor, scale_factor, scale_factor);
- multmatrix(view_matrix);
- translate(-scale_center[0],-scale_center[1],-scale_center[2]);
-
- getmatrix(object_matrix);
- }
-
-