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 mesh
Object The mesh to filter, which is modified in place. attributeName
String <optional>
'position' The name of the attribute. attributeHighName
String <optional>
'positionHigh' The name of the attribute for the encoded high bits. attributeLowName
String <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 modifiedmesh
argument, 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
indexList
is optimally reordered.
Themesh
argument should use the standard layout like the mesh returned by BoxTessellator.
Parameters:
Name Type Argument Default Description mesh
Object The mesh to filter, which is modified in place. cacheCapacity
Number <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 modifiedmesh
argument, 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
indexList
is reordered to keep the same index-vertex correspondence.
Themesh
argument should use the standard layout like the mesh returned by BoxTessellator.
Parameters:
Name Type Description mesh
Object The mesh to filter, which is modified in place. Throws:
DeveloperError : All mesh attribute lists must have the same number of attributes.Returns:
The modifiedmesh
argument, 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
indexList
with a primitive type oftriangles
,triangleStrip
, ortrangleFan
is converted to a list of indices with a primitive type oflines
. Lists of indices with other primitive types remain unchanged.
Themesh
argument 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 mesh
Object The mesh to filter, which is modified in place. Returns:
The modifiedmesh
argument, with its triangle indices converted to lines.Example
var mesh = BoxTessellator.compute(); mesh = MeshFilters.toWireframeInPlace(mesh);
See: