From fc0ac44e30a56c87c7cf39fe66f6b3178732f1b6 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 01 Oct 2017 20:17:17 -0400 Subject: [PATCH] Klein + billboard + rigging "seuil" --- ObjEditor.java | 116 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 91 insertions(+), 25 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index 689f974..1140321 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -692,7 +692,7 @@ protected static ImageIcon createImageIcon(String path, String description) { - java.net.URL imgURL = GraphreeD.class.getResource(path); + java.net.URL imgURL = GrafreeD.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL, description); @@ -1107,7 +1107,7 @@ //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------"); //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------"); -// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints); +// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints); Camera cam = GetCamera(copy, 0); Composite cams = null; @@ -1334,9 +1334,9 @@ frame.getContentPane().add(/*"Center",*/framePanel); //frame.getContentPane().add(/*"Center",*/ worldPane); -// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc); +// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); - frame.setSize(800, 600); + frame.setSize(1024, 768); frame.show(); gridPanel.setDividerLocation(1.0); @@ -1859,19 +1859,21 @@ } // Images/textures - if (textures - && (filename.toLowerCase().endsWith(".jpg") - || filename.toLowerCase().endsWith(".jpeg") - || filename.toLowerCase().endsWith(".gif") - || filename.toLowerCase().endsWith(".png") - || filename.toLowerCase().endsWith(".tre") - || filename.toLowerCase().endsWith(".bmp") - || filename.toLowerCase().endsWith(".tga") - || filename.toLowerCase().endsWith(".sgi") - || filename.toLowerCase().endsWith(".tif") - || filename.toLowerCase().endsWith(".tiff"))) + if (filename.toLowerCase().endsWith(".jpg") + || filename.toLowerCase().endsWith(".jpeg") + || filename.toLowerCase().endsWith(".gif") + || filename.toLowerCase().endsWith(".png") + || filename.toLowerCase().endsWith(".tre") + || filename.toLowerCase().endsWith(".bmp") + || filename.toLowerCase().endsWith(".tga") + || filename.toLowerCase().endsWith(".sgi") + || filename.toLowerCase().endsWith(".tif") + || filename.toLowerCase().endsWith(".tiff")) { - DropTexture(filename); + if (textures) + DropTexture(filename); + else + CreateBillboard(filename); continue; } @@ -1880,6 +1882,60 @@ } ResetModel(); + } + + void CreateBillboard(String filename) + { + Object3D source = null; + Object3D group = copy; + + if (group.selection.size() > 0) + { + source = group.selection.get(0); + } + + Grid grid = new Grid(1,1); + grid.material = null; + + grid.toParent = LA.newMatrix(); + grid.fromParent = LA.newMatrix(); + LA.matYRotate(grid.toParent, Math.PI/2); + LA.matXRotate(grid.toParent, -Math.PI/2); + LA.matXRotate(grid.fromParent, Math.PI/2); + LA.matYRotate(grid.fromParent, -Math.PI/2); + + BillboardNode bb = new BillboardNode(); + bb.addChild(grid); + + Object3D newgroup = new Object3D(); + newgroup.CreateMaterial(); + + File file = new File(filename); + newgroup.name = file.getName(); + newgroup.addChild(bb); + + Object3D main = newgroup; + + main.SetPigmentTexture(filename); + + if (source != null) + { + main.material = new cMaterial(source.material); + if (main.projectedVertices.length < source.projectedVertices.length) + { + main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length]; + } + + for (int i=0; i<source.projectedVertices.length; i++) + { + main.projectedVertices[i].x = source.projectedVertices[i].x; + main.projectedVertices[i].y = source.projectedVertices[i].y; + } + + main.texres = source.texres; + } + + makeSomething(newgroup, false); } Point location; @@ -2345,7 +2401,7 @@ void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) { - if (GraphreeD.standAlone) + if (GrafreeD.standAlone) { /**/ FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); @@ -3183,8 +3239,8 @@ CameraPane.ANIMATION ^= true; - GraphreeD.wav.cursor = 0; - GraphreeD.wav.loop = 0; + GrafreeD.wav.cursor = 0; + GrafreeD.wav.loop = 0; } } else { @@ -4085,7 +4141,7 @@ void load() // throws ClassNotFoundException { - if (GraphreeD.standAlone) + if (GrafreeD.standAlone) { FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); browser.show(); @@ -4190,7 +4246,7 @@ void saveAs() { - if (GraphreeD.standAlone) + if (GrafreeD.standAlone) { FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); browser.setVisible(true); @@ -4213,10 +4269,20 @@ Object3D object = copy.selection.get(0); + FileObject fileobj = null; + + if (object instanceof FileObject) + fileobj = (FileObject)object; + if (object.fileparent != null) { - FileObject fileobj = (FileObject) object.fileparent; + assert(fileobj == null); + fileobj = (FileObject) object.fileparent; + } + + if (fileobj != null) + { System.out.println("WriteObject " + object + " : " + fileobj.name); WriteObject(object, fileobj.name); } @@ -4259,7 +4325,7 @@ } } else - //if (GraphreeD.standAlone) + //if (GrafreeD.standAlone) { FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE); browser.setVisible(true); @@ -4291,7 +4357,7 @@ Object3D objectparent = obj.parent; obj.parent = null; - Object3D object = (Object3D) GraphreeD.clone(obj); + Object3D object = (Object3D) GrafreeD.clone(obj); obj.parent = objectparent; @@ -4325,7 +4391,7 @@ buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); copy.generatePOV(buffer); - if (GraphreeD.standAlone) + if (GrafreeD.standAlone) { FileDialog browser = new FileDialog(frame, "Export POV", 1); browser.show(); -- Gitblit v1.6.2