Example usage for javafx.scene.shape CullFace NONE

List of usage examples for javafx.scene.shape CullFace NONE

Introduction

In this page you can find the example usage for javafx.scene.shape CullFace NONE.

Prototype

CullFace NONE

To view the source code for javafx.scene.shape CullFace NONE.

Click Source Link

Document

Do not perform any face culling.

Usage

From source file:eu.mihosoft.vrl.fxscad.MainController.java

private void compile(String code) {

    csgObject = null;//  w ww.  j a va  2 s.  c o m

    clearLog();

    viewGroup.getChildren().clear();

    try {

        CompilerConfiguration cc = new CompilerConfiguration();

        cc.addCompilationCustomizers(
                new ImportCustomizer().addStarImports("eu.mihosoft.vrl.v3d", "eu.mihosoft.vrl.v3d.samples")
                        .addStaticStars("eu.mihosoft.vrl.v3d.Transform"));

        GroovyShell shell = new GroovyShell(getClass().getClassLoader(), new Binding(), cc);

        Script script = shell.parse(code);

        Object obj = script.run();

        if (obj instanceof CSG) {

            CSG csg = (CSG) obj;

            csgObject = csg;

            MeshContainer meshContainer = csg.toJavaFXMesh();

            final MeshView meshView = meshContainer.getAsMeshViews().get(0);

            setMeshScale(meshContainer, viewContainer.getBoundsInLocal(), meshView);

            PhongMaterial m = new PhongMaterial(Color.RED);

            meshView.setCullFace(CullFace.NONE);

            meshView.setMaterial(m);

            viewGroup.layoutXProperty().bind(viewContainer.widthProperty().divide(2));
            viewGroup.layoutYProperty().bind(viewContainer.heightProperty().divide(2));

            viewContainer.boundsInLocalProperty().addListener((ov, oldV, newV) -> {
                setMeshScale(meshContainer, newV, meshView);
            });

            VFX3DUtil.addMouseBehavior(meshView, viewContainer, MouseButton.PRIMARY);

            viewGroup.getChildren().add(meshView);

        } else {
            System.out.println(">> no CSG object returned :(");
        }

    } catch (Throwable ex) {
        ex.printStackTrace(System.err);
    }
}

From source file:be.makercafe.apps.makerbench.editors.JFXScadEditor.java

private void compile(String code) {

    csgObject = null;//  w  w  w. j  a va2 s. c o  m

    // clearLog();

    viewGroup.getChildren().clear();

    try {

        CompilerConfiguration cc = new CompilerConfiguration();

        cc.addCompilationCustomizers(
                new ImportCustomizer().addStarImports("eu.mihosoft.vrl.v3d", "eu.mihosoft.vrl.v3d.samples")
                        .addStaticStars("eu.mihosoft.vrl.v3d.Transform"));

        GroovyShell shell = new GroovyShell(getClass().getClassLoader(), new Binding(), cc);

        Script script = shell.parse(code);

        Object obj = script.run();

        if (obj instanceof CSG) {

            CSG csg = (CSG) obj;

            csgObject = csg;

            //Plane plane = new Plane();

            MeshContainer meshContainer = csg.toJavaFXMesh();

            final MeshView meshView = meshContainer.getAsMeshViews().get(0);

            setMeshScale(meshContainer, viewContainer.getBoundsInLocal(), meshView);

            PhongMaterial m = new PhongMaterial(Color.GREEN);

            meshView.setCullFace(CullFace.NONE);

            meshView.setMaterial(m);

            viewGroup.layoutXProperty().bind(viewContainer.widthProperty().divide(2));
            viewGroup.layoutYProperty().bind(viewContainer.heightProperty().divide(2));

            viewContainer.boundsInLocalProperty().addListener((ov, oldV, newV) -> {
                setMeshScale(meshContainer, newV, meshView);
            });

            VFX3DUtil.addMouseBehavior(meshView, viewContainer, MouseButton.PRIMARY);

            viewGroup.getChildren().add(meshView);

        } else {
            Logger.getLogger(this.getClass().getName()).log(Level.INFO, "No CSG object returned");
        }

    } catch (Throwable ex) {
        Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Unsuspected xception", ex);
    }
}