Attribute.java
.. .. @@ -45,13 +45,13 @@ 45 45 editWindow = objectUI.GetEditor(); 46 46 } 47 47 48 - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)48 + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)49 49 { 50 50 if (hide) 51 51 return; 52 52 53 53 // super.draw(display, root, selected); 54 - if (display.ambientOcclusion)54 + if (display.IsAmbientOcclusionOn())55 55 return; 56 56 57 57 if (cleardepth) .. .. @@ -64,7 +64,7 @@ 64 64 if (backfacecull) 65 65 display.BackFaceCull(true); 66 66 else 67 - display.BackFaceCull(display.CULLFACE);67 + display.BackFaceCull(display.BackFaceCullMode());68 68 } 69 69 70 70 boolean cleardepth; BezierPatch.java
.. .. @@ -60,7 +60,7 @@ 60 60 } 61 61 62 62 /**/ 63 - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)63 + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)64 64 { 65 65 //recalculate(); 66 66 //System.out.println(); BezierSurface.java
.. .. @@ -67,7 +67,7 @@ 67 67 return l; 68 68 } 69 69 70 - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)70 + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)71 71 { 72 72 // ((BezierSurface)parent.parent).currentHandle = (Sphere)this; 73 73 // parent.parent.recalculate(); BillboardNode.java
.. .. @@ -21,9 +21,9 @@ 21 21 22 22 cVector pos = new cVector(); 23 23 24 - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)24 + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)25 25 { 26 - cVector eye = display.eyeCamera.location;26 + cVector eye = display.EyeCamera().location;27 27 28 28 GlobalTransformInv(); 29 29 Biparam.java
.. .. @@ -16,7 +16,7 @@ 16 16 CreateMaterial(); 17 17 } 18 18 19 - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)19 + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)20 20 { 21 21 //System.out.println("#vertices = " + bRep.VertexCount()); 22 22 if(false) BlobComponent.java
.. .. @@ -140,7 +140,7 @@ 140 140 info.g.drawArc(spot.x + 1, spot.y + 1, spot.width - 2, spot.height - 2, 0, 360); 141 141 } 142 142 143 - void draw(CameraPane display, boolean selected)143 + void draw(iCameraPane display, boolean selected)144 144 { 145 145 } 146 146 */ BoundaryRep.java
.. .. @@ -790,7 +790,7 @@ 790 790 v.weights[k] = other.ComputeWeight(v, toRoot, k); // (float)(supportsize * normalweight * nz / Math.pow(tx*tx+ty*ty+tz*tz, 1)); 791 791 v.totalweight += v.weights[k]; 792 792 793 - if (CameraPane.CROWD)793 + if (Globals.CROWD)794 794 { 795 795 // System.out.print("weight = " + v.weights[k]); 796 796 // System.out.println("; totalweight = " + v.totalweight); .. .. @@ -2668,11 +2668,11 @@ 2668 2668 tmp.set(v); 2669 2669 tmp.sub(eye); 2670 2670 2671 - if (CameraPane.framecount - lastsoundtime > 30) // 0.25 secs2671 + if (Globals.framecount - lastsoundtime > 30) // 0.25 secs2672 2672 { 2673 2673 GrafreeD.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1); 2674 2674 2675 - lastsoundtime = CameraPane.framecount;2675 + lastsoundtime = Globals.framecount;2676 2676 } 2677 2677 2678 2678 stepout = false; CameraPane.java
.. .. @@ -31,8 +31,12 @@ 31 31 32 32 import gleem.linalg.Mat4f; 33 33 34 -class CameraPane extends GLCanvas implements Runnable, GLEventListener, ActionListener, MouseWheelListener, MouseMotionListener, MouseListener, KeyListener34 +class CameraPane extends GLCanvas implements iCameraPane, Runnable, GLEventListener, ActionListener, MouseWheelListener, MouseMotionListener, MouseListener, KeyListener35 35 { 36 + static cMaterial[] materialstack = new cMaterial[65536];37 + static boolean[] selectedstack = new boolean[65536];38 + static int materialdepth = 0;39 +36 40 static boolean DEBUG = false; 37 41 static boolean FRUSTUM = false; // still bogus true; // frustum culling 38 42 .. .. @@ -42,25 +46,7 @@ 42 46 43 47 static int STEP = 1; 44 48 45 - static boolean ONESTEP = false; // do LIVE once46 -47 - /**48 - * @return the LIVE49 - */50 - public static boolean isLIVE()51 - {52 - return LIVE || ONESTEP;53 - }54 -55 - /**56 - * @param aLIVE the LIVE to set57 - */58 - public static void setLIVE(boolean aLIVE)59 - {60 - LIVE = aLIVE;61 - }62 -63 - /*static*/ boolean CULLFACE = false; // true;49 + /*static*/ private boolean CULLFACE = false; // true;64 50 /*static*/ boolean NEAREST = false; // true; 65 51 /*static*/ boolean WIREFRAME = false; // true; 66 52 .. .. @@ -97,10 +83,8 @@ 97 83 98 84 static boolean textureon = true; 99 85 static boolean LOCALTRANSFORM = false; 100 -private static boolean LIVE = false;101 86 static boolean FULLSCREEN = false; 102 87 static boolean SUPPORT = true; 103 -static boolean CROWD = false;104 88 static boolean INERTIA = true; 105 89 static boolean FAST = false; 106 90 static boolean SLOWPOSE = false; .. .. @@ -206,12 +190,14 @@ 206 190 return CURRENTANTIALIAS > 0; 207 191 } 208 192 209 - void ClearDepth()193 + /// INTERFACE194 +195 + public void ClearDepth()210 196 { 211 197 GetGL().glClear(GetGL().GL_DEPTH_BUFFER_BIT); 212 198 } 213 199 214 - void DepthTest(boolean depthtest)200 + public void DepthTest(boolean depthtest)215 201 { 216 202 if (depthtest) 217 203 GetGL().glDepthFunc(GL.GL_LEQUAL); .. .. @@ -219,7 +205,7 @@ 219 205 GetGL().glDepthFunc(GL.GL_ALWAYS); 220 206 } 221 207 222 - void DepthWrite(boolean depthwrite)208 + public void DepthWrite(boolean depthwrite)223 209 { 224 210 if (depthwrite) 225 211 GetGL().glDepthMask(true); .. .. @@ -227,12 +213,776 @@ 227 213 GetGL().glDepthMask(false); 228 214 } 229 215 230 - void BackFaceCull(boolean bfc)216 + public void BackFaceCull(boolean bfc)231 217 { 232 218 if (bfc) 233 219 GetGL().glEnable(GetGL().GL_CULL_FACE); 234 220 else 235 221 GetGL().glDisable(GetGL().GL_CULL_FACE); 222 + }223 +224 + public boolean BackFaceCullMode()225 + {226 + return this.CULLFACE;227 + }228 +229 + public boolean IsAmbientOcclusionOn()230 + {231 + return this.ambientOcclusion;232 + }233 +234 + public boolean IsFrozen()235 + {236 + boolean selectmode = this.DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION;237 +238 + return !selectmode && cameracount == 0; // != 0;239 + }240 +241 + // Currently in Globals242 + public int DrawMode()243 + {244 + return Globals.DrawMode();245 + }246 +247 + public Camera EyeCamera()248 + {249 + return eyeCamera;250 + }251 +252 + public Camera LightCamera()253 + {254 + return lightCamera;255 + }256 +257 + public Camera RenderCamera()258 + {259 + return renderCamera;260 + }261 +262 + public void PushMaterial(Object3D obj, boolean selected)263 + {264 + CameraPane display = this;265 + javax.media.opengl.GL gl = display.GetGL();266 + cMaterial material = obj.material;267 +268 + if (material != null)269 + {270 + materialstack[materialdepth] = material;271 + selectedstack[materialdepth] = selected;272 + cStatic.objectstack[materialdepth++] = obj;273 + //System.out.println("material " + material);274 + //Applet3D.tracein(this, selected);275 + display.vector2buffer = obj.projectedVertices;276 + if (obj instanceof Camera)277 + {278 + display.options1[0] = material.shift;279 + //System.out.println("shift " + material.shift);280 + display.options1[1] = material.lightarea;281 + display.options1[2] = material.shadowbias;282 + display.options1[3] = material.aniso;283 + display.options1[4] = material.anisoV;284 + display.options2[0] = material.opacity;285 + display.options2[1] = material.diffuse;286 + display.options2[2] = material.factor;287 +288 + cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);289 + display.options4[0] = material.cameralight/0.2f;290 + display.options4[1] = material.subsurface;291 + display.options4[2] = material.sheen;292 +293 + // if (display.CURRENTANTIALIAS > 0)294 + // display.options3[3] /= 4;295 +296 + /*297 + System.out.println("Focus = " + display.options1[0]);298 + System.out.println("Aperture = " + display.options1[1]);299 + System.out.println("ShadowBlur = " + display.options1[2]);300 + System.out.println("Antialiasing = " + display.options1[3]);301 + System.out.println("Fog = " + display.options2[0]);302 + System.out.println("Intensity = " + display.options2[1]);303 + System.out.println("Elevation = " + display.options2[2]);304 + /**/305 + } else306 + {307 + DrawMaterial(material, selected);308 + }309 + } else310 + {311 + if (selected && CameraPane.flash)312 + {313 + display.modelParams4[1] = 100;314 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);315 + }316 + }317 + }318 +319 + public void PushMaterial2(Object3D obj, boolean selected)320 + {321 + CameraPane display = this;322 + cMaterial material = obj.material;323 +324 + if (material != null)325 + {326 + materialstack[materialdepth] = material;327 + selectedstack[materialdepth] = selected;328 + cStatic.objectstack[materialdepth++] = obj;329 + //System.out.println("material " + material);330 + //Applet3D.tracein("selected ", selected);331 + display.vector2buffer = obj.projectedVertices;332 + display.DrawMaterial(material, selected);333 + }334 + }335 +336 + public void PopMaterial(Object3D obj, boolean selected)337 + {338 + CameraPane display = this;339 + javax.media.opengl.GL gl = display.GetGL();340 + cMaterial material = obj.material;341 +342 + //if (parent != null && parent.GetMaterial() != null)343 + // parent.GetMaterial().Draw(display, parent.IsSelected(this));344 + if (material != null)345 + {346 + materialdepth -= 1;347 + if (materialdepth > 0)348 + {349 + display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;350 + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);351 + }352 + //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");353 + } else if (selected && CameraPane.flash && obj.GetMaterial() != null)354 + {355 + display.modelParams4[1] = obj.GetMaterial().cameralight;356 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);357 + }358 + }359 +360 + public void PopMaterial2(Object3D obj)361 + {362 + CameraPane display = this;363 + cMaterial material = obj.material;364 +365 + if (material != null)366 + {367 + materialdepth -= 1;368 + if (materialdepth > 0)369 + {370 + display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;371 + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);372 + }373 + //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");374 + //else375 + //material.Draw(display, false);376 + }377 + }378 +379 + public void DrawFace(Object3D obj, Vertex pv, Vertex qv, Vertex rv, Face face)380 + {381 + CameraPane display = this;382 +383 + if (pv.y == -10000 ||384 + qv.y == -10000 ||385 + rv.y == -10000)386 + return;387 +388 +// float b = f.nbiterations & 1;389 +// float g = (f.nbiterations>>1) & 1;390 +// float r = (f.nbiterations>>2) & 1;391 +//392 +// //if (f.weight == 10000)393 +// //{394 +// // r = 1; g = b = 0;395 +// //}396 +// //else397 +// //{398 +// // assert(f.weight < 10000);399 +// r = g = b = (float)bRep.FaceWeight(f)*100;400 +// if (r<0)401 +// assert(r>=0);402 +// //}403 +404 + javax.media.opengl.GL gl = display.GetGL();405 +406 + boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;407 +408 + //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);409 + if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)410 + {411 + //gl.glBegin(gl.GL_TRIANGLES);412 + boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);413 + if (!hasnorm)414 + {415 + // System.out.println("FUCK!!");416 + LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0);417 + LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);418 + LA.vecCross(obj.v0, obj.v1, obj.v2);419 + LA.vecNormalize(obj.v2);420 + gl.glNormal3f((float) obj.v2.x, (float) obj.v2.y, (float) obj.v2.z);421 + }422 +423 + // P424 + float x = (float)pv.x;425 + float y = (float)pv.y;426 + float z = (float)pv.z;427 +428 + if (hasnorm)429 + {430 +// if (!pv.norm.normalized())431 +// assert(pv.norm.normalized());432 +433 + //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);434 + float nx = (float)pv.norm.x;435 + float ny = (float)pv.norm.y;436 + float nz = (float)pv.norm.z;437 +438 + x += nx * obj.NORMALPUSH;439 + y += ny * obj.NORMALPUSH;440 + z += nz * obj.NORMALPUSH;441 +442 + gl.glNormal3f(nx, ny, nz);443 + }444 + gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);445 + SetColor(obj, pv);446 + //gl.glColor4f(r, g, b, 1);447 + //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);448 + if (obj.flipV)449 + gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);450 + else451 + gl.glTexCoord2f((float) pv.s, (float) pv.t);452 + //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);453 +454 + gl.glVertex3f(x, y, z);455 +456 + // Q457 + x = (float)qv.x;458 + y = (float)qv.y;459 + z = (float)qv.z;460 +461 +// Print(pv);462 + if (hasnorm)463 + {464 +// assert(qv.norm.normalized());465 + //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);466 + float nx = (float)qv.norm.x;467 + float ny = (float)qv.norm.y;468 + float nz = (float)qv.norm.z;469 +470 + x += nx * obj.NORMALPUSH;471 + y += ny * obj.NORMALPUSH;472 + z += nz * obj.NORMALPUSH;473 +474 + gl.glNormal3f(nx, ny, nz);475 + }476 + //System.out.println("vertexq = " + qv.s + ", " + qv.t);477 + // boolean locked = false;478 + // float eps = 0.1f;479 + // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice480 +481 + // int dot = 0; //*/ (int)f.dot;482 +483 + // if ((dot&1) == 0)484 + // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;485 +486 + // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)487 + if (obj.flipV)488 + gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);489 + else490 + gl.glTexCoord2f((float) qv.s, (float) qv.t);491 + // else492 + // {493 + // locked = true;494 + // gl.glTexCoord2f((float) pv.s, (float) pv.t);495 + // }496 + gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);497 + SetColor(obj, qv);498 +499 + gl.glVertex3f(x, y, z);500 + //gl.glColor4f(r, g, b, 1);501 + //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);502 + //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);503 +// Print(qv);504 +505 + // R506 + x = (float)rv.x;507 + y = (float)rv.y;508 + z = (float)rv.z;509 +510 + if (hasnorm)511 + {512 +// assert(rv.norm.normalized());513 + //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);514 + float nx = (float)rv.norm.x;515 + float ny = (float)rv.norm.y;516 + float nz = (float)rv.norm.z;517 +518 + x += nx * obj.NORMALPUSH;519 + y += ny * obj.NORMALPUSH;520 + z += nz * obj.NORMALPUSH;521 +522 + gl.glNormal3f(nx, ny, nz);523 + }524 +525 + // if ((dot&4) == 0)526 + // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;527 +528 + // if (wrap || !locked && (dot&8) != 0)529 + if (obj.flipV)530 + gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);531 + else532 + gl.glTexCoord2f((float) rv.s, (float) rv.t);533 + // else534 + // gl.glTexCoord2f((float) pv.s, (float) pv.t);535 +536 + // f.dot = dot;537 +538 + gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);539 + SetColor(obj, rv);540 + //gl.glColor4f(r, g, b, 1);541 + //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);542 + //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);543 + gl.glVertex3f(x, y, z);544 +// Print(rv);545 + //gl.glEnd();546 + }547 + else548 + {549 + gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);550 + gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);551 + gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);552 +553 + }554 +555 + if (false) // (attributes & WIREFRAME) != 0)556 + {557 + gl.glDisable(gl.GL_LIGHTING);558 +559 + gl.glBegin(gl.GL_LINE_LOOP);560 + gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);561 + gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);562 + gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);563 + gl.glEnd();564 +565 + gl.glEnable(gl.GL_LIGHTING);566 + }567 + }568 +569 + /// INTERFACE570 +571 + void SetColor(Object3D obj, Vertex p0)572 + {573 + CameraPane display = this;574 + BoundaryRep bRep = obj.bRep;575 +576 + if (RENDERPROGRAM == 0)577 + {578 + float r = 0;579 + if (bRep != null)580 + {581 + if (bRep.stripified)582 + {583 + r = 1;584 + }585 + }586 + float g = 0;587 + if (bRep != null)588 + {589 + if (bRep.trimmed)590 + {591 + g = 1;592 + }593 + }594 + float b = 0;595 + if (obj.support != null && obj.link2master)596 + {597 + b = 1;598 + }599 + display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);600 + return;601 + }602 +603 + if (display.DrawMode() != CameraPane.SHADOW)604 + return;605 +606 + javax.media.opengl.GL gl = display.GetGL();607 +// if (true) return;608 +// float ao = p.AO;609 +//610 +// // if (ao == 0 && !bRep.AOdone) // transient problem!611 +// // ao = 1;612 +//613 +// gl.glColor4f(ao, ao, ao, 1);614 +615 +// CameraPane.selectedpoint.616 +// getAverage(cStatic.point1, true);617 + if (CameraPane.pointflow == null) // !random) // live)618 + {619 + return;620 + }621 +622 + cStatic.point1.set(0,0,0);623 + LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);624 +625 + cStatic.point1.sub(p0);626 +627 +628 +// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?629 +// {630 +// return;631 +// }632 +633 + //if (true)634 + if (cStatic.point1.dot(cStatic.point1) > 0.000001)635 + {636 + return;637 + }638 +639 + float[] colorV = new float[3];640 +641 + if (false) // marked)642 + {643 + // debug rigging weights644 + for (int object = 0; object < p0.vertexlinks.length; object++)645 + {646 + float weight = p0.weights[object] / p0.totalweight;647 +648 + // if (weight < 0.1)649 + // {650 + // assert(weight == 0);651 + // continue;652 + // }653 +654 + if (p0.vertexlinks[object] == -1)655 + continue;656 +657 + Vertex q = obj.support.bRep.GetVertex(p0.vertexlinks[object]);658 +659 + int color = //1 << object; //660 + //p.vertexlinks.length;661 + obj.support.bRep.supports[p0.closestsupport].links[object];662 + colorV[2] += (color & 1) * weight;663 + colorV[1] += ((color & 2) >> 1) * weight;664 + colorV[0] += ((color & 4) >> 2) * weight;665 + }666 + }667 + else668 + {669 + if (obj.drawingstarted)670 + {671 + // find next point672 + if (bRep.GetVertex(0).faceindices == null)673 + {674 + bRep.InitFaceIndices();675 + }676 +677 + double ymin = p0.y;678 +679 + Vertex newp = p0;680 +681 + for (int fii = 0; fii < p0.faceindices.length; fii++)682 + {683 + int fi = p0.faceindices[fii];684 +685 + if (fi == -1)686 + break;687 +688 + Face f = bRep.GetFace(fi);689 +690 + Vertex p = bRep.GetVertex(f.p);691 + Vertex q = bRep.GetVertex(f.q);692 + Vertex r = bRep.GetVertex(f.r);693 +694 + int swap = (int)(Math.random()*3);695 +696 +// for (int s=swap; --s>=0;)697 +// {698 +// Vertex t = p;699 +// p = q;700 +// q = r;701 +// r = t;702 +// }703 + if (ymin > p.y)704 + {705 + ymin = p.y;706 + newp = p;707 +// break;708 + }709 + if (ymin > q.y)710 + {711 + ymin = q.y;712 + newp = q;713 +// break;714 + }715 + if (ymin > r.y)716 + {717 + ymin = r.y;718 + newp = r;719 +// break;720 + }721 + }722 +723 + CameraPane.selectedpoint.toParent[3][0] = newp.x;724 + CameraPane.selectedpoint.toParent[3][1] = newp.y;725 + CameraPane.selectedpoint.toParent[3][2] = newp.z;726 +727 + obj.drawingstarted = false;728 +729 + // return;730 + }731 +732 + if (false) // CameraPane.DRAW733 + {734 + p0.AO = colorV[0] = 2;735 + colorV[1] = 2;736 + colorV[2] = 2;737 + }738 +739 + CameraPane.pointflow.add(p0);740 + CameraPane.pointflow.Touch();741 + }742 +743 +// gl.glColor3f(colorV[0], colorV[1], colorV[2]);744 +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);745 +// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);746 + }747 +748 + void DrawMaterial(cMaterial material, boolean selected)749 + {750 + CameraPane display = this;751 + //new Exception().printStackTrace();752 +753 + if (display.IsFrozen() && !selected || display.IsAmbientOcclusionOn()) // || display.drawMode == display.SHADOW)754 + {755 + return;756 + }757 +758 + javax.media.opengl.GL gl = display.GetGL();759 +760 + //Color col = Color.getHSBColor(color,modulation,1);761 + //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0);762 + if (!material.multiply)763 + {764 + display.color = color;765 + display.saturation = material.modulation;766 + }767 + else768 + {769 + display.color *= color*2;770 + display.saturation *= material.modulation*2;771 + }772 +773 + cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);774 +775 + float[] colorV = GrafreeD.colorV;776 +777 + /**/778 + if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)779 + {780 + colorV[0] = display.modelParams0[0] * material.diffuse;781 + colorV[1] = display.modelParams0[1] * material.diffuse;782 + colorV[2] = display.modelParams0[2] * material.diffuse;783 + colorV[3] = material.opacity;784 +785 + gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);786 + //System.out.println("Opacity = " + opacity);787 +788 + gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);789 + //color[0] /= 2; color[1] /= 2; color[2] /= 2;790 + gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);791 +792 + float amb = material.ambient;793 + if (amb < material.cameralight)794 + {795 + amb = material.cameralight;796 + }797 + colorV[0] = display.modelParams0[0] * material.diffuse * amb;798 + colorV[1] = display.modelParams0[1] * material.diffuse * amb;799 + colorV[2] = display.modelParams0[2] * material.diffuse * amb;800 + gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT, colorV, 0);801 + //color[0] /= 2; color[1] /= 2; color[2] /= 2;802 + gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT, colorV, 0);803 +804 + /**/805 + colorV[0] = ((1 - material.metalness) + display.modelParams0[0] * material.metalness) * material.specular;806 + colorV[1] = ((1 - material.metalness) + display.modelParams0[1] * material.metalness) * material.specular;807 + colorV[2] = ((1 - material.metalness) + display.modelParams0[2] * material.metalness) * material.specular;808 + gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR, colorV, 0);809 + //color[0] /= 2; color[1] /= 2; color[2] /= 2;810 + gl.glMaterialfv(gl.GL_BACK, gl.GL_SPECULAR, colorV, 0);811 + colorV[0] = 10 / material.shininess; // 1/0.005f;812 + //System.out.println("shininess = " + colorV[0]);813 + if (colorV[0] > 128)814 + {815 + colorV[0] = 128;816 + }817 + gl.glMaterialfv(gl.GL_FRONT, gl.GL_SHININESS, colorV, 0);818 + gl.glMaterialfv(gl.GL_BACK, gl.GL_SHININESS, colorV, 0);819 + /**/820 + }821 + /**/822 +823 + //selected = false;824 + selected = selected && display.flash;825 +826 + //display.modelParams0[0] = 0; // pigment.r;827 + //display.modelParams0[1] = 0; // pigment.g;828 + //display.modelParams0[2] = 0; // pigment.b;829 + if (!material.multiply)830 + {831 + display.modelParams0[3] = material.metalness;832 + display.modelParams1[0] = material.diffuse;833 + display.modelParams1[1] = material.specular;834 + display.modelParams1[2] = 1 / material.shininess;835 + display.modelParams1[3] = material.shift;836 + display.modelParams2[0] = material.ambient;837 + display.modelParams2[1] = material.lightarea;838 + //System.out.println("light area = " + lightarea);839 + display.modelParams2[2] = 1 / material.factor; // diffuseness840 + display.modelParams2[3] = material.velvet;841 + display.modelParams3[0] = material.sheen;842 + display.modelParams3[1] = material.subsurface;843 + display.modelParams3[2] = material.bump; // backlit844 + display.modelParams3[3] = material.aniso;845 + display.modelParams4[0] = material.anisoV;846 + display.modelParams4[1] = selected ? 100 : material.cameralight;847 + //System.out.println("selected = " + selected);848 + display.modelParams4[2] = material.diffuseness;849 + display.modelParams4[3] = material.shadow;850 + display.modelParams5[0] = material.texture;851 + display.modelParams5[1] = material.opacity;852 + display.modelParams5[2] = material.fakedepth;853 + display.modelParams5[3] = CameraPane.SHADOWCULLFACE ? 0f : (material.shadowbias - 0.005f) / 10;854 + }855 + else856 + {857 + display.modelParams0[3] *= material.metalness*2;858 + display.modelParams1[0] *= material.diffuse*2;859 + display.modelParams1[1] *= material.specular*2;860 + display.modelParams1[2] *= material.shininess*2;861 + display.modelParams1[3] *= material.shift*2;862 + display.modelParams2[0] *= material.ambient*2;863 + display.modelParams2[1] *= material.lightarea*2;864 + display.modelParams2[2] *= material.factor*2;865 + display.modelParams2[3] *= material.velvet*2;866 + display.modelParams3[0] *= material.sheen*2;867 + display.modelParams3[1] *= material.subsurface*2;868 + display.modelParams3[2] *= material.bump*2;869 + display.modelParams3[3] *= material.aniso*2;870 + display.modelParams4[0] *= material.anisoV*2;871 + display.modelParams4[1] *= material.cameralight*2;872 + //System.out.println("selected = " + selected);873 + display.modelParams4[2] *= material.diffuseness*2;874 + display.modelParams4[3] *= material.shadow*2;875 + display.modelParams5[0] *= material.texture*2;876 + display.modelParams5[1] *= material.opacity*2;877 + display.modelParams5[2] *= material.fakedepth*2;878 + display.modelParams5[3] *= material.shadowbias*2;879 + }880 +881 + display.modelParams6[0] = 0;882 + display.modelParams6[1] = 0;883 + display.modelParams6[2] = 0;884 + display.modelParams6[3] = 0;885 +886 + display.modelParams7[0] = 0;887 + display.modelParams7[1] = 1000;888 + display.modelParams7[2] = 0;889 + display.modelParams7[3] = 0;890 +891 + display.modelParams6[0] = 100; // criss de bug de bump892 +893 + Object3D.cVector2[] extparams = display.vector2buffer;894 + if (extparams != null && extparams.length > 0 && extparams[0] != null)895 + {896 + display.modelParams6[0] = extparams[0].x / 1000.0f; // bump897 + display.modelParams6[1] = extparams[0].y / 1000.0f; // noise898 + if (extparams.length > 1)899 + {900 + display.modelParams6[2] = extparams[1].x / 1000.0f; // borderfade901 + display.modelParams6[3] = extparams[1].y / 1000.0f; // (float)Math.exp(-extparams[1].y / 1000.0f); // fog punchthrough902 + if (extparams.length > 2)903 + {904 + display.modelParams7[0] = extparams[2].x / 1000.0f; // noise power905 + float x = extparams[2].y / 1000.0f;906 + //if (x == 0)907 + // x = 1f;908 + display.modelParams7[1] = 1 / x / x / x / x / x / x / x / x / x / x / x / x / x; // (float)Math.pow(-Math.log((extparams[2].y+0.00) / 1000.0f), 1); // opacity power909 + if (extparams[2].y > 0)910 + {911 + //System.out.println("extparams[1].y = " + extparams[1].y);912 + //System.out.println("extparams[2].y = " + extparams[2].y);913 + //System.out.println("opacity power = " + display.modelParams7[1]);914 + }915 + }916 + }917 + }918 +919 + //if (display.modelParams6[2] != 0)920 + /*921 + System.out.println("modelParams0[0] = " + display.modelParams0[0]);922 + System.out.println("modelParams0[1] = " + display.modelParams0[1]);923 + System.out.println("modelParams0[2] = " + display.modelParams0[2]);924 + System.out.println("modelParams0[3] = " + display.modelParams0[3]);925 + System.out.println("modelParams1[0] = " + display.modelParams1[0]);926 + System.out.println("modelParams1[1] = " + display.modelParams1[1]);927 + System.out.println("modelParams1[2] = " + display.modelParams1[2]);928 + System.out.println("modelParams1[3] = " + display.modelParams1[3]);929 + System.out.println("modelParams2[0] = " + display.modelParams2[0]);930 + System.out.println("modelParams2[1] = " + display.modelParams2[1]);931 + System.out.println("modelParams2[2] = " + display.modelParams2[2]);932 + System.out.println("modelParams2[3] = " + display.modelParams2[3]);933 + System.out.println("modelParams3[0] = " + display.modelParams3[0]);934 + System.out.println("modelParams3[1] = " + display.modelParams3[1]);935 + System.out.println("modelParams3[2] = " + display.modelParams3[2]);936 + System.out.println("modelParams3[3] = " + display.modelParams3[3]);937 + System.out.println("modelParams4[0] = " + display.modelParams4[0]);938 + System.out.println("modelParams4[1] = " + display.modelParams4[1]);939 + System.out.println("modelParams4[2] = " + display.modelParams4[2]);940 + System.out.println("modelParams4[3] = " + display.modelParams4[3]);941 + System.out.println("modelParams5[0] = " + display.modelParams5[0]);942 + System.out.println("modelParams5[1] = " + display.modelParams5[1]);943 + System.out.println("modelParams5[2] = " + display.modelParams5[2]);944 + System.out.println("modelParams5[3] = " + display.modelParams5[3]);945 + System.out.println("modelParams6[0] = " + display.modelParams6[0]);946 + System.out.println("modelParams6[1] = " + display.modelParams6[1]);947 + System.out.println("modelParams6[2] = " + display.modelParams6[2]);948 + System.out.println("modelParams6[3] = " + display.modelParams6[3]);949 + System.out.println("modelParams7[0] = " + display.modelParams7[0]);950 + System.out.println("modelParams7[1] = " + display.modelParams7[1]);951 + System.out.println("modelParams7[2] = " + display.modelParams7[2]);952 + System.out.println("modelParams7[3] = " + display.modelParams7[3]);953 + /**/954 + //assert (display.modelParams6[2] == 0);955 +956 + //System.out.println("noise power = " + display.modelParams7[0]);957 + //System.out.println("shadowbias = " + shadowbias);958 +959 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);960 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 1, display.modelParams1, 0);961 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 2, display.modelParams2, 0);962 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 3, display.modelParams3, 0);963 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);964 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);965 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 6, display.modelParams6, 0);966 + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 7, display.modelParams7, 0);967 +968 + int mode = display.FP_SHADER;969 +970 + if (material.aniso != material.anisoV || material.aniso > 0.002)971 + {972 + mode |= display.FP_ANISO;973 + }974 +975 + display.EnableProgram(mode);976 +977 + //System.out.println("opacity power = " + display.modelParams7[1]);978 +979 + if (!material.multiply)980 + {981 + if (Globals.drawMode == CameraPane.SHADOW)982 + gl.glDepthMask(material.opacity >= 0.9 && display.modelParams7[1] > 0.1);983 + else984 + gl.glDepthMask(material.opacity >= 0.99);985 + }236 986 } 237 987 238 988 int matrixdepth = 0; // 10000; // CONFLICT WITH cMESH... WARNING WARNING WARNING WARNING WARNING WARNING !!!!!!!!!!!! 0; .. .. @@ -253,7 +1003,7 @@ 253 1003 currentGL.glMultMatrixd(model, 0); 254 1004 } 255 1005 256 - void PushMatrix(double[][] matrix, int count)1006 + public void PushMatrix(double[][] matrix, int count) // INTERFACE257 1007 { 258 1008 matrixdepth++; 259 1009 // GrafreeD.tracein(matrix); .. .. @@ -298,7 +1048,7 @@ 298 1048 299 1049 double[][] tmpmat = new double[4][4]; 300 1050 301 - void PopMatrix(double[][] inverse)1051 + public void PopMatrix(double[][] inverse) // INTERFACE302 1052 { 303 1053 --matrixdepth; 304 1054 .. .. @@ -338,7 +1088,7 @@ 338 1088 PushTextureMatrix(matrix, 1); 339 1089 } 340 1090 341 - void PushTextureMatrix(double[][] matrix, int count)1091 + public void PushTextureMatrix(double[][] matrix, int count) // INTERFACE342 1092 { 343 1093 currentGL.glActiveTexture(GetGL().GL_TEXTURE0); 344 1094 .. .. @@ -352,7 +1102,7 @@ 352 1102 currentGL.glMatrixMode(GetGL().GL_MODELVIEW); 353 1103 } 354 1104 355 - void PopTextureMatrix(double[][] inverse)1105 + public void PopTextureMatrix(double[][] inverse) // INTERFACE356 1106 { 357 1107 currentGL.glActiveTexture(GetGL().GL_TEXTURE0); 358 1108 currentGL.glMatrixMode(GetGL().GL_TEXTURE); .. .. @@ -384,10 +1134,10 @@ 384 1134 // may 2014 if (cam == cameras[0] || cam == cameras[1]) 385 1135 // return false; 386 1136 387 - if (REFUSEMODE && isLIVE() && camerachangeframe != 0 && camerachangeframe != framecount)1137 + if (REFUSEMODE && Globals.isLIVE() && camerachangeframe != 0 && camerachangeframe != Globals.framecount)388 1138 { 389 1139 // check for last change 390 - if (framecount < camerachangeframe + 400) // 120 == 1 second1140 + if (Globals.framecount < camerachangeframe + 400) // 120 == 1 second391 1141 { 392 1142 // refuse the camera change 393 1143 System.err.println("Camera " + cam + " REFUSED"); .. .. @@ -395,7 +1145,7 @@ 395 1145 } 396 1146 } 397 1147 398 - camerachangeframe = framecount;1148 + camerachangeframe = Globals.framecount;399 1149 400 1150 cam.hAspect = -1; // Read only 401 1151 .. .. @@ -426,7 +1176,7 @@ 426 1176 { 427 1177 //System.err.println("Oeil on"); 428 1178 TRACK = true; 429 -// JUNE 2014 if (TRACK && trackedobject != null && drawMode == SHADOW) // && !lightMode)1179 +// JUNE 2014 if (TRACK && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)430 1180 // object.editWindow.ScreenFit(trackedobject); 431 1181 //pingthread.StepToTarget(true); 432 1182 } .. .. @@ -435,7 +1185,7 @@ 435 1185 { 436 1186 //System.err.println("Oeil on"); 437 1187 OEIL = true; 438 - if ((TRACK || SHADOWTRACK) && trackedobject != null && drawMode == SHADOW) // && !lightMode)1188 + if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)439 1189 object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); 440 1190 //pingthread.StepToTarget(true); 441 1191 } .. .. @@ -499,7 +1249,7 @@ 499 1249 { 500 1250 frozen ^= true; 501 1251 // Weird... 502 - lighttouched = true;1252 + Globals.lighttouched = true;503 1253 } 504 1254 505 1255 void ToggleDL() .. .. @@ -514,11 +1264,11 @@ 514 1264 515 1265 void ToggleLive() 516 1266 { 517 - setLIVE(isLIVE() ^ true);1267 + Globals.setLIVE(Globals.isLIVE() ^ true);518 1268 519 - System.err.println("LIVE = " + isLIVE());1269 + System.err.println("LIVE = " + Globals.isLIVE());520 1270 521 - if (!isLIVE()) // save sound1271 + if (!Globals.isLIVE()) // save sound522 1272 GrafreeD.savesound = true; // wav.save(); 523 1273 // else 524 1274 repaint(); // start loop // may 2013 .. .. @@ -541,7 +1291,7 @@ 541 1291 542 1292 void ToggleCrowd() 543 1293 { 544 - CROWD ^= true;1294 + Globals.CROWD ^= true;545 1295 } 546 1296 547 1297 void ToggleInertia() .. .. @@ -759,7 +1509,7 @@ 759 1509 760 1510 GL currentGL; 761 1511 762 - GL GetGL()1512 + public GL GetGL() // INTERFACE763 1513 { 764 1514 return currentGL; 765 1515 } .. .. @@ -6271,7 +7021,7 @@ 6271 7021 return null; 6272 7022 } 6273 7023 6274 - void ReleaseTextures(cTexture tex)7024 + public void ReleaseTextures(cTexture tex) // INTERFACE6275 7025 { 6276 7026 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) 6277 7027 { .. .. @@ -6309,7 +7059,7 @@ 6309 7059 6310 7060 void ReleaseTexture(String tex, boolean bump) 6311 7061 { 6312 - if (// drawMode != 0 || /*tex == null ||*/7062 + if (// DrawMode() != 0 || /*tex == null ||*/6313 7063 ambientOcclusion ) // || !textureon) 6314 7064 { 6315 7065 return; .. .. @@ -6410,9 +7160,9 @@ 6410 7160 } 6411 7161 } 6412 7162 6413 - /*boolean*/ void BindTextures(cTexture tex, int resolution)7163 + /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE6414 7164 { 6415 - if (// drawMode != 0 || /*tex == null ||*/7165 + if (// DrawMode() != 0 || /*tex == null ||*/6416 7166 ambientOcclusion ) // || !textureon) 6417 7167 { 6418 7168 return; // false; .. .. @@ -7312,9 +8062,9 @@ 7312 8062 static boolean occlusionInitialized = false; 7313 8063 boolean selection = false; 7314 8064 boolean pointselection = false; 7315 - /*static*/ boolean lighttouched = true;8065 + ///*static*/ boolean lighttouched = true;7316 8066 boolean deselect; 7317 - boolean ambientOcclusion = false;8067 + private boolean ambientOcclusion = false;7318 8068 static boolean flash = false; 7319 8069 /*static*/ boolean wait = false; 7320 8070 boolean displaydone = false; // after repaint() calls .. .. @@ -7603,8 +8353,6 @@ 7603 8353 7604 8354 boolean restartframe = false; 7605 8355 7606 - static int framecount = 0; // general-purpose global count7607 -7608 8356 void displayAntiAliased(javax.media.opengl.GL gl) 7609 8357 { 7610 8358 //gl.glGetIntegerv(gl.GL_ACCUM_RED_BITS, viewport, 0); .. .. @@ -7635,7 +8383,7 @@ 7635 8383 gl.glClear(gl.GL_ACCUM_BUFFER_BIT); 7636 8384 for (jitter = 0; jitter < ACSIZE; jitter++) //, GrafreeD.wav.cursor += LIVE ? 735 : 0) 7637 8385 { 7638 - framecount++;8386 + Globals.framecount++;7639 8387 7640 8388 if (CameraPane.tickcount > 0) 7641 8389 CameraPane.tickcount--; .. .. @@ -7673,7 +8421,7 @@ 7673 8421 7674 8422 gl.glLightfv(gl.GL_LIGHT0, gl.GL_POSITION, pos, 0); 7675 8423 */ 7676 - lighttouched = true;8424 + Globals.lighttouched = true;7677 8425 //System.err.println(" shadowbuffer: " + jitter); 7678 8426 shadowbuffer.display(); 7679 8427 .. .. @@ -8620,13 +9368,6 @@ 8620 9368 } 8621 9369 } 8622 9370 8623 - boolean IsFrozen()8624 - {8625 - boolean selectmode = drawMode == SELECTION || CameraPane.DEBUG_SELECTION;8626 -8627 - return !selectmode && cameracount == 0; // != 0;8628 - }8629 -8630 9371 boolean niceon = false; 8631 9372 javax.swing.Timer AAtimer = new javax.swing.Timer(750, this); 8632 9373 boolean currentlydrawing = false; .. .. @@ -8644,8 +9385,8 @@ 8644 9385 } 8645 9386 // if (DEBUG_SELECTION) 8646 9387 // { 8647 -// if (drawMode != SELECTION)8648 -// drawMode = SELECTION;9388 +// if (DrawMode() != SELECTION)9389 +// DrawMode() = SELECTION;8649 9390 // } 8650 9391 8651 9392 if (!isRenderer) .. .. @@ -8701,9 +9442,9 @@ 8701 9442 8702 9443 //ANTIALIAS = 0; 8703 9444 8704 - if (drawMode == DEFAULT) // && CURRENTANTIALIAS > 0)9445 + if (DrawMode() == DEFAULT) // && CURRENTANTIALIAS > 0)8705 9446 { 8706 - if (niceon || isLIVE())9447 + if (niceon || Globals.isLIVE())8707 9448 { 8708 9449 //if(active == 0) 8709 9450 // antialiaser = null; .. .. @@ -8728,7 +9469,7 @@ 8728 9469 assert eyeCamera.shaper_zFar == 1E5f; // 500.0f; 8729 9470 */ 8730 9471 8731 - if (drawMode == DEFAULT)9472 + if (DrawMode() == DEFAULT)8732 9473 { 8733 9474 currentlydrawing = true; 8734 9475 } .. .. @@ -8759,12 +9500,12 @@ 8759 9500 8760 9501 // if(Applet3D.clipboard != null) 8761 9502 // System.out.println("Clipboard = " + Applet3D.clipboard); //.get(0).parent); 8762 -//drawMode = SELECTION;9503 +//DrawMode() = SELECTION;8763 9504 indexcount = 0; 8764 9505 8765 - if (drawMode == OCCLUSION)9506 + if (DrawMode() == OCCLUSION)8766 9507 { 8767 - drawMode = DEFAULT;9508 + Globals.drawMode = DEFAULT; // WARNING8768 9509 ambientOcclusion = true; 8769 9510 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); 8770 9511 Object3D theobject = object; .. .. @@ -8783,19 +9524,19 @@ 8783 9524 ambientOcclusion = false; 8784 9525 } 8785 9526 8786 - if (lighttouched && drawMode == DEFAULT && !lightMode) // && !FROZEN)9527 + if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN)8787 9528 { 8788 9529 //if (RENDERSHADOW) // ? 8789 9530 if (!IsFrozen()) 8790 9531 { 8791 9532 // dec 2012 8792 - if (!ambientOcclusion && !(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0))9533 + if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0))8793 9534 { 8794 - framecount++;9535 + Globals.framecount++;8795 9536 shadowbuffer.display(); 8796 9537 } 8797 9538 } 8798 - lighttouched = false; // ??9539 + Globals.lighttouched = false; // ??8799 9540 //drawing = true; 8800 9541 //lighttouched = true; 8801 9542 } .. .. @@ -8816,9 +9557,9 @@ 8816 9557 //eyeCamera.shaper_fovy = 1; 8817 9558 } 8818 9559 8819 - if ((RENDERPROGRAM != 0 || ambientOcclusion || spherical) && drawMode == DEFAULT) // SELECTION)9560 + if ((RENDERPROGRAM != 0 || ambientOcclusion || spherical) && DrawMode() == DEFAULT) // SELECTION)8820 9561 { 8821 - //System.out.println("drawMode = " + drawMode);9562 + //System.out.println("DrawMode() = " + DrawMode());8822 9563 vertexMode |= VP_PASS; 8823 9564 //vertexMode |= VP_PROJECTION; 8824 9565 if (!ambientOcclusion) .. .. @@ -8878,7 +9619,7 @@ 8878 9619 Camera cam = renderCamera; // lightMode?lightCamera:eyeCamera; 8879 9620 //Camera lightcam = new Camera(light0); 8880 9621 8881 - if (drawMode == SHADOW)9622 + if (DrawMode() == SHADOW)8882 9623 { 8883 9624 /* 8884 9625 gl.glMatrixMode(GL.GL_MODELVIEW); .. .. @@ -8968,7 +9709,7 @@ 8968 9709 gl.glClear(gl.GL_DEPTH_BUFFER_BIT); 8969 9710 } else 8970 9711 { 8971 - if (drawMode != DEFAULT)9712 + if (DrawMode() != DEFAULT)8972 9713 { 8973 9714 gl.glClearColor(1, 1, 1, 0); 8974 9715 } // 1); .. .. @@ -9033,7 +9774,7 @@ 9033 9774 9034 9775 fast &= !ambientOcclusion; 9035 9776 9036 - if (drawMode == DEFAULT)9777 + if (DrawMode() == DEFAULT)9037 9778 { 9038 9779 //gl.glEnable(gl.GL_ALPHA_TEST); 9039 9780 //gl.glActiveTexture(GL.GL_TEXTURE0); .. .. @@ -9231,7 +9972,7 @@ 9231 9972 gl.glMatrixMode(gl.GL_PROJECTION); 9232 9973 gl.glLoadIdentity(); 9233 9974 9234 - if (drawMode == SHADOW || cam == lightCamera) // || (vertexMode&VP_PROJECTION) != 0)9975 + if (DrawMode() == SHADOW || cam == lightCamera) // || (vertexMode&VP_PROJECTION) != 0)9235 9976 { 9236 9977 //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar); 9237 9978 double scale = lightCamera.SCALE / lightCamera.Distance(); .. .. @@ -9289,7 +10030,7 @@ 9289 10030 //gl.glPushMatrix(); 9290 10031 gl.glLoadIdentity(); 9291 10032 9292 - if (!ambientOcclusion) // drawMode != OCCLUSION)10033 + if (!ambientOcclusion) // DrawMode() != OCCLUSION)9293 10034 { 9294 10035 //LA.xformPos(light0, lightCamera.fromScreen, light); 9295 10036 LA.xformDir(dirlight, lightCamera.fromScreen, lightposition); .. .. @@ -9376,7 +10117,7 @@ 9376 10117 } 9377 10118 9378 10119 /**/ 9379 - if (true) // drawMode == SELECTION) // != DEFAULT)10120 + if (true) // DrawMode() == SELECTION) // != DEFAULT)9380 10121 gl.glDisable(gl.GL_LIGHTING); 9381 10122 else 9382 10123 gl.glEnable(gl.GL_LIGHTING); .. .. @@ -9394,7 +10135,7 @@ 9394 10135 9395 10136 lightslot = 64; 9396 10137 9397 - if (!frozen && !ambientOcclusion && isRenderer && drawMode == DEFAULT)10138 + if (!frozen && !ambientOcclusion && isRenderer && DrawMode() == DEFAULT)9398 10139 { 9399 10140 DrawLights(object); 9400 10141 } .. .. @@ -9405,7 +10146,7 @@ 9405 10146 fragmentMode |= (lightslot - 64) << 2; // 1; // first bit is available for aniso 9406 10147 //System.out.println("fragmentMode = " + fragmentMode); 9407 10148 9408 - if (drawMode == DEFAULT || drawMode == SELECTION || DEBUG_SELECTION)10149 + if (DrawMode() == DEFAULT || DrawMode() == SELECTION || DEBUG_SELECTION)9409 10150 { 9410 10151 /* 9411 10152 if (CULLFACE || (ambientOcclusion && OCCLUSION_CULLING)) .. .. @@ -9438,7 +10179,7 @@ 9438 10179 } 9439 10180 } 9440 10181 9441 - if (drawMode == DEFAULT)10182 + if (DrawMode() == DEFAULT)9442 10183 { 9443 10184 if (WIREFRAME && !ambientOcclusion) 9444 10185 { .. .. @@ -9456,7 +10197,7 @@ 9456 10197 gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); 9457 10198 gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB); 9458 10199 9459 - if (!fast/*RENDERPROGRAM != 0*/ && (drawMode == DEFAULT || drawMode == SHADOW)) // && !WIREFRAME) //10200 + if (!fast/*RENDERPROGRAM != 0*/ && (DrawMode() == DEFAULT || DrawMode() == SHADOW)) // && !WIREFRAME) //9460 10201 { 9461 10202 if (vertexMode != 0) // && !fast) 9462 10203 { .. .. @@ -9476,7 +10217,7 @@ 9476 10217 } 9477 10218 } 9478 10219 9479 - if (false) // fast && !IsFreezed() && drawMode != SELECTION && !ambientOcclusion)10220 + if (false) // fast && !IsFreezed() && DrawMode() != SELECTION && !ambientOcclusion)9480 10221 { 9481 10222 //gl.glDepthFunc(GL.GL_LEQUAL); 9482 10223 //gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); .. .. @@ -9504,7 +10245,7 @@ 9504 10245 //gl.glDepthMask(false); 9505 10246 } 9506 10247 9507 - if (false) // drawMode == SHADOW)10248 + if (false) // DrawMode() == SHADOW)9508 10249 { 9509 10250 //SetColumnMajorData(cameraInverseTransform, view_1); 9510 10251 //System.out.println("light = " + cameraInverseTransform); .. .. @@ -9518,16 +10259,16 @@ 9518 10259 //System.out.println("object = " + object); 9519 10260 if (!frozen && !imageLocked) 9520 10261 { 9521 - if (!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0)10262 + if (!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)9522 10263 { 9523 10264 displayAntiAliased(gl); 9524 10265 } else 9525 10266 { 9526 10267 programcount = 0; 9527 - int keepmode = drawMode;10268 + int keepmode = DrawMode();9528 10269 // if (DEBUG_SELECTION) 9529 10270 // { 9530 -// drawMode = SELECTION;10271 +// DrawMode() = SELECTION;9531 10272 // } 9532 10273 // for point selection 9533 10274 // gl.glGetDoublev(gl.GL_MODELVIEW_MATRIX, tempmat, 0); .. .. @@ -9537,10 +10278,10 @@ 9537 10278 DrawObject(gl); 9538 10279 9539 10280 // jan 2013 System.err.println("RESET ABORT (display)"); 9540 - // if (drawMode == DEFAULT)10281 + // if (DrawMode() == DEFAULT)9541 10282 // ABORTED = false; 9542 10283 fullreset = false; 9543 - drawMode = keepmode;10284 + Globals.drawMode = keepmode; // WARNING9544 10285 //System.out.println("PROGRAM SWITCH " + programcount); 9545 10286 } 9546 10287 } .. .. @@ -9548,11 +10289,11 @@ 9548 10289 gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB); 9549 10290 gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); 9550 10291 9551 - if (drawMode == DEFAULT)10292 + if (DrawMode() == DEFAULT)9552 10293 { 9553 10294 ReleaseTexture(NOISE_TEXTURE, false); 9554 10295 } 9555 - //if (drawMode == DEFAULT)10296 + //if (DrawMode() == DEFAULT)9556 10297 { 9557 10298 9558 10299 gl.glActiveTexture(GL.GL_TEXTURE1); .. .. @@ -9564,7 +10305,7 @@ 9564 10305 //else 9565 10306 //gl.glDisable(gl.GL_TEXTURE_2D); 9566 10307 //gl.glPopMatrix(); 9567 - if (imageCompleted && ANTIALIAS > 0 && drawMode == DEFAULT && cam != lightCamera && !ambientOcclusion)10308 + if (imageCompleted && ANTIALIAS > 0 && DrawMode() == DEFAULT && cam != lightCamera && !ambientOcclusion)9568 10309 { 9569 10310 //new Exception().printStackTrace(); 9570 10311 //System.out.println("Draw image " + width + ", " + height); .. .. @@ -9606,7 +10347,7 @@ 9606 10347 //gl.glFlush(); 9607 10348 } 9608 10349 9609 - if (flash && drawMode == DEFAULT)10350 + if (flash && DrawMode() == DEFAULT)9610 10351 { 9611 10352 flash = false; 9612 10353 wait = true; .. .. @@ -9614,9 +10355,9 @@ 9614 10355 } 9615 10356 9616 10357 //drawing = false; 9617 - //if(drawMode == DEFAULT)10358 + //if(DrawMode() == DEFAULT)9618 10359 // niceon = false; 9619 - if (drawMode == DEFAULT)10360 + if (DrawMode() == DEFAULT)9620 10361 { 9621 10362 currentlydrawing = false; 9622 10363 } .. .. @@ -9636,7 +10377,7 @@ 9636 10377 repaint(); 9637 10378 } 9638 10379 9639 - if (isLIVE() && drawMode == DEFAULT) // may 201310380 + if (Globals.isLIVE() && DrawMode() == DEFAULT) // may 20139640 10381 repaint(); 9641 10382 9642 10383 displaydone = true; .. .. @@ -9673,7 +10414,7 @@ 9673 10414 if (GrafreeD.RENDERME > 0) 9674 10415 GrafreeD.RENDERME--; // mechante magouille 9675 10416 9676 - ONESTEP = false;10417 + Globals.ONESTEP = false;9677 10418 } 9678 10419 9679 10420 static boolean zoomonce = false; .. .. @@ -9681,11 +10422,11 @@ 9681 10422 void DrawObject(GL gl, boolean draw) 9682 10423 { 9683 10424 //System.out.println("DRAW OBJECT " + mouseDown); 9684 -// drawMode = SELECTION;10425 +// DrawMode() = SELECTION;9685 10426 //GL gl = getGL(); 9686 10427 if ((TRACK || SHADOWTRACK) || zoomonce) 9687 10428 { 9688 - if ((TRACK || SHADOWTRACK) && trackedobject != null && drawMode == SHADOW) // && !lightMode)10429 + if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)9689 10430 object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); 9690 10431 pingthread.StepToTarget(true); // true); 9691 10432 // zoomonce = false; .. .. @@ -9706,9 +10447,9 @@ 9706 10447 callist = gl.glGenLists(1); 9707 10448 } 9708 10449 9709 - boolean selectmode = drawMode == SELECTION || CameraPane.DEBUG_SELECTION;10450 + boolean selectmode = DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION;9710 10451 9711 - boolean active = !selectmode; // drawMode != SELECTION; // mouseDown;10452 + boolean active = !selectmode; // DrawMode() != SELECTION; // mouseDown;9712 10453 9713 10454 if (!mainDL || !active || touched) 9714 10455 { .. .. @@ -9735,7 +10476,7 @@ 9735 10476 PushMatrix(ClickInfo.matbuffer); 9736 10477 } 9737 10478 9738 - if (drawMode == 0)10479 + if (DrawMode() == 0)9739 10480 { 9740 10481 // System.out.println("CLEAR +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++"); 9741 10482 .. .. @@ -9749,7 +10490,7 @@ 9749 10490 // DRAW 9750 10491 object.draw(this, /*(Composite)*/ object, false, false); 9751 10492 9752 - if (drawMode == DEFAULT)10493 + if (DrawMode() == DEFAULT)9753 10494 { 9754 10495 if (DEBUG) 9755 10496 { .. .. @@ -9801,7 +10542,7 @@ 9801 10542 } 9802 10543 // GrafreeD.traceoff(); 9803 10544 //System.out.println(stackdepth); 9804 - if (drawMode == 0)10545 + if (DrawMode() == 0)9805 10546 { 9806 10547 ReleaseTextures(DEFAULT_TEXTURES); 9807 10548 .. .. @@ -9826,10 +10567,10 @@ 9826 10567 9827 10568 checker = null; 9828 10569 9829 - if (!ambientOcclusion && !IsFrozen() && drawMode == DEFAULT)10570 + if (!ambientOcclusion && !IsFrozen() && DrawMode() == DEFAULT)9830 10571 FindChecker(object); 9831 10572 9832 - if (checker != null && drawMode == DEFAULT)10573 + if (checker != null && DrawMode() == DEFAULT)9833 10574 { 9834 10575 //BindTexture(IMMORTAL_TEXTURE); 9835 10576 BindTextures(checker.GetTextures(), checker.texres); .. .. @@ -9851,7 +10592,7 @@ 9851 10592 //gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB); 9852 10593 //gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); 9853 10594 9854 - if (DISPLAYTEXT && drawMode == DEFAULT)10595 + if (DISPLAYTEXT && DrawMode() == DEFAULT)9855 10596 { 9856 10597 // Draw it once, then use the raster 9857 10598 Balloon(gl, balloon.createGraphics()); .. .. @@ -9907,9 +10648,9 @@ 9907 10648 int[] xs = new int[3]; 9908 10649 int[] ys = new int[3]; 9909 10650 9910 - void DrawString(Object3D obj) // String string)10651 + public void DrawString(Object3D obj) // String string) // INTERFACE9911 10652 { 9912 - if (!DISPLAYTEXT || drawMode != DEFAULT)10653 + if (!DISPLAYTEXT || DrawMode() != DEFAULT)9913 10654 { 9914 10655 return; 9915 10656 } .. .. @@ -12068,7 +12809,7 @@ 12068 12809 // ObjEditor.tweenManager.update(1f / 60f); 12069 12810 12070 12811 // fev 2014??? 12071 - if ((TRACK || SHADOWTRACK) && trackedobject != null) // && drawMode == SHADOW) // && !lightMode)12812 + if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)12072 12813 object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); 12073 12814 pingthread.StepToTarget(true); // true); 12074 12815 } .. .. @@ -12319,7 +13060,7 @@ 12319 13060 //System.out.println("---------------- ---------- Paint " + tmp.length2()); 12320 13061 if (lightMode) 12321 13062 { 12322 - lighttouched = true;13063 + Globals.lighttouched = true;12323 13064 } 12324 13065 12325 13066 if (OEILONCE && OEIL) .. .. @@ -12377,7 +13118,7 @@ 12377 13118 mouseDown = false; 12378 13119 if (lightMode) 12379 13120 { 12380 - lighttouched = true;13121 + Globals.lighttouched = true;12381 13122 } 12382 13123 repaint(); 12383 13124 alreadypainted = true; .. .. @@ -12385,7 +13126,7 @@ 12385 13126 isMoving = false; 12386 13127 } //?? 12387 13128 12388 - if (isLIVE() && !alreadypainted)13129 + if (Globals.isLIVE() && !alreadypainted)12389 13130 { 12390 13131 // FOR DEBUG BREAKPOINT USING PAUSE: while (true) 12391 13132 repaint(); .. .. @@ -12397,7 +13138,7 @@ 12397 13138 { 12398 13139 if (lightMode) 12399 13140 { 12400 - lighttouched = true;13141 + Globals.lighttouched = true;12401 13142 } 12402 13143 drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); 12403 13144 } .. .. @@ -12651,7 +13392,7 @@ 12651 13392 12652 13393 if (manipCamera == lightCamera) 12653 13394 { 12654 - lighttouched = true;13395 + Globals.lighttouched = true;12655 13396 } 12656 13397 /* 12657 13398 switch (mode) .. .. @@ -13039,7 +13780,7 @@ 13039 13780 case 'B': 13040 13781 BRISMOOTH ^= true; 13041 13782 SHADOWCULLFACE ^= true; 13042 - lighttouched = true;13783 + Globals.lighttouched = true;13043 13784 repaint(); 13044 13785 break; 13045 13786 case 'b': .. .. @@ -13139,7 +13880,7 @@ 13139 13880 repaint(); 13140 13881 break; 13141 13882 case 'O': 13142 - drawMode = OCCLUSION;13883 + Globals.drawMode = OCCLUSION; // WARNING13143 13884 repaint(); 13144 13885 break; 13145 13886 case 'o': .. .. @@ -13230,7 +13971,7 @@ 13230 13971 break; 13231 13972 case ' ': 13232 13973 lightMode ^= true; 13233 - lighttouched = true;13974 + Globals.lighttouched = true;13234 13975 manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; 13235 13976 targetLookAt.set(manipCamera.lookAt); 13236 13977 repaint(); .. .. @@ -13246,7 +13987,7 @@ 13246 13987 //break; 13247 13988 case 'z': 13248 13989 RENDERSHADOW ^= true; 13249 - lighttouched = true;13990 + Globals.lighttouched = true;13250 13991 repaint(); 13251 13992 break; 13252 13993 //case UP: .. .. @@ -13848,6 +14589,7 @@ 13848 14589 //if (g != gr) g.drawImage(img, 0, 0, width, height, null); 13849 14590 } 13850 14591 14592 + // To avoid clear.13851 14593 public void update(Graphics g) 13852 14594 { 13853 14595 paint(g); .. .. @@ -14510,20 +15252,21 @@ 14510 15252 /**/ 14511 15253 //checker.GetMaterial().opacity = 1.1f; 14512 15254 ////checker.GetMaterial().ambient = 0.99f; 14513 - Object3D.materialstack[Object3D.materialdepth] = checker.material;14514 - Object3D.selectedstack[Object3D.materialdepth] = false;14515 - cStatic.objectstack[Object3D.materialdepth++] = checker;15255 + materialstack[materialdepth] = checker.material;15256 + selectedstack[materialdepth] = false;15257 + cStatic.objectstack[materialdepth++] = checker;14516 15258 //System.out.println("material " + material); 14517 15259 //Applet3D.tracein(this, selected); 14518 15260 vector2buffer = checker.projectedVertices; 14519 15261 14520 - checker.GetMaterial().Draw(this, false); // true);15262 + //checker.GetMaterial().Draw(this, false); // true);15263 + DrawMaterial(checker.GetMaterial(), false); // true);14521 15264 14522 - Object3D.materialdepth -= 1;14523 - if (Object3D.materialdepth > 0)15265 + materialdepth -= 1;15266 + if (materialdepth > 0)14524 15267 { 14525 - vector2buffer = cStatic.objectstack[Object3D.materialdepth - 1].projectedVertices;14526 - Object3D.materialstack[Object3D.materialdepth - 1].Draw(this, Object3D.selectedstack[Object3D.materialdepth - 1]);15268 + vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;15269 + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);14527 15270 } 14528 15271 //checker.GetMaterial().opacity = 1f; 14529 15272 ////checker.GetMaterial().ambient = 1f; .. .. @@ -14689,14 +15432,14 @@ 14689 15432 14690 15433 //int tmp = selection_view; 14691 15434 //selection_view = -1; 14692 - int temp = drawMode;14693 - drawMode = SELECTION;15435 + int temp = DrawMode();15436 + Globals.drawMode = SELECTION; // WARNING14694 15437 indexcount = 0; 14695 15438 parent.display(drawable); 14696 15439 //selection_view = tmp; 14697 15440 //if (temp == SELECTION) 14698 15441 // temp = DEFAULT; // patch for selection debug 14699 - drawMode = temp;15442 + Globals.drawMode = temp; // WARNING14700 15443 14701 15444 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); 14702 15445 .. .. @@ -14969,14 +15712,14 @@ 14969 15712 //gl.glColorMask(false, false, false, false); 14970 15713 14971 15714 //render_scene_from_light_view(gl, drawable, 0, 0); 14972 - if (RENDERSHADOW && lighttouched && !movingcamera) // && !parent.IsFreezed())15715 + if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())14973 15716 { 14974 15717 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); 14975 15718 14976 - int temp = drawMode;14977 - drawMode = SHADOW;15719 + int temp = DrawMode();15720 + Globals.drawMode = SHADOW; // WARNING14978 15721 parent.display(drawable); 14979 - drawMode = temp;15722 + Globals.drawMode = temp; // WARNING14980 15723 } 14981 15724 14982 15725 gl.glCullFace(gl.GL_BACK); .. .. @@ -15374,12 +16117,6 @@ 15374 16117 GLUT glut = new GLUT(); 15375 16118 15376 16119 15377 - static final public int DEFAULT = 0;15378 - static final public int SELECTION = 1;15379 - static final public int SHADOW = 2;15380 - static final public int OCCLUSION = 3;15381 - static15382 - public int drawMode = DEFAULT;15383 16120 public boolean spherical = false; 15384 16121 static boolean DEBUG_OCCLUSION = false; 15385 16122 static boolean DEBUG_SELECTION = false; Composite.java
.. .. @@ -822,7 +822,7 @@ 822 822 823 823 } 824 824 825 - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)825 + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)826 826 { 827 827 if (this instanceof BezierPatch) 828 828 { .. .. @@ -837,7 +837,7 @@ 837 837 } 838 838 839 839 if ((//display.drawMode == CameraPane.SHADOW || 840 - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) &&840 + display.DrawMode() == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) &&841 841 //HasTransparency()) 842 842 // SERIAL PATCH 843 843 // if (viewCode == -1) .. .. @@ -855,7 +855,7 @@ 855 855 856 856 cTexture tex = null; 857 857 858 - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;858 + boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;859 859 860 860 if (//display.drawMode != display.SHADOW && 861 861 !selectmode // display.drawMode != display.SELECTION GenericJoint.java
.. .. @@ -339,7 +339,7 @@ 339 339 340 340 // assert(bRep != null); 341 341 342 - if (display.isLIVE() && live && display.drawMode == display.SHADOW) // FUCK342 + if (Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK343 343 { 344 344 // float ms = getDeltaTimeMicroseconds(); 345 345 // float minFPS = 1000000f / 60f; Globals.java
.. .. @@ -0,0 +1,26 @@ 1 +2 +public class Globals3 +{4 +static boolean CROWD = false;5 + static public int drawMode = iCameraPane.DEFAULT; // WARNING6 + static public boolean lighttouched = false; // WARNING7 +8 + static int framecount = 0; // general-purpose global count9 + private static boolean LIVE = false;10 + static boolean ONESTEP = false; // do LIVE once11 +12 + public static boolean isLIVE()13 + {14 + return LIVE || ONESTEP;15 + }16 +17 + public static void setLIVE(boolean aLIVE)18 + {19 + LIVE = aLIVE;20 + }21 +22 + public static int DrawMode()23 + {24 + return drawMode;25 + }26 +}GroupEditor.java
.. .. @@ -437,7 +437,7 @@ 437 437 oe.aConstraints.gridwidth = 1; 438 438 oe.aConstraints.gridx = 0; 439 439 440 - oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);440 + oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);441 441 liveCB.addItemListener(this); 442 442 443 443 oe.aConstraints.gridx += 1; .. .. @@ -449,7 +449,7 @@ 449 449 // localCB.addItemListener(this); 450 450 451 451 oe.aConstraints.gridx += 1; 452 - oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);452 + oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), oe.aConstraints);453 453 crowdCB.addItemListener(this); 454 454 455 455 oe.aConstraints.gridx += 1; .. .. @@ -1782,7 +1782,7 @@ 1782 1782 } else 1783 1783 if (event.getSource() == computeAOItem) 1784 1784 { 1785 - CameraPane.drawMode = CameraPane.OCCLUSION;1785 + Globals.drawMode = CameraPane.OCCLUSION;1786 1786 CameraPane.theRenderer.repaint(); 1787 1787 } else 1788 1788 if (event.getSource() == recompileItem) .. .. @@ -2920,7 +2920,8 @@ 2920 2920 cameraView.cameras[cameraView.cameracount] = radio.camera; 2921 2921 cameraView.targetLookAt.set(radio.camera.lookAt); 2922 2922 cameraView.object = group; 2923 - cameraView.lighttouched = true;2923 + //cameraView.lighttouched = true;2924 + Globals.lighttouched = true;2924 2925 topView.object = group; 2925 2926 frontView.object = group; 2926 2927 sideView.object = group; .. .. @@ -2956,7 +2957,7 @@ 2956 2957 if (useclient) 2957 2958 { 2958 2959 cameraView.object = client; 2959 - cameraView.lighttouched = true;2960 + Globals.lighttouched = true;2960 2961 //topView.object = client; 2961 2962 //frontView.object = client; 2962 2963 //sideView.object = client; .. .. @@ -2964,7 +2965,7 @@ 2964 2965 else 2965 2966 { 2966 2967 cameraView.object = group; 2967 - cameraView.lighttouched = true;2968 + Globals.lighttouched = true;2968 2969 //topView.object = group; 2969 2970 //frontView.object = group; 2970 2971 //sideView.object = group; .. .. @@ -4058,7 +4059,7 @@ 4058 4059 4059 4060 objEditor.SetText(); // jan 2014 4060 4061 4061 - if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))4062 + if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))4062 4063 CameraPane.flash = true; 4063 4064 4064 4065 if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera) Mocap.java
.. .. @@ -1564,7 +1564,7 @@ 1564 1564 //GraphreeD. 1565 1565 wav.play(volume * usedvolume); //, mywave); 1566 1566 1567 - lastsoundtime = CameraPane.framecount;1567 + lastsoundtime = Globals.framecount;1568 1568 1569 1569 GrafreeD.hassound = true; 1570 1570 } .. .. @@ -3289,7 +3289,7 @@ 3289 3289 "; fullname = " + fullname); 3290 3290 3291 3291 //int delta = frame - baseframe; 3292 - if (CameraPane.CROWD)3292 + if (Globals.CROWD)3293 3293 { 3294 3294 baseframe = GetFirstFrame(); // 0 initial point 3295 3295 } .. .. @@ -3871,7 +3871,7 @@ 3871 3871 // return; 3872 3872 3873 3873 if (!restarted && /*display.restartframe &&*/ 3874 - display.isLIVE() && live && display.drawMode == display.SHADOW) // FUCK3874 + Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK3875 3875 { 3876 3876 //display.restartframe = false; 3877 3877 restarted = true; .. .. @@ -3879,7 +3879,7 @@ 3879 3879 } 3880 3880 else 3881 3881 { 3882 - if (display.isLIVE() && live && display.drawMode != display.SHADOW)3882 + if (Globals.isLIVE() && live && display.DrawMode() != display.SHADOW)3883 3883 restarted = false; 3884 3884 } 3885 3885 MorphNode.java
.. .. @@ -59,7 +59,7 @@ 59 59 // bRep = (BoundaryRep) GrafreeD.clone(morphobject.get(0).bRep); 60 60 // } 61 61 62 - if (CameraPane.SUPPORT && display.drawMode == display.SHADOW)62 + if (CameraPane.SUPPORT && display.DrawMode() == display.SHADOW)63 63 { 64 64 for (int i=0; i<morphobject.Size(); i++) 65 65 { ObjEditor.java
.. .. @@ -311,7 +311,7 @@ 311 311 toggleTextureItem.setState(CameraPane.textureon); 312 312 cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); 313 313 toggleLiveItem.addItemListener(this); 314 - toggleLiveItem.setState(CameraPane.isLIVE());314 + toggleLiveItem.setState(Globals.isLIVE());315 315 cameraMenu.add(stepItem = new MenuItem("Step")); 316 316 stepItem.addActionListener(this); 317 317 // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); .. .. @@ -3139,7 +3139,8 @@ 3139 3139 objEditor.refreshContents(); 3140 3140 } else if (event.getSource() == stepItem) 3141 3141 { 3142 - cameraView.ONESTEP = true;3142 + //cameraView.ONESTEP = true;3143 + Globals.ONESTEP = true;3143 3144 cameraView.repaint(); 3144 3145 return; 3145 3146 } else if (event.getSource() == stepButton) Object3D.java
.. .. @@ -760,7 +760,7 @@ 760 760 761 761 int GetTransformCount() 762 762 { 763 - // marde pour serialization de Texture763 + // patch pour serialization de Texture764 764 resetmaxcount(); 765 765 resettransformcount(); 766 766 resetstep(); .. .. @@ -794,12 +794,12 @@ 794 794 // factor = CameraPane.STEP; 795 795 // } 796 796 797 - if (marked && CameraPane.isLIVE() && live &&797 + if (marked && Globals.isLIVE() && live &&798 798 //TEMP21aug2018 799 - CameraPane.drawMode == CameraPane.SHADOW &&800 - currentframe != CameraPane.framecount)799 + Globals.DrawMode() == iCameraPane.SHADOW &&800 + currentframe != Globals.framecount)801 801 { 802 - currentframe = CameraPane.framecount;802 + currentframe = Globals.framecount;803 803 804 804 // System.err.println("transformcount = " + transformcount); 805 805 // System.err.println("factor = " + factor); .. .. @@ -5001,7 +5001,8 @@ 5001 5001 } else // 5002 5002 if (editWindow != null) 5003 5003 { 5004 - editWindow.cameraView.lighttouched = true;5004 + //editWindow.cameraView.lighttouched = true;5005 + Globals.lighttouched = true;5005 5006 } 5006 5007 } 5007 5008 .. .. @@ -5313,25 +5314,21 @@ 5313 5314 } 5314 5315 } 5315 5316 5316 - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)5317 + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)5317 5318 { 5318 5319 Draw(display, root, selected, blocked); 5319 5320 } 5320 5321 5321 - static cMaterial[] materialstack = new cMaterial[65536];5322 - static boolean[] selectedstack = new boolean[65536];5323 - static int materialdepth = 0;5324 -5325 5322 boolean NeedSupport() 5326 5323 { 5327 5324 return 5328 5325 CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null 5329 5326 // PROBLEM with CROWD!! 5330 - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);5327 + && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);5331 5328 } 5332 5329 5333 5330 5334 - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)5331 + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)5335 5332 { 5336 5333 Invariants(); // june 2013 5337 5334 .. .. @@ -5340,7 +5337,7 @@ 5340 5337 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); 5341 5338 } 5342 5339 5343 - if (display.drawMode == CameraPane.SELECTION &&5340 + if (display.DrawMode() == iCameraPane.SELECTION &&5344 5341 hide) 5345 5342 return; 5346 5343 .. .. @@ -5359,7 +5356,7 @@ 5359 5356 if (this instanceof Checker) 5360 5357 return; 5361 5358 5362 - if (display.drawMode == display.SHADOW && PASSTEST)5359 + if (display.DrawMode() == display.SHADOW && PASSTEST)5363 5360 return; 5364 5361 5365 5362 if (count <= 0) .. .. @@ -5367,8 +5364,8 @@ 5367 5364 return; 5368 5365 } 5369 5366 5370 - if ((//display.drawMode == CameraPane.SHADOW ||5371 - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())5367 + if ((//display.DrawMode() == CameraPane.SHADOW ||5368 + display.DrawMode() == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())5372 5369 { 5373 5370 return; 5374 5371 } .. .. @@ -5409,15 +5406,15 @@ 5409 5406 5410 5407 boolean compiled = false; 5411 5408 5412 - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;5409 + boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;5413 5410 5414 - if (!selectmode && //display.drawMode != display.SELECTION &&5411 + if (!selectmode && //display.DrawMode() != display.SELECTION &&5415 5412 (touched || (bRep != null && bRep.displaylist <= 0))) 5416 5413 { 5417 - display.lighttouched = true;5414 + Globals.lighttouched = true;5418 5415 } // all panes... 5419 - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW &&5420 - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW &&5416 + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&5417 + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&5421 5418 (touched || (bRep != null && bRep.displaylist <= 0))) 5422 5419 { 5423 5420 if (!(this instanceof Composite)) .. .. @@ -5448,7 +5445,7 @@ 5448 5445 } 5449 5446 //gl.glDrawBuffer(gl.GL_BACK); 5450 5447 // XXX touched = false; 5451 - display.lighttouched = true; // all panes...5448 + Globals.lighttouched = true; // all panes...5452 5449 } 5453 5450 5454 5451 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; .. .. @@ -5487,12 +5484,12 @@ 5487 5484 5488 5485 // frustum culling 5489 5486 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid 5490 - && display.drawMode != CameraPane.SELECTION)5487 + && display.DrawMode() != CameraPane.SELECTION)5491 5488 { 5492 - if (display.drawMode == CameraPane.SHADOW)5489 + if (display.DrawMode() == CameraPane.SHADOW)5493 5490 { 5494 5491 if (!link2master // tricky to cull in shadow mode. 5495 - && GetBRep().FrustumCull(this, gl, display.lightCamera, true))5492 + && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))5496 5493 { 5497 5494 //System.out.print("CULLED"); 5498 5495 culled = true; .. .. @@ -5500,7 +5497,7 @@ 5500 5497 } 5501 5498 else 5502 5499 //GetBRep().getBounds(v0, v1, this); 5503 - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))5500 + if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))5504 5501 culled = true; 5505 5502 5506 5503 // LA.xformPos(v0, display.renderCamera.toScreen, v0); .. .. @@ -5536,7 +5533,7 @@ 5536 5533 5537 5534 5538 5535 if (!culled) 5539 - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)5536 + if (display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION)5540 5537 { 5541 5538 if (GetBRep() != null) 5542 5539 { .. .. @@ -5562,55 +5559,7 @@ 5562 5559 color[2] /= 2; 5563 5560 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); 5564 5561 */ 5565 - if (material != null)5566 - {5567 - materialstack[materialdepth] = material;5568 - selectedstack[materialdepth] = selected;5569 - cStatic.objectstack[materialdepth++] = this;5570 - //System.out.println("material " + material);5571 - //Applet3D.tracein(this, selected);5572 - display.vector2buffer = projectedVertices;5573 - if (this instanceof Camera)5574 - {5575 - display.options1[0] = material.shift;5576 - //System.out.println("shift " + material.shift);5577 - display.options1[1] = material.lightarea;5578 - display.options1[2] = material.shadowbias;5579 - display.options1[3] = material.aniso;5580 - display.options1[4] = material.anisoV;5581 - display.options2[0] = material.opacity;5582 - display.options2[1] = material.diffuse;5583 - display.options2[2] = material.factor;5584 -5585 - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);5586 - display.options4[0] = material.cameralight/0.2f;5587 - display.options4[1] = material.subsurface;5588 - display.options4[2] = material.sheen;5589 -5590 - // if (display.CURRENTANTIALIAS > 0)5591 - // display.options3[3] /= 4;5592 -5593 - /*5594 - System.out.println("Focus = " + display.options1[0]);5595 - System.out.println("Aperture = " + display.options1[1]);5596 - System.out.println("ShadowBlur = " + display.options1[2]);5597 - System.out.println("Antialiasing = " + display.options1[3]);5598 - System.out.println("Fog = " + display.options2[0]);5599 - System.out.println("Intensity = " + display.options2[1]);5600 - System.out.println("Elevation = " + display.options2[2]);5601 - /**/5602 - } else5603 - {5604 - material.Draw(display, selected);5605 - }5606 - } else5607 - {5608 - if (selected && CameraPane.flash)5609 - {5610 - display.modelParams4[1] = 100;5611 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);5612 - }5613 - }5562 + display.PushMaterial(this, selected);5614 5563 5615 5564 //System.out.println("call list " + list); 5616 5565 //System.out.println(); .. .. @@ -5652,23 +5601,8 @@ 5652 5601 } 5653 5602 5654 5603 display.ReleaseTextures(tex); 5655 -5656 - //if (parent != null && parent.GetMaterial() != null)5657 - // parent.GetMaterial().Draw(display, parent.IsSelected(this));5658 - if (material != null)5659 - {5660 - materialdepth -= 1;5661 - if (materialdepth > 0)5662 - {5663 - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;5664 - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);5665 - }5666 - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");5667 - } else if (selected && CameraPane.flash && GetMaterial() != null)5668 - {5669 - display.modelParams4[1] = GetMaterial().cameralight;5670 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);5671 - }5604 +5605 + display.PopMaterial(this, selected);5672 5606 } 5673 5607 5674 5608 if (this instanceof Texture || this instanceof TextureNode) .. .. @@ -5710,7 +5644,7 @@ 5710 5644 // resetMasterNode(); 5711 5645 } 5712 5646 5713 - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)5647 + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)5714 5648 { 5715 5649 if (GetBRep() == null) 5716 5650 { .. .. @@ -5793,7 +5727,7 @@ 5793 5727 boolean flipV = false; // true; 5794 5728 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture 5795 5729 5796 - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)5730 + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)5797 5731 { 5798 5732 if (hide) 5799 5733 return; .. .. @@ -5852,16 +5786,7 @@ 5852 5786 // // ??????????????????????????? Touch(); 5853 5787 // } 5854 5788 5855 - if (material != null)5856 - {5857 - materialstack[materialdepth] = material;5858 - selectedstack[materialdepth] = selected;5859 - cStatic.objectstack[materialdepth++] = this;5860 - //System.out.println("material " + material);5861 - //Applet3D.tracein("selected ", selected);5862 - display.vector2buffer = projectedVertices;5863 - material.Draw(display, selected);5864 - }5789 +display.PushMaterial2(this, selected);5865 5790 5866 5791 Object3D child; 5867 5792 boolean sel; .. .. @@ -5913,19 +5838,7 @@ 5913 5838 */ 5914 5839 //depth += 1; 5915 5840 5916 - if (material != null)5917 - {5918 - materialdepth -= 1;5919 - if (materialdepth > 0)5920 - {5921 - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;5922 - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);5923 - }5924 - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");5925 - //else5926 - //material.Draw(display, false);5927 - }5928 -5841 +display.PopMaterial2(this);5929 5842 /* 5930 5843 display.ReleaseTextures(tex); 5931 5844 */ .. .. @@ -5936,9 +5849,9 @@ 5936 5849 5937 5850 //static cVector min,max; 5938 5851 5939 - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)5852 + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)5940 5853 { 5941 - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)5854 + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)5942 5855 return; // no shadow for transparent objects 5943 5856 5944 5857 if (hide) .. .. @@ -6060,7 +5973,7 @@ 6060 5973 { 6061 5974 //throw new Error(); 6062 5975 6063 - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;5976 + boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;6064 5977 6065 5978 int[] strips = bRep.getRawIndices(); 6066 5979 .. .. @@ -6304,7 +6217,7 @@ 6304 6217 // // r.norm.dot(v3) > -0.5) 6305 6218 // // continue; 6306 6219 6307 - drawFace(p, q, r, display, face);6220 + display.DrawFace(this, p, q, r, face);6308 6221 } 6309 6222 gl.glEnd(); 6310 6223 } .. .. @@ -6348,7 +6261,7 @@ 6348 6261 Vertex q = bRep.GetVertex(face.q); 6349 6262 Vertex r = bRep.GetVertex(face.r); 6350 6263 6351 - drawFace(p, q, r, display, face);6264 + display.DrawFace(this, p, q, r, face);6352 6265 } 6353 6266 gl.glEnd(); 6354 6267 } .. .. @@ -6488,180 +6401,6 @@ 6488 6401 6489 6402 transient FaceCompare[] facescompare = null; 6490 6403 6491 - void SetColor(CameraPane display, Vertex p0)6492 - {6493 - if (display.RENDERPROGRAM == 0)6494 - {6495 - float r = 0;6496 - if (bRep != null)6497 - {6498 - if (bRep.stripified)6499 - {6500 - r = 1;6501 - }6502 - }6503 - float g = 0;6504 - if (bRep != null)6505 - {6506 - if (bRep.trimmed)6507 - {6508 - g = 1;6509 - }6510 - }6511 - float b = 0;6512 - if (support != null && link2master)6513 - {6514 - b = 1;6515 - }6516 - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);6517 - return;6518 - }6519 -6520 - if (display.drawMode != CameraPane.SHADOW)6521 - return;6522 -6523 - javax.media.opengl.GL gl = display.GetGL();6524 -// if (true) return;6525 -// float ao = p.AO;6526 -//6527 -// // if (ao == 0 && !bRep.AOdone) // transient problem!6528 -// // ao = 1;6529 -//6530 -// gl.glColor4f(ao, ao, ao, 1);6531 -6532 -// CameraPane.selectedpoint.6533 -// getAverage(cStatic.point1, true);6534 - if (CameraPane.pointflow == null) // !random) // live)6535 - {6536 - return;6537 - }6538 -6539 - cStatic.point1.set(0,0,0);6540 - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);6541 -6542 - cStatic.point1.sub(p0);6543 -6544 -6545 -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?6546 -// {6547 -// return;6548 -// }6549 -6550 - //if (true)6551 - if (cStatic.point1.dot(cStatic.point1) > 0.000001)6552 - {6553 - return;6554 - }6555 -6556 - float[] colorV = new float[3];6557 -6558 - if (false) // marked)6559 - {6560 - // debug rigging weights6561 - for (int object = 0; object < p0.vertexlinks.length; object++)6562 - {6563 - float weight = p0.weights[object] / p0.totalweight;6564 -6565 - // if (weight < 0.1)6566 - // {6567 - // assert(weight == 0);6568 - // continue;6569 - // }6570 -6571 - if (p0.vertexlinks[object] == -1)6572 - continue;6573 -6574 - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]);6575 -6576 - int color = //1 << object; //6577 - //p.vertexlinks.length;6578 - support.bRep.supports[p0.closestsupport].links[object];6579 - colorV[2] += (color & 1) * weight;6580 - colorV[1] += ((color & 2) >> 1) * weight;6581 - colorV[0] += ((color & 4) >> 2) * weight;6582 - }6583 - }6584 - else6585 - {6586 - if (drawingstarted)6587 - {6588 - // find next point6589 - if (bRep.GetVertex(0).faceindices == null)6590 - {6591 - bRep.InitFaceIndices();6592 - }6593 -6594 - double ymin = p0.y;6595 -6596 - Vertex newp = p0;6597 -6598 - for (int fii = 0; fii < p0.faceindices.length; fii++)6599 - {6600 - int fi = p0.faceindices[fii];6601 -6602 - if (fi == -1)6603 - break;6604 -6605 - Face f = bRep.GetFace(fi);6606 -6607 - Vertex p = bRep.GetVertex(f.p);6608 - Vertex q = bRep.GetVertex(f.q);6609 - Vertex r = bRep.GetVertex(f.r);6610 -6611 - int swap = (int)(Math.random()*3);6612 -6613 -// for (int s=swap; --s>=0;)6614 -// {6615 -// Vertex t = p;6616 -// p = q;6617 -// q = r;6618 -// r = t;6619 -// }6620 - if (ymin > p.y)6621 - {6622 - ymin = p.y;6623 - newp = p;6624 -// break;6625 - }6626 - if (ymin > q.y)6627 - {6628 - ymin = q.y;6629 - newp = q;6630 -// break;6631 - }6632 - if (ymin > r.y)6633 - {6634 - ymin = r.y;6635 - newp = r;6636 -// break;6637 - }6638 - }6639 -6640 - CameraPane.selectedpoint.toParent[3][0] = newp.x;6641 - CameraPane.selectedpoint.toParent[3][1] = newp.y;6642 - CameraPane.selectedpoint.toParent[3][2] = newp.z;6643 -6644 - drawingstarted = false;6645 -6646 - // return;6647 - }6648 -6649 - if (false) // CameraPane.DRAW6650 - {6651 - p0.AO = colorV[0] = 2;6652 - colorV[1] = 2;6653 - colorV[2] = 2;6654 - }6655 -6656 - CameraPane.pointflow.add(p0);6657 - CameraPane.pointflow.Touch();6658 - }6659 -6660 -// gl.glColor3f(colorV[0], colorV[1], colorV[2]);6661 -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);6662 -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);6663 - }6664 -6665 6404 void Print(Vertex v) 6666 6405 { 6667 6406 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); .. .. @@ -6683,195 +6422,6 @@ 6683 6422 gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); 6684 6423 } 6685 6424 6686 - void drawFace(Vertex pv, Vertex qv, Vertex rv,6687 - CameraPane display, Face face)6688 - {6689 - if (pv.y == -10000 ||6690 - qv.y == -10000 ||6691 - rv.y == -10000)6692 - return;6693 -6694 -// float b = f.nbiterations & 1;6695 -// float g = (f.nbiterations>>1) & 1;6696 -// float r = (f.nbiterations>>2) & 1;6697 -//6698 -// //if (f.weight == 10000)6699 -// //{6700 -// // r = 1; g = b = 0;6701 -// //}6702 -// //else6703 -// //{6704 -// // assert(f.weight < 10000);6705 -// r = g = b = (float)bRep.FaceWeight(f)*100;6706 -// if (r<0)6707 -// assert(r>=0);6708 -// //}6709 -6710 - javax.media.opengl.GL gl = display.GetGL();6711 -6712 - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;6713 -6714 - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);6715 - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)6716 - {6717 - //gl.glBegin(gl.GL_TRIANGLES);6718 - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);6719 - if (!hasnorm)6720 - {6721 - // System.out.println("FUCK!!");6722 - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0);6723 - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1);6724 - LA.vecCross(v0, v1, v2);6725 - LA.vecNormalize(v2);6726 - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);6727 - }6728 -6729 - // P6730 - float x = (float)pv.x;6731 - float y = (float)pv.y;6732 - float z = (float)pv.z;6733 -6734 - if (hasnorm)6735 - {6736 -// if (!pv.norm.normalized())6737 -// assert(pv.norm.normalized());6738 -6739 - //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);6740 - float nx = (float)pv.norm.x;6741 - float ny = (float)pv.norm.y;6742 - float nz = (float)pv.norm.z;6743 -6744 - x += nx * NORMALPUSH;6745 - y += ny * NORMALPUSH;6746 - z += nz * NORMALPUSH;6747 -6748 - gl.glNormal3f(nx, ny, nz);6749 - }6750 - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);6751 - SetColor(display, pv);6752 - //gl.glColor4f(r, g, b, 1);6753 - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);6754 - if (flipV)6755 - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);6756 - else6757 - gl.glTexCoord2f((float) pv.s, (float) pv.t);6758 - //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);6759 -6760 - gl.glVertex3f(x, y, z);6761 -6762 - // Q6763 - x = (float)qv.x;6764 - y = (float)qv.y;6765 - z = (float)qv.z;6766 -6767 -// Print(pv);6768 - if (hasnorm)6769 - {6770 -// assert(qv.norm.normalized());6771 - //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);6772 - float nx = (float)qv.norm.x;6773 - float ny = (float)qv.norm.y;6774 - float nz = (float)qv.norm.z;6775 -6776 - x += nx * NORMALPUSH;6777 - y += ny * NORMALPUSH;6778 - z += nz * NORMALPUSH;6779 -6780 - gl.glNormal3f(nx, ny, nz);6781 - }6782 - //System.out.println("vertexq = " + qv.s + ", " + qv.t);6783 - // boolean locked = false;6784 - // float eps = 0.1f;6785 - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice6786 -6787 - // int dot = 0; //*/ (int)f.dot;6788 -6789 - // if ((dot&1) == 0)6790 - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;6791 -6792 - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)6793 - if (flipV)6794 - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);6795 - else6796 - gl.glTexCoord2f((float) qv.s, (float) qv.t);6797 - // else6798 - // {6799 - // locked = true;6800 - // gl.glTexCoord2f((float) pv.s, (float) pv.t);6801 - // }6802 - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);6803 - SetColor(display, qv);6804 -6805 - gl.glVertex3f(x, y, z);6806 - //gl.glColor4f(r, g, b, 1);6807 - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);6808 - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);6809 -// Print(qv);6810 -6811 - // R6812 - x = (float)rv.x;6813 - y = (float)rv.y;6814 - z = (float)rv.z;6815 -6816 - if (hasnorm)6817 - {6818 -// assert(rv.norm.normalized());6819 - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);6820 - float nx = (float)rv.norm.x;6821 - float ny = (float)rv.norm.y;6822 - float nz = (float)rv.norm.z;6823 -6824 - x += nx * NORMALPUSH;6825 - y += ny * NORMALPUSH;6826 - z += nz * NORMALPUSH;6827 -6828 - gl.glNormal3f(nx, ny, nz);6829 - }6830 -6831 - // if ((dot&4) == 0)6832 - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;6833 -6834 - // if (wrap || !locked && (dot&8) != 0)6835 - if (flipV)6836 - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);6837 - else6838 - gl.glTexCoord2f((float) rv.s, (float) rv.t);6839 - // else6840 - // gl.glTexCoord2f((float) pv.s, (float) pv.t);6841 -6842 - // f.dot = dot;6843 -6844 - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);6845 - SetColor(display, rv);6846 - //gl.glColor4f(r, g, b, 1);6847 - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);6848 - //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);6849 - gl.glVertex3f(x, y, z);6850 -// Print(rv);6851 - //gl.glEnd();6852 - }6853 - else6854 - {6855 - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);6856 - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);6857 - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);6858 -6859 - }6860 -6861 - if (false) // (attributes & WIREFRAME) != 0)6862 - {6863 - gl.glDisable(gl.GL_LIGHTING);6864 -6865 - gl.glBegin(gl.GL_LINE_LOOP);6866 - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);6867 - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);6868 - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);6869 - gl.glEnd();6870 -6871 - gl.glEnable(gl.GL_LIGHTING);6872 - }6873 - }6874 -6875 6425 void drawSelf(ClickInfo info, int level, boolean select) 6876 6426 { 6877 6427 if (bRep == null) ParticleNode.java
.. .. @@ -346,7 +346,7 @@ 346 346 347 347 void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? 348 348 { 349 - if (display.drawMode == display.SELECTION || display.BOXMODE)349 + if (display.DrawMode() == display.SELECTION || display.BOXMODE)350 350 return; // hum... 351 351 352 352 Object3D geo = test; .. .. @@ -354,7 +354,7 @@ 354 354 if (support != null && link2master) 355 355 geo = support; 356 356 357 - if (live && display.isLIVE() && display.drawMode == display.SHADOW) // june 2013357 + if (live && Globals.isLIVE() && display.DrawMode() == display.SHADOW) // june 2013358 358 { 359 359 Step(); 360 360 } PhysicsNode.java
.. .. @@ -110,7 +110,7 @@ 110 110 111 111 void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) 112 112 { 113 - if (display.isLIVE() && live && display.drawMode == display.SHADOW) // FUCK113 + if (Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK114 114 { 115 115 float ms = getDeltaTimeMicroseconds(); 116 116 float minFPS = 1000000f / 60f; ScriptNode.java
.. .. @@ -538,13 +538,13 @@ 538 538 } 539 539 if (command.equals("stoplive") || command.equals("liveoff")) 540 540 { 541 - if (CameraPane.isLIVE())541 + if (Globals.isLIVE())542 542 CameraPane.theRenderer.ToggleLive(); 543 543 return; 544 544 } 545 545 if (command.equals("startlive") || command.equals("liveon")) 546 546 { 547 - if (!CameraPane.isLIVE())547 + if (!Globals.isLIVE())548 548 CameraPane.theRenderer.ToggleLive(); 549 549 return; 550 550 } .. .. @@ -1793,7 +1793,7 @@ 1793 1793 return; 1794 1794 } 1795 1795 1796 - if (isLive() && display.isLIVE() && display.drawMode == display.SHADOW)1796 + if (isLive() && Globals.isLIVE() && Globals.drawMode == display.SHADOW)1797 1797 { 1798 1798 if (reader == null) 1799 1799 Init(); SwitchNode.java
.. .. @@ -57,7 +57,7 @@ 57 57 parent = super.parent; 58 58 59 59 } 60 - if (live && display.isLIVE() && display.drawMode == display.SHADOW)60 + if (live && Globals.isLIVE() && display.DrawMode() == display.SHADOW)61 61 { 62 62 if (countspeed == 0) 63 63 { .. .. @@ -100,7 +100,7 @@ 100 100 bRep = (BoundaryRep) GrafreeD.clone(switchobject.get(0).bRep); 101 101 } 102 102 103 - if (CameraPane.SUPPORT && display.drawMode == display.SHADOW)103 + if (CameraPane.SUPPORT && display.DrawMode() == display.SHADOW)104 104 { 105 105 Update(); 106 106 } VehicleDemo.java
.. .. @@ -490,7 +490,7 @@ 490 490 491 491 renderme(display); 492 492 493 - if (display.isLIVE()) // && display.drawMode != display.SHADOW)493 + if (Globals.isLIVE()) // && display.drawMode != display.SHADOW)494 494 { 495 495 float ms = getDeltaTimeMicroseconds(); 496 496 float minFPS = 1000000f / 60f; cFileSystemPane.java
.. .. @@ -235,7 +235,7 @@ 235 235 System.out.println("drop2 = " + dtde + "; drop : " + target); 236 236 237 237 //assert dropTarget == dtde.getSource(); 238 - if (target instanceof CameraPane)238 + if (target instanceof iCameraPane)239 239 { 240 240 Object object = null; 241 241 try cLinker.java
.. .. @@ -29,12 +29,12 @@ 29 29 editWindow = objectUI.GetEditor(); 30 30 } 31 31 32 - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)32 + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)33 33 { 34 34 //if(count <= 0) 35 35 // return; 36 36 37 - if(display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)37 + if(display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION)38 38 { 39 39 super.draw(display, root, selected, blocked); 40 40 return; .. .. @@ -134,7 +134,7 @@ 134 134 //System.out.println("point = " + cStatic.point7); 135 135 LA.matConcat(cStatic.matrix1, cStatic.cone[d].toParent, cStatic.cone[d].toParent); 136 136 137 - if (display.matrixdepth >= display.MAXSTACK)137 + if (false) // TODO display.matrixdepth >= display.MAXSTACK)138 138 { 139 139 LA.matRotate(cStatic.cone[d].fromParent, cStatic.point8, cStatic.point7); 140 140 LA.matRotate(cStatic.sphere[d].fromParent, cStatic.point8, cStatic.point7); cMaterial.java
.. .. @@ -118,244 +118,244 @@ 118 118 return current / anchor; 119 119 } 120 120 121 - void Draw(CameraPane display, boolean selected)122 - {123 - //new Exception().printStackTrace();124 -125 - if (display.IsFrozen() && !selected || display.ambientOcclusion) // || display.drawMode == display.SHADOW)126 - {127 - return;128 - }129 -130 - javax.media.opengl.GL gl = display.GetGL();131 -132 - //Color col = Color.getHSBColor(color,modulation,1);133 - //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0);134 - if (!multiply)135 - {136 - display.color = color;137 - display.saturation = modulation;138 - }139 - else140 - {141 - display.color *= color*2;142 - display.saturation *= modulation*2;143 - }144 -145 - cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);146 -147 - float[] colorV = GrafreeD.colorV;148 -149 - /**/150 - if (display.drawMode == display.DEFAULT) // && display.RENDERPROGRAM == 0)151 - {152 - colorV[0] = display.modelParams0[0] * diffuse;153 - colorV[1] = display.modelParams0[1] * diffuse;154 - colorV[2] = display.modelParams0[2] * diffuse;155 - colorV[3] = opacity;156 -157 - gl.glColor4f(colorV[0], colorV[1], colorV[2], opacity);158 - //System.out.println("Opacity = " + opacity);159 -160 - gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);161 - //color[0] /= 2; color[1] /= 2; color[2] /= 2;162 - gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);163 -164 - float amb = ambient;165 - if (amb < cameralight)166 - {167 - amb = cameralight;168 - }169 - colorV[0] = display.modelParams0[0] * diffuse * amb;170 - colorV[1] = display.modelParams0[1] * diffuse * amb;171 - colorV[2] = display.modelParams0[2] * diffuse * amb;172 - gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT, colorV, 0);173 - //color[0] /= 2; color[1] /= 2; color[2] /= 2;174 - gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT, colorV, 0);175 -176 - /**/177 - colorV[0] = ((1 - metalness) + display.modelParams0[0] * metalness) * specular;178 - colorV[1] = ((1 - metalness) + display.modelParams0[1] * metalness) * specular;179 - colorV[2] = ((1 - metalness) + display.modelParams0[2] * metalness) * specular;180 - gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR, colorV, 0);181 - //color[0] /= 2; color[1] /= 2; color[2] /= 2;182 - gl.glMaterialfv(gl.GL_BACK, gl.GL_SPECULAR, colorV, 0);183 - colorV[0] = 10 / shininess; // 1/0.005f;184 - //System.out.println("shininess = " + colorV[0]);185 - if (colorV[0] > 128)186 - {187 - colorV[0] = 128;188 - }189 - gl.glMaterialfv(gl.GL_FRONT, gl.GL_SHININESS, colorV, 0);190 - gl.glMaterialfv(gl.GL_BACK, gl.GL_SHININESS, colorV, 0);191 - /**/192 - }193 - /**/194 -195 - //selected = false;196 - selected = selected && display.flash;197 -198 - //display.modelParams0[0] = 0; // pigment.r;199 - //display.modelParams0[1] = 0; // pigment.g;200 - //display.modelParams0[2] = 0; // pigment.b;201 - if (!multiply)202 - {203 - display.modelParams0[3] = metalness;204 - display.modelParams1[0] = diffuse;205 - display.modelParams1[1] = specular;206 - display.modelParams1[2] = 1 / shininess;207 - display.modelParams1[3] = shift;208 - display.modelParams2[0] = ambient;209 - display.modelParams2[1] = lightarea;210 - //System.out.println("light area = " + lightarea);211 - display.modelParams2[2] = 1 / factor; // diffuseness212 - display.modelParams2[3] = velvet;213 - display.modelParams3[0] = sheen;214 - display.modelParams3[1] = subsurface;215 - display.modelParams3[2] = bump; // backlit216 - display.modelParams3[3] = aniso;217 - display.modelParams4[0] = anisoV;218 - display.modelParams4[1] = selected ? 100 : cameralight;219 - //System.out.println("selected = " + selected);220 - display.modelParams4[2] = diffuseness;221 - display.modelParams4[3] = shadow;222 - display.modelParams5[0] = texture;223 - display.modelParams5[1] = opacity;224 - display.modelParams5[2] = fakedepth;225 - display.modelParams5[3] = CameraPane.SHADOWCULLFACE ? 0f : (shadowbias - 0.005f) / 10;226 - }227 - else228 - {229 - display.modelParams0[3] *= metalness*2;230 - display.modelParams1[0] *= diffuse*2;231 - display.modelParams1[1] *= specular*2;232 - display.modelParams1[2] *= shininess*2;233 - display.modelParams1[3] *= shift*2;234 - display.modelParams2[0] *= ambient*2;235 - display.modelParams2[1] *= lightarea*2;236 - display.modelParams2[2] *= factor*2;237 - display.modelParams2[3] *= velvet*2;238 - display.modelParams3[0] *= sheen*2;239 - display.modelParams3[1] *= subsurface*2;240 - display.modelParams3[2] *= bump*2;241 - display.modelParams3[3] *= aniso*2;242 - display.modelParams4[0] *= anisoV*2;243 - display.modelParams4[1] *= cameralight*2;244 - //System.out.println("selected = " + selected);245 - display.modelParams4[2] *= diffuseness*2;246 - display.modelParams4[3] *= shadow*2;247 - display.modelParams5[0] *= texture*2;248 - display.modelParams5[1] *= opacity*2;249 - display.modelParams5[2] *= fakedepth*2;250 - display.modelParams5[3] *= shadowbias*2;251 - }252 -253 - display.modelParams6[0] = 0;254 - display.modelParams6[1] = 0;255 - display.modelParams6[2] = 0;256 - display.modelParams6[3] = 0;257 -258 - display.modelParams7[0] = 0;259 - display.modelParams7[1] = 1000;260 - display.modelParams7[2] = 0;261 - display.modelParams7[3] = 0;262 -263 - display.modelParams6[0] = 100; // criss de bug de bump264 -265 - Object3D.cVector2[] extparams = display.vector2buffer;266 - if (extparams != null && extparams.length > 0 && extparams[0] != null)267 - {268 - display.modelParams6[0] = extparams[0].x / 1000.0f; // bump269 - display.modelParams6[1] = extparams[0].y / 1000.0f; // noise270 - if (extparams.length > 1)271 - {272 - display.modelParams6[2] = extparams[1].x / 1000.0f; // borderfade273 - display.modelParams6[3] = extparams[1].y / 1000.0f; // (float)Math.exp(-extparams[1].y / 1000.0f); // fog punchthrough274 - if (extparams.length > 2)275 - {276 - display.modelParams7[0] = extparams[2].x / 1000.0f; // noise power277 - float x = extparams[2].y / 1000.0f;278 - //if (x == 0)279 - // x = 1f;280 - display.modelParams7[1] = 1 / x / x / x / x / x / x / x / x / x / x / x / x / x; // (float)Math.pow(-Math.log((extparams[2].y+0.00) / 1000.0f), 1); // opacity power281 - if (extparams[2].y > 0)282 - {283 - //System.out.println("extparams[1].y = " + extparams[1].y);284 - //System.out.println("extparams[2].y = " + extparams[2].y);285 - //System.out.println("opacity power = " + display.modelParams7[1]);286 - }287 - }288 - }289 - }290 -291 - //if (display.modelParams6[2] != 0)292 - /*293 - System.out.println("modelParams0[0] = " + display.modelParams0[0]);294 - System.out.println("modelParams0[1] = " + display.modelParams0[1]);295 - System.out.println("modelParams0[2] = " + display.modelParams0[2]);296 - System.out.println("modelParams0[3] = " + display.modelParams0[3]);297 - System.out.println("modelParams1[0] = " + display.modelParams1[0]);298 - System.out.println("modelParams1[1] = " + display.modelParams1[1]);299 - System.out.println("modelParams1[2] = " + display.modelParams1[2]);300 - System.out.println("modelParams1[3] = " + display.modelParams1[3]);301 - System.out.println("modelParams2[0] = " + display.modelParams2[0]);302 - System.out.println("modelParams2[1] = " + display.modelParams2[1]);303 - System.out.println("modelParams2[2] = " + display.modelParams2[2]);304 - System.out.println("modelParams2[3] = " + display.modelParams2[3]);305 - System.out.println("modelParams3[0] = " + display.modelParams3[0]);306 - System.out.println("modelParams3[1] = " + display.modelParams3[1]);307 - System.out.println("modelParams3[2] = " + display.modelParams3[2]);308 - System.out.println("modelParams3[3] = " + display.modelParams3[3]);309 - System.out.println("modelParams4[0] = " + display.modelParams4[0]);310 - System.out.println("modelParams4[1] = " + display.modelParams4[1]);311 - System.out.println("modelParams4[2] = " + display.modelParams4[2]);312 - System.out.println("modelParams4[3] = " + display.modelParams4[3]);313 - System.out.println("modelParams5[0] = " + display.modelParams5[0]);314 - System.out.println("modelParams5[1] = " + display.modelParams5[1]);315 - System.out.println("modelParams5[2] = " + display.modelParams5[2]);316 - System.out.println("modelParams5[3] = " + display.modelParams5[3]);317 - System.out.println("modelParams6[0] = " + display.modelParams6[0]);318 - System.out.println("modelParams6[1] = " + display.modelParams6[1]);319 - System.out.println("modelParams6[2] = " + display.modelParams6[2]);320 - System.out.println("modelParams6[3] = " + display.modelParams6[3]);321 - System.out.println("modelParams7[0] = " + display.modelParams7[0]);322 - System.out.println("modelParams7[1] = " + display.modelParams7[1]);323 - System.out.println("modelParams7[2] = " + display.modelParams7[2]);324 - System.out.println("modelParams7[3] = " + display.modelParams7[3]);325 - /**/326 - //assert (display.modelParams6[2] == 0);327 -328 - //System.out.println("noise power = " + display.modelParams7[0]);329 - //System.out.println("shadowbias = " + shadowbias);330 -331 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);332 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 1, display.modelParams1, 0);333 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 2, display.modelParams2, 0);334 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 3, display.modelParams3, 0);335 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);336 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);337 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 6, display.modelParams6, 0);338 - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 7, display.modelParams7, 0);339 -340 - int mode = display.FP_SHADER;341 -342 - if (aniso != anisoV || aniso > 0.002)343 - {344 - mode |= display.FP_ANISO;345 - }346 -347 - display.EnableProgram(mode);348 -349 - //System.out.println("opacity power = " + display.modelParams7[1]);350 -351 - if (!multiply)352 - {353 - if (display.drawMode == CameraPane.SHADOW)354 - gl.glDepthMask(opacity >= 0.9 && display.modelParams7[1] > 0.1);355 - else356 - gl.glDepthMask(opacity >= 0.99);357 - }358 - }121 +// void Draw(iCameraPane display, boolean selected)122 +// {123 +// //new Exception().printStackTrace();124 +//125 +// if (display.IsFrozen() && !selected || display.IsAmbientOcclusionOn()) // || display.drawMode == display.SHADOW)126 +// {127 +// return;128 +// }129 +//130 +// javax.media.opengl.GL gl = display.GetGL();131 +//132 +// //Color col = Color.getHSBColor(color,modulation,1);133 +// //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0);134 +// if (!multiply)135 +// {136 +// display.color = color;137 +// display.saturation = modulation;138 +// }139 +// else140 +// {141 +// display.color *= color*2;142 +// display.saturation *= modulation*2;143 +// }144 +//145 +// cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);146 +//147 +// float[] colorV = GrafreeD.colorV;148 +//149 +// /**/150 +// if (display.drawMode == display.DEFAULT) // && display.RENDERPROGRAM == 0)151 +// {152 +// colorV[0] = display.modelParams0[0] * diffuse;153 +// colorV[1] = display.modelParams0[1] * diffuse;154 +// colorV[2] = display.modelParams0[2] * diffuse;155 +// colorV[3] = opacity;156 +//157 +// gl.glColor4f(colorV[0], colorV[1], colorV[2], opacity);158 +// //System.out.println("Opacity = " + opacity);159 +//160 +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);161 +// //color[0] /= 2; color[1] /= 2; color[2] /= 2;162 +// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);163 +//164 +// float amb = ambient;165 +// if (amb < cameralight)166 +// {167 +// amb = cameralight;168 +// }169 +// colorV[0] = display.modelParams0[0] * diffuse * amb;170 +// colorV[1] = display.modelParams0[1] * diffuse * amb;171 +// colorV[2] = display.modelParams0[2] * diffuse * amb;172 +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT, colorV, 0);173 +// //color[0] /= 2; color[1] /= 2; color[2] /= 2;174 +// gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT, colorV, 0);175 +//176 +// /**/177 +// colorV[0] = ((1 - metalness) + display.modelParams0[0] * metalness) * specular;178 +// colorV[1] = ((1 - metalness) + display.modelParams0[1] * metalness) * specular;179 +// colorV[2] = ((1 - metalness) + display.modelParams0[2] * metalness) * specular;180 +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR, colorV, 0);181 +// //color[0] /= 2; color[1] /= 2; color[2] /= 2;182 +// gl.glMaterialfv(gl.GL_BACK, gl.GL_SPECULAR, colorV, 0);183 +// colorV[0] = 10 / shininess; // 1/0.005f;184 +// //System.out.println("shininess = " + colorV[0]);185 +// if (colorV[0] > 128)186 +// {187 +// colorV[0] = 128;188 +// }189 +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_SHININESS, colorV, 0);190 +// gl.glMaterialfv(gl.GL_BACK, gl.GL_SHININESS, colorV, 0);191 +// /**/192 +// }193 +// /**/194 +//195 +// //selected = false;196 +// selected = selected && display.flash;197 +//198 +// //display.modelParams0[0] = 0; // pigment.r;199 +// //display.modelParams0[1] = 0; // pigment.g;200 +// //display.modelParams0[2] = 0; // pigment.b;201 +// if (!multiply)202 +// {203 +// display.modelParams0[3] = metalness;204 +// display.modelParams1[0] = diffuse;205 +// display.modelParams1[1] = specular;206 +// display.modelParams1[2] = 1 / shininess;207 +// display.modelParams1[3] = shift;208 +// display.modelParams2[0] = ambient;209 +// display.modelParams2[1] = lightarea;210 +// //System.out.println("light area = " + lightarea);211 +// display.modelParams2[2] = 1 / factor; // diffuseness212 +// display.modelParams2[3] = velvet;213 +// display.modelParams3[0] = sheen;214 +// display.modelParams3[1] = subsurface;215 +// display.modelParams3[2] = bump; // backlit216 +// display.modelParams3[3] = aniso;217 +// display.modelParams4[0] = anisoV;218 +// display.modelParams4[1] = selected ? 100 : cameralight;219 +// //System.out.println("selected = " + selected);220 +// display.modelParams4[2] = diffuseness;221 +// display.modelParams4[3] = shadow;222 +// display.modelParams5[0] = texture;223 +// display.modelParams5[1] = opacity;224 +// display.modelParams5[2] = fakedepth;225 +// display.modelParams5[3] = CameraPane.SHADOWCULLFACE ? 0f : (shadowbias - 0.005f) / 10;226 +// }227 +// else228 +// {229 +// display.modelParams0[3] *= metalness*2;230 +// display.modelParams1[0] *= diffuse*2;231 +// display.modelParams1[1] *= specular*2;232 +// display.modelParams1[2] *= shininess*2;233 +// display.modelParams1[3] *= shift*2;234 +// display.modelParams2[0] *= ambient*2;235 +// display.modelParams2[1] *= lightarea*2;236 +// display.modelParams2[2] *= factor*2;237 +// display.modelParams2[3] *= velvet*2;238 +// display.modelParams3[0] *= sheen*2;239 +// display.modelParams3[1] *= subsurface*2;240 +// display.modelParams3[2] *= bump*2;241 +// display.modelParams3[3] *= aniso*2;242 +// display.modelParams4[0] *= anisoV*2;243 +// display.modelParams4[1] *= cameralight*2;244 +// //System.out.println("selected = " + selected);245 +// display.modelParams4[2] *= diffuseness*2;246 +// display.modelParams4[3] *= shadow*2;247 +// display.modelParams5[0] *= texture*2;248 +// display.modelParams5[1] *= opacity*2;249 +// display.modelParams5[2] *= fakedepth*2;250 +// display.modelParams5[3] *= shadowbias*2;251 +// }252 +//253 +// display.modelParams6[0] = 0;254 +// display.modelParams6[1] = 0;255 +// display.modelParams6[2] = 0;256 +// display.modelParams6[3] = 0;257 +//258 +// display.modelParams7[0] = 0;259 +// display.modelParams7[1] = 1000;260 +// display.modelParams7[2] = 0;261 +// display.modelParams7[3] = 0;262 +//263 +// display.modelParams6[0] = 100; // criss de bug de bump264 +//265 +// Object3D.cVector2[] extparams = display.vector2buffer;266 +// if (extparams != null && extparams.length > 0 && extparams[0] != null)267 +// {268 +// display.modelParams6[0] = extparams[0].x / 1000.0f; // bump269 +// display.modelParams6[1] = extparams[0].y / 1000.0f; // noise270 +// if (extparams.length > 1)271 +// {272 +// display.modelParams6[2] = extparams[1].x / 1000.0f; // borderfade273 +// display.modelParams6[3] = extparams[1].y / 1000.0f; // (float)Math.exp(-extparams[1].y / 1000.0f); // fog punchthrough274 +// if (extparams.length > 2)275 +// {276 +// display.modelParams7[0] = extparams[2].x / 1000.0f; // noise power277 +// float x = extparams[2].y / 1000.0f;278 +// //if (x == 0)279 +// // x = 1f;280 +// display.modelParams7[1] = 1 / x / x / x / x / x / x / x / x / x / x / x / x / x; // (float)Math.pow(-Math.log((extparams[2].y+0.00) / 1000.0f), 1); // opacity power281 +// if (extparams[2].y > 0)282 +// {283 +// //System.out.println("extparams[1].y = " + extparams[1].y);284 +// //System.out.println("extparams[2].y = " + extparams[2].y);285 +// //System.out.println("opacity power = " + display.modelParams7[1]);286 +// }287 +// }288 +// }289 +// }290 +//291 +// //if (display.modelParams6[2] != 0)292 +// /*293 +// System.out.println("modelParams0[0] = " + display.modelParams0[0]);294 +// System.out.println("modelParams0[1] = " + display.modelParams0[1]);295 +// System.out.println("modelParams0[2] = " + display.modelParams0[2]);296 +// System.out.println("modelParams0[3] = " + display.modelParams0[3]);297 +// System.out.println("modelParams1[0] = " + display.modelParams1[0]);298 +// System.out.println("modelParams1[1] = " + display.modelParams1[1]);299 +// System.out.println("modelParams1[2] = " + display.modelParams1[2]);300 +// System.out.println("modelParams1[3] = " + display.modelParams1[3]);301 +// System.out.println("modelParams2[0] = " + display.modelParams2[0]);302 +// System.out.println("modelParams2[1] = " + display.modelParams2[1]);303 +// System.out.println("modelParams2[2] = " + display.modelParams2[2]);304 +// System.out.println("modelParams2[3] = " + display.modelParams2[3]);305 +// System.out.println("modelParams3[0] = " + display.modelParams3[0]);306 +// System.out.println("modelParams3[1] = " + display.modelParams3[1]);307 +// System.out.println("modelParams3[2] = " + display.modelParams3[2]);308 +// System.out.println("modelParams3[3] = " + display.modelParams3[3]);309 +// System.out.println("modelParams4[0] = " + display.modelParams4[0]);310 +// System.out.println("modelParams4[1] = " + display.modelParams4[1]);311 +// System.out.println("modelParams4[2] = " + display.modelParams4[2]);312 +// System.out.println("modelParams4[3] = " + display.modelParams4[3]);313 +// System.out.println("modelParams5[0] = " + display.modelParams5[0]);314 +// System.out.println("modelParams5[1] = " + display.modelParams5[1]);315 +// System.out.println("modelParams5[2] = " + display.modelParams5[2]);316 +// System.out.println("modelParams5[3] = " + display.modelParams5[3]);317 +// System.out.println("modelParams6[0] = " + display.modelParams6[0]);318 +// System.out.println("modelParams6[1] = " + display.modelParams6[1]);319 +// System.out.println("modelParams6[2] = " + display.modelParams6[2]);320 +// System.out.println("modelParams6[3] = " + display.modelParams6[3]);321 +// System.out.println("modelParams7[0] = " + display.modelParams7[0]);322 +// System.out.println("modelParams7[1] = " + display.modelParams7[1]);323 +// System.out.println("modelParams7[2] = " + display.modelParams7[2]);324 +// System.out.println("modelParams7[3] = " + display.modelParams7[3]);325 +// /**/326 +// //assert (display.modelParams6[2] == 0);327 +//328 +// //System.out.println("noise power = " + display.modelParams7[0]);329 +// //System.out.println("shadowbias = " + shadowbias);330 +//331 +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);332 +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 1, display.modelParams1, 0);333 +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 2, display.modelParams2, 0);334 +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 3, display.modelParams3, 0);335 +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);336 +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);337 +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 6, display.modelParams6, 0);338 +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 7, display.modelParams7, 0);339 +//340 +// int mode = display.FP_SHADER;341 +//342 +// if (aniso != anisoV || aniso > 0.002)343 +// {344 +// mode |= display.FP_ANISO;345 +// }346 +//347 +// display.EnableProgram(mode);348 +//349 +// //System.out.println("opacity power = " + display.modelParams7[1]);350 +//351 +// if (!multiply)352 +// {353 +// if (display.drawMode == CameraPane.SHADOW)354 +// gl.glDepthMask(opacity >= 0.9 && display.modelParams7[1] > 0.1);355 +// else356 +// gl.glDepthMask(opacity >= 0.99);357 +// }358 +// }359 359 360 360 float color = 0.5f, modulation /*SATURATION*/ = 0.001f, metalness = 0.001f; 361 361 float diffuse = 0.75f, specular = 0.25f, shininess = 0.75f, shift = 1; cMesh.java
.. .. @@ -644,7 +644,7 @@ 644 644 gl.glEnable(gl.GL_LIGHTING); 645 645 } 646 646 647 - if (live && display.isLIVE() && display.drawMode == CameraPane.DEFAULT)647 + if (live && Globals.isLIVE() && display.DrawMode() == CameraPane.DEFAULT)648 648 { 649 649 //System.out.println("UPDATE"); 650 650 if (Phys == null) cSpring.java
.. .. @@ -10,7 +10,7 @@ 10 10 11 11 boolean IsStatic() 12 12 { 13 - return !(live && (CameraPane.isLIVE() || CameraPane.waslive));13 + return !(live && (Globals.isLIVE() || CameraPane.waslive));14 14 } 15 15 16 16 void Revert() .. .. @@ -569,7 +569,7 @@ 569 569 570 570 //gl.glDisable(GL.GL_LIGHTING); 571 571 572 - if (display.drawMode == display.SHADOW)572 + if (display.DrawMode() == display.SHADOW)573 573 { 574 574 gl.glDisable(gl.GL_CULL_FACE); 575 575 } .. .. @@ -762,7 +762,7 @@ 762 762 gl.glEnd(); 763 763 gl.glEnable(GL.GL_LIGHTING); 764 764 /**/ 765 - if (display.CULLFACE)765 + if (display.BackFaceCullMode())766 766 { 767 767 gl.glEnable(gl.GL_CULL_FACE); 768 768 } .. .. @@ -775,7 +775,7 @@ 775 775 // displaylist = 0; // june 2013 -1; 776 776 777 777 //System.out.println("DRAW " + display.drawMode); 778 - if (live && display.isLIVE() && display.drawMode == display.DEFAULT)778 + if (live && Globals.isLIVE() && display.DrawMode() == display.DEFAULT)779 779 { 780 780 //System.out.println("UPDATE"); 781 781 Phys.update(); iCameraPane.java
.. .. @@ -0,0 +1,53 @@ 1 +2 +public interface iCameraPane3 +{4 + static final public int DEFAULT = 0;5 + static final public int SELECTION = 1;6 + static final public int SHADOW = 2;7 + static final public int OCCLUSION = 3;8 +9 + void ClearDepth();10 +11 + void DepthTest(boolean depthtest);12 +13 + void DepthWrite(boolean depthwrite);14 +15 + void BackFaceCull(boolean bfc);16 +17 + boolean BackFaceCullMode();18 +19 + boolean IsAmbientOcclusionOn();20 +21 + boolean IsFrozen();22 +23 + javax.media.opengl.GL GetGL();24 +25 + // Currently in Globals26 + int DrawMode();27 +28 + void PushMatrix(double[][] matrix, int count);29 + void PopMatrix(double[][] matrix);30 +31 + void PushTextureMatrix(double[][] matrix, int count);32 + void PopTextureMatrix(double[][] matrix);33 +34 + Camera EyeCamera();35 +36 + Camera LightCamera();37 +38 + Camera RenderCamera();39 +40 + // Should be cMaterial41 + void PushMaterial(Object3D obj, boolean selected);42 + void PushMaterial2(Object3D obj, boolean selected);43 +44 + void PopMaterial(Object3D obj, boolean selected);45 + void PopMaterial2(Object3D obj);46 +47 + void DrawString(Object3D obj);48 +49 + void BindTextures(cTexture tex, int resolution);50 + void ReleaseTextures(cTexture tex);51 +52 + void DrawFace(Object3D obj, Vertex pv, Vertex qv, Vertex rv, Face face);53 +}