jeske / SimpleScene

Simple 3D scene manager in C# and OpenTK / OpenGL
https://github.com/jeske/SimpleScene/wiki
Other
173 stars 69 forks source link

ssBVH code does not agree with comment #21

Open ylkurs opened 1 year ago

ylkurs commented 1 year ago

The first if statement in the following code snippet (in file ssBVH_Node.cs)

           // perform the best rotation...            
            if (bestRot.rot != Rot.NONE) {
                // if the best rotation is no-rotation... we check our parents anyhow..                
                if (parent != null) { 
                    // but only do it some random percentage of the time.
                    if ((DateTime.Now.Ticks % 100) < 2) {
                        bvh.refitNodes.Add(parent); 
                    }
                }                
            } else {
                // ...
            } 

should be replace by the following line of code???

if (bestRot.rot == Rot.NONE) {
jeske commented 1 year ago

That's very peculiar... as it would seem like this bug would cause it to hardly ever perform a rotation. I'm going to have to look more carefully at the code, but that if-condition does seem most likely wrong.