Class VisibleSort
java.lang.Object
java.util.AbstractCollection<RenderState<?,?>>
java.util.AbstractList<RenderState<?,?>>
java.util.ArrayList<RenderState<?,?>>
com.j3d.engine.scene.draw.SortMethod
com.j3d.engine.scene.draw.methods.VisibleSort
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<RenderState<?,,?>> Collection<RenderState<?,,?>> List<RenderState<?,,?>> RandomAccess,SequencedCollection<RenderState<?,?>>
The following sort method was generated by GitHub Copilot Chat (IntelliJ plugin) on 03-01-2026 with the following prompt:
This is SortMethod and there is PureListener and GTri following the JDoc in Sortmethod make a class which will effeicntly sort the triangles such that only visible triangles will be rendered. keep in mind it has to strictly adhere to Sortmethod JDoc and also dont use back face culling as i'll implement that myself.
VisibleSort is a SortMethod that keeps only triangles which are visible according to a software Z-buffer pass performed with ZDepthIdBuffer.
Behaviour requirements from SortMethod.javadoc: - When a triangle is added via add(Object) it sorts the list according to its algorithm. - clear() re-adds non-dirty triangles from the registered listeners. This implementation does NOT perform back-face culling (left for caller).- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(RenderState<?, ?> gTri) voidclear()voidsort()private voidPerforms a Z-buffer rasterisation of all registered triangles and keeps only those which appear on the final buffer (i.e. are visible).Methods inherited from class com.j3d.engine.scene.draw.SortMethod
backFaceCulledMethods inherited from class java.util.ArrayList
add, addAll, addAll, addFirst, addLast, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll, reversed
-
Field Details
-
zb
-
-
Constructor Details
-
VisibleSort
public VisibleSort()
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<RenderState<?,?>> - Specified by:
addin interfaceList<RenderState<?,?>> - Overrides:
addin classSortMethod
-
clear
public void clear()- Specified by:
clearin interfaceCollection<RenderState<?,?>> - Specified by:
clearin interfaceList<RenderState<?,?>> - Overrides:
clearin classArrayList<RenderState<?,?>>
-
sort
public void sort()- Specified by:
sortin classSortMethod
-
updateVisibilityAndSort
private void updateVisibilityAndSort()Performs a Z-buffer rasterisation of all registered triangles and keeps only those which appear on the final buffer (i.e. are visible). The remaining visible triangles are sorted by depth (farthest first) to be suitable for painter-style rendering if desired.
-