Package org.robwork.sdurw_geometry
Class Model3D
- java.lang.Object
-
- org.robwork.sdurw_geometry.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classModel3D.Materialdescribes material properties.static classModel3D.SmoothMethodMethod to do smoothing.static classModel3D.Texture
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGeometry(Model3D.Material mat, GeometryPtr geom)add geometry to this model3dintaddMaterial(Model3D.Material mat)all objects in a model use the materials defined on the modelintaddObject(SWIGTYPE_p_rw__core__PtrT_rw__geometry__Object3DGeneric_t obj)add an Object to this Model3DvoidaddTriMesh(Model3D.Material mat, TriMesh mesh)add a triangle mesh to this model3dvoidaddTriMesh(Model3D.Material mat, TriMeshCPtr geom)add a triangle mesh to this model3dvoiddelete()SWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_tget_materials()The array of materials.SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_tget_objects()The array of objects in the modelstatic longgetCPtr(Model3D obj)java.lang.StringgetFilePath()get filePath of this model3dintgetMask()get mask of this model3dModel3D.MaterialgetMaterial(java.lang.String matid)get material with string id matidSWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_tgetMaterials()get all materials that are available in this modeljava.lang.StringgetName()get string identifier of this model3dSWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_tgetObjects()get all objects that make out this modelSWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Model3D__Texture_t_tgetTextures()Get/set the object TexturesTransform3DgetTransform()get pose of this Model3DbooleanhasMaterial(java.lang.String matid)check if model has material with id matidbooleanisDynamic()true if data in the model are expected to changevoidoptimize(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.voidoptimize(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.voidremoveObject(java.lang.String name)remove object with string id namevoidscale(float scale)voidset_materials(SWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_t value)The array of materials.voidset_objects(SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_t value)The array of objects in the modelvoidsetDynamic(boolean dynamic)set to true if data in the model are expected to changevoidsetFilePath(java.lang.String name)set filePath this model3dvoidsetMask(int mask)set mask of this model3dvoidsetName(java.lang.String name)set string identifier of this model3dvoidsetTransform(Transform3D t3d)set the pose of this Model3DGeometryDataPtrtoGeometryData()convert this model3d to a geometry.
-
-
-
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-
-
addObject
public int addObject(SWIGTYPE_p_rw__core__PtrT_rw__geometry__Object3DGeneric_t obj)
add an Object to this Model3D- Parameters:
obj- [in] the geometric object to add.- Returns:
- index of object in model3d
-
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)
-
getMaterials
public SWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_t getMaterials()
get all materials that are available in this model
-
getObjects
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_t getObjects()
get all objects that make out this model
-
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
-
getTextures
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Model3D__Texture_t_t getTextures()
Get/set the object Textures- Returns:
- std::vector< rw::core::Ptr< Texture > >
-
set_materials
public void set_materials(SWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_t value)
The array of materials.
-
get_materials
public SWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_t get_materials()
The array of materials.
-
set_objects
public void set_objects(SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_t value)
The array of objects in the model
-
get_objects
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_t get_objects()
The array of objects in the model
-
-