Package com.aspose.threed
Class PolygonModifier
- java.lang.Object
-
- com.aspose.threed.PolygonModifier
-
public class PolygonModifier extends java.lang.Object
Utilities to modify polygons
-
-
Method Summary
Modifier and Type Method Description static void
buildTangentBinormal(Mesh mesh)
This will create tangent and binormal on the mesh Normal is required, if normal is not existing on the mesh, it will also create the normal data from position.static void
buildTangentBinormal(Scene scene)
This will create tangent and binormal on all meshes of the scene Normal is required, if normal is not existing on the mesh, it will also create the normal data from position.static VertexElementNormal
generateNormal(Mesh mesh)
Generate normal data from Mesh definitionstatic VertexElementUV
generateUV(Mesh mesh)
Generate UV data from the given input meshstatic VertexElementUV
generateUV(Mesh mesh, VertexElementNormal normals)
Generate UV data from the given input mesh and specified normal data.static Mesh
mergeMesh(Node node)
Convert a whole node to a single transformed mesh Vertex elements like normal/texture coordinates are not supported yetstatic Mesh
mergeMesh(Scene scene)
Convert a whole scene to a single transformed mesh Vertex elements like normal/texture coordinates are not supported yetstatic Mesh
mergeMesh(java.util.List<Node> nodes)
Convert a whole node to a single transformed mesh Vertex elements like normal/texture coordinates are not supported yetstatic void
scale(Node node, Vector3 scale)
Scale all geometries(Scale the control points not the transformation matrix) in this nodestatic Scene
scale(Scene scene, Vector3 scale)
Scale all geometries(Scale the control points not the transformation matrix) in this scenestatic Mesh[]
splitMesh(Mesh mesh, SplitMeshPolicy policy)
Split mesh into sub-meshes byVertexElementMaterial
.static void
splitMesh(Node node, SplitMeshPolicy policy)
Split mesh into sub-meshes byVertexElementMaterial
.static void
splitMesh(Node node, SplitMeshPolicy policy, boolean createChildNodes)
Split mesh into sub-meshes byVertexElementMaterial
.static void
splitMesh(Node node, SplitMeshPolicy policy, boolean createChildNodes, boolean removeOldMesh)
Split mesh into sub-meshes byVertexElementMaterial
.static void
splitMesh(Scene scene, SplitMeshPolicy policy)
Split mesh into sub-meshes byVertexElementMaterial
.static void
splitMesh(Scene scene, SplitMeshPolicy policy, boolean removeOldMesh)
Split mesh into sub-meshes byVertexElementMaterial
.static Mesh
triangulate(Mesh mesh)
Convert a polygon-based mesh into full triangle meshstatic void
triangulate(Scene scene)
Convert all polygon-based meshes into full triangle meshstatic int[][]
triangulate(java.util.List<Vector4> controlPoints)
Convert a polygon into triangles, the order of the polygon is defined by thecontrolPoints
static int[][]
triangulate(java.util.List<Vector4> controlPoints, int[] polygon)
Convert a polygon into trianglesstatic int[][]
triangulate(java.util.List<Vector4> controlPoints, java.util.List<int[]> polygons)
Convert a polygon-based mesh into trianglesstatic int[][]
triangulate(java.util.List<Vector4> controlPoints, java.util.List<int[]> polygons, boolean generateNormals, Vector3[][] nor_out)
Convert a polygon-based mesh into full triangle mesh
-
-
-
Method Detail
-
triangulate
public static void triangulate(Scene scene)
Convert all polygon-based meshes into full triangle mesh- Parameters:
scene
- The scene to process
-
triangulate
public static Mesh triangulate(Mesh mesh)
Convert a polygon-based mesh into full triangle mesh- Parameters:
mesh
- The original non-triangle mesh- Returns:
- The generated new triangle mesh
-
triangulate
public static int[][] triangulate(java.util.List<Vector4> controlPoints, java.util.List<int[]> polygons, boolean generateNormals, Vector3[][] nor_out)
Convert a polygon-based mesh into full triangle mesh- Parameters:
controlPoints
- Control points of the meshpolygons
- Polygon facesgenerateNormals
- Generate normalsnor_out
- Generated Per-control point normal- Returns:
- A set of triangles
-
triangulate
public static int[][] triangulate(java.util.List<Vector4> controlPoints, java.util.List<int[]> polygons)
Convert a polygon-based mesh into triangles- Parameters:
controlPoints
- Control points of the meshpolygons
- Polygon faces- Returns:
- A set of triangles
-
triangulate
public static int[][] triangulate(java.util.List<Vector4> controlPoints, int[] polygon)
Convert a polygon into triangles- Parameters:
controlPoints
- Control points of the meshpolygon
- Polygon face- Returns:
- A set of triangles
-
triangulate
public static int[][] triangulate(java.util.List<Vector4> controlPoints)
Convert a polygon into triangles, the order of the polygon is defined by thecontrolPoints
- Parameters:
controlPoints
- Control points of the mesh- Returns:
- A set of triangles
-
mergeMesh
public static Mesh mergeMesh(Scene scene)
Convert a whole scene to a single transformed mesh Vertex elements like normal/texture coordinates are not supported yet- Parameters:
scene
- The scene to merge- Returns:
- The merged mesh
-
mergeMesh
public static Mesh mergeMesh(java.util.List<Node> nodes)
Convert a whole node to a single transformed mesh Vertex elements like normal/texture coordinates are not supported yet- Parameters:
nodes
- The nodes to merge- Returns:
- Merged mesh
-
mergeMesh
public static Mesh mergeMesh(Node node)
Convert a whole node to a single transformed mesh Vertex elements like normal/texture coordinates are not supported yet- Parameters:
node
- The node to merge- Returns:
- Merged mesh
-
scale
public static Scene scale(Scene scene, Vector3 scale)
Scale all geometries(Scale the control points not the transformation matrix) in this scene- Parameters:
scene
- The scene to scalescale
- The scale factor
-
scale
public static void scale(Node node, Vector3 scale)
Scale all geometries(Scale the control points not the transformation matrix) in this node- Parameters:
node
- The node to scalescale
- The scale factor
-
generateNormal
public static VertexElementNormal generateNormal(Mesh mesh)
Generate normal data from Mesh definition
-
generateUV
public static VertexElementUV generateUV(Mesh mesh, VertexElementNormal normals)
Generate UV data from the given input mesh and specified normal data.- Parameters:
mesh
- The input meshnormals
- The normal data- Returns:
- Generated UV data
-
generateUV
public static VertexElementUV generateUV(Mesh mesh)
Generate UV data from the given input mesh- Parameters:
mesh
- The input mesh- Returns:
- Generated UV data
-
splitMesh
public static void splitMesh(Node node, SplitMeshPolicy policy, boolean createChildNodes, boolean removeOldMesh)
Split mesh into sub-meshes byVertexElementMaterial
. Each sub-mesh will use only one material. Perform mesh splitting on a node- Parameters:
node
-policy
-createChildNodes
- Create child nodes for each sub-mesh.removeOldMesh
- Remove the old mesh after splitted, if this parameter is false, the old and new meshes will co-exists.
-
splitMesh
public static void splitMesh(Node node, SplitMeshPolicy policy)
Split mesh into sub-meshes byVertexElementMaterial
. Each sub-mesh will use only one material. Perform mesh splitting on a node- Parameters:
node
-policy
-
-
splitMesh
public static void splitMesh(Node node, SplitMeshPolicy policy, boolean createChildNodes)
Split mesh into sub-meshes byVertexElementMaterial
. Each sub-mesh will use only one material. Perform mesh splitting on a node- Parameters:
node
-policy
-createChildNodes
- Create child nodes for each sub-mesh.
-
splitMesh
public static void splitMesh(Scene scene, SplitMeshPolicy policy, boolean removeOldMesh)
Split mesh into sub-meshes byVertexElementMaterial
. Each sub-mesh will use only one material. Perform mesh splitting on all nodes of the scene.- Parameters:
scene
-policy
-removeOldMesh
-
-
splitMesh
public static void splitMesh(Scene scene, SplitMeshPolicy policy)
Split mesh into sub-meshes byVertexElementMaterial
. Each sub-mesh will use only one material. Perform mesh splitting on all nodes of the scene.- Parameters:
scene
-policy
-
-
splitMesh
public static Mesh[] splitMesh(Mesh mesh, SplitMeshPolicy policy)
Split mesh into sub-meshes byVertexElementMaterial
. Each sub-mesh will use only one material. The original mesh will not get changed.
-
buildTangentBinormal
public static void buildTangentBinormal(Scene scene)
This will create tangent and binormal on all meshes of the scene Normal is required, if normal is not existing on the mesh, it will also create the normal data from position. UV is also required, the mesh will be ignored if no UV is defined.
-
buildTangentBinormal
public static void buildTangentBinormal(Mesh mesh)
This will create tangent and binormal on the mesh Normal is required, if normal is not existing on the mesh, it will also create the normal data from position. UV is also required, an exception will be raised if no UV found.
-
-