I wanted to put a really large disk over the square viewport as a vignette (so, .InnerRadius is half the width), and… it is edgy!
function TCircle2DNode.CalculateSlices: Cardinal;
// use default in case of -1 or invalid value
if FdSlices.Value < MinTriangulationSlices then
Result := DefaultTriangulationSlices
Result := FdSlices.Value;
function TDisk2DNode.CalculateSlices: Cardinal;
Result := DefaultTriangulationSlices;
I blissfully ignored the “Do not edit this file manually!” warning and just copypasted it anyway
Seems working okay, but i won’t be proud of it
…also, why strict private is function CalculateSlices: Cardinal; ?
Seems a handy way to calculate effective value. Why not public?
Once again i feel like it would be nice if those low-level components could reach back to the ViewPort and the physical screen properties, to asses their size in pixels and dynamically adjust slices quantity…
Because I didn’t see much need for it. Everything we make public is then a burden to maintain. As time goes by, I am more and more careful about exposing things public without a really convincing reason
In case of this particular method, it’s not really a big deal to expose it, it’s a trivial method. But then it’s also not a big deal for particular need to just implement the same logic on your side. We don’t plan to change the logic of this subdivision any time soon.
Thanks, these docs contained a few outdated things (we don’t have divisions on Box anymore, we don’t have any “over-triangulation” since a long time because we don’t even use Gouraud by default). I improved them and linked.
I wondered about this in the past, both for simple primitives (like spheres or circles) and also for NURBS (to adjust tesselation). It is tempting, and with modern GPUs and geometry shaders it could be really done dynamically and efficiently.
… But the use-case seemed rather low, compared to the additional code complication. And on some really ancient GPUs, there are no geometry shader nodes. It seemed much easier to just allow user code to set higher DefaultTriangulationSlices / DefaultTriangulationStacks when neeeded.
Most 3D rendering is just using meshes (sometimes with LOD), as they are much more flexible to express anything (which is e.g. why glTF doesn’t even define any primitives or NURBS; only meshes). So the logic of “automatically adjusting primitives / NURBS to screen” would be a significant effort to implement, and mostly unused in many practical games.