projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.18.tar.gz
[xscreensaver]
/
hacks
/
glx
/
gltrackball.c
diff --git
a/hacks/glx/gltrackball.c
b/hacks/glx/gltrackball.c
index e3c0cd42402fdb781b03a48a0be8e502d4c7f9c9..93d4c54263ef97e2610616d794013e10f0acbc5d 100644
(file)
--- a/
hacks/glx/gltrackball.c
+++ b/
hacks/glx/gltrackball.c
@@
-1,4
+1,4
@@
-/* gltrackball, Copyright (c) 2002-20
08
Jamie Zawinski <jwz@jwz.org>
+/* gltrackball, Copyright (c) 2002-20
12
Jamie Zawinski <jwz@jwz.org>
* GL-flavored wrapper for trackball.c
*
* Permission to use, copy, modify, distribute, and sell this software and its
* GL-flavored wrapper for trackball.c
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@
-12,20
+12,25
@@
#include <math.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
+#include <string.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#ifdef HAVE_COCOA
-# include <OpenGL/gl.h>
-#else
+#ifndef HAVE_COCOA
# include <GL/gl.h>
#endif
# include <GL/gl.h>
#endif
+#ifdef HAVE_JWZGLES
+# include "jwzgles.h"
+#endif /* HAVE_JWZGLES */
+
#include "trackball.h"
#include "gltrackball.h"
#include "trackball.h"
#include "gltrackball.h"
+extern double current_device_rotation (void); /* Bah, it's in fps.h */
+
struct trackball_state {
int x, y;
GLfloat q[4];
struct trackball_state {
int x, y;
GLfloat q[4];
@@
-43,6
+48,16
@@
gltrackball_init (void)
return ts;
}
return ts;
}
+/* Reset the trackball to the default unrotated state.
+ */
+void
+gltrackball_reset (trackball_state *ts)
+{
+ memset (ts, 0, sizeof(*ts));
+ trackball (ts->q, 0, 0, 0, 0);
+}
+
+
/* Begin tracking the mouse: Call this when the mouse button goes down.
x and y are the mouse position relative to the window.
w and h are the size of the window.
/* Begin tracking the mouse: Call this when the mouse button goes down.
x and y are the mouse position relative to the window.
w and h are the size of the window.