BiparamEditor.java | ●●●●● patch | view | raw | blame | history | |
BoundaryRep.java | ●●●●● patch | view | raw | blame | history | |
CameraPane.java | ●●●●● patch | view | raw | blame | history | |
Checker.java | ●●●●● patch | view | raw | blame | history | |
CheckerIG.java | ●●●●● patch | view | raw | blame | history | |
CheckerInterface.java | ●●●●● patch | view | raw | blame | history | |
GroupEditor.java | ●●●●● patch | view | raw | blame | history | |
HeightField.java | ●●●●● patch | view | raw | blame | history | |
KDNode.java | ●●●●● patch | view | raw | blame | history | |
KDTree.java | ●●●●● patch | view | raw | blame | history | |
Mocap.java | ●●●●● patch | view | raw | blame | history | |
ObjEditor.java | ●●●●● patch | view | raw | blame | history | |
Object3D.java | ●●●●● patch | view | raw | blame | history | |
ScriptNode.java | ●●●●● patch | view | raw | blame | history | |
Texture.java | ●●●●● patch | view | raw | blame | history | |
iHeightField.java | ●●●●● patch | view | raw | blame | history |
BiparamEditor.java
.. .. @@ -66,9 +66,9 @@ 66 66 */ 67 67 super.SetupUI2(oe); 68 68 69 - uDivsField = AddSlider(oe.ctrlPanel, "U #", biparam.minUDivs, 256+biparam.minUDivs, biparam.uDivs);69 + uDivsField = AddSlider(oe.ctrlPanel, "U #", biparam.minUDivs, 1024+biparam.minUDivs, biparam.uDivs);70 70 Return(); 71 - vDivsField = AddSlider(oe.ctrlPanel, "V #", biparam.minVDivs, 256+biparam.minVDivs, biparam.vDivs);71 + vDivsField = AddSlider(oe.ctrlPanel, "V #", biparam.minVDivs, 1024+biparam.minVDivs, biparam.vDivs);72 72 Return(); 73 73 // oe.aConstraints.gridwidth = 1; 74 74 // oe.aConstraints.fill = GridBagConstraints.VERTICAL; BoundaryRep.java
.. .. @@ -3531,7 +3531,7 @@ 3531 3531 e.printStackTrace(); 3532 3532 } 3533 3533 3534 - Trim(wastrim,true,crease,wasstrip,false);3534 + Trim(true/*wastrim*/,true,crease,wasstrip,false);3535 3535 } 3536 3536 3537 3537 void GenNormalsJME() .. .. @@ -5038,6 +5038,59 @@ 5038 5038 colors = null; 5039 5039 } 5040 5040 5041 + void CreateMesh(iHeightField hf, int x, int y)5042 + {5043 + BoundaryRep tmp = new BoundaryRep();5044 +5045 + int vc = 0;5046 +5047 + Vertex v = new Vertex(true);5048 +5049 + for (int i=0; i<x; i++)5050 + {5051 + for (int j=0; j<y; j++)5052 + {5053 +// Vertex v = tmp.GetVertex(vc++);5054 +5055 + v.s = v.x = i;5056 + v.t = v.z = j;5057 + v.s /= x; v.t /= y;5058 + v.y = hf.f(i,j);5059 +5060 + int iu = tmp.AddTableVertex(v);5061 +5062 + v.s = v.x = i+1;5063 + v.t = v.z = j;5064 + v.s /= x; v.t /= y;5065 + v.y = hf.f(i+1,j);5066 +5067 + int iv = tmp.AddTableVertex(v);5068 +5069 + v.s = v.x = i+1;5070 + v.t = v.z = j+1;5071 + v.s /= x; v.t /= y;5072 + v.y = hf.f(i+1,j+1);5073 +5074 + int iw = tmp.AddTableVertex(v);5075 +5076 + v.s = v.x = i;5077 + v.t = v.z = j+1;5078 + v.s /= x; v.t /= y;5079 + v.y = hf.f(i,j+1);5080 +5081 + int ix = tmp.AddTableVertex(v);5082 +5083 + tmp.AddFace(iu,iw,iv);5084 + tmp.AddFace(iu,ix,iw);5085 + }5086 + }5087 +5088 + Set(tmp);5089 +5090 + Trim(true,false,true);5091 + ClearColors();5092 + }5093 +5041 5094 void Stripify() 5042 5095 { 5043 5096 if (stripified) .. .. @@ -5297,18 +5350,10 @@ 5297 5350 double minweight = 1E10; 5298 5351 5299 5352 nbbadfaces = 0; 5300 - for (int i=faces.size(); (i-=8)>=0;)5353 + for (int i=0; i<faces.size(); i+=8)5354 +// for (int i=faces.size(); (i-=8)>=0;)5301 5355 { 5302 5356 Face face = (Face) faces.get(i); 5303 -5304 - //?? if (face.weight < 0)5305 - // continue;5306 -5307 - double K = 1; // 0.01; // .25;5308 -5309 - double factor = (1-K)*face.nbiterations + K; //*face.weight;5310 -5311 - double weight = FaceWeight(face); // *Math.pow(PerimeterMax(face),0.25)*factor;5312 5357 5313 5358 if (!Valid(face)) 5314 5359 { .. .. @@ -5327,10 +5372,21 @@ 5327 5372 !ValidValence(face.r)) 5328 5373 continue; 5329 5374 5375 + //?? if (face.weight < 0)5376 + // continue;5377 +5378 + double K = 1; // 0.01; // .25;5379 +5380 + double factor = (1-K)*face.nbiterations + K; //*face.weight;5381 +5382 + double weight = FaceWeight(face); // *Math.pow(PerimeterMax(face),0.25)*factor;5383 +5330 5384 if (minweight > weight) 5331 5385 { 5332 5386 minweight = weight; 5333 5387 chosen = i; 5388 + if (minweight == 0)5389 + break;5334 5390 } 5335 5391 } 5336 5392 .. .. @@ -7373,7 +7429,7 @@ 7373 7429 if (max < maxz - minz) 7374 7430 max = maxz - minz; 7375 7431 7376 - tmp.THRESHOLD = max/25; // 50;7432 + tmp.THRESHOLD = 0.5; // max/25; // 50;7377 7433 7378 7434 tmp.faces.clear(); 7379 7435 .. .. @@ -7932,6 +7988,8 @@ 7932 7988 7933 7989 minface.q = minface.r = minface.p; 7934 7990 7991 + int count = 0;7992 +7935 7993 for (int i=0; i<faces.size(); i++) 7936 7994 { 7937 7995 Face face = (Face) faces.get(i); .. .. @@ -7943,6 +8001,9 @@ 7943 8001 TouchVertex(face.r, true); // , minface.weight); 7944 8002 // assert(!lock); 7945 8003 faces.remove(i--); 8004 + count++;8005 + if (count == 4)8006 + break;7946 8007 } 7947 8008 } 7948 8009 CameraPane.java
.. .. @@ -768,6 +768,8 @@ 768 768 class CacheTexture 769 769 { 770 770 com.sun.opengl.util.texture.Texture texture; 771 + com.sun.opengl.util.texture.TextureData texturedata;772 +771 773 int resolution; 772 774 773 775 CacheTexture(com.sun.opengl.util.texture.Texture tex, int res) .. .. @@ -6451,7 +6453,7 @@ 6451 6453 return; // true; 6452 6454 } 6453 6455 6454 - com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution)6456 + CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)6455 6457 { 6456 6458 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; 6457 6459 .. .. @@ -6665,6 +6667,8 @@ 6665 6667 thetex.texture.dispose(); 6666 6668 textures.remove(texname); 6667 6669 } 6670 +6671 + texture.texturedata = texturedata;6668 6672 textures.put(texname, texture); 6669 6673 6670 6674 // newtex = true; .. .. @@ -6681,6 +6685,13 @@ 6681 6685 } 6682 6686 } 6683 6687 6688 + return texture;6689 + }6690 +6691 + com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution)6692 + {6693 + CacheTexture texture = GetCacheTexture(tex, bump, resolution);6694 +6684 6695 if (bump) 6685 6696 { 6686 6697 // GraphreeD.trace("PUSH BUMP " + tex + "(" + bumpdepth + ")" + " : " + texture); .. .. @@ -6693,6 +6704,13 @@ 6693 6704 } 6694 6705 6695 6706 return texture!=null?texture.texture:null; 6707 + }6708 +6709 + com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution)6710 + {6711 + CacheTexture texture = GetCacheTexture(tex, bump, resolution);6712 +6713 + return texture!=null?texture.texturedata:null;6696 6714 } 6697 6715 6698 6716 boolean BindTexture(String tex, boolean bump, int resolution) .. .. @@ -10253,7 +10271,7 @@ 10253 10271 return; 10254 10272 } 10255 10273 10256 - if (obj instanceof CheckerIG)10274 + if (obj instanceof Checker)10257 10275 { 10258 10276 checker = obj; 10259 10277 Checker.java
.. .. @@ -1,5 +1,26 @@ 1 -//package edu.wlu.cs.levy.CG;1 +class Checker extends Object3D2 +{3 + Checker()4 + {5 + this("Checker");6 + }7 +8 + Checker(String name)9 + {10 + super(name);11 +12 + material = new cMaterial();13 +14 + material.ambient = 100;15 + material.specular = 0.001f;16 + material.diffuse = 0.01f;17 + material.cameralight = 0.001f;18 + }2 19 3 -public interface Checker<T> {4 - public boolean usable(T v);20 + Object3D deepCopy()21 + {22 + Object3D comp = new Checker();23 + deepCopySelf(comp);24 + return comp;25 + }5 26 } CheckerIG.javadeleted file mode 100644
.. .. @@ -1,26 +0,0 @@ 1 -class CheckerIG extends Object3D2 -{3 - CheckerIG()4 - {5 - this("Checker");6 - }7 -8 - CheckerIG(String name)9 - {10 - super(name);11 -12 - material = new cMaterial();13 -14 - material.ambient = 100;15 - material.specular = 0.001f;16 - material.diffuse = 0.01f;17 - material.cameralight = 0.001f;18 - }19 -20 - Object3D deepCopy()21 - {22 - Object3D comp = new CheckerIG();23 - deepCopySelf(comp);24 - return comp;25 - }26 -}CheckerInterface.java
.. .. @@ -0,0 +1,5 @@ 1 +//package edu.wlu.cs.levy.CG;2 +3 +public interface CheckerInterface<T> {4 + public boolean usable(T v);5 +}GroupEditor.java
.. .. @@ -14,7 +14,7 @@ 14 14 15 15 //import buoy.widget.BFileChooser; 16 16 17 -class GroupEditor extends ObjEditor implements iParse, //iCallBack,17 +class GroupEditor extends ObjEditor implements //iParse, //iCallBack,18 18 ObjectUI, 19 19 Runnable, 20 20 ActionListener, .. .. @@ -188,8 +188,9 @@ 188 188 clearItem.addActionListener(this); 189 189 clearAllItem = menu.add(new MenuItem("Clear All")); 190 190 clearAllItem.addActionListener(this); 191 - menu.add("-");192 - resetMeshItem = menu.add(new MenuItem("Reset All"));191 +192 + oe.menuBar.add(menu = new Menu("Setting"));193 + resetMeshItem = menu.add(new MenuItem("Reset All"));193 194 resetMeshItem.addActionListener(this); 194 195 stepAllItem = menu.add(new MenuItem("Step All")); 195 196 stepAllItem.addActionListener(this); .. .. @@ -221,7 +222,7 @@ 221 222 setMasterItem = menu.add(new MenuItem("Set Master Mesh")); 222 223 setMasterItem.addActionListener(this); 223 224 224 - oe.menuBar.add(menu = new Menu("Object"));225 + oe.menuBar.add(menu = new Menu("Group"));225 226 grabItem = menu.add(new MenuItem("Grab")); 226 227 grabItem.addActionListener(this); 227 228 frontItem = menu.add(new MenuItem("Front")); .. .. @@ -247,7 +248,8 @@ 247 248 scriptNodeItem.addActionListener(this); 248 249 cameraItem = menu.add(new MenuItem("Camera")); 249 250 cameraItem.addActionListener(this); 250 - menu.add("-");251 +252 + oe.menuBar.add(menu = new Menu("Object"));251 253 textureItem = menu.add(new MenuItem("Texture")); 252 254 textureItem.addActionListener(this); 253 255 csgItem = menu.add(new MenuItem("CSG")); .. .. @@ -292,8 +294,6 @@ 292 294 untrimItem = menu.add(new MenuItem("Untrim")); 293 295 untrimItem.addActionListener(this); 294 296 menu.add("-"); 295 - clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));296 - clearMaterialsItem.addActionListener(this);297 297 clearColorsItem = menu.add(new MenuItem("Clear AO")); 298 298 clearColorsItem.addActionListener(this); 299 299 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals")); .. .. @@ -310,6 +310,10 @@ 310 310 smoothMeshItem.addActionListener(this); 311 311 clipMeshItem = menu.add(new MenuItem("Clip mesh")); 312 312 clipMeshItem.addActionListener(this); 313 +314 + oe.menuBar.add(menu = new Menu("Attributes"));315 + clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));316 + clearMaterialsItem.addActionListener(this);313 317 menu.add("-"); 314 318 liveleavesItem = menu.add(new MenuItem("Live Leaves")); 315 319 liveleavesItem.addActionListener(this); .. .. @@ -332,27 +336,18 @@ 332 336 flipVItem.addActionListener(this); 333 337 unflipVItem = menu.add(new MenuItem("Unflip V")); 334 338 unflipVItem.addActionListener(this); 335 - lowTexturesItem = menu.add(new MenuItem("Low Texture"));339 + lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));336 340 lowTexturesItem.addActionListener(this); 337 - normalTexturesItem = menu.add(new MenuItem("Normal Texture"));341 + normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));338 342 normalTexturesItem.addActionListener(this); 339 - highTexturesItem = menu.add(new MenuItem("High Texture"));343 + highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));340 344 highTexturesItem.addActionListener(this); 341 - veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));345 + veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));342 346 veryhighTexturesItem.addActionListener(this); 343 - maxTexturesItem = menu.add(new MenuItem("Max Texture"));347 + maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));344 348 maxTexturesItem.addActionListener(this); 345 - panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));349 + panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));346 350 panoTexturesItem.addActionListener(this); 347 - menu.add("-");348 - extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));349 - extractGeometriesItem.addActionListener(this);350 - cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));351 - cloneGeometriesItem.addActionListener(this);352 - shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));353 - shareGeometriesItem.addActionListener(this);354 - mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));355 - mergeGeometriesItem.addActionListener(this);356 351 357 352 oe.menuBar.add(menu = new Menu("Selection")); 358 353 attachPigmentItem = menu.add(new MenuItem("Attach Pigment...")); .. .. @@ -370,9 +365,31 @@ 370 365 sortbysizeItem.addActionListener(this); 371 366 sortbynameItem = menu.add(new MenuItem("Sort by name")); 372 367 sortbynameItem.addActionListener(this); 368 + menu.add("-");369 + extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));370 + extractGeometriesItem.addActionListener(this);371 + cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));372 + cloneGeometriesItem.addActionListener(this);373 + shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));374 + shareGeometriesItem.addActionListener(this);375 + mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));376 + mergeGeometriesItem.addActionListener(this);377 +373 378 oe.menuBar.add(menu = new Menu("Insert")); 374 379 buildCreateMenu(menu); 375 - oe.menuBar.add(menu = new Menu("Tools"));380 +381 +382 + oe.menuBar.add(menu = new Menu("Include"));383 + importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));384 + importGFDItem.addActionListener(this);385 + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));386 + importVRMLX3DItem.addActionListener(this);387 + importOBJItem = menu.add(new MenuItem("OBJ Object..."));388 + importOBJItem.addActionListener(this);389 + import3DSItem = menu.add(new MenuItem("3DS Object..."));390 + import3DSItem.addActionListener(this);391 +392 + oe.menuBar.add(menu = new Menu("Tools"));376 393 buildToolsMenu(menu); 377 394 } 378 395 .. .. @@ -1002,6 +1019,8 @@ 1002 1019 1003 1020 void buildCreateMenu(Menu menu) 1004 1021 { 1022 + //heightFieldItem = menu.add(new MenuItem("Height Field"));1023 + //heightFieldItem.addActionListener(this);1005 1024 gridItem = menu.add(new MenuItem("Grid")); 1006 1025 gridItem.addActionListener(this); 1007 1026 rectoidItem = menu.add(new MenuItem("Box")); .. .. @@ -1048,15 +1067,6 @@ 1048 1067 doubleItem.addActionListener(this); 1049 1068 tripleItem = menu.add(new MenuItem("Trident")); 1050 1069 tripleItem.addActionListener(this); 1051 - menu.add("-");1052 - importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));1053 - importGFDItem.addActionListener(this);1054 - importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));1055 - importVRMLX3DItem.addActionListener(this);1056 - importOBJItem = menu.add(new MenuItem("OBJ Object..."));1057 - importOBJItem.addActionListener(this);1058 - import3DSItem = menu.add(new MenuItem("3DS Object..."));1059 - import3DSItem.addActionListener(this);1060 1070 } 1061 1071 1062 1072 void buildToolsMenu(Menu menu) .. .. @@ -1068,6 +1078,8 @@ 1068 1078 menu.add("-"); 1069 1079 parseverticesItem = menu.add(new MenuItem("Multiplicity")); 1070 1080 parseverticesItem.addActionListener(this); 1081 + textureFieldItem = menu.add(new MenuItem("Texture Field"));1082 + textureFieldItem.addActionListener(this);1071 1083 alignItem = menu.add(new MenuItem("Align")); 1072 1084 alignItem.addActionListener(this); 1073 1085 mirrorItem = menu.add(new MenuItem("Mirror Poses")); .. .. @@ -1521,6 +1533,46 @@ 1521 1533 makeSomething(ragdoll); 1522 1534 //makeSomething(new VehicleDemo()); 1523 1535 } else 1536 + /*1537 + */1538 + if (event.getSource() == heightFieldItem)1539 + {1540 + Object3D obj = new Object3D();1541 +1542 + obj.CreateMaterial();1543 + obj.bRep = new BoundaryRep();1544 +1545 + obj.bRep.CreateMesh(new iHeightField()1546 + {1547 + public double f(double x, double y)1548 + {1549 + // The Mandelbrot set is represented by coloring1550 + // each point (x,y) according to the number of1551 + // iterations it takes before the while loop in1552 + // this method ends. For points that are actually1553 + // in the Mandelbrot set, or very close to it, the1554 + // count will reach the maximum value, 80. These1555 + // points will be colored purple. All other colors1556 + // represent points that are definitely NOT in the set.1557 + x -= 600;1558 + y -= 500;1559 + x /= 200;1560 + y /= 200;1561 + int count = 0;1562 + double zx = x;1563 + double zy = y;1564 + while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {1565 + double new_zx = zx*zx - zy*zy + x;1566 + zy = 2*zx*zy + y;1567 + zx = new_zx;1568 + count++;1569 + }1570 + return count; // Math.sqrt(count);1571 + }1572 + }, 1000,1000);1573 +1574 + makeSomething(obj);1575 + } else1524 1576 if (event.getSource() == gridItem) 1525 1577 { 1526 1578 makeSomething(new Grid()); .. .. @@ -1570,7 +1622,7 @@ 1570 1622 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent); 1571 1623 LA.matInvert(obj.toParent, obj.fromParent); 1572 1624 */ 1573 - makeSomething(new CheckerIG());1625 + makeSomething(new Checker());1574 1626 } else 1575 1627 if (event.getSource() == meshItem) 1576 1628 { .. .. @@ -2352,6 +2404,10 @@ 2352 2404 if (event.getSource() == parseverticesItem) 2353 2405 { 2354 2406 ParseVertices(); 2407 + } else2408 + if (event.getSource() == textureFieldItem)2409 + {2410 + TextureVertices();2355 2411 } else 2356 2412 if (event.getSource() == alignItem) 2357 2413 { .. .. @@ -3157,96 +3213,228 @@ 3157 3213 3158 3214 //Object3D buffer; 3159 3215 cVector temp = new cVector(); 3160 - BoundaryRep temprep;3161 - Object3D nodes;3162 - Vector<Vertex> vertices;3163 -3164 - public void Vertex(Object3D node, Vertex v)3165 - {3166 - vertices.add(v);3167 - nodes.addElement(node);3168 -3169 - if (temprep.GetCache(v) != null)3170 - {3171 - temprep.Remove(v);3172 - }3173 - else3174 - {3175 - temprep.Remember(v);3176 - }3177 - }3178 -3179 - public void Face(Object3D node, Face f)3180 - {3181 -3182 - }3183 -3216 +// BoundaryRep temprep;3217 +// Object3D nodes;3218 +// Vector<Vertex> vertices;3219 +//3220 +// cGroup buffer;3221 +//3222 +// public void Vertex(Object3D node, Vertex v)3223 +// {3224 +//// vertices.add(v);3225 +//// nodes.addElement(node);3226 +////3227 +//// if (temprep.GetCache(v) != null)3228 +//// {3229 +//// temprep.Remove(v);3230 +//// } else3231 +//// {3232 +//// temprep.Remember(v);3233 +//// }3234 +//3235 +// //Object3D node = nodes.get(index);3236 +// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));3237 +// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);3238 +//3239 +// LA.xformPos(temp, node.GlobalTransformInv(), temp);3240 +//3241 +// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);3242 +//3243 +// cGroup g = new cGroup();3244 +//3245 +// if (g.toParent == null)3246 +// {3247 +// g.toParent = LA.newMatrix();3248 +// g.fromParent = LA.newMatrix();3249 +// }3250 +// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);3251 +// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);3252 +//3253 +// g.add(GraphreeD.clipboard);3254 +//3255 +// buffer.add(g);3256 +// }3257 +//3258 +// public void Face(Object3D node, Face f)3259 +// {3260 +//3261 +// }3262 +//3263 +// void ParseVerticesOld() // ??3264 +// {3265 +// //if (group.selection.size() != 1)3266 +// // return;3267 +//3268 +// temprep = new BoundaryRep();3269 +// nodes = new Object3D();3270 +// vertices = new Vector<Vertex>();3271 +//3272 +// boolean epsequal = GraphreeD.epsequal;3273 +// GraphreeD.epsequal = true;3274 +//3275 +// for (int i=0; i<group.selection.size(); i++)3276 +// {3277 +// Object3D buffer = new cGroup(group.selection.get(i).name + "+");3278 +//3279 +// group.selection.get(i).Parse(3280 +//this );3281 +//3282 +// int repsize = temprep.VertexCount();3283 +// int tablesize = temprep.vertextable.size();3284 +// int nodesize = nodes.size();3285 +//3286 +// assert(vertices.size() == nodes.size());3287 +//3288 +// temprep.vertextable.elements();3289 +//3290 +// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();3291 +//3292 +// for (java.util.Map.Entry<Vertex,Vertex> entry : set)3293 +// {3294 +// cGroup g = new cGroup();3295 +//3296 +// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));3297 +//3298 +// Object3D node = nodes.get(index);3299 +// temp.set(vertices.get(index)); // temprep.GetVertex(k));3300 +// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);3301 +//3302 +// LA.xformPos(temp, node.GlobalTransformInv(), temp);3303 +//3304 +// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);3305 +//3306 +// if (g.toParent == null)3307 +// {3308 +// g.toParent = LA.newMatrix();3309 +// g.fromParent = LA.newMatrix();3310 +// }3311 +// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);3312 +// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);3313 +//3314 +// g.add(GraphreeD.clipboard);3315 +//3316 +// buffer.add(g);3317 +// }3318 +//3319 +// makeSomething(buffer, i==group.selection.size()-1);3320 +// }3321 +//3322 +// GraphreeD.epsequal = epsequal;3323 +//3324 +// //buffer = null;3325 +// temprep = null;3326 +// nodes = null;3327 +//3328 +// refreshContents();3329 +// }3330 +3184 3331 void ParseVertices() 3185 3332 { 3186 - //if (group.selection.size() != 1)3187 - // return;3188 -3189 - temprep = new BoundaryRep();3190 - nodes = new Object3D();3191 - vertices = new Vector<Vertex>();3192 -3193 3333 boolean epsequal = GraphreeD.epsequal; 3194 3334 GraphreeD.epsequal = true; 3195 3335 3196 3336 for (int i=0; i<group.selection.size(); i++) 3197 3337 { 3198 - Object3D buffer = new cGroup(group.selection.get(i).name + "+");3338 + final cGroup buffer = new cGroup(group.selection.get(i).name + "+");3199 3339 3200 - group.selection.get(i).Parse(this);3201 -3202 - int repsize = temprep.VertexCount();3203 - int tablesize = temprep.vertextable.size();3204 - int nodesize = nodes.size();3340 + group.selection.get(i).Parse(3341 +3342 + new iParse()3343 + {3344 + public void Vertex(Object3D node, Vertex v)3345 + {3346 + temp.set(v);3347 + LA.xformPos(temp, node.GlobalTransformInv(), temp);3205 3348 3206 - assert(vertices.size() == nodes.size());3207 -3208 - temprep.vertextable.elements();3209 -3210 - java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();3349 + cGroup g = new cGroup();3211 3350 3212 - for (java.util.Map.Entry<Vertex,Vertex> entry : set)3213 - {3214 - cGroup g = new cGroup();3351 + if (g.toParent == null)3352 + {3353 + g.toParent = LA.newMatrix();3354 + g.fromParent = LA.newMatrix();3355 + }3356 + LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);3357 + LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);3215 3358 3216 - int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));3217 - Object3D node = nodes.get(index);3218 - temp.set(vertices.get(index)); // temprep.GetVertex(k));3219 - // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);3359 + g.add(GraphreeD.clipboard);3220 3360 3221 - LA.xformPos(temp, node.GlobalTransformInv(), temp);3222 -3223 - // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);3224 -3225 - if (g.toParent == null)3226 - {3227 - g.toParent = LA.newMatrix();3228 - g.fromParent = LA.newMatrix();3229 - }3230 - LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);3231 - LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);3361 + buffer.add(g);3362 + }3232 3363 3233 - g.add(GraphreeD.clipboard);3364 + public void Face(Object3D node, Face f)3365 + {3234 3366 3235 - buffer.add(g);3236 - }3367 + }3368 + }3369 + );3237 3370 3238 3371 makeSomething(buffer, i==group.selection.size()-1); 3239 3372 } 3240 3373 3241 3374 GraphreeD.epsequal = epsequal; 3242 3375 3243 - //buffer = null;3244 - temprep = null;3245 - nodes = null;3376 + refreshContents();3377 + }3378 +3379 + void TextureVertices()3380 + {3381 + for (int i=0; i<group.selection.size(); i++)3382 + {3383 + group.selection.get(i).Parse(3384 + new iParse()3385 + {3386 + public void Vertex(Object3D node, Vertex v)3387 + {3388 + cTexture tex = node.GetTextures();3389 + String pigment = Object3D.GetPigment(tex);3390 + //String bump = Object3D.GetBump(tex);3391 +3392 + com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);3393 +3394 + double s = v.s;3395 +3396 + if (s == 1)3397 + s = 0;3398 +3399 + double t = v.t;3400 +3401 + if (t == 1)3402 + t = 0;3403 +3404 + int indexs = (int) (texturedata.getWidth() * s);3405 + int indext = (int) (texturedata.getHeight() * t);3406 +3407 + int index = indext * texturedata.getWidth() + indexs;3408 +3409 + java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();3410 +3411 + int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();3412 +3413 + float scale = bytebuf.get(index*slide) & 0xFF;3414 + scale += bytebuf.get(index*slide+1) & 0xFF;3415 + scale += bytebuf.get(index*slide+2) & 0xFF;3416 + scale /= 3;3417 +3418 + scale /= 0xFF;3419 + scale /= 4;3420 +3421 + //v.AO = scale;3422 +3423 + v.x += v.norm.x * scale;3424 + v.y += v.norm.y * scale;3425 + v.z += v.norm.z * scale;3426 + }3427 +3428 + public void Face(Object3D node, Face f)3429 + {3430 + }3431 + }3432 + );3433 + }3246 3434 3247 3435 refreshContents(); 3248 3436 } 3249 -3437 +3250 3438 void Align() 3251 3439 { 3252 3440 for (int i=0; i<group.selection.size(); i++) .. .. @@ -4728,6 +4916,8 @@ 4728 4916 private MenuItem particleItem; 4729 4917 private MenuItem ragdollItem; 4730 4918 private MenuItem ragdoll2Item; 4919 + private MenuItem heightFieldItem;4920 + private MenuItem textureFieldItem;4731 4921 private MenuItem gridItem; 4732 4922 private MenuItem rectoidItem; 4733 4923 private MenuItem ellipsoidItem; HeightField.java
.. .. @@ -0,0 +1,26 @@ 1 +/*2 + * To change this template, choose Tools | Templates3 + * and open the template in the editor.4 + */5 +6 +/**7 + *8 + * @author nbriere9 + */10 +public class HeightField extends Grid11 +{12 + iHeightField heightField;13 +14 + HeightField(iHeightField hf)15 + {16 + heightField = hf;17 + }18 +19 + Vertex biparamFunction(double u, double v)20 + {21 + Vertex temp = new Vertex((2*v-1)*radius*8, 0 /*-radius,*/, (2*u-1)*radius*8);22 + temp.norm = LA.newVector(0,1,0);23 + return temp;24 + }25 +26 +}KDNode.java
.. .. @@ -140,7 +140,7 @@ 140 140 protected static <T> void nnbr(KDNode<T> kd, HPoint target, HRect hr, 141 141 double max_dist_sqd, int lev, int K, 142 142 NearestNeighborList<KDNode<T>> nnl, 143 - Checker<T> checker,143 + CheckerInterface<T> checker,144 144 long timeout) 145 145 { 146 146 KDTree.java
.. .. @@ -285,7 +285,7 @@ 285 285 * @throws IllegalArgumentException if <I>n</I> is negative or 286 286 * exceeds tree size 287 287 */ 288 - public List<T> nearest(double[] key, int n, Checker<T> checker)288 + public List<T> nearest(double[] key, int n, CheckerInterface<T> checker)289 289 throws KeySizeException, IllegalArgumentException 290 290 { 291 291 .. .. @@ -360,7 +360,7 @@ 360 360 } 361 361 362 362 private NearestNeighborList<KDNode<T>> getnbrs(double[] key, int n, 363 - Checker<T> checker) throws KeySizeException363 + CheckerInterface<T> checker) throws KeySizeException364 364 { 365 365 366 366 if (key.length != m_K) Mocap.java
.. .. @@ -754,7 +754,7 @@ 754 754 //long 755 755 // june 2014 floorid = sourcenode.getFloor(floor); // , sourcenode.parent); 756 756 757 - CameraPane.debugpoints[0].name = "Floor = " + floorid;757 + CameraPane.debugpoints[0].name = ""; // "Floor = " + 0; // floorid;758 758 CameraPane.debugpoints[0].toParent[3][0] = floor.x; 759 759 CameraPane.debugpoints[0].toParent[3][1] = floor.y; 760 760 CameraPane.debugpoints[0].toParent[3][2] = floor.z; .. .. @@ -770,7 +770,7 @@ 770 770 771 771 this.count--; // currently drawing itself 772 772 773 - CameraPane.debugpoints[7].name = "Centroid = " + groundid; // centroid;773 + CameraPane.debugpoints[7].name = ""; // Centroid = " + 0; // groundid; // centroid;774 774 CameraPane.debugpoints[7].toParent[3][0] = centroid.x; 775 775 CameraPane.debugpoints[7].toParent[3][1] = centroid.y; 776 776 CameraPane.debugpoints[7].toParent[3][2] = centroid.z; .. .. @@ -795,7 +795,7 @@ 795 795 796 796 // jan 2014 sourcenode.parent.TransformToWorld(tmp); 797 797 798 - CameraPane.debugpoints[1].name = "C+";798 + CameraPane.debugpoints[1].name = ""; // "C+";799 799 CameraPane.debugpoints[1].toParent[3][0] = tmp.x; 800 800 CameraPane.debugpoints[1].toParent[3][1] = tmp.y; 801 801 CameraPane.debugpoints[1].toParent[3][2] = tmp.z; .. .. @@ -814,7 +814,7 @@ 814 814 tmp.z = pinz; 815 815 } 816 816 817 - CameraPane.debugpoints[2].name = "Pin";817 + CameraPane.debugpoints[2].name = ""; // "Pin";818 818 CameraPane.debugpoints[2].toParent[3][0] = tmp.x; 819 819 CameraPane.debugpoints[2].toParent[3][1] = tmp.y; 820 820 CameraPane.debugpoints[2].toParent[3][2] = tmp.z; .. .. @@ -822,7 +822,7 @@ 822 822 //if (sourcenode.parent.parent != null) 823 823 // jan 2014 sourcenode.parent.TransformToLocal(tmp); //, tmp); 824 824 825 - CameraPane.debugpoints[3].name = "C-";825 + CameraPane.debugpoints[3].name = ""; // "C-";826 826 CameraPane.debugpoints[3].toParent[3][0] = tmp.x; 827 827 CameraPane.debugpoints[3].toParent[3][1] = tmp.y; 828 828 CameraPane.debugpoints[3].toParent[3][2] = tmp.z; .. .. @@ -895,14 +895,14 @@ 895 895 // if (sourcenode.parent.parent != null) 896 896 // sourcenode.parent.parent.TransformToWorld(floor); //, floor); 897 897 898 - CameraPane.debugpoints[5].name = "F++";898 + CameraPane.debugpoints[5].name = ""; // "F++";899 899 CameraPane.debugpoints[5].toParent[3][0] = floor.x; 900 900 CameraPane.debugpoints[5].toParent[3][1] = floor.y; 901 901 CameraPane.debugpoints[5].toParent[3][2] = floor.z; 902 902 903 903 floor.y = tempg; 904 904 905 - CameraPane.debugpoints[6].name = "F+-";905 + CameraPane.debugpoints[6].name = ""; // "F+-";906 906 CameraPane.debugpoints[6].toParent[3][0] = floor.x; 907 907 CameraPane.debugpoints[6].toParent[3][1] = floor.y; 908 908 CameraPane.debugpoints[6].toParent[3][2] = floor.z; .. .. @@ -1318,7 +1318,7 @@ 1318 1318 1319 1319 rotsourcenode.TransformToWorld(test); 1320 1320 1321 - CameraPane.debugpoints[4].name = "ROT = "; // + test;1321 + CameraPane.debugpoints[4].name = ""; // "ROT = "; // + test;1322 1322 CameraPane.debugpoints[4].toParent[3][0] = test.x; 1323 1323 CameraPane.debugpoints[4].toParent[3][1] = test.y; 1324 1324 CameraPane.debugpoints[4].toParent[3][2] = test.z; ObjEditor.java
.. .. @@ -1336,7 +1336,7 @@ 1336 1336 1337 1337 // aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc); 1338 1338 1339 - frame.setSize(800, 600);1339 + frame.setSize(1024, 768);1340 1340 frame.show(); 1341 1341 1342 1342 gridPanel.setDividerLocation(1.0); Object3D.java
.. .. @@ -3717,7 +3717,7 @@ 3717 3717 3718 3718 boolean getCentroid(cVector centroid, boolean xform) 3719 3719 { 3720 - assert(false);3720 +// for speaker assert(false);3721 3721 if (blockloop) 3722 3722 return false; 3723 3723 .. .. @@ -4515,16 +4515,28 @@ 4515 4515 4516 4516 Object3D GetFileRoot() 4517 4517 { 4518 + if (overflow)4519 + return null;4520 +4521 + overflow = true;4522 +4523 + Object3D pfr = null;4524 +4518 4525 if (parent == null && fileparent == null) 4519 - return this;4526 + pfr = this;4520 4527 4521 4528 if (parent == null && fileparent != null) // V4.gfd??? 4522 - return fileparent;4529 + pfr = fileparent;4523 4530 4524 - if (parent == null)4525 - return this;4531 + if (pfr == null && parent == null)4532 + pfr = this;4526 4533 4527 - return parent.GetFileRoot();4534 + if (pfr == null)4535 + pfr = parent.GetFileRoot();4536 +4537 + overflow = false;4538 +4539 + return pfr;4528 4540 } 4529 4541 4530 4542 cTreePath GetPath() .. .. @@ -5280,7 +5292,7 @@ 5280 5292 if (name != null && name.contains("sclera")) 5281 5293 name = name; 5282 5294 5283 - if (this instanceof CheckerIG)5295 + if (this instanceof Checker)5284 5296 return; 5285 5297 5286 5298 if (display.drawMode == display.SHADOW && PASSTEST) .. .. @@ -7735,8 +7747,15 @@ 7735 7747 info.pane.repaint(); 7736 7748 } 7737 7749 7750 + boolean overflow = false;7751 +7738 7752 void TransformToWorld(cVector out) // , cVector out) 7739 7753 { 7754 + if (overflow)7755 + return;7756 +7757 + overflow = true;7758 +7740 7759 // june 2013 ??? assert (in == out); 7741 7760 cVector in = out; 7742 7761 if (toParent != null && !(this instanceof Texture || this instanceof TextureNode)) .. .. @@ -7753,6 +7772,8 @@ 7753 7772 { 7754 7773 (parent!=null?parent:fileparent).TransformToWorld(out); //, out); 7755 7774 } 7775 +7776 + overflow = false;7756 7777 } 7757 7778 7758 7779 void TransformToLocal(cVector out) //, cVector out) .. .. @@ -7995,19 +8016,22 @@ 7995 8016 max = new cVector(); 7996 8017 } 7997 8018 7998 - Object3D sourcenode = GetFileRoot();7999 -8000 - if (!sourcenode.name.contains("rclab"))8019 + if (false) // Can crawl!!8001 8020 { 8002 - getBounds(min, max, true);8021 + Object3D sourcenode = GetFileRoot();8003 8022 8004 - if (min.y != Double.POSITIVE_INFINITY && min.y > 2)8023 + if (sourcenode != null && !sourcenode.name.contains("rclab"))8005 8024 { 8006 -// sourcenode.getBounds(min, max, true);8007 - sourcenode.getBounds(v0, v1, true);8008 -// sourcenode.toParent = sourcenode.toParent;8009 -// get(0).toParent = get(0).toParent;8010 -// sourcenode.GlobalTransform();8025 + getBounds(min, max, true);8026 +8027 + if (min.y != Double.POSITIVE_INFINITY && min.y > 2)8028 + {8029 + // sourcenode.getBounds(min, max, true);8030 + sourcenode.getBounds(v0, v1, true);8031 + // sourcenode.toParent = sourcenode.toParent;8032 + // get(0).toParent = get(0).toParent;8033 + // sourcenode.GlobalTransform();8034 + }8011 8035 } 8012 8036 } 8013 8037 .. .. @@ -8016,7 +8040,8 @@ 8016 8040 if (support != null) 8017 8041 { 8018 8042 assert(bRep != null); 8019 - GraphreeD.Assert(support.bRep == bRep.support);8043 + if (!(support instanceof GenericJoint)) // support.bRep != null)8044 + GraphreeD.Assert(support.bRep == bRep.support);8020 8045 } 8021 8046 else 8022 8047 { ScriptNode.java
.. .. @@ -285,7 +285,7 @@ 285 285 else 286 286 { 287 287 if (speaker != null) 288 - System.err.println(speaker.GetFileRoot().name + " (not a command) : " + reader.line);288 + System.err.println(speaker.GetFileRoot().name + " (speaking) : " + reader.line);289 289 else 290 290 System.err.println("no speaker (not a command) : " + reader.line); 291 291 } .. .. @@ -412,7 +412,7 @@ 412 412 { 413 413 //path += "/" + Filename(readers[i].script); 414 414 ScriptReader reader = readers[i]; 415 - path += Filename(readers[i].script) + "; duration=" + reader.duration + "; total=" + reader.totalduration +415 + path += Filename(reader.script) + "; duration=" + reader.duration + "; total=" + reader.totalduration +416 416 "; line#" + reader.linecount + ": " + reader.line; 417 417 if (reader.line != null && // sept 2014 418 418 reader.line.startsWith("_")) .. .. @@ -488,7 +488,7 @@ 488 488 reader = readers[stack] = new ScriptReader(new BufferedReader(new FileReader(script)), reader.totalduration, /*0, 0, "",*/ script); 489 489 //duration = 0; // june 2014 490 490 //linecount = 0; 491 - //reader.script = script;491 + reader.script = script; // oct 2014492 492 return; 493 493 } 494 494 if (command.equals("return")) // line.startsWith("; return")) .. .. @@ -1438,7 +1438,7 @@ 1438 1438 object.skip = false; 1439 1439 return; 1440 1440 } 1441 - if (command.equals("skipmocap"))1441 + if (command.equals("skipmocap") || command.equals("mocapskip")) // oct 20141442 1442 { 1443 1443 object.skipmocap = true; 1444 1444 return; Texture.java
.. .. @@ -10,8 +10,8 @@ 10 10 public class Texture extends Composite implements java.io.Serializable 11 11 { 12 12 // deprecated due to serial problems 13 - static final long serialVersionUID = //-5280151442948961597L; // new java14 - 7695543694999681408L; // old java !!!13 + static final long serialVersionUID = -5280151442948961597L; // new java14 + // 7695543694999681408L; // old java !!!15 15 16 16 // default = -8076744133104150348L 17 17 iHeightField.java
.. .. @@ -0,0 +1,13 @@ 1 +/*2 + * To change this template, choose Tools | Templates3 + * and open the template in the editor.4 + */5 +6 +/**7 + *8 + * @author nbriere9 + */10 +public interface iHeightField11 +{12 + double f(double x, double y);13 +}