From ec1ab4278b2408d3b19083e530e0376f809cca44 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 22 Apr 2019 14:29:20 -0400 Subject: [PATCH] Fix drawSelf --- Object3D.java | 656 +++++++++++++++-------------------------------------------- 1 files changed, 171 insertions(+), 485 deletions(-) diff --git a/Object3D.java b/Object3D.java index 1b4f39c..18fd57e 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++) @@ -296,6 +309,8 @@ boolean speedup = false; boolean rewind = false; + float NORMALPUSH = 0; + Object3D support; Object3D GetObject() @@ -355,7 +370,7 @@ int MemorySize() { - if (memorysize == 0) + if (true) // memorysize == 0) { try { @@ -745,7 +760,7 @@ int GetTransformCount() { - // marde pour serialization de Texture + // patch pour serialization de Texture resetmaxcount(); resettransformcount(); resetstep(); @@ -779,9 +794,12 @@ // factor = CameraPane.STEP; // } - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) + if (marked && Globals.isLIVE() && live && + //TEMP21aug2018 + Globals.DrawMode() == iCameraPane.SHADOW && + currentframe != Globals.framecount) { - currentframe = CameraPane.framecount; + currentframe = Globals.framecount; // System.err.println("transformcount = " + transformcount); // System.err.println("factor = " + factor); @@ -935,7 +953,7 @@ public Object clone() { - return GraphreeD.clone(this); + return GrafreeD.clone(this); } Object3D copyExpand() @@ -1446,7 +1464,16 @@ // if (other == null) // return; - System.out.println("Link support this = " + this + "; other = " + other); + if (other != null) + { + BoundaryRep.SEUIL = other.material.cameralight; + + // Set default to 0.1 + BoundaryRep.SEUIL /= 2; + System.out.println("SEUIL = " + BoundaryRep.SEUIL); + } + + System.out.println("Link this = " + this + "; support = " + other); //if (bRep != null) // bRep.linkVerticesThis(other.bRep); @@ -1701,7 +1728,7 @@ Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); o.bRep = transientrep; if (clone) - o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); + o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); o.CreateMaterial(); o.SetAttributes(this, -1); //parent @@ -1714,7 +1741,7 @@ Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); o.bRep = bRep; if (clone) - o.bRep = (BoundaryRep) GraphreeD.clone(bRep); + o.bRep = (BoundaryRep) GrafreeD.clone(bRep); o.CreateMaterial(); //o.overwriteThis(this, -1); o.SetAttributes(this, -1); @@ -1756,7 +1783,7 @@ // { // assert(bRep == null); // Object3D o = new Object3D("Geometry:" + this.name); -// o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); +// o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); // o.CreateMaterial(); // parent.addChild(o); // } @@ -1765,7 +1792,7 @@ // { // assert(transientrep == null); // Object3D o = new Object3D("Geometry:" + this.name); -// o.bRep = (BoundaryRep) GraphreeD.clone(bRep); +// o.bRep = (BoundaryRep) GrafreeD.clone(bRep); // o.CreateMaterial(); // parent.addChild(o); // } @@ -1816,8 +1843,9 @@ if (obj.name == null) continue; // can't be a null one - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count - if (n.startsWith(obj.name)) + String name = obj.name.split(":")[0]; // Poser generates a count + //if (n.startsWith(obj.name)) + if (n.contains(name)) { theobj = obj; count++; @@ -2120,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) { @@ -2732,6 +2753,24 @@ blockloop = false; } + void GenNormalsMINE() + { + if (blockloop) + return; + + blockloop = true; + GenNormalsMINE0(); + for (int i = 0; i < Children().Size(); i++) + { + Object3D child = (Object3D) Children().get(i); // reserve(i); + if (child == null) + continue; + child.GenNormalsMINE(); +// Children().release(i); + } + blockloop = false; + } + void ClearColors() { if (blockloop) @@ -2876,6 +2915,15 @@ if (bRep != null) { bRep.GenerateNormals(crease); + Touch(); + } + } + + void GenNormalsMINE0() + { + if (bRep != null) + { + bRep.GenerateNormalsMINE(); Touch(); } } @@ -3153,7 +3201,7 @@ BoundaryRep sup = bRep.support; bRep.support = null; - BoundaryRep temprep = (BoundaryRep) GraphreeD.clone(bRep); + BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); // bRep.SplitInTwo(onlyone); // thread... temprep.SplitInTwo(reduction34, onlyone); bRep = temprep; @@ -3677,7 +3725,7 @@ if (child == null) continue; - if (GraphreeD.RENDERME > 0) + if (GrafreeD.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -3717,7 +3765,7 @@ boolean getCentroid(cVector centroid, boolean xform) { - assert(false); +// for speaker assert(false); if (blockloop) return false; @@ -3828,7 +3876,7 @@ if (child == null) continue; - if (GraphreeD.RENDERME > 0) + if (GrafreeD.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -4023,7 +4071,7 @@ if (child == null) continue; - if (GraphreeD.RENDERME > 0) + if (GrafreeD.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -4111,7 +4159,7 @@ if (blockloop) return; - for (int i=0; i<size(); i++) + for (int i=0; i<Size(); i++) { if (get(i).parent != this) { @@ -4120,6 +4168,22 @@ } blockloop = true; get(i).RepairParent(); + blockloop = false; + } + } + + 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; } } @@ -4515,16 +4579,28 @@ Object3D GetFileRoot() { + if (overflow) + return null; + + overflow = true; + + Object3D pfr = null; + if (parent == null && fileparent == null) - return this; + pfr = this; if (parent == null && fileparent != null) // V4.gfd??? - return fileparent; + pfr = fileparent; - if (parent == null) - return this; + if (pfr == null && parent == null) + pfr = this; - return parent.GetFileRoot(); + if (pfr == null) + pfr = parent.GetFileRoot(); + + overflow = false; + + return pfr; } cTreePath GetPath() @@ -4925,7 +5001,8 @@ } else // if (editWindow != null) { - editWindow.cameraView.lighttouched = true; + //editWindow.cameraView.lighttouched = true; + Globals.lighttouched = true; } } @@ -5237,25 +5314,21 @@ } } - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) { Draw(display, root, selected, blocked); } - static cMaterial[] materialstack = new cMaterial[65536]; - static boolean[] selectedstack = new boolean[65536]; - static int materialdepth = 0; - boolean NeedSupport() { return CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null // PROBLEM with CROWD!! - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); + && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); } - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) { Invariants(); // june 2013 @@ -5264,7 +5337,7 @@ // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); } - if (display.drawMode == CameraPane.SELECTION && + if (display.DrawMode() == iCameraPane.SELECTION && hide) return; @@ -5280,10 +5353,10 @@ if (name != null && name.contains("sclera")) name = name; - if (this instanceof CheckerIG) + if (this instanceof Checker) return; - if (display.drawMode == display.SHADOW && PASSTEST) + if (display.DrawMode() == display.SHADOW && PASSTEST) return; if (count <= 0) @@ -5291,8 +5364,8 @@ return; } - if ((//display.drawMode == CameraPane.SHADOW || - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) + if ((//display.DrawMode() == CameraPane.SHADOW || + display.DrawMode() == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) { return; } @@ -5333,15 +5406,15 @@ boolean compiled = false; - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; + boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION; - if (!selectmode && //display.drawMode != display.SELECTION && + if (!selectmode && //display.DrawMode() != display.SELECTION && (touched || (bRep != null && bRep.displaylist <= 0))) { - display.lighttouched = true; + Globals.lighttouched = true; } // all panes... - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW && - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW && + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && (touched || (bRep != null && bRep.displaylist <= 0))) { if (!(this instanceof Composite)) @@ -5372,7 +5445,7 @@ } //gl.glDrawBuffer(gl.GL_BACK); // XXX touched = false; - display.lighttouched = true; // all panes... + Globals.lighttouched = true; // all panes... } touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; @@ -5411,12 +5484,12 @@ // frustum culling if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid - && display.drawMode != CameraPane.SELECTION) + && display.DrawMode() != CameraPane.SELECTION) { - if (display.drawMode == CameraPane.SHADOW) + if (display.DrawMode() == CameraPane.SHADOW) { if (!link2master // tricky to cull in shadow mode. - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) + && GetBRep().FrustumCull(this, gl, display.LightCamera(), true)) { //System.out.print("CULLED"); culled = true; @@ -5424,7 +5497,7 @@ } else //GetBRep().getBounds(v0, v1, this); - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) + if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false)) culled = true; // LA.xformPos(v0, display.renderCamera.toScreen, v0); @@ -5460,7 +5533,7 @@ if (!culled) - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) + if (display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION) { if (GetBRep() != null) { @@ -5486,53 +5559,7 @@ color[2] /= 2; gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); */ - if (material != null) - { - materialstack[materialdepth] = material; - selectedstack[materialdepth] = selected; - cStatic.objectstack[materialdepth++] = this; - //System.out.println("material " + material); - //Applet3D.tracein(this, selected); - display.vector2buffer = projectedVertices; - if (this instanceof Camera) - { - display.options1[0] = material.shift; - //System.out.println("shift " + material.shift); - display.options1[1] = material.lightarea; - display.options1[2] = material.shadowbias; - display.options1[3] = material.aniso; - display.options1[4] = material.anisoV; - display.options2[0] = material.opacity; - display.options2[1] = material.diffuse; - display.options2[2] = material.factor; - - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); - display.options3[3] = material.cameralight/0.2f; - - // if (display.CURRENTANTIALIAS > 0) - // display.options3[3] /= 4; - - /* - System.out.println("Focus = " + display.options1[0]); - System.out.println("Aperture = " + display.options1[1]); - System.out.println("ShadowBlur = " + display.options1[2]); - System.out.println("Antialiasing = " + display.options1[3]); - System.out.println("Fog = " + display.options2[0]); - System.out.println("Intensity = " + display.options2[1]); - System.out.println("Elevation = " + display.options2[2]); - /**/ - } else - { - material.Draw(display, selected); - } - } else - { - if (selected && CameraPane.flash) - { - display.modelParams4[1] = 100; - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); - } - } + display.PushMaterial(this, selected); //System.out.println("call list " + list); //System.out.println(); @@ -5574,23 +5601,8 @@ } display.ReleaseTextures(tex); - - //if (parent != null && parent.GetMaterial() != null) - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); - if (material != null) - { - materialdepth -= 1; - if (materialdepth > 0) - { - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); - } - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); - } else if (selected && CameraPane.flash && GetMaterial() != null) - { - display.modelParams4[1] = GetMaterial().cameralight; - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); - } + + display.PopMaterial(this, selected); } if (this instanceof Texture || this instanceof TextureNode) @@ -5632,7 +5644,7 @@ // resetMasterNode(); } - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) { if (GetBRep() == null) { @@ -5715,7 +5727,7 @@ boolean flipV = false; // true; int texres = 0; // 0 = low, 1 = normal, 2 = high res texture - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) { if (hide) return; @@ -5774,16 +5786,7 @@ // // ??????????????????????????? Touch(); // } - if (material != null) - { - materialstack[materialdepth] = material; - selectedstack[materialdepth] = selected; - cStatic.objectstack[materialdepth++] = this; - //System.out.println("material " + material); - //Applet3D.tracein("selected ", selected); - display.vector2buffer = projectedVertices; - material.Draw(display, selected); - } +display.PushMaterial2(this, selected); Object3D child; boolean sel; @@ -5807,12 +5810,12 @@ if (!child.HasTransparency()) { sel = root != null && root.selection != null && root.selection.indexOf(child) != -1; - // GraphreeD.tracein("draw ", child); + // GrafreeD.tracein("draw ", child); boolean wasblocked = blockdraw; blockdraw = true; child.draw(display, root, selected || sel, wasblocked || blocked); // || child.IsSelected()); blockdraw = false; - // GraphreeD.traceout("draw ", child); + // GrafreeD.traceout("draw ", child); } release(i); @@ -5835,19 +5838,7 @@ */ //depth += 1; - if (material != null) - { - materialdepth -= 1; - if (materialdepth > 0) - { - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); - } - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); - //else - //material.Draw(display, false); - } - +display.PopMaterial2(this); /* display.ReleaseTextures(tex); */ @@ -5858,9 +5849,9 @@ //static cVector min,max; - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) { - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) return; // no shadow for transparent objects if (hide) @@ -5907,7 +5898,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(); @@ -5982,7 +5973,7 @@ { //throw new Error(); - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; + boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION; int[] strips = bRep.getRawIndices(); @@ -6226,7 +6217,7 @@ // // r.norm.dot(v3) > -0.5) // // continue; - drawFace(p, q, r, display, face); + display.DrawFace(this, p, q, r, face); } gl.glEnd(); } @@ -6270,7 +6261,7 @@ Vertex q = bRep.GetVertex(face.q); Vertex r = bRep.GetVertex(face.r); - drawFace(p, q, r, display, face); + display.DrawFace(this, p, q, r, face); } gl.glEnd(); } @@ -6410,180 +6401,6 @@ transient FaceCompare[] facescompare = null; - void SetColor(CameraPane display, Vertex p0) - { - if (display.RENDERPROGRAM == 0) - { - float r = 0; - if (bRep != null) - { - if (bRep.stripified) - { - r = 1; - } - } - float g = 0; - if (bRep != null) - { - if (bRep.trimmed) - { - g = 1; - } - } - float b = 0; - if (support != null && link2master) - { - b = 1; - } - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); - return; - } - - if (display.drawMode != CameraPane.SHADOW) - return; - - javax.media.opengl.GL gl = display.GetGL(); -// if (true) return; -// float ao = p.AO; -// -// // if (ao == 0 && !bRep.AOdone) // transient problem! -// // ao = 1; -// -// gl.glColor4f(ao, ao, ao, 1); - -// CameraPane.selectedpoint. -// getAverage(cStatic.point1, true); - if (CameraPane.pointflow == null) // !random) // live) - { - return; - } - - cStatic.point1.set(0,0,0); - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); - - cStatic.point1.sub(p0); - - -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? -// { -// return; -// } - - //if (true) - if (cStatic.point1.dot(cStatic.point1) > 0.000001) - { - return; - } - - float[] colorV = new float[3]; - - if (false) // marked) - { - // debug rigging weights - for (int object = 0; object < p0.vertexlinks.length; object++) - { - float weight = p0.weights[object] / p0.totalweight; - - // if (weight < 0.1) - // { - // assert(weight == 0); - // continue; - // } - - if (p0.vertexlinks[object] == -1) - continue; - - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); - - int color = //1 << object; // - //p.vertexlinks.length; - support.bRep.supports[p0.closestsupport].links[object]; - colorV[2] += (color & 1) * weight; - colorV[1] += ((color & 2) >> 1) * weight; - colorV[0] += ((color & 4) >> 2) * weight; - } - } - else - { - if (drawingstarted) - { - // find next point - if (bRep.GetVertex(0).faceindices == null) - { - bRep.InitFaceIndices(); - } - - double ymin = p0.y; - - Vertex newp = p0; - - for (int fii = 0; fii < p0.faceindices.length; fii++) - { - int fi = p0.faceindices[fii]; - - if (fi == -1) - break; - - Face f = bRep.GetFace(fi); - - Vertex p = bRep.GetVertex(f.p); - Vertex q = bRep.GetVertex(f.q); - Vertex r = bRep.GetVertex(f.r); - - int swap = (int)(Math.random()*3); - -// for (int s=swap; --s>=0;) -// { -// Vertex t = p; -// p = q; -// q = r; -// r = t; -// } - if (ymin > p.y) - { - ymin = p.y; - newp = p; -// break; - } - if (ymin > q.y) - { - ymin = q.y; - newp = q; -// break; - } - if (ymin > r.y) - { - ymin = r.y; - newp = r; -// break; - } - } - - CameraPane.selectedpoint.toParent[3][0] = newp.x; - CameraPane.selectedpoint.toParent[3][1] = newp.y; - CameraPane.selectedpoint.toParent[3][2] = newp.z; - - drawingstarted = false; - - // return; - } - - if (false) // CameraPane.DRAW - { - p0.AO = colorV[0] = 2; - colorV[1] = 2; - colorV[2] = 2; - } - - CameraPane.pointflow.add(p0); - CameraPane.pointflow.Touch(); - } - -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); - } - void Print(Vertex v) { //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); @@ -6605,152 +6422,6 @@ gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); } - void drawFace(Vertex pv, Vertex qv, Vertex rv, - CameraPane display, Face face) - { - if (pv.y == -10000 || - qv.y == -10000 || - rv.y == -10000) - return; - -// float b = f.nbiterations & 1; -// float g = (f.nbiterations>>1) & 1; -// float r = (f.nbiterations>>2) & 1; -// -// //if (f.weight == 10000) -// //{ -// // r = 1; g = b = 0; -// //} -// //else -// //{ -// // assert(f.weight < 10000); -// r = g = b = (float)bRep.FaceWeight(f)*100; -// if (r<0) -// assert(r>=0); -// //} - - javax.media.opengl.GL gl = display.GetGL(); - - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; - - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) - { - //gl.glBegin(gl.GL_TRIANGLES); - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); - if (!hasnorm) - { - // System.out.println("FUCK!!"); - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); - LA.vecCross(v0, v1, v2); - LA.vecNormalize(v2); - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.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); - } - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); - SetColor(display, pv); - //gl.glColor4f(r, g, b, 1); - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); - if (flipV) - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); - 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); -// 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); - } - //System.out.println("vertexq = " + qv.s + ", " + qv.t); - // boolean locked = false; - // float eps = 0.1f; - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice - - // int dot = 0; //*/ (int)f.dot; - - // if ((dot&1) == 0) - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; - - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) - if (flipV) - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); - else - gl.glTexCoord2f((float) qv.s, (float) qv.t); - // else - // { - // locked = true; - // gl.glTexCoord2f((float) pv.s, (float) pv.t); - // } - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); - SetColor(display, qv); - //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); - 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); - } - - // if ((dot&4) == 0) - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; - - // if (wrap || !locked && (dot&8) != 0) - if (flipV) - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); - else - gl.glTexCoord2f((float) rv.s, (float) rv.t); - // else - // gl.glTexCoord2f((float) pv.s, (float) pv.t); - - // f.dot = dot; - - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); - SetColor(display, rv); - //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); -// Print(rv); - //gl.glEnd(); - } - else - { - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); - - } - - if (false) // (attributes & WIREFRAME) != 0) - { - gl.glDisable(gl.GL_LIGHTING); - - gl.glBegin(gl.GL_LINE_LOOP); - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); - gl.glEnd(); - - gl.glEnable(gl.GL_LIGHTING); - } - } - void drawSelf(ClickInfo info, int level, boolean select) { if (bRep == null) @@ -7719,7 +7390,7 @@ if (parent == null) { System.out.println("NULL PARENT"); - new Exception().printStackTrace(); + //new Exception().printStackTrace(); } else { if (parent instanceof BezierPatch) @@ -7735,8 +7406,15 @@ info.pane.repaint(); } + boolean overflow = false; + void TransformToWorld(cVector out) // , cVector out) { + if (overflow) + return; + + overflow = true; + // june 2013 ??? assert (in == out); cVector in = out; if (toParent != null && !(this instanceof Texture || this instanceof TextureNode)) @@ -7753,6 +7431,8 @@ { (parent!=null?parent:fileparent).TransformToWorld(out); //, out); } + + overflow = false; } void TransformToLocal(cVector out) //, cVector out) @@ -7995,19 +7675,22 @@ max = new cVector(); } - Object3D sourcenode = GetFileRoot(); - - if (!sourcenode.name.contains("rclab")) + if (false) // Can crawl!! { - getBounds(min, max, true); + Object3D sourcenode = GetFileRoot(); - if (min.y != Double.POSITIVE_INFINITY && min.y > 2) + if (sourcenode != null && !sourcenode.name.contains("rclab")) { -// sourcenode.getBounds(min, max, true); - sourcenode.getBounds(v0, v1, true); -// sourcenode.toParent = sourcenode.toParent; -// get(0).toParent = get(0).toParent; -// sourcenode.GlobalTransform(); + getBounds(min, max, true); + + if (min.y != Double.POSITIVE_INFINITY && min.y > 2) + { + // sourcenode.getBounds(min, max, true); + sourcenode.getBounds(v0, v1, true); + // sourcenode.toParent = sourcenode.toParent; + // get(0).toParent = get(0).toParent; + // sourcenode.GlobalTransform(); + } } } @@ -8016,7 +7699,8 @@ if (support != null) { assert(bRep != null); - GraphreeD.Assert(support.bRep == bRep.support); + if (!(support instanceof GenericJoint)) // support.bRep != null) + GrafreeD.Assert(support.bRep == bRep.support); } else { @@ -8099,6 +7783,8 @@ { Object3D targ = this; + targ.NORMALPUSH = obj.NORMALPUSH; + if (obj.material != null) { if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) -- Gitblit v1.6.2