Ok, after spending the whole day of debugging I finally fixed this issue:
The root cause of the issue was that OrientedBoundingBox.GetCorners() method returns incorrect points. I don`t know why this is happening, especially that I update my OBB matrix and scale each frame and it should be correct.
But If I get corners from basic OBB (without any transformations applied) and transform all these points with my World matrix with Vector3.TransformCoord(), then issue will gone and all frustum checks goes correctly.
That is very strange issue.
Here is SharpdX OBB code for GetCorners()
Is there anything wrong with it:
/// Retrieves the eight corners of the bounding box.
/// <returns>An array of points representing the eight corners of the bounding box.</returns>
public Vector3 GetCorners()
var xv = new Vector3(Extents.X, 0, 0);
var yv = new Vector3(0, Extents.Y, 0);
var zv = new Vector3(0, 0, Extents.Z);
Vector3.TransformNormal(ref xv, ref Transformation, out xv);
Vector3.TransformNormal(ref yv, ref Transformation, out yv);
Vector3.TransformNormal(ref zv, ref Transformation, out zv);
var center = Transformation.TranslationVector;
var corners = new Vector3;
corners = center + xv + yv + zv;
corners = center + xv + yv - zv;
corners = center - xv + yv - zv;
corners = center - xv + yv + zv;
corners = center + xv - yv + zv;
corners = center + xv - yv - zv;
corners = center - xv - yv - zv;
corners = center - xv - yv + zv;
Posted by BlackJoker
on 25 December 2015 - 04:35 PM
I dont want to be dependent from WInForms or WPF as they has their own bugs and I want to make my own UI Control system from scratch.
Pick one thread to run the UI (likely your main thread which is already running a message pump) and issue messages to it when you want it to do something either through your own message passing system, or the PostMessage Win32 function.
You mean that I must not create windows in other threads than main? Or just post messages to the threads, where windows was created?
Posted by BlackJoker
on 23 November 2015 - 12:53 PM
I mean that I want to draw controls using true depth feeling, which could be made only with projection matrix. With ortho I need to scale objects manually if I want make them smaller when they are far from the camera.