java-3d

Java 3D: Where can I insert a “post rendering” FX?

心已入冬 提交于 2021-02-11 15:59:43
问题 I extended a Canvas3D and then I override the method "postSwap()", but my odd-even line effect is flickering a lot, what could be another good point for inserting this process? public void postSwap() { Graphics2D g2 = (Graphics2D)this.getGraphics(); Map map = new HashMap(); map.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2.addRenderingHints(map); g2.setColor(WipideaApplet.BCK2); int h = this.getHeight(), w = this.getWidth(); for (int i=0;i<h;i++) { if (i%2==0)

Class in jar not found at runtime, but was used to compile

佐手、 提交于 2021-01-27 14:51:59
问题 After I build this project from an ant file, I recieve a jar that contains all of the classes I built. When I try to run this jar, I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/j3d/SceneGraphObject This error indicates that a one of the jars, specifically the j3dcore.jar from java3d, I am using can not be found. However, this jar is on the classpath when compiling through the ant build into the class files. Why can this class not be found at

Class in jar not found at runtime, but was used to compile

半世苍凉 提交于 2021-01-27 14:37:01
问题 After I build this project from an ant file, I recieve a jar that contains all of the classes I built. When I try to run this jar, I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/j3d/SceneGraphObject This error indicates that a one of the jars, specifically the j3dcore.jar from java3d, I am using can not be found. However, this jar is on the classpath when compiling through the ant build into the class files. Why can this class not be found at

How Can I embed java3d's Canvas3d in javafx layout?

亡梦爱人 提交于 2020-01-17 03:17:13
问题 I try to embed Canvas3d in StackPane using SwingNode . I put Canvas3d into JPanel , and put JPanel into SwingNode . But only empty Jpanel was appeared. I heard in somewhere that SwingNode is rendering only pure Swing. So I used JCanvas3d instead of Canvas3d , but it is not working too! Is there any method to embed Java3d's Canvas3d in javafx layout? It's okay if not use SwingNode. My java version is jdk 1.8_xx And Here is my source code public class Main extends Application { public static

Image rotation in 3D space around Y axis

爷,独闯天下 提交于 2020-01-14 02:39:08
问题 I have a BufferedImage and I want to rotate the image (Picture) around the Y axis in Java with theta angle not affine transform. The rotation will be like the image below (the rectangle will be an image). I can do this by rotating each pixel of the image and drawing the image. Because I have to rotate a lot of images, I don't think this is the best idea. How I will do this transformation? Thanks for your help. 回答1: Generally, you'll want to find the inverse transform from your output pixel

Java 3D: Get intersection of two Shape3D's?

会有一股神秘感。 提交于 2020-01-07 02:18:15
问题 Is it possible to get the intersection co-ords of two shapes3d's? (One is a Line and the other is a QuadArray) Just wondering if there is a simple way before I try a hack and slash method? -I'm pretty new to Java 3D so I may have missed a function which does exactly what I need. 回答1: The Easy way is to use Bounds and intersect method : Bounds quadArrayBounds = quadArrayShape.getBounds(); if (quadArrayBounds.intersect(new Point3d(startLine.x, startLine.y, startLine.z), new Vector3d(endLine.x,

How to resize viewable area to show all objects/coordinates?

旧街凉风 提交于 2020-01-06 14:19:58
问题 I'm draving some objects on GLSurfaceArea (similar to this: http://www.droidnova.com/android-3d-game-tutorial-part-ii,328.html). It all works fine, but there are shown only points which coordinates are on -1.0 - +1.0 interval. Is there a way to resize viewable area to show coordinates that are not in this area (for example (-2.0, 2.0, 0.0))? 回答1: You want to change the view frustum. This is how I've done it in my android Renderer class: int viewportWidth = -1; int viewportHeight = -1; int

Translate Java 3D coordinates to 2D screen coordinates

泪湿孤枕 提交于 2020-01-03 17:07:13
问题 I'm working with a Java 3D application called "Walrus" that is used to display directed graphs. The code already has a feature to highlight a node and draw label adjacent in graph given its screen coordinates. Upon rotating the screen, the node is no more highlighted. What I have is the node coordinates in 3D. I need to draw label to it. Code for highlight using 3D coordinates Point3d p = new Point3d(); m_graph.getNodeCoordinates(node, p); PointArray array = new PointArray(1, PointArray

Java 3D Hello World - Jar freeze

社会主义新天地 提交于 2020-01-02 07:30:13
问题 Hi guys I'm following this tutorial to build my first Java 3D application. I included in my project the java3D libraries and my DllLoader class that extracts (from the classpath to the jar's location) and loads the j3dcore-ogl.dll : public class DllLoader { private DllLoader() { } public static void extractAndLoad(String dll) throws IOException { int aux = dll.lastIndexOf('/'); if (aux == -1) { aux = dll.lastIndexOf('\\'); } File dllCopy = new File((aux == -1) ? dll : dll.substring(aux + 1));

Java3D: Painting 2D HUD over a Canvas3D

自古美人都是妖i 提交于 2019-12-30 09:28:28
问题 I'm using Java3D to render a three-dimensional scene. I would like to overlay a two-dimensional "heads-up-display" on top of the 3d image. How can I efficiently paint the 2d content on top of the 3d canvas? Thanks! 回答1: // Create a Canvas3D using the preferred configuration Canvas3D canvas3d = new Canvas3D(config) { private static final long serialVersionUID = 7144426579917281131L; public void postRender() { this.getGraphics2D().setColor(Color.white); this.getGraphics2D().drawString("Heads Up