Code Monkey home page Code Monkey logo

fxyz's Introduction

FXyz3D

  • FXyz3D Core: Download

  • FXyz3D Client: Download

  • FXyz3D Importers: Download

A JavaFX 3D Visualization and Component Library

BSD-3 license

How to build

The project is managed by gradle. To build, type

./gradlew assemble

To deploy it to your local Maven repository, type:

./gradlew publishToMavenLocal

Use of FXyz3D Core

With FXyz3D there are many different 3D custom shapes. The following sample makes use of SpringMesh to create a 3D mesh of a spring.

Sample

Create a gradle project, edit the build.gradle file and add:

plugins {
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.8'
}

mainClassName = 'org.fxyz3d.Sample'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.fxyz3d:fxyz3d:0.5.2'
}

javafx {
    modules = [ 'javafx.controls' ]
}

and create a JavaFX Application class Sample under the org.fxyz3d package:

    @Override
    public void start(Stage primaryStage) throws Exception {
        PerspectiveCamera camera = new PerspectiveCamera(true);        
        camera.setNearClip(0.1);
        camera.setFarClip(10000.0);
        camera.setTranslateX(10);
        camera.setTranslateZ(-100);
        camera.setFieldOfView(20);
        
        CameraTransformer cameraTransform = new CameraTransformer();
        cameraTransform.getChildren().add(camera);
        cameraTransform.ry.setAngle(-30.0);
        cameraTransform.rx.setAngle(-15.0);
        
        SpringMesh spring = new SpringMesh(10, 2, 2, 8 * 2 * Math.PI, 200, 100, 0, 0);
        spring.setCullFace(CullFace.NONE);
        spring.setTextureModeVertices3D(1530, p -> p.f);
        
        Group group = new Group(cameraTransform, spring);
        
        Scene scene = new Scene(group, 600, 400, true, SceneAntialiasing.BALANCED);
        scene.setFill(Color.BISQUE);
        scene.setCamera(camera);
        
        primaryStage.setScene(scene);
        primaryStage.setTitle("FXyz3D Sample");
        primaryStage.show();
    }

Note: For more information on JavaFX 11, check this link.

FXSampler

To use the FXSampler and visualize all the samples and the different options available, run:

./gradlew run

There is a hidden side popup menu at the left, from where different samples can be selected. From the right panels different options can be applied dynamically to the 3D shape.

Custom image

You can create a custom image for your platform running:

./gradlew clean :FXyz-Samples:jlink  

And you can run it with Java 9+ on your platform:

FXyz-Samples/build/FXyz/bin/FXyzSamples

Special Thanks go to ControlsFX for providing the FXSampler framework. http://fxexperience.com/controlsfx/ Our Sampler uses a heavily modified version, due to being 3D.

fxyz's People

Contributors

jperedadnr avatar almasb avatar nlisker avatar birdasaur avatar jdub1581 avatar miho avatar naramski avatar anishthecoder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.