Nico de Poel
8b34fb1950
Small tweaks: made background black to cover up seams, defined a few flags
3 years ago
Nico de Poel
3b5a59dae6
Geometry, textures and lighting now all working correctly.
Ditched the concept of surface vertices, as UVs cannot be shared between polygons.
3 years ago
Nico de Poel
ebbc01c672
Overhaul of geometry representation, with correct UV'ing and more finely tesselated surfaces.
3 years ago
Nico de Poel
62cfb91f1c
Made some tweaks after experimenting with interlaced mode:
- VSync needs to be enabled for interlaced mode to work at all
- Y offset does not need to be doubled in interlaced mode
3 years ago
Nico de Poel
989ec0bafb
Simplified toggle behavior for button inputs, and added an option to toggle texturing with the circle button.
3 years ago
Nico de Poel
9c1cbd467e
Small tweaks:
- Math functions return results in 32-bit int, cast back to short is done only where necessary
- Changed GTE screen distance to obtain an exact 90 degree horizontal FOV in 4:3 mode
3 years ago
Nico de Poel
a478a7c1ed
Fixed a silly mistake in the primitive buffer allocation space check
3 years ago
Nico de Poel
b43767ebb8
Realized we can include the UV offsets into the UVs stored in the preprocessed map file, so we don't need to add those at runtime. Easy performance win.
3 years ago
Nico de Poel
35d91b1de2
Switched to map atlas image file generated directly by the preprocessing tool, rather than a .pcx converted by img2tim.
This one fixes the holes in the textures on pure black pixels.
3 years ago
Nico de Poel
6a3554511b
Simplified controls, so that strafe left/right only moves on the X/Y plane, while up/down only moves along the Z axis.
3 years ago
Nico de Poel
5549e3f126
Textures are now showing up somewhat correctly!
Most of the actual changes are on the data conversion side.
3 years ago
Nico de Poel
297ae187f6
Fixed some issues with texture atlas generation.
The image is at least stable now, but textures are still not drawing properly.
3 years ago
Nico de Poel
76a6dc92d5
First pass at implementing texturing of face polygons.
Not quite right yet but things are starting to work.
3 years ago
Nico de Poel
1a88f6e052
Fixed the wonky camera rotation, though the left/right vectors are still off.
3 years ago
Nico de Poel
c8c44b352f
A bit of cleanup ahead of attempting to make textures work
3 years ago
Nico de Poel
36c409115a
Use per-face vertex lighting for improved geometry definition and less light leaking between sharp-angled surfaces.
3 years ago
Nico de Poel
1796d75c20
Made the framerate counter show 100ths of a second
3 years ago
Nico de Poel
586ee71c3c
Added anamorphic 16:9 widescreen support because why the heck not?
3 years ago
Nico de Poel
e1d239150e
Made polygon building faster by checking ahead of time if we have enough primitive buffer space, instead of checking it per polygon.
Also the primitive buffer management is now all done through inline functions.
3 years ago
Nico de Poel
59d838f501
Small optimization to BSP tree traversal, by making the child node selection branchless
3 years ago
Nico de Poel
b0d36ab11b
Sped up plane calculations by making use of axis-aligned properties
3 years ago
Nico de Poel
bbf87bbf58
Implemented backface culling per face, by adding plane and center point fields to the face struct and checking the plane's normal against the camera vector to the center point.
This eliminates the need for per-polygon normal clipping and reduces the amount of redundant vertex copying, for a measurable speed boost.
3 years ago
Nico de Poel
ddffc8860e
Fixes to make things work on real hardware again:
- Struct pointers need to be 32-bit aligned, otherwise the PS1 will crash
- For this purpose, some structs have been padded to make them a multiple of 4 bytes in size
- Vector data needs to be copied into scratch RAM at a 32-bit aligned address
3 years ago
Nico de Poel
3a7ea8d4b3
Debugging work:
- Load map data using a macro, so I can easily change the implementation for all data chunks.
- Implemented a visdata function that loads all 1's, so that every leaf will be drawn.
- Point-to-plane distance now uses copies of input vectors. May or may not be faster.
- Fixed fps counter rounding and disabled vsync so we can see the true framerate
3 years ago
Nico de Poel
a05a800da0
Implemented PVS decompression, leaf visibility check using PVS data, and front-to-back traversal of the BSP tree.
3 years ago
Nico de Poel
b7da18d0c8
First bits of code involving BSP traversal with front/back selection and math: determine the leaf that the camera is currently in.
3 years ago
Nico de Poel
337406c03f
Use the node and leaf data to traverse the entire BSP tree and draw all attached faces.
This already gets rid of all the collision volumes that were being drawn before.
3 years ago
Nico de Poel
37f619dc94
Load plane, node and leaf data, and iterate through leaves to draw faces.
3 years ago
Nico de Poel
0e1bb7a5bf
Reworked PS1BSP format to use dentry-style header info
3 years ago
Nico de Poel
c5783982e1
Added a more aggressive inlining macro. Not sure if it makes any difference now, but it's nice to have the option.
3 years ago
Nico de Poel
dfa6ec2f85
Split face drawing off into a separate function, and made triangle fan and triangle strip available again as alternative options, for comparison.
Also using triangle fan as a special case for faces with three vertices, i.e. a simple single triangle.
3 years ago
Nico de Poel
d3efa8e590
Keep track of and display total polycount
3 years ago
Nico de Poel
75ae399d38
Implemented quad strip topology for rendering faces, which is actually a good bit simpler than triangle strips.
3 years ago
Nico de Poel
7606d89998
Implemented triangle strip topology for drawing faces
3 years ago
Nico de Poel
3167f1474e
Faces can now carry their own per-vertex lighting data, instead of sharing all vertex data with adjacent faces.
3 years ago
Nico de Poel
d7a4957452
Re-enabled bounds check for primitive buffer. Fixes crashing on larger maps.
3 years ago
Nico de Poel
08008af2a0
Implemented rudimentary baked lighting through vertex colors and gouraud shading.
3 years ago
Nico de Poel
eb05cec59c
Adjusted display values slightly to better match aspect between NTSC and PAL, and for better vertical centering in PAL.
3 years ago
Nico de Poel
f8a4d171a3
Faces now have a vertex index list, which is more space-efficient and allows easy rewrites of polygon topology.
Also works quite well with the scratchpad RAM setup.
3 years ago
Nico de Poel
1336d0b2b5
Reset background and dither flags when switching video modes. Fixes flickering background.
3 years ago
Nico de Poel
79f1e52d1e
Rewrote scratchpad function to work more as I envisioned it:
sequential calls will pass on a variable to each other that gets updated with the new offset position in the scratch buffer.
3 years ago
Nico de Poel
a6e9aa1b21
First simple test with scratch memory, just to verify that it works.
3 years ago
Nico de Poel
a68b2c370f
Set up some helper functions for memory management, including scratchpad memory. Moved the primitive buffer here too.
This will probably have to become inline functions or macros at some point, but for now it's just pure C.
3 years ago
Nico de Poel
f4017d5f56
Modified triangle rendering code so that it finally works on real hardware.
Not sure why the original method doesn't work, probably some weird limitation on the memory/GTE register subsystems.
This will get rewritten anyway so it doesn't matter much now.
3 years ago
Nico de Poel
780abe0d84
Fixes to the time system to make it work on real hardware, and prevent potential crash from division by zero.
3 years ago
Nico de Poel
be9719ce03
Made a few changes to the ordering of the display code, which fixes execution on real hardware.
This also fixes the text overlay, which now renders on top of the 3D content.
3 years ago
Nico de Poel
5709d4973c
Adapted Select button input to switch between NTSC and PAL, which is a bit more useful at the moment.
3 years ago
Nico de Poel
edd851f9e3
Tweaks to time system:
- Init time system first, because it no longer depends on video mode.
- Made real time updates less frequent, so it has less impact on performance. Still more than accurate enough.
3 years ago
Nico de Poel
a80c6d490b
First implementation of interlaced mode and switching display modes by pressing Select.
Still a bit buggy, not sure what I'm doing wrong. Will have to revisit this after performance is improved.
3 years ago
Nico de Poel
adff38b978
Expanded display initialization code with proper handling of both NTSC and PAL aspect ratios, and allowing PAL to render at higher resolution.
Also includes provisioning for switching between progressive and interlaced modes.
3 years ago