got a scaling window going, yay
-
@eniko why stop at 4x4? - or rather, why two fixed levels rather than a full quad-tree structure?
@nicklockwood it's harder to write a generic dynamically sized hierarchical system that's also fully optimized. also, at 32x32 even at 8k resolution that's only 240x135 meta tiles, so i'm not sure it has a ton of advantage
-
@eniko is the gourard shading just bilinear interpolation of vertex colors supplied by the caller, or do you actually have a lighting model on top?
And if so, what do you do in flat shading mode if a triangle has different vertex colors?
@nicklockwood it's just bilinear interpolation. the way it works is that vertices can have any number of interpolated attributes, so in gouraud it has r, g, and b attributes. in flat color mode it doesn't actually step the attributes at all and just pipes the color value straight through
-
@bnut a simpler optimization would be to count left sided vs right sided verts and switch iteration direction based on that
-
now i need to convert it from floating point to fixed point and i'll be mostly done with the optimizing stage. then i'll add some different rendering options (it just does flat and gouraud atm) and put it on github
ok ok one more. i'm checking right sidedness by counting vertices on the right side of the bounding box center, and if it is a right sided triangle i change the horizontal tile iteration from left-to-right to right-to-left
so now the left image's triangle doesn't do a bunch of extra work
-
ok ok one more. i'm checking right sidedness by counting vertices on the right side of the bounding box center, and if it is a right sided triangle i change the horizontal tile iteration from left-to-right to right-to-left
so now the left image's triangle doesn't do a bunch of extra work
@eniko This reminds me so much of a book I still have somewhere with assembly drawing routines from the demo scene of the late 90s.
Pro: taught me how to rasterize a curved line.
Con: I forgot everything.
I also don't remember the target platform.