Normand Briere
2019-06-17 e36047725ce3217618d4e5807ac7c8769b9e3598
CameraPane.java
....@@ -1890,7 +1890,7 @@
18901890 void PushMatrix(double[][] matrix)
18911891 {
18921892 // GrafreeD.tracein(matrix);
1893
- PushMatrix(matrix,1);
1893
+ PushMatrix(matrix, 1);
18941894 }
18951895
18961896 void PushMatrix()
....@@ -7921,6 +7921,64 @@
79217921 ReleaseTexture(pigment, false);
79227922 }
79237923
7924
+ public void ReleasePigmentTexture(cTexture tex) // INTERFACE
7925
+ {
7926
+ if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
7927
+ {
7928
+ return;
7929
+ }
7930
+
7931
+ if (tex == null)
7932
+ {
7933
+ ReleaseTexture(null, false);
7934
+ return;
7935
+ }
7936
+
7937
+ String pigment = Object3D.GetPigment(tex);
7938
+
7939
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7940
+ {
7941
+ // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
7942
+ // System.out.println("; bump = " + bump);
7943
+ }
7944
+
7945
+ if (pigment.equals(""))
7946
+ {
7947
+ pigment = null;
7948
+ }
7949
+
7950
+ ReleaseTexture(pigment, false);
7951
+ }
7952
+
7953
+ public void ReleaseBumpTexture(cTexture tex) // INTERFACE
7954
+ {
7955
+ if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
7956
+ {
7957
+ return;
7958
+ }
7959
+
7960
+ if (tex == null)
7961
+ {
7962
+ ReleaseTexture(null, true);
7963
+ return;
7964
+ }
7965
+
7966
+ String bump = Object3D.GetBump(tex);
7967
+
7968
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7969
+ {
7970
+ // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
7971
+ // System.out.println("; bump = " + bump);
7972
+ }
7973
+
7974
+ if (bump.equals(""))
7975
+ {
7976
+ bump = null;
7977
+ }
7978
+
7979
+ ReleaseTexture(bump, true);
7980
+ }
7981
+
79247982 void ReleaseTexture(String tex, boolean bump)
79257983 {
79267984 if (// DrawMode() != 0 || /*tex == null ||*/
....@@ -8067,6 +8125,73 @@
80678125 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
80688126
80698127 return; // true;
8128
+ }
8129
+
8130
+ /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
8131
+ {
8132
+ if (// DrawMode() != 0 || /*tex == null ||*/
8133
+ ambientOcclusion ) // || !textureon)
8134
+ {
8135
+ return; // false;
8136
+ }
8137
+
8138
+ if (tex == null)
8139
+ {
8140
+ BindTexture(null,false,resolution);
8141
+ return;
8142
+ }
8143
+
8144
+ String pigment = Object3D.GetPigment(tex);
8145
+
8146
+ usedtextures.put(pigment, pigment);
8147
+
8148
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8149
+ {
8150
+ // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8151
+ // System.out.println("; bump = " + bump);
8152
+ }
8153
+
8154
+ if (pigment.equals(""))
8155
+ {
8156
+ pigment = null;
8157
+ }
8158
+
8159
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8160
+ BindTexture(pigment, false, resolution);
8161
+ }
8162
+
8163
+ /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
8164
+ {
8165
+ if (// DrawMode() != 0 || /*tex == null ||*/
8166
+ ambientOcclusion ) // || !textureon)
8167
+ {
8168
+ return; // false;
8169
+ }
8170
+
8171
+ if (tex == null)
8172
+ {
8173
+ BindTexture(null,true,resolution);
8174
+ return;
8175
+ }
8176
+
8177
+ String bump = Object3D.GetBump(tex);
8178
+
8179
+ usedtextures.put(bump, bump);
8180
+
8181
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8182
+ {
8183
+ // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8184
+ // System.out.println("; bump = " + bump);
8185
+ }
8186
+
8187
+ if (bump.equals(""))
8188
+ {
8189
+ bump = null;
8190
+ }
8191
+
8192
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8193
+ BindTexture(bump, true, resolution);
8194
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
80708195 }
80718196
80728197 java.util.HashSet<String> missingTextures = new java.util.HashSet<String>();
....@@ -9335,7 +9460,7 @@
93359460
93369461 if (renderCamera != lightCamera)
93379462 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9338
- LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
9463
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
93399464
93409465 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
93419466
....@@ -9351,7 +9476,7 @@
93519476
93529477 if (renderCamera != lightCamera)
93539478 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9354
- LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
9479
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
93559480
93569481 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
93579482
....@@ -10550,7 +10675,7 @@
1055010675 // if (parentcam != renderCamera) // not a light
1055110676 if (cam != lightCamera)
1055210677 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10553
- LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
10678
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
1055410679
1055510680 for (int j = 0; j < 4; j++)
1055610681 {
....@@ -10565,7 +10690,7 @@
1056510690 // if (parentcam != renderCamera) // not a light
1056610691 if (cam != lightCamera)
1056710692 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10568
- LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
10693
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
1056910694
1057010695 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1057110696
....@@ -10959,7 +11084,7 @@
1095911084
1096011085 // if (cam != lightCamera)
1096111086 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10962
- LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013
11087
+ LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
1096311088 }
1096411089
1096511090 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -10981,7 +11106,7 @@
1098111106 {
1098211107 if (cam != lightCamera)
1098311108 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10984
- LA.xformDir(light0, parentcam.GlobalTransformInv(), light0); // may 2013
11109
+ LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013
1098511110 }
1098611111
1098711112 LA.xformPos(light0, cam.toScreen, light0);
....@@ -11894,7 +12019,7 @@
1189412019 for (int i = tp.size(); --i >= 0;)
1189512020 {
1189612021 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
11897
- LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
12022
+ LA.xformPos(light, tp.get(i).GlobalTransform(), light);
1189812023 }
1189912024
1190012025
....@@ -11912,7 +12037,7 @@
1191212037 }
1191312038
1191412039 //for (int count = parentcam.GetTransformCount(); --count>=0;)
11915
- LA.xformPos(light, parentcam.GlobalTransformInv(), light); // may 2013
12040
+ LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013
1191612041
1191712042 LA.xformPos(light, renderCamera.toScreen, light);
1191812043
....@@ -13833,6 +13958,8 @@
1383313958
1383413959 public void mouseDragged(MouseEvent e)
1383513960 {
13961
+ Globals.MOUSEDRAGGED = true;
13962
+
1383613963 //System.out.println("mouseDragged: " + e);
1383713964 if (isRenderer)
1383813965 movingcamera = true;
....@@ -14398,6 +14525,8 @@
1439814525
1439914526 public void mouseReleased(MouseEvent e)
1440014527 {
14528
+ Globals.MOUSEDRAGGED = false;
14529
+
1440114530 movingcamera = false;
1440214531 X = Y = 0;
1440314532 //System.out.println("mouseReleased: " + e);
....@@ -15513,12 +15642,17 @@
1551315642 {
1551415643 switch (object.selection.get(0).hitSomething)
1551515644 {
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;
15645
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15646
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15647
+ break;
15648
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15649
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15650
+ break;
15651
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15652
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15653
+ break;
1551915654 }
1552015655
15521
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1552215656 }
1552315657 }
1552415658 }