Class TexturedTriangle
java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractCoordinateShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.texturedpolygon.TexturedTriangle
A textured triangle renderer with perspective-correct texture mapping.
This class renders triangles with UV-mapped textures. For large triangles, the rendering may be tessellated into smaller pieces for better perspective correction.
Perspective-correct texture rendering:
- Small triangles are rendered without perspective correction
- Larger triangles are tessellated into smaller pieces for accurate perspective
- See Also:
-
Field Summary
FieldsFields inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractCoordinateShape
onScreenZ, shapeId, verticesFields inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
cachedBoundingBox, mouseInteractionController -
Constructor Summary
ConstructorsConstructorDescriptionTexturedTriangle(Vertex p1, Vertex p2, Vertex p3, Texture texture) Creates a textured triangle with the specified vertices and texture. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if backface culling is enabled for this triangle.voidpaint(RenderingContext renderBuffer) Renders this textured triangle to the screen.voidsetBackfaceCulling(boolean backfaceCulling) Enables or disables backface culling for this triangle.Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractCoordinateShape
getBoundingBox, getZ, transform, translateMethods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
invalidateBounds, setMouseInteractionController
-
Field Details
-
texture
The texture to apply to this triangle.
-
-
Constructor Details
-
TexturedTriangle
Creates a textured triangle with the specified vertices and texture.- Parameters:
p1- the first vertex (must have textureCoordinate set)p2- the second vertex (must have textureCoordinate set)p3- the third vertex (must have textureCoordinate set)texture- the texture to apply
-
-
Method Details
-
paint
Renders this textured triangle to the screen.This method performs:
- Backface culling check (if enabled)
- Mouse interaction detection
- Mipmap level selection based on screen coverage
- Scanline rasterization with texture sampling
- Specified by:
paintin classAbstractCoordinateShape- Parameters:
renderBuffer- the rendering context containing the pixel buffer
-
isBackfaceCullingEnabled
public boolean isBackfaceCullingEnabled()Checks if backface culling is enabled for this triangle.- Returns:
trueif backface culling is enabled
-
setBackfaceCulling
public void setBackfaceCulling(boolean backfaceCulling) Enables or disables backface culling for this triangle.- Parameters:
backfaceCulling-trueto enable backface culling
-