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 class
Model3D.Material
describes material properties.static class
Model3D.SmoothMethod
Method to do smoothing.static class
Model3D.Texture
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGeometry(Model3D.Material mat, GeometryPtr geom)
add geometry to this model3dint
addMaterial(Model3D.Material mat)
all objects in a model use the materials defined on the modelint
addObject(SWIGTYPE_p_rw__core__PtrT_rw__geometry__Object3DGeneric_t obj)
add an Object to this Model3Dvoid
addTriMesh(Model3D.Material mat, TriMesh mesh)
add a triangle mesh to this model3dvoid
addTriMesh(Model3D.Material mat, TriMeshCPtr geom)
add a triangle mesh to this model3dvoid
delete()
SWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_t
get_materials()
The array of materials.SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_t
get_objects()
The array of objects in the modelstatic long
getCPtr(Model3D obj)
java.lang.String
getFilePath()
get filePath of this model3dint
getMask()
get mask of this model3dModel3D.Material
getMaterial(java.lang.String matid)
get material with string id matidSWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_t
getMaterials()
get all materials that are available in this modeljava.lang.String
getName()
get string identifier of this model3dSWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_t
getObjects()
get all objects that make out this modelSWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Model3D__Texture_t_t
getTextures()
Get/set the object TexturesTransform3D
getTransform()
get pose of this Model3Dboolean
hasMaterial(java.lang.String matid)
check if model has material with id matidboolean
isDynamic()
true if data in the model are expected to changevoid
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.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.void
removeObject(java.lang.String name)
remove object with string id namevoid
scale(float scale)
void
set_materials(SWIGTYPE_p_std__vectorT_rw__geometry__Model3D__Material_t value)
The array of materials.void
set_objects(SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Object3DGeneric_t_t value)
The array of objects in the modelvoid
setDynamic(boolean dynamic)
set to true if data in the model are expected to changevoid
setFilePath(java.lang.String name)
set filePath this model3dvoid
setMask(int mask)
set mask of this model3dvoid
setName(java.lang.String name)
set string identifier of this model3dvoid
setTransform(Transform3D t3d)
set the pose of this Model3DGeometryDataPtr
toGeometryData()
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
-
-