Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19730/src/net/sourceforge/bprocessor/gl/view
Modified Files:
View3D.java
Log Message:
fixed rotation so it now rotates around the center of view
Index: View3D.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** View3D.java 16 Sep 2005 12:09:07 -0000 1.16
--- View3D.java 30 Sep 2005 15:51:45 -0000 1.17
***************
*** 73,84 ****
gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] {0.0f, 0.0f, 0.0f, 1.0f});
! glu.gluLookAt(0.0 + center[0], 25.0 * getZoomFactor() + center[1], 0.0 + center[2],
! center[0], center[1], center[2],
0.0, 0.0, 1.0);
-
- //gl.glMultMatrixd(viewTrans);
gl.glRotated(rotationX, 1.0, 0.0, 0.0);
gl.glRotated(rotationZ, 0.0, 0.0, 1.0);
!
if (picking == 0) {
gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix);
--- 73,83 ----
gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] {0.0f, 0.0f, 0.0f, 1.0f});
! glu.gluLookAt(0.0, 25.0 * getZoomFactor(), 0.0,
! 0.0, 0.0, 0.0,
0.0, 0.0, 1.0);
gl.glRotated(rotationX, 1.0, 0.0, 0.0);
gl.glRotated(rotationZ, 0.0, 0.0, 1.0);
! gl.glMultMatrixd(viewTrans);
!
if (picking == 0) {
gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix);
***************
*** 94,100 ****
public void translateCenter(double [] mv) {
if (mv.length == 3) {
! this.center[0] -= mv[0];
! this.center[1] += mv[2];
! this.center[2] += mv[1];
} else {
log.error("[translateViewMatrix] Wrong parameter size");
--- 93,102 ----
public void translateCenter(double [] mv) {
if (mv.length == 3) {
! this.viewTrans[12] -= modelMatrix[0] * mv[0] + modelMatrix[1] * mv[1] +
! modelMatrix[2] * mv[2];
! this.viewTrans[13] -= modelMatrix[4] * mv[0] + modelMatrix[5] * mv[1] +
! modelMatrix[6] * mv[2];
! this.viewTrans[14] -= modelMatrix[8] * mv[0] + modelMatrix[9] * mv[1] +
! modelMatrix[10] * mv[2];
} else {
log.error("[translateViewMatrix] Wrong parameter size");
|