Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
CameraPane.java
....@@ -37,7 +37,6 @@
3737 static boolean[] selectedstack = new boolean[65536];
3838 static int materialdepth = 0;
3939
40
- static boolean DEBUG = false;
4140 static boolean FRUSTUM = false; // still bogus true; // frustum culling
4241
4342 // camera change fix
....@@ -327,7 +326,7 @@
327326 cStatic.objectstack[materialdepth++] = obj;
328327 //System.out.println("material " + material);
329328 //Applet3D.tracein(this, selected);
330
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
331330 if (obj instanceof Camera)
332331 {
333332 display.options1[0] = material.shift;
....@@ -336,14 +335,28 @@
336335 display.options1[2] = material.shadowbias;
337336 display.options1[3] = material.aniso;
338337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
339343 display.options2[0] = material.opacity;
340344 display.options2[1] = material.diffuse;
341345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
342349
343350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
344354 display.options4[0] = material.cameralight/0.2f;
345355 display.options4[1] = material.subsurface;
346356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
347360
348361 // if (display.CURRENTANTIALIAS > 0)
349362 // display.options3[3] /= 4;
....@@ -359,7 +372,7 @@
359372 /**/
360373 } else
361374 {
362
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
363376 }
364377 } else
365378 {
....@@ -383,8 +396,8 @@
383396 cStatic.objectstack[materialdepth++] = obj;
384397 //System.out.println("material " + material);
385398 //Applet3D.tracein("selected ", selected);
386
- display.vector2buffer = obj.projectedVertices;
387
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
388401 }
389402 }
390403
....@@ -401,8 +414,8 @@
401414 materialdepth -= 1;
402415 if (materialdepth > 0)
403416 {
404
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
405
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
417
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
418
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
406419 }
407420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
408421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -422,8 +435,8 @@
422435 materialdepth -= 1;
423436 if (materialdepth > 0)
424437 {
425
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
426
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
438
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
439
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
427440 }
428441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
429442 //else
....@@ -464,10 +477,12 @@
464477 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
465478 {
466479 //gl.glBegin(gl.GL_TRIANGLES);
467
- boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
480
+ boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0)
481
+ // TEST LIVE NORMALS && !obj.dontselect
482
+ ;
468483 if (!hasnorm)
469484 {
470
- // System.out.println("FUCK!!");
485
+ // System.out.println("Mesh normal");
471486 LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0);
472487 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
473488 LA.vecCross(obj.v0, obj.v1, obj.v2);
....@@ -1192,10 +1207,12 @@
11921207 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
11931208 }
11941209 }
1210
+
11951211 if (flipV)
11961212 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
11971213 else
11981214 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1215
+
11991216 //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12001217 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12011218
....@@ -1215,10 +1232,12 @@
12151232 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
12161233 }
12171234 }
1235
+
12181236 if (flipV)
12191237 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12201238 else
12211239 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1240
+
12221241 //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12231242 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12241243
....@@ -1246,8 +1265,10 @@
12461265 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12471266 else
12481267 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1268
+
12491269 //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
12501270 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1271
+
12511272 count2 += 2;
12521273 count3 += 3;
12531274 }
....@@ -1603,7 +1624,7 @@
16031624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16041625 }
16051626
1606
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16071628 {
16081629 CameraPane display = this;
16091630 //new Exception().printStackTrace();
....@@ -1638,7 +1659,7 @@
16381659 colorV[0] = display.modelParams0[0] * material.diffuse;
16391660 colorV[1] = display.modelParams0[1] * material.diffuse;
16401661 colorV[2] = display.modelParams0[2] * material.diffuse;
1641
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16421663
16431664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16441665 //System.out.println("Opacity = " + opacity);
....@@ -1746,9 +1767,9 @@
17461767 display.modelParams7[2] = 0;
17471768 display.modelParams7[3] = 0;
17481769
1749
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17501771
1751
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17521773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17531774 {
17541775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -1890,7 +1911,7 @@
18901911 void PushMatrix(double[][] matrix)
18911912 {
18921913 // GrafreeD.tracein(matrix);
1893
- PushMatrix(matrix,1);
1914
+ PushMatrix(matrix, 1);
18941915 }
18951916
18961917 void PushMatrix()
....@@ -2044,7 +2065,7 @@
20442065 //System.err.println("Oeil on");
20452066 OEIL = true;
20462067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2047
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20482069 //pingthread.StepToTarget(true);
20492070 }
20502071
....@@ -2259,7 +2280,7 @@
22592280
22602281 void ToggleDebug()
22612282 {
2262
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22632284 }
22642285
22652286 void ToggleLookAt()
....@@ -7921,6 +7942,64 @@
79217942 ReleaseTexture(pigment, false);
79227943 }
79237944
7945
+ public void ReleasePigmentTexture(cTexture tex) // INTERFACE
7946
+ {
7947
+ if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
7948
+ {
7949
+ return;
7950
+ }
7951
+
7952
+ if (tex == null)
7953
+ {
7954
+ ReleaseTexture(null, false);
7955
+ return;
7956
+ }
7957
+
7958
+ String pigment = Object3D.GetPigment(tex);
7959
+
7960
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7961
+ {
7962
+ // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
7963
+ // System.out.println("; bump = " + bump);
7964
+ }
7965
+
7966
+ if (pigment.equals(""))
7967
+ {
7968
+ pigment = null;
7969
+ }
7970
+
7971
+ ReleaseTexture(pigment, false);
7972
+ }
7973
+
7974
+ public void ReleaseBumpTexture(cTexture tex) // INTERFACE
7975
+ {
7976
+ if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
7977
+ {
7978
+ return;
7979
+ }
7980
+
7981
+ if (tex == null)
7982
+ {
7983
+ ReleaseTexture(null, true);
7984
+ return;
7985
+ }
7986
+
7987
+ String bump = Object3D.GetBump(tex);
7988
+
7989
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7990
+ {
7991
+ // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
7992
+ // System.out.println("; bump = " + bump);
7993
+ }
7994
+
7995
+ if (bump.equals(""))
7996
+ {
7997
+ bump = null;
7998
+ }
7999
+
8000
+ ReleaseTexture(bump, true);
8001
+ }
8002
+
79248003 void ReleaseTexture(String tex, boolean bump)
79258004 {
79268005 if (// DrawMode() != 0 || /*tex == null ||*/
....@@ -8067,6 +8146,73 @@
80678146 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
80688147
80698148 return; // true;
8149
+ }
8150
+
8151
+ /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
8152
+ {
8153
+ if (// DrawMode() != 0 || /*tex == null ||*/
8154
+ ambientOcclusion ) // || !textureon)
8155
+ {
8156
+ return; // false;
8157
+ }
8158
+
8159
+ if (tex == null)
8160
+ {
8161
+ BindTexture(null,false,resolution);
8162
+ return;
8163
+ }
8164
+
8165
+ String pigment = Object3D.GetPigment(tex);
8166
+
8167
+ usedtextures.put(pigment, pigment);
8168
+
8169
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8170
+ {
8171
+ // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8172
+ // System.out.println("; bump = " + bump);
8173
+ }
8174
+
8175
+ if (pigment.equals(""))
8176
+ {
8177
+ pigment = null;
8178
+ }
8179
+
8180
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8181
+ BindTexture(pigment, false, resolution);
8182
+ }
8183
+
8184
+ /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
8185
+ {
8186
+ if (// DrawMode() != 0 || /*tex == null ||*/
8187
+ ambientOcclusion ) // || !textureon)
8188
+ {
8189
+ return; // false;
8190
+ }
8191
+
8192
+ if (tex == null)
8193
+ {
8194
+ BindTexture(null,true,resolution);
8195
+ return;
8196
+ }
8197
+
8198
+ String bump = Object3D.GetBump(tex);
8199
+
8200
+ usedtextures.put(bump, bump);
8201
+
8202
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8203
+ {
8204
+ // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8205
+ // System.out.println("; bump = " + bump);
8206
+ }
8207
+
8208
+ if (bump.equals(""))
8209
+ {
8210
+ bump = null;
8211
+ }
8212
+
8213
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8214
+ BindTexture(bump, true, resolution);
8215
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
80708216 }
80718217
80728218 java.util.HashSet<String> missingTextures = new java.util.HashSet<String>();
....@@ -9234,11 +9380,35 @@
92349380 jy8[3] = 0.5f;
92359381 }
92369382
9237
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9383
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
92389384 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
92399385 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
92409386 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
92419387
9388
+ void ResetOptions()
9389
+ {
9390
+ options1[0] = 100;
9391
+ options1[1] = 0.025f;
9392
+ options1[2] = 0.01f;
9393
+ options1[3] = 0;
9394
+ options1[4] = 0;
9395
+
9396
+ options2[0] = 0;
9397
+ options2[1] = 0.75f;
9398
+ options2[2] = 0;
9399
+ options2[3] = 0;
9400
+
9401
+ options3[0] = 1;
9402
+ options3[1] = 1;
9403
+ options3[2] = 1;
9404
+ options3[3] = 0;
9405
+
9406
+ options4[0] = 1;
9407
+ options4[1] = 0;
9408
+ options4[2] = 1;
9409
+ options4[3] = 0;
9410
+ }
9411
+
92429412 static int imagecount = 0; // movie generation
92439413
92449414 static int jitter = 0;
....@@ -9335,7 +9505,7 @@
93359505
93369506 if (renderCamera != lightCamera)
93379507 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9338
- LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
9508
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
93399509
93409510 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
93419511
....@@ -9351,7 +9521,7 @@
93519521
93529522 if (renderCamera != lightCamera)
93539523 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9354
- LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
9524
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
93559525
93569526 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
93579527
....@@ -10349,6 +10519,7 @@
1034910519 ANTIALIAS = 0;
1035010520 //System.out.println("RESTART");
1035110521 AAtimer.restart();
10522
+ Globals.TIMERRUNNING = true;
1035210523 }
1035310524 }
1035410525 }
....@@ -10416,7 +10587,8 @@
1041610587 ambientOcclusion = false;
1041710588 }
1041810589
10419
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10590
+ if (//Globals.lighttouched &&
10591
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1042010592 {
1042110593 //if (RENDERSHADOW) // ?
1042210594 if (!IsFrozen())
....@@ -10550,7 +10722,7 @@
1055010722 // if (parentcam != renderCamera) // not a light
1055110723 if (cam != lightCamera)
1055210724 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10553
- LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
10725
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
1055410726
1055510727 for (int j = 0; j < 4; j++)
1055610728 {
....@@ -10565,7 +10737,7 @@
1056510737 // if (parentcam != renderCamera) // not a light
1056610738 if (cam != lightCamera)
1056710739 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10568
- LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
10740
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
1056910741
1057010742 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1057110743
....@@ -10856,9 +11028,9 @@
1085611028
1085711029 gl.glMatrixMode(GL.GL_MODELVIEW);
1085811030
10859
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10860
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10861
-//gl.glEnable(gl.GL_MULTISAMPLE);
11031
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11032
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11033
+gl.glEnable(gl.GL_MULTISAMPLE);
1086211034 } else
1086311035 {
1086411036 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -10869,7 +11041,7 @@
1086911041 //System.out.println("BLENDING ON");
1087011042 gl.glEnable(GL.GL_BLEND);
1087111043 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
10872
-
11044
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1087311045 gl.glMatrixMode(gl.GL_PROJECTION);
1087411046 gl.glLoadIdentity();
1087511047
....@@ -10959,7 +11131,7 @@
1095911131
1096011132 // if (cam != lightCamera)
1096111133 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10962
- LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013
11134
+ LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
1096311135 }
1096411136
1096511137 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -10981,7 +11153,7 @@
1098111153 {
1098211154 if (cam != lightCamera)
1098311155 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10984
- LA.xformDir(light0, parentcam.GlobalTransformInv(), light0); // may 2013
11156
+ LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013
1098511157 }
1098611158
1098711159 LA.xformPos(light0, cam.toScreen, light0);
....@@ -11326,15 +11498,36 @@
1132611498
1132711499 static boolean zoomonce = false;
1132811500
11501
+ static void CreateSelectedPoint()
11502
+ {
11503
+ if (selectedpoint == null)
11504
+ {
11505
+ debugpointG = new Sphere();
11506
+ debugpointP = new Sphere();
11507
+ debugpointC = new Sphere();
11508
+ debugpointR = new Sphere();
11509
+
11510
+ selectedpoint = new Superellipsoid();
11511
+
11512
+ for (int i=0; i<8; i++)
11513
+ {
11514
+ debugpoints[i] = new Sphere();
11515
+ }
11516
+ }
11517
+ }
11518
+
1132911519 void DrawObject(GL gl, boolean draw)
1133011520 {
11521
+ // To clear camera values
11522
+ ResetOptions();
11523
+
1133111524 //System.out.println("DRAW OBJECT " + mouseDown);
1133211525 // DrawMode() = SELECTION;
1133311526 //GL gl = getGL();
1133411527 if ((TRACK || SHADOWTRACK) || zoomonce)
1133511528 {
1133611529 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11337
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11530
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1133811531 pingthread.StepToTarget(true); // true);
1133911532 // zoomonce = false;
1134011533 }
....@@ -11406,8 +11599,9 @@
1140611599
1140711600 if (DrawMode() == DEFAULT)
1140811601 {
11409
- if (DEBUG)
11602
+ if (Globals.DEBUG)
1141011603 {
11604
+ CreateSelectedPoint();
1141111605 float radius = 0.05f;
1141211606 if (selectedpoint.radius != radius)
1141311607 {
....@@ -11912,7 +12106,7 @@
1191212106 }
1191312107
1191412108 //for (int count = parentcam.GetTransformCount(); --count>=0;)
11915
- LA.xformPos(light, parentcam.GlobalTransformInv(), light); // may 2013
12109
+ LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013
1191612110
1191712111 LA.xformPos(light, renderCamera.toScreen, light);
1191812112
....@@ -13164,7 +13358,8 @@
1316413358 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1316513359 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1316613360 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13167
- Object3D.cVector2[] vector2buffer;
13361
+
13362
+ //Object3D.cVector2[] vector2buffer;
1316813363
1316913364 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1317013365 // OUT : diff, spec
....@@ -13180,9 +13375,10 @@
1318013375 "DP3 " + dest + ".z," + "normals," + "eye;" +
1318113376 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1318213377 //"MOV " + dest + ".w," + "normal.z;" +
13183
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13184
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13185
- //"MOV " + dest + ".z," + "params2.w;" +
13378
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13379
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13380
+
13381
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1318613382 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1318713383 "RCP " + dest + ".w," + dest + ".w;" +
1318813384 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13687,6 +13883,7 @@
1368713883 else
1368813884 if (evt.getSource() == AAtimer)
1368913885 {
13886
+ Globals.TIMERRUNNING = false;
1369013887 if (mouseDown)
1369113888 {
1369213889 //new Exception().printStackTrace();
....@@ -13746,7 +13943,7 @@
1374613943
1374713944 // fev 2014???
1374813945 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13749
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13946
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1375013947 pingthread.StepToTarget(true); // true);
1375113948 }
1375213949 // if (!LIVE)
....@@ -13761,6 +13958,7 @@
1376113958 return;
1376213959
1376313960 AAtimer.restart(); //
13961
+ Globals.TIMERRUNNING = true;
1376413962
1376513963 // waslive = LIVE;
1376613964 // LIVE = false;
....@@ -13833,6 +14031,8 @@
1383314031
1383414032 public void mouseDragged(MouseEvent e)
1383514033 {
14034
+ Globals.MOUSEDRAGGED = true;
14035
+
1383614036 //System.out.println("mouseDragged: " + e);
1383714037 if (isRenderer)
1383814038 movingcamera = true;
....@@ -14097,12 +14297,12 @@
1409714297 void GoDown(int mod)
1409814298 {
1409914299 MODIFIERS |= COMMAND;
14100
- /*
14300
+ /**/
1410114301 if((mod&SHIFT) == SHIFT)
1410214302 manipCamera.RotatePosition(0, -speed);
1410314303 else
14104
- manipCamera.BackForth(0, -speed*delta, getWidth());
14105
- */
14304
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14305
+ /**/
1410614306 if ((mod & SHIFT) == SHIFT)
1410714307 {
1410814308 mouseMode = mouseMode; // VR??
....@@ -14118,12 +14318,12 @@
1411814318 void GoUp(int mod)
1411914319 {
1412014320 MODIFIERS |= COMMAND;
14121
- /*
14321
+ /**/
1412214322 if((mod&SHIFT) == SHIFT)
1412314323 manipCamera.RotatePosition(0, speed);
1412414324 else
14125
- manipCamera.BackForth(0, speed*delta, getWidth());
14126
- */
14325
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14326
+ /**/
1412714327 if ((mod & SHIFT) == SHIFT)
1412814328 {
1412914329 mouseMode = mouseMode;
....@@ -14139,12 +14339,12 @@
1413914339 void GoLeft(int mod)
1414014340 {
1414114341 MODIFIERS |= COMMAND;
14142
- /*
14342
+ /**/
1414314343 if((mod&SHIFT) == SHIFT)
14144
- manipCamera.RotatePosition(speed, 0);
14145
- else
1414614344 manipCamera.Translate(speed*delta, 0, getWidth());
14147
- */
14345
+ else
14346
+ manipCamera.RotatePosition(speed, 0);
14347
+ /**/
1414814348 if ((mod & SHIFT) == SHIFT)
1414914349 {
1415014350 mouseMode = mouseMode;
....@@ -14160,12 +14360,12 @@
1416014360 void GoRight(int mod)
1416114361 {
1416214362 MODIFIERS |= COMMAND;
14163
- /*
14363
+ /**/
1416414364 if((mod&SHIFT) == SHIFT)
14165
- manipCamera.RotatePosition(-speed, 0);
14166
- else
1416714365 manipCamera.Translate(-speed*delta, 0, getWidth());
14168
- */
14366
+ else
14367
+ manipCamera.RotatePosition(-speed, 0);
14368
+ /**/
1416914369 if ((mod & SHIFT) == SHIFT)
1417014370 {
1417114371 mouseMode = mouseMode;
....@@ -14222,7 +14422,8 @@
1422214422 info.camera = renderCamera;
1422314423 info.x = x;
1422414424 info.y = y;
14225
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14425
+ object.GetWindow().copy
14426
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1422614427 } else
1422714428 {
1422814429 if (x < startX)
....@@ -14386,7 +14587,9 @@
1438614587 ci.camera = renderCamera;
1438714588 if (!isRenderer)
1438814589 {
14389
- if (object.editWindow.copy.doEditClick(ci, 0))
14590
+ //ObjEditor editWindow = object.editWindow;
14591
+ //Object3D copy = editWindow.copy;
14592
+ if (object.doEditClick(ci, 0))
1439014593 {
1439114594 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1439214595 } else
....@@ -14398,8 +14601,11 @@
1439814601
1439914602 public void mouseReleased(MouseEvent e)
1440014603 {
14604
+ Globals.MOUSEDRAGGED = false;
14605
+
1440114606 movingcamera = false;
14402
- X = Y = 0;
14607
+ X = 0; // getBounds().width/2;
14608
+ Y = 0; // getBounds().height/2;
1440314609 //System.out.println("mouseReleased: " + e);
1440414610 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1440514611 }
....@@ -14740,7 +14946,9 @@
1474014946 case 'E' : COMPACT ^= true;
1474114947 repaint();
1474214948 break;
14743
- case 'W' : DEBUGHSB ^= true;
14949
+ case 'W' : // Wide Window (fullscreen)
14950
+ //DEBUGHSB ^= true;
14951
+ ObjEditor.theFrame.ToggleFullScreen();
1474414952 repaint();
1474514953 break;
1474614954 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14765,8 +14973,8 @@
1476514973 RevertCamera();
1476614974 repaint();
1476714975 break;
14768
- case 'L':
1476914976 case 'l':
14977
+ //case 'L':
1477014978 if (lightMode)
1477114979 {
1477214980 lightMode = false;
....@@ -14909,9 +15117,9 @@
1490915117 case '_':
1491015118 kompactbit = 5;
1491115119 break;
14912
- case '+':
14913
- kompactbit = 6;
14914
- break;
15120
+// case '+':
15121
+// kompactbit = 6;
15122
+// break;
1491515123 case ' ':
1491615124 lightMode ^= true;
1491715125 Globals.lighttouched = true;
....@@ -14923,6 +15131,7 @@
1492315131 case ESC:
1492415132 RENDERPROGRAM += 1;
1492515133 RENDERPROGRAM %= 3;
15134
+
1492615135 repaint();
1492715136 break;
1492815137 case 'Z':
....@@ -14962,8 +15171,9 @@
1496215171 case DELETE:
1496315172 ClearSelection();
1496415173 break;
14965
- /*
1496615174 case '+':
15175
+
15176
+ /*
1496715177 //fontsize += 1;
1496815178 bbzoom *= 2;
1496915179 repaint();
....@@ -14980,17 +15190,17 @@
1498015190 case '=':
1498115191 IncDepth();
1498215192 //fontsize += 1;
14983
- object.editWindow.refreshContents(true);
15193
+ object.GetWindow().refreshContents(true);
1498415194 maskbit = 6;
1498515195 break;
1498615196 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1498715197 DecDepth();
1498815198 maskbit = 5;
1498915199 //if(fontsize > 1) fontsize -= 1;
14990
- if (object.editWindow == null)
14991
- new Exception().printStackTrace();
14992
- else
14993
- object.editWindow.refreshContents(true);
15200
+// if (object.editWindow == null)
15201
+// new Exception().printStackTrace();
15202
+// else
15203
+ object.GetWindow().refreshContents(true);
1499415204 break;
1499515205 case '{':
1499615206 manipCamera.shaper_fovy /= 1.1;
....@@ -15214,7 +15424,7 @@
1521415424 }
1521515425 */
1521615426
15217
- object.editWindow.EditSelection();
15427
+ object.GetWindow().EditSelection(false);
1521815428 }
1521915429
1522015430 void SelectParent()
....@@ -15231,10 +15441,10 @@
1523115441 {
1523215442 //selectees.remove(i);
1523315443 System.out.println("select parent of " + elem);
15234
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15444
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1523515445 } else
1523615446 {
15237
- group.editWindow.Select(elem.GetTreePath(), first, true);
15447
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1523815448 }
1523915449
1524015450 first = false;
....@@ -15276,12 +15486,12 @@
1527615486 for (int j = 0; j < group.children.size(); j++)
1527715487 {
1527815488 elem = (Object3D) group.children.elementAt(j);
15279
- object.editWindow.Select(elem.GetTreePath(), first, true);
15489
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1528015490 first = false;
1528115491 }
1528215492 } else
1528315493 {
15284
- object.editWindow.Select(elem.GetTreePath(), first, true);
15494
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1528515495 }
1528615496
1528715497 first = false;
....@@ -15292,21 +15502,21 @@
1529215502 {
1529315503 //Composite group = (Composite) object;
1529415504 Object3D group = object;
15295
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15505
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1529615506 }
1529715507
1529815508 void ResetTransform(int mask)
1529915509 {
1530015510 //Composite group = (Composite) object;
1530115511 Object3D group = object;
15302
- group.editWindow.ResetTransform(mask);
15512
+ group.GetWindow().ResetTransform(mask);
1530315513 }
1530415514
1530515515 void FlipTransform()
1530615516 {
1530715517 //Composite group = (Composite) object;
1530815518 Object3D group = object;
15309
- group.editWindow.FlipTransform();
15519
+ group.GetWindow().FlipTransform();
1531015520 // group.editWindow.ReduceMesh(true);
1531115521 }
1531215522
....@@ -15314,7 +15524,7 @@
1531415524 {
1531515525 //Composite group = (Composite) object;
1531615526 Object3D group = object;
15317
- group.editWindow.PrintMemory();
15527
+ group.GetWindow().PrintMemory();
1531815528 // group.editWindow.ReduceMesh(true);
1531915529 }
1532015530
....@@ -15322,7 +15532,7 @@
1532215532 {
1532315533 //Composite group = (Composite) object;
1532415534 Object3D group = object;
15325
- group.editWindow.ResetCentroid();
15535
+ group.GetWindow().ResetCentroid();
1532615536 }
1532715537
1532815538 void IncDepth()
....@@ -15507,18 +15717,42 @@
1550715717 */
1550815718 if (!isRenderer)
1550915719 {
15510
- object.drawEditHandles(info, 0);
15511
-
15512
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15720
+ if (object.selection.Size() > 0)
1551315721 {
15514
- switch (object.selection.get(0).hitSomething)
15722
+ int hitSomething = object.selection.get(0).hitSomething;
15723
+
15724
+ info.DX = 0;
15725
+ info.DY = 0;
15726
+ info.W = 1;
15727
+ if (hitSomething == Object3D.hitCenter)
1551515728 {
15516
- case Object3D.hitCenter: gr.setColor(Color.pink); break;
15517
- case Object3D.hitRotate: gr.setColor(Color.green); break;
15518
- case Object3D.hitScale: gr.setColor(Color.cyan); break;
15729
+ info.DX = X;
15730
+ if (X != 0)
15731
+ info.DX -= info.bounds.width/2;
15732
+
15733
+ info.DY = Y;
15734
+ if (Y != 0)
15735
+ info.DY -= info.bounds.height/2;
1551915736 }
15520
-
15521
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15737
+
15738
+ object.drawEditHandles(info, 0);
15739
+
15740
+ if (drag && (X != 0 || Y != 0))
15741
+ {
15742
+ switch (hitSomething)
15743
+ {
15744
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15745
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15746
+ break;
15747
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15748
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15749
+ break;
15750
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15751
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15752
+ break;
15753
+ }
15754
+
15755
+ }
1552215756 }
1552315757 }
1552415758 }
....@@ -16221,16 +16455,16 @@
1622116455 cStatic.objectstack[materialdepth++] = checker;
1622216456 //System.out.println("material " + material);
1622316457 //Applet3D.tracein(this, selected);
16224
- vector2buffer = checker.projectedVertices;
16458
+ //vector2buffer = checker.projectedVertices;
1622516459
1622616460 //checker.GetMaterial().Draw(this, false); // true);
16227
- DrawMaterial(checker.GetMaterial(), false); // true);
16461
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1622816462
1622916463 materialdepth -= 1;
1623016464 if (materialdepth > 0)
1623116465 {
16232
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16233
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16466
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16467
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1623416468 }
1623516469 //checker.GetMaterial().opacity = 1f;
1623616470 ////checker.GetMaterial().ambient = 1f;
....@@ -16454,6 +16688,8 @@
1645416688 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1645516689 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1645616690
16691
+ CreateSelectedPoint();
16692
+
1645716693 // Will fit the mesh !!!
1645816694 selectedpoint.toParent[0][0] = 0.0001;
1645916695 selectedpoint.toParent[1][1] = 0.0001;
....@@ -16507,7 +16743,7 @@
1650716743 }
1650816744
1650916745 if (!movingcamera && !PAINTMODE)
16510
- object.editWindow.ScreenFitPoint(); // fev 2014
16746
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1651116747
1651216748 if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1651316749 {
....@@ -16519,17 +16755,17 @@
1651916755
1652016756 group.add(paintobj); // link
1652116757
16522
- object.editWindow.SnapObject(group);
16758
+ object.GetWindow().SnapObject(group);
1652316759
16524
- Object3D folder = object.editWindow.copy;
16760
+ Object3D folder = object.GetWindow().copy;
1652516761
16526
- if (object.editWindow.copy.selection.Size() > 0)
16527
- folder = object.editWindow.copy.selection.elementAt(0);
16762
+ if (object.GetWindow().copy.selection.Size() > 0)
16763
+ folder = object.GetWindow().copy.selection.elementAt(0);
1652816764
1652916765 folder.add(group);
1653016766
16531
- object.editWindow.ResetModel();
16532
- object.editWindow.refreshContents();
16767
+ object.GetWindow().ResetModel();
16768
+ object.GetWindow().refreshContents();
1653316769 }
1653416770 else
1653516771 paintcount = 0;
....@@ -16568,6 +16804,11 @@
1656816804 //System.out.println("objects[color] = " + objects[color]);
1656916805 //objects[color].Select();
1657016806 indexcount = 0;
16807
+ ObjEditor window = object.GetWindow();
16808
+ if (window != null && deselect)
16809
+ {
16810
+ window.Select(null, deselect, true);
16811
+ }
1657116812 object.Select(color, deselect);
1657216813 }
1657316814
....@@ -17093,23 +17334,15 @@
1709317334 int AAbuffersize = 0;
1709417335
1709517336 //double[] selectedpoint = new double[3];
17096
- static Superellipsoid selectedpoint = new Superellipsoid();
17337
+ static Superellipsoid selectedpoint;
1709717338 static Sphere previousselectedpoint = null;
17098
- static Sphere debugpointG = new Sphere();
17099
- static Sphere debugpointP = new Sphere();
17100
- static Sphere debugpointC = new Sphere();
17101
- static Sphere debugpointR = new Sphere();
17339
+ static Sphere debugpointG;
17340
+ static Sphere debugpointP;
17341
+ static Sphere debugpointC;
17342
+ static Sphere debugpointR;
1710217343
1710317344 static Sphere debugpoints[] = new Sphere[8];
1710417345
17105
- static
17106
- {
17107
- for (int i=0; i<8; i++)
17108
- {
17109
- debugpoints[i] = new Sphere();
17110
- }
17111
- }
17112
-
1711317346 static void InitPoints(float radius)
1711417347 {
1711517348 for (int i=0; i<8; i++)