From 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Tue, 25 Jun 2019 23:58:09 -0400 Subject: [PATCH] Edit panel pin state. --- cJ3D.java | 52 ++++++++++++++++++++++++++++++++++------------------ 1 files changed, 34 insertions(+), 18 deletions(-) diff --git a/cJ3D.java b/cJ3D.java index 686d003..1a2fa60 100644 --- a/cJ3D.java +++ b/cJ3D.java @@ -360,13 +360,13 @@ toParent[3][3] = m.m33; } + Matrix4d m = new Matrix4d(); + Object3D Read(TransformGroup g) { Object3D c = new Object3D(GetName(g)); // g.getClass().getName()); Transform3D t = new Transform3D(); - - Matrix4d m = new Matrix4d(); g.getTransform(t); @@ -375,22 +375,18 @@ c.toParent = LA.newMatrix(); c.fromParent = LA.newMatrix(); - c.toParent[0][0] = m.m00; - c.toParent[0][1] = m.m10; - c.toParent[0][2] = m.m20; - c.toParent[0][3] = m.m30; - c.toParent[1][0] = m.m01; - c.toParent[1][1] = m.m11; - c.toParent[1][2] = m.m21; - c.toParent[1][3] = m.m31; - c.toParent[2][0] = m.m02; - c.toParent[2][1] = m.m12; - c.toParent[2][2] = m.m22; - c.toParent[2][3] = m.m32; - c.toParent[3][0] = m.m03; - c.toParent[3][1] = m.m13; - c.toParent[3][2] = m.m23; - c.toParent[3][3] = m.m33; + if (m.m00 != 0 || m.m10 != 0 || m.m20 != 0 || m.m30 != 0 || + m.m01 != 0 || m.m11 != 0 || m.m21 != 0 || m.m31 != 0 || + m.m02 != 0 || m.m12 != 0 || m.m22 != 0 || m.m32 != 0 || + m.m03 != 0 || m.m13 != 0 || m.m23 != 0 /*|| m.m33 != 0 */) + { + SetMatrix(c, m); + } + else + { + System.err.println("Found zero scale matrix. Hide the object instead."); + c.count = 1; + } // ReadNode(c, g); LA.matInvert(c.toParent, c.fromParent); @@ -402,6 +398,26 @@ return c; } + + private void SetMatrix(Object3D c, Matrix4d m) + { + c.toParent[0][0] = m.m00; + c.toParent[0][1] = m.m10; + c.toParent[0][2] = m.m20; + c.toParent[0][3] = m.m30; + c.toParent[1][0] = m.m01; + c.toParent[1][1] = m.m11; + c.toParent[1][2] = m.m21; + c.toParent[1][3] = m.m31; + c.toParent[2][0] = m.m02; + c.toParent[2][1] = m.m12; + c.toParent[2][2] = m.m22; + c.toParent[2][3] = m.m32; + c.toParent[3][0] = m.m03; + c.toParent[3][1] = m.m13; + c.toParent[3][2] = m.m23; + c.toParent[3][3] = m.m33; + } Object3D Read(Scene s, String fn) { -- Gitblit v1.6.2