Class Model3D


  • public class Model3D
    extends java.lang.Object

    a 3d model that has geometry but also material and color.
    he model can be composed of multiple objects that are connected in
    a hierarchical manner. The model is designed for efficient drawing and as such special
    structures are used to order the indexes such that efficient drawing is possible.
    • Constructor Detail

      • Model3D

        public Model3D​(long cPtr,
                       boolean cMemoryOwn)
      • Model3D

        public Model3D​(java.lang.String name)
        Constructor.
        Parameters:
        name - [in] name of the model.
      • Model3D

        public Model3D​(Model3D model)
        Copy constructor, make a copy of the 3D object

        Parameters:
        model -
    • Method Detail

      • getCPtr

        public static long getCPtr​(Model3D obj)
      • delete

        public void delete()
      • optimize

        public void optimize​(double smooth_angle,
                             Model3D.SmoothMethod method)
        optimize vertices and vertice normals

        removes redundant vertices and recalculates all vertice normals based on the face normals
        and the angle between face normals smooth_angle.
        Parameters:
        smooth_angle -
        method -
      • optimize

        public void optimize​(double smooth_angle)
        optimize vertices and vertice normals

        removes redundant vertices and recalculates all vertice normals based on the face normals
        and the angle between face normals smooth_angle.
        Parameters:
        smooth_angle -
      • addGeometry

        public void addGeometry​(Model3D.Material mat,
                                GeometryPtr geom)
        add geometry to this model3d
        Parameters:
        mat - [in] the material properties to use for the geometry.
        geom - [in] the geometry to add.
      • addTriMesh

        public void addTriMesh​(Model3D.Material mat,
                               TriMesh mesh)
        add a triangle mesh to this model3d
        Parameters:
        mat - [in] the material properties to use for the mesh.
        mesh - [in] the mesh geometry.
      • addTriMesh

        public void addTriMesh​(Model3D.Material mat,
                               TriMeshCPtr geom)
        add a triangle mesh to this model3d
        Parameters:
        mat - [in] the material properties to use for the mesh.
        geom - [in] the mesh geometry.
      • addMaterial

        public int addMaterial​(Model3D.Material mat)
        all objects in a model use the materials defined on the model
        Parameters:
        mat - [in] material to add.
        Returns:
        id of the newly added material.
      • getMaterial

        public Model3D.Material getMaterial​(java.lang.String matid)
        get material with string id matid
        Parameters:
        matid - [in] string id
        Returns:
        pointer to Matrial data
      • hasMaterial

        public boolean hasMaterial​(java.lang.String matid)
        check if model has material with id matid
        Parameters:
        matid - [in] string id of material
        Returns:
        true if exists in model
      • removeObject

        public void removeObject​(java.lang.String name)
        remove object with string id name
        Parameters:
        name - [in] name of object to remove
      • scale

        public void scale​(float scale)
      • getTransform

        public Transform3D getTransform()
        get pose of this Model3D
      • setTransform

        public void setTransform​(Transform3D t3d)
        set the pose of this Model3D
      • getName

        public java.lang.String getName()
        get string identifier of this model3d
      • getFilePath

        public java.lang.String getFilePath()
        get filePath of this model3d
      • setName

        public void setName​(java.lang.String name)
        set string identifier of this model3d
      • setFilePath

        public void setFilePath​(java.lang.String name)
        set filePath this model3d
      • getMask

        public int getMask()
        get mask of this model3d
      • setMask

        public void setMask​(int mask)
        set mask of this model3d
      • toGeometryData

        public GeometryDataPtr toGeometryData()
        convert this model3d to a geometry. Notice that geometry does not hold any
        color information.
        Returns:
        a geometry of this model3d
      • isDynamic

        public boolean isDynamic()
        true if data in the model are expected to change
      • setDynamic

        public void setDynamic​(boolean dynamic)
        set to true if data in the model are expected to change