小编Deb*_*jee的帖子

如何正确渲染 3D 图形

我试图制作一个魔方,但javafx最终得到了一个非常糟糕的模型,如图所示。我给出了我的代码源代码,其中我使用RectangleBuilder类来创建矩形并在 3d 中进行转换。为了修复图形,我还尝试构建使用TriangleMesh类的矩形,并在向它们添加材质后,将它们转换为 3D,最终再次出现相同的糟糕图形。为什么会出现这种情况以及如何消除它?

import javafx.scene.transform.Rotate;
import javafx.scene.PerspectiveCamera;
import javafx.scene.transform.Translate;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.SceneAntialiasing;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.shape.RectangleBuilder;
import javafx.scene.transform.Rotate;
import javafx.util.Duration;


    public class NewFXMain1 extends Application {


    public class Cube extends Group {
    final Rotate rx = new Rotate(0,Rotate.X_AXIS);
    final Rotate ry = new Rotate(0,Rotate.Y_AXIS);
    final Rotate rz = …
Run Code Online (Sandbox Code Playgroud)

java javafx-8 javafx-3d

2
推荐指数
1
解决办法
3496
查看次数

标签 统计

java ×1

javafx-3d ×1

javafx-8 ×1