PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Changes to d_scan.c

I'll just post this bit of info then:

I've removed the 'perspective correctness' from D_DrawSpans8, and made it 100% fixed point. Some background info: This function is passed a 'span' struct, wich contains only an u/v and a length. This struct represents a single horizontal line of a polygon on screen. This is weird: u/v are normally used to represent coordinates in a texture map, but in Quake, they are SCREEN coordinates. So, this struct actually contains only enough info to know where to draw a span, and how long it should be. U and V, in turn, are called S and T in Quake. Keep this in mind, it makes life easier. :)

So, the span struct doesn't contain enough info. 'Enough info' is therefore obtained from a globally declared set of vars that form a matrix, wich is used to transform 2D screen coordinates into a position on a texture map. These vars are floats, so I convert them to fixed point each time they change. This is at most once per polygon, but usually not that often (since multiple polygons use the same texture mapping).

If anyone wants to test the new code, let me know. I have no idea how much speed I have gained. :)

- Jacco.
Yeah, ID uses a ton of global vars. Not the best practice, and it makes following the code much harder. If you want to email me the modified files I'll build and try them, or send me the exe or whatever. Is perspective correctness anything like political correctness? Quake has never been politically correct, so I guess it need not be the other either. ;)

Dan East
Do we need shaded monsters and particle effects by the way? :) I removed some of those, to see if the speed goes up.
Don't panic, I can put them back at any time. :)
Dan: I'll send you the modified stuff right away.
It would be nice to perhaps add in Quake console variables to allow runtime selection of which effects to provide. I can do that part if you put in some decent comments (unlike ID, I think there's like 5 comments in the entire Quake source). :) I removed the sky / water / lava surface animations, and it made absolutely no change in performance. I guess that further indicates that the actual 3D rendering is taking 95% of the work. I tried a build with no textures at all, and still a very insignificant improvement was realized (like .5 fps).

Dan East