Commit graph

659 commits

Author SHA1 Message Date
Ian Curtis 18f460db6f 2017-09-24 22:49:20 +00:00
Ian Curtis da1342b5d9 update project files 2017-09-24 22:39:53 +00:00
Ian Curtis 0376f74192 work around for visual studio bug 2017-09-24 22:36:12 +00:00
Ian Curtis adecec77de fix missing header 2017-09-24 22:14:39 +00:00
Ian Curtis 7590f50350 cannot specify explicit initializer for arrays - fix for visual studio 2017-09-24 22:03:31 +00:00
Bart Trzynadlowski 55bb02d4e5 - New work-in-progress frame timing code (disabled by default, compile with NEW_FRAME_TIMING defined to activate it)
- New JTAG emulation, moved into its own class, CJTAG
- Removed game-specific sun clamp hacks from CNew3D (JTAG and Real3D emulation will call the appropriate method to configure this at run-time)
- Removed JTAG from Real3D save state data and reused some of that space for new state variables having to do with the internal JTAG-based config as well as new frame timing state variables
2017-09-24 20:52:48 +00:00
Bart Trzynadlowski c4f8471d7a Added functions to safely read and write bools 2017-09-24 20:49:31 +00:00
Bart Trzynadlowski 1db2f6bb84 Added functions to extract bits as integer values and updated comment about bit vector layout 2017-09-24 18:40:58 +00:00
Bart Trzynadlowski 3041ca1922 Added SetOnes() and SetZeros() 2017-09-23 16:08:27 +00:00
Bart Trzynadlowski c3eef706e8 Safe guard against shifting empty register. 2017-09-23 15:40:20 +00:00
Bart Trzynadlowski 98b0354dd6 Hex formatting support extended to 64 bits. 2017-09-23 15:33:26 +00:00
Bart Trzynadlowski 61a0517bd9 Added ShiftOutLeft() and ShiftOutRight() 2017-09-23 15:03:06 +00:00
Bart Trzynadlowski 7a2e6b393a Renamed shift in/out functions to add/remove to be less ambiguous about their functionality 2017-09-23 14:42:05 +00:00
Bart Trzynadlowski 86631695d7 Added ToHexString() and made ostream serialization use this 2017-09-19 19:43:06 +00:00
Bart Trzynadlowski e12a945ddd Fix for VS2015 and newer by MetalliC 2017-09-18 04:24:23 +00:00
Bart Trzynadlowski f2030ac125 Added BitRegister class (for use in upcoming JTAG refactor): an inefficient but flexible container for manipulating a dynamic bit stream. 2017-09-07 19:33:25 +00:00
Ian Curtis a3e2fb7906 Calculating the length of the vertex results in quite broken values for fogging when the vertices are traversing the view frustum. The hardware also wouldn't have been doing a square root per vertex for fogging. Simply using the z values is enough. Todo check clamping of values for the near/far planes. 2017-09-06 13:07:39 +00:00
Ian Curtis 2786d95795 add interface for sun clamp 2017-09-02 14:54:16 +00:00
Ian Curtis 266c911133 Optimise vertex data to cut down on unnecessary copying 2017-08-30 21:45:25 +00:00
Ian Curtis 165926aa06 Modern hardware does backface culling in window space by calculating the face normal for the polygon, then doing a dot product against the view vector. The real3d pro-1000 on the other hand passes a pre-calculated face normal for each polygon which is used for culling. We were using this face normal to rewind the polygons so that regular backface culling would work. This worked 99.9% of the time. However this was failing on some models in Virtua Striker. The reason was because the pre-calculated face normals being passed were actually completely different to the actual face normals for the poly (not just inverted like you would expect). This broke our code. The solution was to emulate face culling directly in the vertex shader using the pre-calculated face normals directly. Only minimally tested this but hopefully there are no obvious regressions. 2017-08-29 10:27:29 +00:00
Bart Trzynadlowski f04a285727 DMA and register space access for Real3D have been unified and CReal3D::ReadRegister() returns little endian data now that the PowerPC handler byte-swaps back, to be consistent with how DMA registers work. 2017-08-29 01:28:21 +00:00
Ian Curtis 50d1f95648 Changed fixed shaded logic for step 1.5 hw based upon Harry's findings 2017-08-25 22:40:39 +00:00
Ian Curtis b21ed49512 cosmetic 2017-08-21 23:00:29 +00:00
Ian Curtis cd5978773a Harry made some important discoveries with regards to fixed shading on the model 3 (per vertex poly brightness values). Firstly values are allowed to be negative, and they are used as a drop in replacement in the standard lighting equation for the normal dot light vector. This quite radically changes the brightness in LA Machine guns, but now correctly matches the arcade. 2017-08-19 20:06:31 +00:00
Bart Trzynadlowski 94e6f9a156 Patched Sega Rally 2 DX to boot up. Enjoy Sega Rall 2 without MPEG music at 50% speed ;) 2017-08-19 19:29:05 +00:00
Bart Trzynadlowski 507990a350 Fixed up memory region dumping code to use the new Util::FlipEndian functions 2017-08-19 19:27:58 +00:00
Bart Trzynadlowski 21f813ad3e Fixed a bug in MCRFS instruction related to the VXSOFT, VXSQRT, and VXCVI bits. Thanks to Spindizzi. 2017-08-16 00:58:39 +00:00
Ian Curtis 0efd4dac39 Finish fixed shading for 2.0 hardware. I'm pretty sure it actually works identically to step 1.5 hardware. The oddball is LA machine guns where the viewport ambient doesn't seem to effect the brightness. But the ambient works differently in this game because it uses the unclamped light model. Still need to investigate if the diffuse factor effects fixed shading. 2017-08-15 23:21:57 +00:00
Ian Curtis b1cc9a615d With fixed shading, when lighting is disabled, fixed shading appears to be a flat shaded version based upon the poly colour, instead of per vertex attributes. 2017-08-15 20:50:36 +00:00
Ian Curtis 2422caadc6 Pad struct and align on 4 byte boundary. 2017-08-15 20:45:08 +00:00
Ian Curtis eac76f0908 simplify 2017-08-14 23:30:34 +00:00
Ian Curtis 81188bee07 fixed shading doesn't effect the alpha channel 2017-08-14 16:10:26 +00:00
Ian Curtis c12e4c3215 Fixed shading (per vertex poly colours) on step 1.5 hardware have the viewport ambient value added to them. This fixes various shading on scud. To do this had to switch the maths to the vertex shader. 2017-08-14 09:14:06 +00:00
Ian Curtis 8f622714a7 Fix attribute locations. glBindAttribLocation must be called linking 2017-08-11 11:59:41 +00:00
Bart Trzynadlowski a315627401 Added support for loading shaders from files for new engine and tile renderer. Changed help text to reflect new engine being default. 2017-08-11 00:41:10 +00:00
Ian Curtis 7dc1eac614 make the new3d engine default :] Legacy engine can still be selected using -legacy3d in the command line 2017-08-10 15:59:16 +00:00
Ian Curtis d7403afda6 use generic vertex attributes 2017-08-10 15:43:03 +00:00
Ian Curtis 57d0a513fd Technically matrix casts are only allowed in glsl 1.2 and later 2017-08-09 23:25:01 +00:00
Ian Curtis 063b7d3ea4 Remove debug code 2017-08-09 21:40:48 +00:00
Ian Curtis 5709ee2659 Sometime ago I managed to work out that specular on the model3 is not real specular, and really is just an extension of diffuse lighting. But attempts were derailed by corner cases and the fact we were not handling the normals correctly. Anyway Harry managed to successfully come up with an algorithm, and coefficients that give an almost perfect match to specular on the model3, based soley on observations from video footage! He also worked out that the lighting on hardware 1.5 onwards appears to be unclamped (ie greater than 1). This quite radically changes the brightness of some of the games, but much better matches the original hardware. 2017-08-09 16:56:56 +00:00
Ian Curtis 1d338877fc cosmetic 2017-08-03 11:05:04 +00:00
Ian Curtis 3fc28159eb Add the unclamped light model we know exists to the shaders. 2017-08-03 10:41:18 +00:00
Ian Curtis b1bd877b82 Ski champ for some reason is passing denormalised numbers for the modelscale. This is causing a NaN in our shader killing the lighting for these models, so we simply skip these, since they are essentially zero anyway. Thanks to Harry for finding this bug :) 2017-08-01 23:48:53 +00:00
Ian Curtis 9aa3f13777 We were force normalising the result of matrix * normal, which looked correct in most cases. But this didn't preserve the scaling of the matrix, or the scaling of the model normals which resulted in many over bright areas. On it's own this generally worked, but games like Star Wars looked quite broken. Harry correctly figured out if you scale these normals by the scaling value that is sometimes present in the culling nodes the lighting looks correct. Still more work to do to correctly figure out the model3's lighting model. 2017-07-29 16:30:30 +00:00
Ian Curtis a9b49c1676 Implement unclamped light model based upon Harry's findings. Unknown how this is turned on/off. 2017-07-22 17:15:14 +00:00
Ian Curtis 2335f3173b Use c++11 raw string literals 2017-07-08 10:55:14 +00:00
Ian Curtis 3efb055344 Clamp the ambient light to a max of 0.75. LA Machine guns seems to use an ambient value of 1, which is full bright for everything. But for some reason the hardware seems to treat this as ~ 0.75. This fixes various missing shading in the game. This doesn't seem to have any negative effects on other games I have tested. Clamping in the shader as we might need the full range of values for fixed shading. 2017-06-29 19:05:30 +00:00
Ian Curtis 9e9a549283 remove WIP code 2017-06-25 20:09:45 +00:00
Ian Curtis ec3872d108 convert sun angle coordinate system outside of the shader 2017-06-25 19:50:02 +00:00
Ian Curtis 97781108e8 A second go at fixing the fixed lighting in star wars .. Fixed shading is per vertex poly colours. For some reason in star wars they are treated as unsigned values instead of signed, like in every other game. These polys are all marked with specular enabled, where as in the rest of the games they are missing this flag. That's the only difference I can find. 2017-06-21 17:04:53 +00:00