From 42107f9a01652cb2f47228d20c1148a2a22f6a63 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Tue, 22 May 2018 19:33:31 -0400
Subject: [PATCH] new torus code and VR
---
Torus.java | 23 ++++++++++++++++-------
BoundaryRep.java | 7 ++++---
CameraPane.java | 12 ++++++++++--
Camera.java | 0
GroupLeaf.java | 3 ++-
5 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/BoundaryRep.java b/BoundaryRep.java
index 9cf899c..3a1d080 100644
--- a/BoundaryRep.java
+++ b/BoundaryRep.java
@@ -4932,7 +4932,7 @@
//colors[i3 + 1] = cp.vertexOcclusion.g;
//colors[i3 + 2] = cp.vertexOcclusion.b;
- if ((i % 1000) == 0 && i != 0)
+ if ((i % 100) == 0 && i != 0)
{
CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
//System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done");
@@ -4964,7 +4964,7 @@
v.AO = cp.vertexOcclusion.r;
- if ((i % 1000) == 0 && i != 0)
+ if ((i % 100) == 0 && i != 0)
{
CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
//System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done");
@@ -7230,7 +7230,8 @@
{
if (f3.p == f0.p)
{
- assert(false);
+// assert(false);
+ new Exception().printStackTrace();
f0.r = f3.q;
}
else
diff --git a/RTCamera.java b/Camera.java
similarity index 100%
rename from RTCamera.java
rename to Camera.java
diff --git a/CameraPane.java b/CameraPane.java
index 091d05a..b876bb4 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -12854,7 +12854,9 @@
{
mouseMode |= ZOOM;
}
- if ((modifiers & META) == META)
+
+ boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
+ if (capsLocked || (modifiers & META) == META)
{
mouseMode |= VR; // BACKFORTH;
}
@@ -12868,6 +12870,7 @@
}
if ((modifiers & SHIFT) == SHIFT || forcetranslate)
{
+ mouseMode &= ~VR;
mouseMode |= TRANSLATE;
}
// if ((modifiers & SHIFT_META) == SHIFT_META)
@@ -14719,6 +14722,11 @@
// System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
// System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
+ // Will fit the mesh !!!
+ selectedpoint.toParent[0][0] = 0.0001;
+ selectedpoint.toParent[1][1] = 0.0001;
+ selectedpoint.toParent[2][2] = 0.0001;
+
glu.gluUnProject(x,y,depth,view,0,tempmat2,0,viewport,0,selectedpoint.toParent[3],0);
// if (object.selection != null && object.selection.Size() > 0)
@@ -15341,7 +15349,7 @@
int AAbuffersize = 0;
//double[] selectedpoint = new double[3];
- static Sphere selectedpoint = new Sphere();
+ static Superellipsoid selectedpoint = new Superellipsoid();
static Sphere previousselectedpoint = null;
static Sphere debugpoint = new Sphere();
static Sphere debugpoint2 = new Sphere();
diff --git a/GroupLeaf.java b/GroupLeaf.java
index b42c72d..805acf2 100644
--- a/GroupLeaf.java
+++ b/GroupLeaf.java
@@ -9,7 +9,8 @@
*/
public class GroupLeaf extends Composite
{
- static final long serialVersionUID = -1647706059469889079L;
+ static final long serialVersionUID = // for wader: -6036608125951558970L;
+ -1647706059469889079L;
GroupLeaf()
{
diff --git a/Torus.java b/Torus.java
index 8f85353..af74364 100644
--- a/Torus.java
+++ b/Torus.java
@@ -61,16 +61,25 @@
if (v == 1)
v = 0;
- double uAng = LA.toRadians((1-u) * 360);
- double vAng = LA.toRadians(v * 360);
- double x = (double)Math.cos(uAng) * (major + (double)Math.cos(vAng) * minor);
- double y = (double)Math.sin(vAng) * minor;
+ double uAng = u * 2 * Math.PI;
+ double vAng = v * 2 * Math.PI;
+ double cosua = Math.cos(uAng);
+ double sinua = Math.sin(uAng);
+ double cosva = Math.cos(vAng);
+ double sinva = Math.sin(vAng);
+
+ double radius = (major + cosva * minor);
+ double x = cosua * radius;
+ double y = sinva * minor;
if (Math.abs(y) < 1E-10)
y = 0; // hashtable issue
- double z = (double)Math.sin(uAng) * (major + (double)Math.cos(vAng) * minor);
+
+ double z = sinua * radius;
cVector tPos = LA.newVector(x, y, z);
- double xx = (double)(Math.cos(uAng) * Math.cos(vAng)) * minor;
- double zz = (double)(Math.sin(uAng) * Math.cos(vAng)) * minor;
+
+ double xx = cosua * cosva * minor;
+ double zz = sinua * cosva * minor;
+
cVector tNorm = LA.newVector(xx, y, zz);
Vertex temp = new Vertex(tPos);
//temp.pos = tPos; // useless new
--
Gitblit v1.6.2