From d7bc8865056ea0d35df261e719f92e1422af7c6e Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 05 May 2019 09:00:26 -0400 Subject: [PATCH] Fix Windows issues. --- Object3D.java | 1120 +++++++++++++++++----------------------------------------- 1 files changed, 336 insertions(+), 784 deletions(-) diff --git a/Object3D.java b/Object3D.java index 1b4f39c..2b543d0 100644 --- a/Object3D.java +++ b/Object3D.java @@ -5,6 +5,7 @@ import java.util.Vector; import javax.media.j3d.Transform3D; +import javax.media.opengl.GL; import javax.vecmath.Vector3d; import javax.imageio.ImageIO; @@ -20,6 +21,19 @@ static final long serialVersionUID = 5022536242724664900L; 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) { @@ -296,6 +310,8 @@ boolean speedup = false; boolean rewind = false; + float NORMALPUSH = 0; + Object3D support; Object3D GetObject() @@ -355,7 +371,7 @@ int MemorySize() { - if (memorysize == 0) + if (true) // memorysize == 0) { try { @@ -415,16 +431,16 @@ { Object3D copy = this; - Camera parentcam = CameraPane.theRenderer.manipCamera; + Camera parentcam = Globals.theRenderer.ManipCamera(); - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0]) + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0]) { - parentcam = CameraPane.theRenderer.cameras[1]; + parentcam = Globals.theRenderer.Cameras()[1]; } - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1]) + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1]) { - parentcam = CameraPane.theRenderer.cameras[0]; + parentcam = Globals.theRenderer.Cameras()[0]; } if (this == parentcam) @@ -432,7 +448,7 @@ //assert(this instanceof Camera); for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt); + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt()); } copy.marked ^= true; @@ -452,7 +468,7 @@ //assert(this instanceof Camera); for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt); + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt()); } copy.Touch(); // display list issue @@ -587,7 +603,7 @@ return; } - if (CameraPane.fromscript) + if (Globals.fromscript) { transformcount = 0; return; @@ -745,7 +761,7 @@ int GetTransformCount() { - // marde pour serialization de Texture + // patch pour serialization de Texture resetmaxcount(); resettransformcount(); resetstep(); @@ -779,9 +795,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 +954,7 @@ public Object clone() { - return GraphreeD.clone(this); + return GrafreeD.clone(this); } Object3D copyExpand() @@ -1446,7 +1465,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 +1729,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 +1742,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 +1784,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 +1793,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 +1844,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 +2149,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) { @@ -2278,6 +2300,7 @@ { if (newWindow) { + new Exception().printStackTrace(); System.exit(0); if (parent != null) { @@ -2732,6 +2755,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) @@ -2866,7 +2907,8 @@ { if (bRep != null) { - bRep.GenUV(); + bRep.GenUV(); //1); + //bRep.UnfoldUV(); Touch(); } } @@ -2876,6 +2918,15 @@ if (bRep != null) { bRep.GenerateNormals(crease); + Touch(); + } + } + + void GenNormalsMINE0() + { + if (bRep != null) + { + bRep.GenerateNormalsMINE(); Touch(); } } @@ -3153,7 +3204,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 +3728,7 @@ if (child == null) continue; - if (GraphreeD.RENDERME > 0) + if (GrafreeD.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -3717,7 +3768,7 @@ boolean getCentroid(cVector centroid, boolean xform) { - assert(false); +// for speaker assert(false); if (blockloop) return false; @@ -3828,7 +3879,7 @@ if (child == null) continue; - if (GraphreeD.RENDERME > 0) + if (GrafreeD.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -4023,7 +4074,7 @@ if (child == null) continue; - if (GraphreeD.RENDERME > 0) + if (GrafreeD.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -4111,7 +4162,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 +4171,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 +4582,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() @@ -4778,7 +4857,7 @@ return globalTransform; } - void PreprocessOcclusion(CameraPane cp) + void PreprocessOcclusion(iCameraPane cp) { /* if (AOdone) @@ -4925,7 +5004,8 @@ } else // if (editWindow != null) { - editWindow.cameraView.lighttouched = true; + //editWindow.cameraView.lighttouched = true; + Globals.lighttouched = true; } } @@ -5079,10 +5159,34 @@ // System.out.println("Fullname = " + fullname); - if (fullname.name.indexOf(":") == -1) - return fullname.name; + // Does not work on Windows due to C: +// if (fullname.name.indexOf(":") == -1) +// return fullname.name; +// +// return fullname.name.substring(0,fullname.name.indexOf(":")); - return fullname.name.substring(0,fullname.name.indexOf(":")); + String[] split = fullname.name.split(":"); + + if (split.length == 0) + { + return ""; + } + + if (split.length <= 2) + { + if (fullname.name.endsWith(":")) + { + // Windows + return fullname.name.substring(0, fullname.name.length()-1); + } + + return split[0]; + } + + // Windows + assert(split.length == 4); + + return split[0] + ":" + split[1]; } static String GetBump(cTexture fullname) @@ -5091,10 +5195,38 @@ return ""; // System.out.println("Fullname = " + fullname); - if (fullname.name.indexOf(":") == -1) - return ""; - - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); + // Does not work on Windows due to C: +// if (fullname.name.indexOf(":") == -1) +// return ""; +// +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); + String[] split = fullname.name.split(":"); + + if (split.length == 0) + { + return ""; + } + + if (split.length == 1) + { + return ""; + } + + if (split.length == 2) + { + if (fullname.name.endsWith(":")) + { + // Windows + return ""; + } + + return split[1]; + } + + // Windows + assert(split.length == 4); + + return split[2] + ":" + split[3]; } String GetPigmentTexture() @@ -5168,7 +5300,7 @@ System.out.print("; textures = " + textures); System.out.println("; usedtextures = " + usedtextures); - if (GetTextures() == null) + if (GetTextures() == null) // What is that?? GetTextures().name = ":"; String texname = tex; @@ -5237,25 +5369,22 @@ } } - 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); } + static boolean DEBUG_SELECTION = false; - 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 +5393,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 +5409,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,13 +5420,13 @@ return; } - if ((//display.drawMode == CameraPane.SHADOW || - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) + if ((//display.DrawMode() == CameraPane.SHADOW || + display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency()) { return; } - javax.media.opengl.GL gl = display.GetGL(); + //javax.media.opengl.GL gl = display.GetGL(); /* if (touched) @@ -5333,15 +5462,15 @@ boolean compiled = false; - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); - 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)) @@ -5349,7 +5478,7 @@ //if (displaylist == -1 && usecalllists) if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 { - bRep.displaylist = gl.glGenLists(1); + bRep.displaylist = display.GenList(); assert(bRep.displaylist != 0); // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); //System.out.println("\tgen list " + list); @@ -5361,18 +5490,20 @@ if (usecalllists) { // System.err.println("new list " + bRep.displaylist + " for " + this); - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); + display.NewList(bRep.displaylist); } + CallList(display, root, selected, blocked); + // compiled = true; if (usecalllists) { // System.err.println("end list " + bRep.displaylist + " for " + this); - gl.glEndList(); + display.EndList(); } //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 +5542,12 @@ // frustum culling if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid - && display.drawMode != CameraPane.SELECTION) + && display.DrawMode() != iCameraPane.SELECTION) { - if (display.drawMode == CameraPane.SHADOW) + if (display.DrawMode() == iCameraPane.SHADOW) { if (!link2master // tricky to cull in shadow mode. - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) { //System.out.print("CULLED"); culled = true; @@ -5424,7 +5555,7 @@ } else //GetBRep().getBounds(v0, v1, this); - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) culled = true; // LA.xformPos(v0, display.renderCamera.toScreen, v0); @@ -5460,11 +5591,11 @@ if (!culled) - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) + if (display.DrawMode() == display.SELECTION || display.IsDebugSelection()) { if (GetBRep() != null) { - CameraPane.NextIndex(this, gl); + display.NextIndex(); // vertex color conflict : gl.glCallList(list); DrawNode(display, root, selected); if (this instanceof BezierPatch) @@ -5486,53 +5617,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(); @@ -5567,30 +5652,15 @@ // System.err.println("glCallList: " + bRep.displaylist + " for " + this); assert(bRep.displaylist != 0); - gl.glCallList(bRep.displaylist); + display.CallList(bRep.displaylist); // june 2013 drawSelf(display, root, selected); } } } 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 +5702,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 +5785,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 +5844,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 +5868,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 +5896,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 +5907,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) @@ -5903,11 +5952,12 @@ return; } + //bRep.GenUV(1/material.diffuseness); // bRep.lock = true; - javax.media.opengl.GL gl = display.GetGL(); + //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(); @@ -5922,23 +5972,7 @@ bRep.getMinMax(min, max, 100); - gl.glBegin(gl.GL_LINES); - - gl.glVertex3d(min.x, min.y, min.z); - gl.glVertex3d(min.x, min.y, max.z); - gl.glVertex3d(min.x, min.y, min.z); - gl.glVertex3d(min.x, max.y, min.z); - gl.glVertex3d(min.x, min.y, min.z); - gl.glVertex3d(max.x, min.y, min.z); - - gl.glVertex3d(max.x, max.y, max.z); - gl.glVertex3d(min.x, max.y, max.z); - gl.glVertex3d(max.x, max.y, max.z); - gl.glVertex3d(max.x, min.y, max.z); - gl.glVertex3d(max.x, max.y, max.z); - gl.glVertex3d(max.x, max.y, min.z); - - gl.glEnd(); + display.DrawBox(min, max); return; } @@ -5982,7 +6016,7 @@ { //throw new Error(); - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); int[] strips = bRep.getRawIndices(); @@ -5992,178 +6026,14 @@ new Exception().printStackTrace(); return; } - - // TRIANGLE STRIP ARRAY - if (bRep.trimmed) - { - float[] v = bRep.getRawVertices(); - float[] n = bRep.getRawNormals(); - float[] c = bRep.getRawColors(); - float[] uv = bRep.getRawUVMap(); - - int count2 = 0; - int count3 = 0; - - if (n.length > 0) - { - for (int i = 0; i < strips.length; i++) - { - gl.glBegin(gl.GL_TRIANGLE_STRIP); - - /* - boolean locked = false; - float eps = 0.1f; - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice - - int dot = 0; - - 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) - gl.glTexCoord2f((float) qv.s, (float) qv.t); - else - { - locked = true; - gl.glTexCoord2f((float) pv.s, (float) pv.t); - } - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); - if (hasnorm) - { - //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) - gl.glTexCoord2f((float) rv.s, (float) rv.t); - else - gl.glTexCoord2f((float) pv.s, (float) pv.t); - - f.dot = dot; - */ - - if (!selectmode) - { - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) - { - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); - } else - { - gl.glNormal3f(0, 0, 1); - } - - if (c != null) - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); - { - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); - } - } - if (flipV) - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); - else - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); - - count2 += 2; - count3 += 3; - if (!selectmode) - { - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) - { - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); - } else - { - gl.glNormal3f(0, 0, 1); - } - if (c != null) - { - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); - } - } - if (flipV) - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); - else - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); - - count2 += 2; - count3 += 3; - for (int j = 0; j < strips[i] - 2; j++) - { - //gl.glTexCoord2d(...); - if (!selectmode) - { - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) - { - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); - } else - { - gl.glNormal3f(0, 0, 1); - } - if (c != null) - { - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); - } - } - - if (flipV) - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); - else - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); - count2 += 2; - count3 += 3; - } - - gl.glEnd(); - } - } - - assert count3 == v.length; - } - else // !trimmed - { - int count = 0; - for (int i = 0; i < strips.length; i++) - { - gl.glBegin(gl.GL_TRIANGLE_STRIP); - - Vertex p = bRep.GetVertex(bRep.indices[count++]); - Vertex q = bRep.GetVertex(bRep.indices[count++]); - - drawVertex(gl, p, selectmode); - drawVertex(gl, q, selectmode); - - for (int j = 0; j < strips[i] - 2; j++) - { - Vertex r = bRep.GetVertex(bRep.indices[count++]); - -// if (j%2 == 0) -// drawFace(p, q, r, display, null); -// else -// drawFace(p, r, q, display, null); - -// p = q; -// q = r; - drawVertex(gl, r, selectmode); - } - - gl.glEnd(); - } - } + + display.DrawGeometry(bRep, flipV, selectmode); } else // catch (Error e) { // TRIANGLE ARRAY if (IsOpaque()) // Static()) { - gl.glBegin(gl.GL_TRIANGLES); + display.StartTriangles(); int facecount = bRep.FaceCount(); for (int i = 0; i < facecount; i++) { @@ -6226,9 +6096,9 @@ // // r.norm.dot(v3) > -0.5) // // continue; - drawFace(p, q, r, display, face); + display.DrawFace(this, p, q, r, face); } - gl.glEnd(); + display.EndTriangles(); } else { @@ -6257,8 +6127,8 @@ //System.out.println("SORT"); java.util.Arrays.sort(facescompare); - - gl.glBegin(gl.GL_TRIANGLES); + + display.StartTriangles(); for (int i = 0; i < facecount; i++) { Face face = bRep.GetFace(facescompare[i].index); @@ -6270,13 +6140,14 @@ 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(); + display.EndTriangles(); } if (false) // live && support != null && support.bRep != null) // debug weights { + /* gl.glDisable(gl.GL_LIGHTING); float[] colorV = new float[3]; @@ -6355,6 +6226,7 @@ // gl.glEnd(); } } + */ } } @@ -6399,7 +6271,7 @@ center.add(r); center.mul(1.0/3); - center.sub(CameraPane.theRenderer.eyeCamera.location); + center.sub(Globals.theRenderer.EyeCamera().location); distance = center.dot(center); } @@ -6410,347 +6282,11 @@ 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 + ")"); } - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) - { - if (!selectmode) - { - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); - - if (flipV) - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); - else - gl.glTexCoord2f((float) pv.s, (float) pv.t); - } - - 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) @@ -7322,83 +6858,83 @@ int spotw = spot.x + spot.width; int spoth = spot.y + spot.height; info.g.fillRect(spot.x, spot.y, spot.width, spot.height); - if (CameraPane.Xmin > spot.x) - { - CameraPane.Xmin = spot.x; - } - if (CameraPane.Xmax < spotw) - { - CameraPane.Xmax = spotw; - } - if (CameraPane.Ymin > spot.y) - { - CameraPane.Ymin = spot.y; - } - if (CameraPane.Ymax < spoth) - { - CameraPane.Ymax = spoth; - } +// if (CameraPane.Xmin > spot.x) +// { +// CameraPane.Xmin = spot.x; +// } +// if (CameraPane.Xmax < spotw) +// { +// CameraPane.Xmax = spotw; +// } +// if (CameraPane.Ymin > spot.y) +// { +// CameraPane.Ymin = spot.y; +// } +// if (CameraPane.Ymax < spoth) +// { +// CameraPane.Ymax = spoth; +// } spot.translate(32, 32); spotw = spot.x + spot.width; spoth = spot.y + spot.height; info.g.setColor(Color.blue); info.g.fillRect(spot.x, spot.y, spot.width, spot.height); - if (CameraPane.Xmin > spot.x) - { - CameraPane.Xmin = spot.x; - } - if (CameraPane.Xmax < spotw) - { - CameraPane.Xmax = spotw; - } - if (CameraPane.Ymin > spot.y) - { - CameraPane.Ymin = spot.y; - } - if (CameraPane.Ymax < spoth) - { - CameraPane.Ymax = spoth; - } +// if (CameraPane.Xmin > spot.x) +// { +// CameraPane.Xmin = spot.x; +// } +// if (CameraPane.Xmax < spotw) +// { +// CameraPane.Xmax = spotw; +// } +// if (CameraPane.Ymin > spot.y) +// { +// CameraPane.Ymin = spot.y; +// } +// if (CameraPane.Ymax < spoth) +// { +// CameraPane.Ymax = spoth; +// } info.g.drawLine(spotw, spoth, spotw, spoth - 15); info.g.drawLine(spotw, spoth, spotw - 15, spoth); spot.translate(0, -32); info.g.setColor(Color.green); info.g.fillRect(spot.x, spot.y, spot.width, spot.height); - if (CameraPane.Xmin > spot.x) - { - CameraPane.Xmin = spot.x; - } - if (CameraPane.Xmax < spotw) - { - CameraPane.Xmax = spotw; - } - if (CameraPane.Ymin > spot.y) - { - CameraPane.Ymin = spot.y; - } - if (CameraPane.Ymax < spoth) - { - CameraPane.Ymax = spoth; - } +// if (CameraPane.Xmin > spot.x) +// { +// CameraPane.Xmin = spot.x; +// } +// if (CameraPane.Xmax < spotw) +// { +// CameraPane.Xmax = spotw; +// } +// if (CameraPane.Ymin > spot.y) +// { +// CameraPane.Ymin = spot.y; +// } +// if (CameraPane.Ymax < spoth) +// { +// CameraPane.Ymax = spoth; +// } info.g.drawArc(boundary.x, boundary.y, boundary.width, boundary.height, 0, 360); //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); - if (CameraPane.Xmin > boundary.x) - { - CameraPane.Xmin = boundary.x; - } - if (CameraPane.Xmax < boundary.x + boundary.width) - { - CameraPane.Xmax = boundary.x + boundary.width; - } - if (CameraPane.Ymin > boundary.y) - { - CameraPane.Ymin = boundary.y; - } - if (CameraPane.Ymax < boundary.y + boundary.height) - { - CameraPane.Ymax = boundary.y + boundary.height; - } +// if (CameraPane.Xmin > boundary.x) +// { +// CameraPane.Xmin = boundary.x; +// } +// if (CameraPane.Xmax < boundary.x + boundary.width) +// { +// CameraPane.Xmax = boundary.x + boundary.width; +// } +// if (CameraPane.Ymin > boundary.y) +// { +// CameraPane.Ymin = boundary.y; +// } +// if (CameraPane.Ymax < boundary.y + boundary.height) +// { +// CameraPane.Ymax = boundary.y + boundary.height; +// } return; } } @@ -7501,7 +7037,7 @@ case hitCenter: // Translate - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); if (modified) { @@ -7549,10 +7085,10 @@ } LA.xformDir(up, ClickInfo.matbuffer, up); // if (!CameraPane.LOCALTRANSFORM) - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); // if (!CameraPane.LOCALTRANSFORM) - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); //LA.vecCross(up, cVector.Z, right2); cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); @@ -7610,7 +7146,7 @@ } /**/ - switch (info.pane.renderCamera.viewCode) + switch (info.pane.RenderCamera().viewCode) { case 1: // '\001' LA.matZRotate(toParent, angle); @@ -7666,7 +7202,7 @@ } /**/ - switch (info.pane.renderCamera.viewCode) + switch (info.pane.RenderCamera().viewCode) { case 3: // '\001' if (modified) @@ -7719,7 +7255,7 @@ if (parent == null) { System.out.println("NULL PARENT"); - new Exception().printStackTrace(); + //new Exception().printStackTrace(); } else { if (parent instanceof BezierPatch) @@ -7735,8 +7271,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 +7296,8 @@ { (parent!=null?parent:fileparent).TransformToWorld(out); //, out); } + + overflow = false; } void TransformToLocal(cVector out) //, cVector out) @@ -7885,6 +7430,7 @@ objectUI.closeUI(); if (editWindow != null) { + editWindow.ctrlPanel.FlushUI(); editWindow.refreshContents(); } // ? new objectUI = null; @@ -7995,19 +7541,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 +7565,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 +7649,8 @@ { Object3D targ = this; + targ.NORMALPUSH = obj.NORMALPUSH; + if (obj.material != null) { if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) -- Gitblit v1.6.2