Class TessellatedTexturedTriangle
This class is created by the ScreenSpaceTessellator
during tessellation. Unlike regular TexturedTriangle, it skips the vertex transformation
step during rendering because its screen coordinates and Z-depth are already computed.
This optimization avoids redundant coordinate transformation for tessellated sub-triangles, improving performance when large polygons are split into many smaller pieces.
- See Also:
-
Field Summary
Fields inherited from class TexturedTriangle
textureFields inherited from class AbstractCoordinateShape
onScreenZ, shapeId, verticesFields inherited from class AbstractShape
cachedBoundingBox, mouseInteractionController -
Constructor Summary
ConstructorsConstructorDescriptionTessellatedTexturedTriangle(Vertex v1, Vertex v2, Vertex v3, Texture texture) Creates a tessellated textured triangle with pre-computed screen coordinates. -
Method Summary
Modifier and TypeMethodDescriptionstatic VertexinterpolateMidpoint(Vertex v1, Vertex v2, Point2D screen1, Point2D screen2) Creates a tessellated triangle by interpolating between two vertices.voidtransform(TransformStack transforms, RenderAggregator aggregator, RenderingContext renderingContext) Transforms this triangle for rendering by transforming vertices normally.Methods inherited from class TexturedTriangle
computeMaxScreenEdgeLength, getLastScreenSpaceSize, hasPreviousScreenCoordinates, isBackfaceCullingEnabled, needsRetessellation, paint, setBackfaceCulling, setLastScreenSpaceSizeMethods inherited from class AbstractCoordinateShape
getBoundingBox, getZ, translateMethods inherited from class AbstractShape
invalidateBounds, setMouseInteractionController
-
Constructor Details
-
TessellatedTexturedTriangle
Creates a tessellated textured triangle with pre-computed screen coordinates.The vertices'
Vertex.onScreenCoordinateandVertex.transformedCoordinateare already populated, so thetransform(TransformStack, RenderAggregator, RenderingContext)method will skip coordinate calculation.- Parameters:
v1- the first vertex (world coords, texture coords, screen coords pre-computed)v2- the second vertex (world coords, texture coords, screen coords pre-computed)v3- the third vertex (world coords, texture coords, screen coords pre-computed)texture- the texture to apply
-
-
Method Details
-
transform
public void transform(TransformStack transforms, RenderAggregator aggregator, RenderingContext renderingContext) Transforms this triangle for rendering by transforming vertices normally.Unlike the original design that skipped transformation, this method now transforms vertices normally using their world coordinates. The world coordinates were correctly interpolated during tessellation, so the resulting screen coordinates will be fresh for each frame.
- Overrides:
transformin classAbstractCoordinateShape- Parameters:
transforms- the transform stack to applyaggregator- the aggregator to queue this shape for renderingrenderingContext- the rendering context
-
interpolateMidpoint
Creates a tessellated triangle by interpolating between two vertices.This factory method creates a new vertex at the midpoint of two vertices, interpolating world coordinates, texture coordinates, screen coordinates, and Z-depth. Used during tessellation to split edges.
- Parameters:
v1- the first vertex endpointv2- the second vertex endpointscreen1- the screen coordinate of the first vertexscreen2- the screen coordinate of the second vertex- Returns:
- a new vertex at the midpoint with interpolated properties
-