Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Model3D

[25:7] extends: FxObj

Model3D loads a 3D model file into a JavaFX 3D scene graph. It wraps the FXyz3D importer library (org.fxyz3d.importers), which reads OBJ (.obj), Maya (.ma), and JavaFX FXML (.fxml) model files. After loading, getRoot() returns the model as a JavaFX Group you add to your scene, SubScene, or another parent. This is the JavaFX-specific model-import entry point for Aussom. Support for more formats (such as glTF) can be added to this same class later without changing how callers load and use a model. The JavaFX toolkit must be running before a model is loaded, because the importer builds live JavaFX nodes. Use it from an fx app (or after the toolkit has started).

Methods

  • Model3D (string Path = null)

    Creates a Model3D, optionally loading a model file right away.

    • @p Path is an optional file path to load (OBJ, Maya, or FXML). When null, use load() later.
  • load (string Path)

    Loads a 3D model file, replacing any previously loaded model.

    • @p Path is a file path to an OBJ, Maya (.ma), or FXML model.
    • @r this object for chaining.
  • loadAsPoly (string Path)

    Loads a 3D model file as a polygon mesh (PolygonMeshView) instead of a triangle mesh, replacing any previously loaded model. This keeps the original polygon faces, which can give smoother subdivided results.

    • @p Path is a file path to an OBJ, Maya (.ma), or FXML model.
    • @r this object for chaining.
  • getRoot ()

    Returns the loaded model's root node as a JavaFX Group, ready to add to a scene, SubScene, or another parent.

    • @r A Group wrapper for the model root.
  • getMeshNames ()

    Returns the names of the meshes in the loaded model. A model whose source names no objects or groups may return an empty list.

    • @r A list of mesh name strings.
  • getMeshView (string Name)

    Returns the mesh with the given name as a MeshView wrapper, so wrapper methods (setMaterial, setDrawMode, and so on) can be called on it directly.

    • @p Name is a mesh name from getMeshNames().
    • @r A MeshView wrapper, or null when the name is unknown.
  • getMeshViews ()

    Returns every mesh in the loaded model as MeshView wrappers, so wrapper methods (setMaterial, setDrawMode, and so on) can be called on each one directly.

    • @r A list of MeshView wrappers.
  • adoptMesh (Node)

  • getTimeline ()

    Returns the model's animation timeline when it has one.

    • @r A Timeline AussomJavaObject, or null when the model has no animation.
  • supportedFormats ()

    Returns the file-format extension filters the importer supports, for example ".obj", ".ma", "*.fxml".

    • @r A list of extension-filter strings.