From a9e12f6c508810604c8c91ee15451776b08ce1a1 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 22 Apr 2019 07:41:56 -0400 Subject: [PATCH] Camera capslock fix --- Object3D.java | 106 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 89 insertions(+), 17 deletions(-) diff --git a/Object3D.java b/Object3D.java index f6cf69b..8a39641 100644 --- a/Object3D.java +++ b/Object3D.java @@ -21,6 +21,19 @@ ScriptNode scriptnode; + void InitOthers() + { + if (projectedVertices == null || projectedVertices.length <= 2) + { + projectedVertices = new Object3D.cVector2[3]; + } + for (int i = 0; i < 3; i++) + { + projectedVertices[i] = new cVector2(); // Others + } + projectedVertices[0].x = 100; // bump + } + void MinMax(cVector minima, cVector maxima) { for (int xyz = 0; xyz < 3; xyz++) @@ -295,6 +308,8 @@ boolean random = false; boolean speedup = false; boolean rewind = false; + + float NORMALPUSH = 0; Object3D support; @@ -779,7 +794,10 @@ // factor = CameraPane.STEP; // } - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) + if (marked && CameraPane.isLIVE() && live && + //TEMP21aug2018 + CameraPane.drawMode == CameraPane.SHADOW && + currentframe != CameraPane.framecount) { currentframe = CameraPane.framecount; @@ -2130,15 +2148,8 @@ if (/*parent != null &&*/ material == null) { material = new cMaterial(GetMaterial()); - if (projectedVertices == null || projectedVertices.length <= 2) - { - projectedVertices = new Object3D.cVector2[3]; - } - for (int i = 0; i < 3; i++) - { - projectedVertices[i] = new cVector2(); // Others - } - projectedVertices[0].x = 100; // bump + + InitOthers(); if (this instanceof Camera) { @@ -4161,6 +4172,22 @@ } } + void RepairShadow() + { + if (blockloop) + return; + + if (this.material != null) + this.InitOthers(); + + for (int i=0; i<Size(); i++) + { + blockloop = true; + get(i).RepairShadow(); + blockloop = false; + } + } + void RepairTexture() { if (this instanceof FileObject || blockloop) @@ -5958,7 +5985,7 @@ javax.media.opengl.GL gl = display.GetGL(); - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) { int fc = bRep.FaceCount(); int vc = bRep.VertexCount(); @@ -6699,13 +6726,26 @@ gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); } + // P + float x = (float)pv.x; + float y = (float)pv.y; + float z = (float)pv.z; + if (hasnorm) { // if (!pv.norm.normalized()) // assert(pv.norm.normalized()); //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); + float nx = (float)pv.norm.x; + float ny = (float)pv.norm.y; + float nz = (float)pv.norm.z; + + x += nx * NORMALPUSH; + y += ny * NORMALPUSH; + z += nz * NORMALPUSH; + + gl.glNormal3f(nx, ny, nz); } gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); SetColor(display, pv); @@ -6716,13 +6756,28 @@ else gl.glTexCoord2f((float) pv.s, (float) pv.t); //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); + + gl.glVertex3f(x, y, z); + + // Q + x = (float)qv.x; + y = (float)qv.y; + z = (float)qv.z; + // Print(pv); if (hasnorm) { // assert(qv.norm.normalized()); //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); + float nx = (float)qv.norm.x; + float ny = (float)qv.norm.y; + float nz = (float)qv.norm.z; + + x += nx * NORMALPUSH; + y += ny * NORMALPUSH; + z += nz * NORMALPUSH; + + gl.glNormal3f(nx, ny, nz); } //System.out.println("vertexq = " + qv.s + ", " + qv.t); // boolean locked = false; @@ -6746,16 +6801,31 @@ // } gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); SetColor(display, qv); + + gl.glVertex3f(x, y, z); //gl.glColor4f(r, g, b, 1); //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); // Print(qv); + + // R + x = (float)rv.x; + y = (float)rv.y; + z = (float)rv.z; + if (hasnorm) { // assert(rv.norm.normalized()); //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); + float nx = (float)rv.norm.x; + float ny = (float)rv.norm.y; + float nz = (float)rv.norm.z; + + x += nx * NORMALPUSH; + y += ny * NORMALPUSH; + z += nz * NORMALPUSH; + + gl.glNormal3f(nx, ny, nz); } // if ((dot&4) == 0) @@ -6776,7 +6846,7 @@ //gl.glColor4f(r, g, b, 1); //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); + gl.glVertex3f(x, y, z); // Print(rv); //gl.glEnd(); } @@ -8163,6 +8233,8 @@ { Object3D targ = this; + targ.NORMALPUSH = obj.NORMALPUSH; + if (obj.material != null) { if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) -- Gitblit v1.6.2