mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-30 23:30:27 +02:00
Add options for transparency node sorting algorithm
Until last summer we sorted by object origin to camera distance Since then we used nearest transformed bbox-extent to camera. I've now added an enum to allow switching those plus 2 new: - none (so sorting based on scenegraph instead) - object center to camera. Which I made the new default as it worked the best in my tests. I already experimented with a few more ones like different sphere sizes (bbox radius, minimal inbound radius, maximal inbound radius) around center or origin to handle objects with different sizes, but that just gave worse results for all my test cases. Likely algorithms we should still try: - Collision point with bounding-box in line between camera and object center (sounds a bit slow, but maybe worth it) - Distance to camera plane (instead of camera position). But needs additional parameter to distance functions first (maybe normalized view vector will do). That should be useful when working with planar objects. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6572 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -97,7 +97,32 @@ namespace scene
|
||||
|
||||
//! Drawn after transparent effect nodes. For custom gui's. Unsorted (in order nodes registered themselves).
|
||||
ESNRP_GUI = 128
|
||||
};
|
||||
|
||||
//! Enumeration for sorting transparent nodes
|
||||
/** Sorting used for nodes with ESNRP_TRANSPARENT or ESNRP_AUTOMATIC+transparency.
|
||||
Also used for ESNRP_TRANSPARENT_EFFECT nodes (in an independent array)
|
||||
Transparent nodes are always drawn back to front based on distance to camera.
|
||||
This enum controls which points are used for the distance. */
|
||||
enum E_TRANSPARENT_NODE_SORTING
|
||||
{
|
||||
//! Don't sort, but draw in the order in which nodes registered themselves for rendering
|
||||
//! By default this is the order in which nodes are in the scenegraph
|
||||
//! Which can be used to do some custom sorting via scene-graph (mainly useful if you only have to that once)
|
||||
ETNS_NONE,
|
||||
|
||||
//! Distance from node origin to camera
|
||||
ETNS_ORIGIN,
|
||||
|
||||
//! Distance from node center to camera
|
||||
ETNS_CENTER,
|
||||
|
||||
//! Distance from the nearest of the 2 transformed bounding-box extend corners to camera
|
||||
ETNS_BBOX_EXTENTS,
|
||||
|
||||
//! Default sorting Irrlicht uses currently
|
||||
//! This may change in the future
|
||||
ETNS_DEFAULT = ETNS_CENTER
|
||||
};
|
||||
|
||||
class IAnimatedMesh;
|
||||
@ -1676,6 +1701,12 @@ namespace scene
|
||||
//! Set current render pass.
|
||||
virtual void setCurrentRenderPass(E_SCENE_NODE_RENDER_PASS nextPass) =0;
|
||||
|
||||
//! Get current node sorting algorithm used for transparent nodes
|
||||
virtual E_TRANSPARENT_NODE_SORTING getTransparentNodeSorting() const = 0;
|
||||
|
||||
//! Set the node sorting algorithm used for transparent nodes
|
||||
virtual void setTransparentNodeSorting(E_TRANSPARENT_NODE_SORTING sorting) = 0;
|
||||
|
||||
//! Get an instance of a geometry creator.
|
||||
/** The geometry creator provides some helper methods to create various types of
|
||||
basic geometry. This can be useful for custom scene nodes. */
|
||||
|
Reference in New Issue
Block a user