Add more transparent node sorting algorithms

Adding 2 algorithms to sort by distance to camera plane instead of camera position.
This is better in quite a few situations and extra cost is just one vector subtraction per node and an additional function parameter per call, I think that's worth it. So made the camera-plane to object-center now the new default.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6573 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2023-11-22 16:34:55 +00:00
parent 3c4ac201ce
commit 3752bd9bd4
4 changed files with 63 additions and 30 deletions

View File

@ -654,7 +654,8 @@ namespace scene
//! current active camera
ICameraSceneNode* ActiveCamera;
core::vector3df camWorldPos; // Position of camera for transparent nodes.
core::vector3df CamWorldPos; // Position of camera for transparent nodes.
core::vector3df CamWorldViewNormalized; // Normalized view direction of camera for transparent nodes.
video::SColor ShadowColor;
video::SColorf AmbientLight;
@ -671,8 +672,7 @@ namespace scene
//! Algorithm used to sort transparent nodes
E_TRANSPARENT_NODE_SORTING TransparentNodeSorting;
//! Pointer to the actual algorithm to get the distance
// (Could be we have to pass more parameters for better results, like view normal)
f32 (*funcTransparentNodeDistance)(const ISceneNode* node, const core::vector3df& camera);
f32 (*funcTransparentNodeDistance)(const ISceneNode* node, const core::vector3df& cameraPos, const core::vector3df& cameraViewNormalized);
//! An optional callbacks manager to allow the user app finer control
//! over the scene lighting and rendering.