MeshFilters
DOC_TBA
Methods
-
<static> createAttributeIndices
-
DOC_TBA
-
<static> encodeAttribute
-
Encodes floating-point mesh attribute values as two separate attributes to improve rendering precision using the same encoding as EncodedCartesian3.
This is commonly used to create high-precision position vertex attributes.
Parameters:
Name Type Argument Default Description meshObject The mesh to filter, which is modified in place. attributeNameString <optional>
'position' The name of the attribute. attributeHighNameString <optional>
'positionHigh' The name of the attribute for the encoded high bits. attributeLowNameString <optional>
'positionLow' The name of the attribute for the encoded low bits. Throws:
-
DeveloperError : mesh is required.
-
DeveloperError : mesh must have an attributes property.
-
DeveloperError : mesh must have attribute matching the attributeName argument.
-
DeveloperError : The attribute componentDatatype must be ComponentDatatype.FLOAT.
Returns:
The modifiedmeshargument, with its encoded attribute.Example
mesh = MeshFilters.encodeAttribute(mesh, 'position3D', 'position3DHigh', 'position3DLow');
See:
-
-
<static> fitToUnsignedShortIndices
-
DOC_TBA. Old mesh is not guaranteed to be copied.
Throws:
-
DeveloperError : The mesh's index-lists must have PrimitiveType equal to PrimitiveType.TRIANGLES.
-
DeveloperError : All mesh attribute lists must have the same number of attributes.
-
-
<static> mapAttributeIndices
-
DOC_TBA
-
<static> projectTo2D
-
DOC_TBA
-
<static> reorderForPostVertexCache
-
Reorders a mesh's indices to achieve better performance from the GPU's post vertex-shader cache by using the Tipsify algorithm. Each list of indices in the mesh's
indexListis optimally reordered.
Themeshargument should use the standard layout like the mesh returned by BoxTessellator.
Parameters:
Name Type Argument Default Description meshObject The mesh to filter, which is modified in place. cacheCapacityNumber <optional>
24 The number of vertices that can be held in the GPU's vertex cache. Throws:
-
DeveloperError : Mesh's index list must be defined.
-
DeveloperError : Mesh's index lists' lengths must each be a multiple of three.
-
DeveloperError : Mesh's index list's maximum index value must be greater than zero.
-
DeveloperError : cacheCapacity must be greater than two.
Returns:
The modifiedmeshargument, with its indices optimally reordered for the post-vertex-shader cache.Example
var mesh = CubeMapEllipsoidTessellator.compute(...); mesh = MeshFilters.reorderForPostVertexCache(mesh);
- MeshFilters.reorderForPreVertexCache
- Tipsify
- Fast Triangle Reordering for Vertex Locality and Reduced Overdraw by Sander, Nehab, and Barczak
See:
-
-
<static> reorderForPreVertexCache
-
Reorders a mesh's indices to achieve better performance from the GPU's pre-vertex-shader cache. Each list of indices in the mesh's
indexListis reordered to keep the same index-vertex correspondence.
Themeshargument should use the standard layout like the mesh returned by BoxTessellator.
Parameters:
Name Type Description meshObject The mesh to filter, which is modified in place. Throws:
DeveloperError : All mesh attribute lists must have the same number of attributes.Returns:
The modifiedmeshargument, with its vertices and indices reordered for the GPU's pre-vertex-shader cache.Example
var mesh = CubeMapEllipsoidTessellator.compute(...); mesh = MeshFilters.reorderForPreVertexCache(mesh);
-
<static> toWireframeInPlace
-
Converts a mesh's triangle indices to line indices. Each list of indices in the mesh's
indexListwith a primitive type oftriangles,triangleStrip, ortrangleFanis converted to a list of indices with a primitive type oflines. Lists of indices with other primitive types remain unchanged.
Themeshargument should use the standard layout like the mesh returned by BoxTessellator.
This filter is commonly used to create a wireframe mesh for visual debugging.Parameters:
Name Type Description meshObject The mesh to filter, which is modified in place. Returns:
The modifiedmeshargument, with its triangle indices converted to lines.Example
var mesh = BoxTessellator.compute(); mesh = MeshFilters.toWireframeInPlace(mesh);
See:
