.. | .. |
---|
326 | 326 | cStatic.objectstack[materialdepth++] = obj; |
---|
327 | 327 | //System.out.println("material " + material); |
---|
328 | 328 | //Applet3D.tracein(this, selected); |
---|
329 | | - display.vector2buffer = obj.projectedVertices; |
---|
| 329 | + //display.vector2buffer = obj.projectedVertices; |
---|
330 | 330 | if (obj instanceof Camera) |
---|
331 | 331 | { |
---|
332 | 332 | display.options1[0] = material.shift; |
---|
.. | .. |
---|
335 | 335 | display.options1[2] = material.shadowbias; |
---|
336 | 336 | display.options1[3] = material.aniso; |
---|
337 | 337 | 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]); |
---|
338 | 343 | display.options2[0] = material.opacity; |
---|
339 | 344 | display.options2[1] = material.diffuse; |
---|
340 | 345 | 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]); |
---|
341 | 349 | |
---|
342 | 350 | 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]); |
---|
343 | 354 | display.options4[0] = material.cameralight/0.2f; |
---|
344 | 355 | display.options4[1] = material.subsurface; |
---|
345 | 356 | 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]); |
---|
346 | 360 | |
---|
347 | 361 | // if (display.CURRENTANTIALIAS > 0) |
---|
348 | 362 | // display.options3[3] /= 4; |
---|
.. | .. |
---|
358 | 372 | /**/ |
---|
359 | 373 | } else |
---|
360 | 374 | { |
---|
361 | | - DrawMaterial(material, selected); |
---|
| 375 | + DrawMaterial(material, selected, obj.projectedVertices); |
---|
362 | 376 | } |
---|
363 | 377 | } else |
---|
364 | 378 | { |
---|
.. | .. |
---|
382 | 396 | cStatic.objectstack[materialdepth++] = obj; |
---|
383 | 397 | //System.out.println("material " + material); |
---|
384 | 398 | //Applet3D.tracein("selected ", selected); |
---|
385 | | - display.vector2buffer = obj.projectedVertices; |
---|
386 | | - display.DrawMaterial(material, selected); |
---|
| 399 | + //display.vector2buffer = obj.projectedVertices; |
---|
| 400 | + display.DrawMaterial(material, selected, obj.projectedVertices); |
---|
387 | 401 | } |
---|
388 | 402 | } |
---|
389 | 403 | |
---|
.. | .. |
---|
400 | 414 | materialdepth -= 1; |
---|
401 | 415 | if (materialdepth > 0) |
---|
402 | 416 | { |
---|
403 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
404 | | - 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); |
---|
405 | 419 | } |
---|
406 | 420 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
407 | 421 | } else if (selected && CameraPane.flash && obj.GetMaterial() != null) |
---|
.. | .. |
---|
421 | 435 | materialdepth -= 1; |
---|
422 | 436 | if (materialdepth > 0) |
---|
423 | 437 | { |
---|
424 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
425 | | - 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); |
---|
426 | 440 | } |
---|
427 | 441 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
428 | 442 | //else |
---|
.. | .. |
---|
1610 | 1624 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1611 | 1625 | } |
---|
1612 | 1626 | |
---|
1613 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1627 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1614 | 1628 | { |
---|
1615 | 1629 | CameraPane display = this; |
---|
1616 | 1630 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1645 | 1659 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1646 | 1660 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1647 | 1661 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1648 | | - colorV[3] = material.opacity; |
---|
| 1662 | + colorV[3] = 1; // material.opacity; |
---|
1649 | 1663 | |
---|
1650 | 1664 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1651 | 1665 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1753 | 1767 | display.modelParams7[2] = 0; |
---|
1754 | 1768 | display.modelParams7[3] = 0; |
---|
1755 | 1769 | |
---|
1756 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1770 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1757 | 1771 | |
---|
1758 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1772 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1759 | 1773 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1760 | 1774 | { |
---|
1761 | 1775 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
9366 | 9380 | jy8[3] = 0.5f; |
---|
9367 | 9381 | } |
---|
9368 | 9382 | |
---|
9369 | | - 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 |
---|
9370 | 9384 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9371 | 9385 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9372 | 9386 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9373 | 9387 | |
---|
| 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 | + |
---|
9374 | 9412 | static int imagecount = 0; // movie generation |
---|
9375 | 9413 | |
---|
9376 | 9414 | static int jitter = 0; |
---|
.. | .. |
---|
10481 | 10519 | ANTIALIAS = 0; |
---|
10482 | 10520 | //System.out.println("RESTART"); |
---|
10483 | 10521 | AAtimer.restart(); |
---|
| 10522 | + Globals.TIMERRUNNING = true; |
---|
10484 | 10523 | } |
---|
10485 | 10524 | } |
---|
10486 | 10525 | } |
---|
.. | .. |
---|
10548 | 10587 | ambientOcclusion = false; |
---|
10549 | 10588 | } |
---|
10550 | 10589 | |
---|
10551 | | - if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
| 10590 | + if (//Globals.lighttouched && |
---|
| 10591 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10552 | 10592 | { |
---|
10553 | 10593 | //if (RENDERSHADOW) // ? |
---|
10554 | 10594 | if (!IsFrozen()) |
---|
.. | .. |
---|
11458 | 11498 | |
---|
11459 | 11499 | static boolean zoomonce = false; |
---|
11460 | 11500 | |
---|
11461 | | - void CreateSelectedPoint() |
---|
| 11501 | + static void CreateSelectedPoint() |
---|
11462 | 11502 | { |
---|
11463 | 11503 | if (selectedpoint == null) |
---|
11464 | 11504 | { |
---|
.. | .. |
---|
11478 | 11518 | |
---|
11479 | 11519 | void DrawObject(GL gl, boolean draw) |
---|
11480 | 11520 | { |
---|
| 11521 | + // To clear camera values |
---|
| 11522 | + ResetOptions(); |
---|
| 11523 | + |
---|
11481 | 11524 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11482 | 11525 | // DrawMode() = SELECTION; |
---|
11483 | 11526 | //GL gl = getGL(); |
---|
.. | .. |
---|
12045 | 12088 | for (int i = tp.size(); --i >= 0;) |
---|
12046 | 12089 | { |
---|
12047 | 12090 | //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
12048 | | - LA.xformPos(light, tp.get(i).GlobalTransform(), light); |
---|
| 12091 | + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); |
---|
12049 | 12092 | } |
---|
12050 | 12093 | |
---|
12051 | 12094 | |
---|
.. | .. |
---|
13315 | 13358 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13316 | 13359 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13317 | 13360 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13318 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13361 | + |
---|
| 13362 | + //Object3D.cVector2[] vector2buffer; |
---|
13319 | 13363 | |
---|
13320 | 13364 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13321 | 13365 | // OUT : diff, spec |
---|
.. | .. |
---|
13331 | 13375 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13332 | 13376 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13333 | 13377 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13334 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13335 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13336 | | - //"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 |
---|
13337 | 13382 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13338 | 13383 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13339 | 13384 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13838 | 13883 | else |
---|
13839 | 13884 | if (evt.getSource() == AAtimer) |
---|
13840 | 13885 | { |
---|
| 13886 | + Globals.TIMERRUNNING = false; |
---|
13841 | 13887 | if (mouseDown) |
---|
13842 | 13888 | { |
---|
13843 | 13889 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13912 | 13958 | return; |
---|
13913 | 13959 | |
---|
13914 | 13960 | AAtimer.restart(); // |
---|
| 13961 | + Globals.TIMERRUNNING = true; |
---|
13915 | 13962 | |
---|
13916 | 13963 | // waslive = LIVE; |
---|
13917 | 13964 | // LIVE = false; |
---|
.. | .. |
---|
14375 | 14422 | info.camera = renderCamera; |
---|
14376 | 14423 | info.x = x; |
---|
14377 | 14424 | info.y = y; |
---|
14378 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14425 | + object.GetWindow().copy |
---|
| 14426 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14379 | 14427 | } else |
---|
14380 | 14428 | { |
---|
14381 | 14429 | if (x < startX) |
---|
.. | .. |
---|
14539 | 14587 | ci.camera = renderCamera; |
---|
14540 | 14588 | if (!isRenderer) |
---|
14541 | 14589 | { |
---|
14542 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14590 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14591 | + //Object3D copy = editWindow.copy; |
---|
| 14592 | + if (object.doEditClick(ci, 0)) |
---|
14543 | 14593 | { |
---|
14544 | 14594 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14545 | 14595 | } else |
---|
.. | .. |
---|
15070 | 15120 | case '_': |
---|
15071 | 15121 | kompactbit = 5; |
---|
15072 | 15122 | break; |
---|
15073 | | - case '+': |
---|
15074 | | - kompactbit = 6; |
---|
15075 | | - break; |
---|
| 15123 | +// case '+': |
---|
| 15124 | +// kompactbit = 6; |
---|
| 15125 | +// break; |
---|
15076 | 15126 | case ' ': |
---|
15077 | 15127 | ObjEditor.theFrame.ToggleFullScreen(); |
---|
15078 | 15128 | repaint(); |
---|
.. | .. |
---|
15121 | 15171 | case DELETE: |
---|
15122 | 15172 | ClearSelection(); |
---|
15123 | 15173 | break; |
---|
15124 | | - /* |
---|
15125 | 15174 | case '+': |
---|
| 15175 | + |
---|
| 15176 | + /* |
---|
15126 | 15177 | //fontsize += 1; |
---|
15127 | 15178 | bbzoom *= 2; |
---|
15128 | 15179 | repaint(); |
---|
.. | .. |
---|
15373 | 15424 | } |
---|
15374 | 15425 | */ |
---|
15375 | 15426 | |
---|
15376 | | - object.editWindow.EditSelection(); |
---|
| 15427 | + object.editWindow.EditSelection(false); |
---|
15377 | 15428 | } |
---|
15378 | 15429 | |
---|
15379 | 15430 | void SelectParent() |
---|
.. | .. |
---|
16385 | 16436 | cStatic.objectstack[materialdepth++] = checker; |
---|
16386 | 16437 | //System.out.println("material " + material); |
---|
16387 | 16438 | //Applet3D.tracein(this, selected); |
---|
16388 | | - vector2buffer = checker.projectedVertices; |
---|
| 16439 | + //vector2buffer = checker.projectedVertices; |
---|
16389 | 16440 | |
---|
16390 | 16441 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16391 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16442 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16392 | 16443 | |
---|
16393 | 16444 | materialdepth -= 1; |
---|
16394 | 16445 | if (materialdepth > 0) |
---|
16395 | 16446 | { |
---|
16396 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16397 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16447 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16448 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16398 | 16449 | } |
---|
16399 | 16450 | //checker.GetMaterial().opacity = 1f; |
---|
16400 | 16451 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16618 | 16669 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16619 | 16670 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
16620 | 16671 | |
---|
| 16672 | + CreateSelectedPoint(); |
---|
| 16673 | + |
---|
16621 | 16674 | // Will fit the mesh !!! |
---|
16622 | 16675 | selectedpoint.toParent[0][0] = 0.0001; |
---|
16623 | 16676 | selectedpoint.toParent[1][1] = 0.0001; |
---|
.. | .. |
---|
16732 | 16785 | //System.out.println("objects[color] = " + objects[color]); |
---|
16733 | 16786 | //objects[color].Select(); |
---|
16734 | 16787 | indexcount = 0; |
---|
| 16788 | + ObjEditor window = object.GetWindow(); |
---|
| 16789 | + if (window != null && deselect) |
---|
| 16790 | + { |
---|
| 16791 | + window.Select(null, deselect, true); |
---|
| 16792 | + } |
---|
16735 | 16793 | object.Select(color, deselect); |
---|
16736 | 16794 | } |
---|
16737 | 16795 | |
---|