Ian Curtis
c4b5b185c6
Disable light modifier on fog, seems not to work .. values don't make sense. Maybe the model3 doesn't use these.
2016-05-13 19:26:10 +00:00
Ian Curtis
c8f8cd1655
remove dead code
2016-05-13 08:40:53 +00:00
Ian Curtis
e295ad6868
double up polys for two sided polys, fixes some diffuse lighting problems
2016-05-13 08:39:48 +00:00
Bart Trzynadlowski
ddf3d5213d
FLT_MAX -> std::numeric_limits<float>::max()
2016-05-10 03:08:36 +00:00
Ian Curtis
34c81eabee
update header documentation
2016-05-09 16:53:12 +00:00
Ian Curtis
43add90d2f
Fix bad texture seems
2016-05-09 16:26:34 +00:00
Bart Trzynadlowski
846c9d0edd
Reverted stencil mask change. This reintroduces the Scud Race 'ROLLING START' bug. Previous 'fix' did not work for Magical Truck Adventure anyway and also broke some games (Daytona 2 transmission and course select screen, ECA title screen). The stencil mask is not shifted by 16 pixels and I suspect that either there is some unknown trick to horizontal scrolling or that the behavior is affected by hidden raster timing registers hidden in the JTAG interface.
2016-05-08 21:17:02 +00:00
Bart Trzynadlowski
9249eaa29f
Fixed logic for clearing bottom layer. Added new functions to 2D renderer interface. Avoid drawing top and bottom surfaces when no layers are present there. Added some comments to tile
2016-05-08 19:27:08 +00:00
Bart Trzynadlowski
5d048958b9
Rewrote 2D renderer and fixed 2D layer priorities, stencil mask clipping (Scud Race 'ROLLING START'), and cleaned up code. Unfortunately, the new code is about 50% slower, mostly due to the need to perform stencil clipping after scrolling.
2016-05-07 21:54:03 +00:00
Ian Curtis
69a44a5d5f
add texture helper functions
2016-05-07 18:57:06 +00:00
Ian Curtis
242cddac2d
remove pointless loop
2016-05-07 15:45:02 +00:00
Ian Curtis
ded3168060
Split face colour from per vertex poly colour. Fixes colour bleeding between connected polys in harley.
2016-05-07 15:28:04 +00:00
Ian Curtis
05e1e4de37
update poly header class
2016-05-06 15:00:12 +00:00
Bart Trzynadlowski
fee1cfb126
Fixed compilation on gcc (gotos cannot cross variable declarations)
2016-05-05 22:01:59 +00:00
Ian Curtis
da4bab5f9b
Flat shaded polys can't share vertex normals with adjacent connected polys. Fixes some bad lighting in Harley on pavements
2016-05-05 08:06:06 +00:00
Ian Curtis
b2da849d90
support flat shading
2016-05-05 00:01:17 +00:00
Ian Curtis
3693a51cbb
Make sure texture is bound to correct texture unit, stop flashing micro textures in daytona
2016-05-04 16:30:15 +00:00
Ian Curtis
b0569007ef
set correct microtexture wrap mode
2016-05-04 10:30:58 +00:00
Ian Curtis
c545b9fd85
preliminary microtexture
2016-05-04 00:35:07 +00:00
Ian Curtis
396fba7d24
skip viewports marked as disabled, might stop parsing some bad data
2016-05-03 21:17:37 +00:00
Ian Curtis
6d1aa4d527
fix compilation
2016-05-03 18:38:06 +00:00
Ian Curtis
c459772f8e
wrap invalid texture sizes, seems to fix bad textures in srally2 (skid marks)
2016-05-01 19:52:02 +00:00
Ian Curtis
7ec7906c0f
Turn off lighting if fixed shading (or no normals) flag is present. Fixes some of the lighting weirdness in scud
2016-04-30 20:32:44 +00:00
Bart Trzynadlowski
48767b2267
Legacy engine: fixed per-vertex fixed shading to incorporate Ian's findings that the intensity value is signed and that fixed shading applies only when lighting is enabled
2016-04-30 16:23:25 +00:00
Ian Curtis
23a5839d46
Daytona seems to use 3 bits for texture transparency, will figure it out later but for now this works
2016-04-30 09:02:38 +00:00
Ian Curtis
30ca1792bb
Fix fixed shading maths
2016-04-30 08:58:13 +00:00
Ian Curtis
c499e6640c
fixed shading code
2016-04-29 23:03:46 +00:00
Bart Trzynadlowski
57d5bc8367
Legacy engine: preliminary per-vertex fixed shading. Only limited testing with LA Machineguns (appears to work), Sega Rally 2 (appears okay), and Scud Race (fixes expert course bridge but not other mis-colored polygons).
2016-04-29 03:56:06 +00:00
Bart Trzynadlowski
34e8f00382
Legacy engine: extracting fixed shading component (but still can't use it because unsure of how to activate)
2016-04-28 13:18:15 +00:00
Ian Curtis
09e27e3082
color flag
2016-04-27 16:42:31 +00:00
Ian Curtis
8f6ab2fcf9
simplify
2016-04-27 08:13:22 +00:00
Bart Trzynadlowski
c0ec610e99
Polygon header bit analysis code (need to #define DEBUG and use -gfx-state option)
2016-04-27 04:09:50 +00:00
Bart Trzynadlowski
3682ab7300
Updated polygon header description with double-sided bit (forgot it in last update!)
2016-04-26 23:06:40 +00:00
Bart Trzynadlowski
85a77bb016
Added an updated description of the polygon header to the top of Legacy3D/Models.cpp
2016-04-26 23:04:11 +00:00
Ian Curtis
3e8439c09c
fix model normals, add code for fixed shading, as of yet flag to turn it on is unknown
2016-04-26 09:06:48 +00:00
Bart Trzynadlowski
b730fc466c
Legacy engine: vertex normals are standalone and do not need to be added to polygon normal
2016-04-26 00:12:02 +00:00
Bart Trzynadlowski
908d979cd7
Flattened out nested if-statements in new engine's fragment shader to improve compatibility with older GPUs (e.g., NVS 300)
2016-04-22 23:46:49 +00:00
Ian Curtis
58d187e59a
parse viewports in normal order
2016-04-19 22:05:12 +00:00
Ian Curtis
df9fefd064
walk siblings before children, fixes some of the transparency drawing issues in ocean hunter
2016-04-18 22:25:05 +00:00
Ian Curtis
057ee94210
simplify
2016-04-18 14:06:10 +00:00
Ian Curtis
a5301efed6
avoid cast warning
2016-04-17 00:02:16 +00:00
Ian Curtis
c4dc96ef71
simplify list code
2016-04-17 00:00:51 +00:00
Bart Trzynadlowski
34d4d8981d
Fixed 8-bit texture decoding in legacy 3D engine. Contour mode/alpha still needs to be made consistent (as much as possible) with new engine.
2016-04-15 04:26:42 +00:00
Ian Curtis
f52cb3c491
tweak frustum planes
2016-04-08 23:29:31 +00:00
Bart Trzynadlowski
22907b033f
Fixes for non-Windows builds: Makefile updated and fixed header files in Vec.cpp
2016-04-05 04:30:52 +00:00
Ian Curtis
5f68544641
revert viewport code
2016-04-04 10:50:05 +00:00
Ian Curtis
ecea4cad56
change tex format 4
2016-04-04 10:21:34 +00:00
Bart Trzynadlowski
38d5d14157
Clamping diffuse+ambient light intensity to 1.0 (legacy engine)
2016-04-04 04:32:10 +00:00
Bart Trzynadlowski
faf5f9cf48
Added a comment about viewports
2016-04-04 04:31:26 +00:00
Bart Trzynadlowski
6d9426759b
Fixed texture enable bit (fixes Star Wars light sabers and Sega Rally 2 cones) and added a hack for (and more comments about) color modulation. Scud Race, Sega Rally 2, LA Machineguns, etc. look correct now, but Fighting Vipers 2 shadows are no longer dark enough. Other bugs may exist.
2016-04-04 03:50:24 +00:00
Bart Trzynadlowski
1d4f5c871d
Fixed Types.h include
2016-04-04 03:43:55 +00:00
Ian Curtis
d155fbd6e4
rgb values were swapped for paletted colours
2016-04-03 23:21:50 +00:00
Ian Curtis
3bc2794b0a
Use the correct texture enable bit
2016-04-03 16:10:40 +00:00
Bart Trzynadlowski
3c8352f4ca
Added a comment: observation of Star Wars and Scud Race color modulation issues.
2016-04-03 04:09:06 +00:00
Ian Curtis
688af26846
Possible work around for slightly incorrect viewport positions in ECA and harley
2016-04-02 22:13:59 +00:00
Ian Curtis
c7412828d4
Use proper texture wrapping mode for 2d. Stops garbage down the top and left sides. Should really use NPOT texture.
2016-04-02 12:23:46 +00:00
Ian Curtis
7e7847bc83
Allow asymmetric projection matrices. Fixes a bunch of missing effects and bad camera angles in harley.
2016-03-31 09:27:42 +00:00
Ian Curtis
aee89390ba
add LOD table data. Maybe we can get clipping planes out of these
2016-03-28 20:11:46 +00:00
Ian Curtis
e79b241a49
properly mark dynamic meshes as such
2016-03-28 19:58:36 +00:00
Ian Curtis
e1278f4451
allow 8 bit mono textures to be contour textures, fixes a bunch of missing transparency in harley la riders
2016-03-27 08:39:40 +00:00
Ian Curtis
ffaed8ae32
clear the rom mesh buffer
2016-03-26 22:48:51 +00:00
Ian Curtis
4992e59673
Cache rom models, for better performance.
2016-03-26 22:44:26 +00:00
Ian Curtis
8488f22ac5
2016-03-24 13:26:28 +00:00
Ian Curtis
0327db246f
WIP
2016-03-24 13:17:17 +00:00
Ian Curtis
23172c9aec
fix for bad matrix with NaN
2016-03-23 01:05:02 +00:00
Ian Curtis
f031e5d095
finish front/back face culling code based on matrix determinant. Optimised opengl to avoid redundant state changes.
2016-03-22 23:39:59 +00:00
Ian Curtis
8ea5978093
fix parenthesis error
2016-03-22 21:59:51 +00:00
Ian Curtis
e7eb912eaa
add maths functions
2016-03-22 13:47:28 +00:00
Ian Curtis
93f6b01e0b
Update project to vs 2013. Clean compile warnings
2016-03-22 12:30:23 +00:00
Ian Curtis
ce99c47f8a
Remove double copy of shaders
2016-03-22 11:40:24 +00:00
Bart Trzynadlowski
3627213577
Fixed compiler warnings, whitespace, and moved local variable declarations to site of assignment
2016-03-22 03:43:31 +00:00
Bart Trzynadlowski
3afe3cf1a7
Moved
2016-03-21 23:27:30 +00:00
Bart Trzynadlowski
d61b01ab6f
Removing legacy 3D engine files that were already moved to Graphics/Legacy3D
2016-03-21 23:12:17 +00:00
Bart Trzynadlowski
34301e97e1
Adding new 3D engine by Ian Curtis. Old engine moved to Graphics/Legacy3D/.
2016-03-21 04:10:14 +00:00
Bart Trzynadlowski
f1e93bcd8f
- Fixed Win32 GCC Makefile.
...
- Reverted Nik's polygon palette index change in Models.cpp. Subtracting 1 was breaking Scud Race.
- Added an explicit typecast in Inputs.cpp, which GCC requires for some reason.
2012-07-16 02:27:55 +00:00
Nik Henson
183dca563d
Committing various small updates that have been hanging around in my source tree for a while now:
...
- Added 'crosshairs' command line and config option.
- Added 'vsync' command line and config option (so far only tested on NVidia cards on Windows 7 - other graphics drivers, O/Ss or driver settings may simply chose to ignore this).
- Added fullscreen toggle within game using Alt+Enter key combination.
- Added framework for lamp outputs and 'outputs' command line and config option. So far only the lamps for driving games are hooked up in the emulator (others to be added later).
- Added an initial outputs implementation for Windows that sends MAMEHooker compatible messages (-outputs=win to enable)
- Fixed fps calculation in Main.cpp that was producing incorrect results and so giving the impression that frame throttling wasn't working properly when in fact it was.
- Fixed palette indexed colours as the index was always off by one, causing incorrect colours in various games, eg drivers' suits and flashing Start sign in Daytona 2.
- Altered caching of models so that models with palette indexed colours use the dynamic cache rather than the static one. This is so that changes in palette indexed colours appear on screen, eg the flashing Start sign on the advanced course of Daytona 2 (although currently the START message itself is not visible due to other problems with texture decoding).
- Fixed small bug in TileGen.cpp which meant both palettes were being completely recomputed pretty much with every frame. This was a significant performance hit, particularly as palette recomputation is currently being done in SyncSnapshots (it should be moved out of here at some point, although for now it's no big deal).
- Made sure all OpenGL objects and resources are deleted in Render2D/3D destructors, in particular the deleting of the VBO buffer in DestroyModelCache.
- Made sure that GLSL uniforms are always checked to see if they are bound before using them in order to stop unecessary (but harmless) GL errors.
- Altered the default texture sheet handling to use a single large GL texture holding multiple Model3 texture sheets rather than multiple GL textures as before (if required, the old behaviour can still be selected with the mulisheet fragment shader). I believe this fixes the disappearing crosshairs/corrupt GL state problem which the multisheet fragment shader seemed to be triggering somehow.
- Fixed a bug in debugger which meant memory watches were not triggering properly
2012-07-15 21:04:46 +00:00
Bart Trzynadlowski
93b71c8429
Applied Nik's fix for cyclical scene graphs. Improves Harley Davidson, Ski Champ, Emergency Call Ambulance, and Ocean Hunter.
2012-03-31 19:41:55 +00:00
Bart Trzynadlowski
1bce444668
Brought in the near clipping plane for Step 1.5+. Objects close to camera are no longer cut-off (e.g., driver arms and steering wheels in cockpit views). Note: This change should probably be applied to Step 1.0 as well in the future. For now, I am leaving the old distance because Step 1.0 coordinates need closer investigation. Bringing in the near clipping plane extends the view frustum depth and will worsen Z-buffer accuracy. Be on the lookout for Z-fighting that did not previously exist.
2012-02-28 04:34:32 +00:00
Bart Trzynadlowski
69610ef8dd
Added a clear() method to VBORef and removed unsafe memset() clear.
2012-02-25 06:36:04 +00:00
Nik Henson
3b41239cfb
This update fixes (hopefully) the last of the texture upload lags that were affecting some games, in particular Daytona 2 and Spikeout.
...
To achieve this UploadTextures no longer clears the model cache when called. Instead the cache is kept in-tact (which should help improve cache hits) and all textures referenced by models being rendered are (re-)decoded with every frame.
To help with tracking all the unique texture references contained in a model a new class TextureRefs has been added.
2012-02-23 23:20:21 +00:00
Bart Trzynadlowski
16e4fcab06
Forgot to update to-do list in previous revision. Added a comment to mark CRender2D::WriteVRAM() as deprecated.
2012-02-23 00:12:46 +00:00
Bart Trzynadlowski
fcf1d955a9
Previous "optimization" contained a mistake and made things worse. Removed unnecessary clear of the bottom layer buffer. Now, if there is no bottom layer, it will not be displayed at all and glClear(GL_COLOR_BUFFER_BIT) is used instead.
2012-02-22 01:34:42 +00:00
Bart Trzynadlowski
c085be59af
Further optimization/simplification of the 2D renderer's main loop.
2012-02-20 04:09:11 +00:00
Bart Trzynadlowski
453df4f5f5
- Finished cleaning up and optimizing the 2D renderer.
...
- Fixed up color offset register support for new 2D rendering system. Now maintains 2 computed palettes for layers A/A' and B/B'.
- Fixed a minor bug in InitPalette(); VRAM was not being typecast properly.
- Fixed specular lighting bug that occurred on some OpenGL drivers because integers were not being interpreted as floats in the vertex shader.
- Began to update copyright date in some files.
- Graphics modules now use the C++-style names for C standard library headers (e.g., stdio.h -> cstdio) consistent with the rest of Supermodel.
2012-02-20 03:45:48 +00:00
Bart Trzynadlowski
0257f1f9e8
Contour processing (discarding of pixels when alpha==0) enabled for A4L4 texture formats. Improves smoke and fire in Daytona 2.
2012-02-17 07:45:50 +00:00
Bart Trzynadlowski
79d24d403f
- NOTE: In this revision (possibly earlier), I've started to notice some intermittent geometry glitches in Spikeout and slowdown while playing certain characters.
...
- Added multi-texture fragment shader to repo.
- Added a multiTexture option (enabled by default) to use multi-texturing to decode textures.
- Added some comments regarding timing to the PowerPC execution loop.
2012-02-14 03:28:52 +00:00
Nik Henson
30130f2bd5
Updated fragment shaders' floating point comparisons and also some knock-on changes from SVN revision 246.
2012-02-13 23:51:32 +00:00
Nik Henson
84eb017744
Added support for multiple texture sheets (with up to one per Model 3 texture format) as a rather brute-force way to handle overlapping texture formats in the current 3D engine. This fixes some corrupt textures in Daytona 2 and Virtua Striker 2 (and possibly other games) and also offers a small speed increase when some scenes load multiple overlapping textures.
...
This feature only enables itself when a compatible shader script is loaded. Since none have been checked in yet this means it is currently disabled.
2012-02-13 21:54:26 +00:00
Bart Trzynadlowski
1b8740165c
Added a wide screen hack that can be enabled with the -'wide-screen' argument or WideScreen in the config file.
2012-02-10 19:53:51 +00:00
Bart Trzynadlowski
6814ef1ed8
Added preliminary specular lighting to shaders. The "no spotlight" shader has not yet been updated.
2012-02-06 02:54:43 +00:00
Bart Trzynadlowski
0fcb9686f9
Documented the tile generator.
2012-01-27 22:27:38 +00:00
Bart Trzynadlowski
8a8609f383
- Added specular highlight support to the 3D engine. A shininess parameter is now be passed to the shaders. Does not work correctly and I will save the shaders themselves for a future commit.
...
- Added support for layer priorities. Highly unoptimal! This absolutely needs to be polished up before any release (and properly documented). For now, priorities in the popular games seem to be fixed but not all possible priority settings have been figured out yet.
2012-01-27 05:52:59 +00:00
Bart Trzynadlowski
c38ec7d5af
Removed unused dirty rectangle code.
2012-01-26 02:57:02 +00:00
Bart Trzynadlowski
e00a372cef
Removed unused dirty rectangle code.
2012-01-26 02:49:07 +00:00
Bart Trzynadlowski
b7980aa562
Removed unused dirty rectangle code.
2012-01-26 02:48:16 +00:00
Bart Trzynadlowski
3315fb463b
Small correction to lighting model in shaders. Light intensity is no longer clipped.
2012-01-22 01:05:59 +00:00
Bart Trzynadlowski
b57ba51e44
Removed unused (and non-functional) 'stack machine' scene graph traversal.
2012-01-18 08:12:23 +00:00
Nik Henson
d1d5175548
New multi-threaded rendering changes that parallelise graphics rendering and PPC execution in order to increase performance on multi-core machines.
...
New gpuMultiThreaded config option to enable/disable multi-threaded rendering (enabled by default, disabling it reverts to previous behaviour).
Other rendering optimisations:
- texture uploads now only affect appropriate region in the texture sheet, rather than uploading the whole sheet each time
- performance of clearing the model caches has been improved
New Alt+O key input added to toggle outputting of frame timings for debugging purposes.
2012-01-16 23:21:14 +00:00
Bart Trzynadlowski
bdf11c765f
Preliminary backface culling fix. Matrices which effectively change the polygon winding without changing the Z component of the polygon normal are tested for when appending items to the display list. If necessary, the polygon winding is changed on the fly to ensure visibility is correct. This code desperately needs to be optimized. Note: Not yet thoroughly tested.
2011-12-26 06:10:55 +00:00
Bart Trzynadlowski
7f97346fc9
- Tweaked some error messages and comments. Hopefully, this is the last update for v0.2a's code.
...
- Documentation updates.
2011-09-24 01:49:48 +00:00
Bart Trzynadlowski
2f5bf43bda
Updated copyright information and added headers to all remaining files except debugger.
2011-09-14 19:08:43 +00:00
Bart Trzynadlowski
11d1d61bc2
- Removed BOOL and replaced it with native C++ type, bool.
...
- Removed TRUE and FALSE, changed to 'true' and 'false' keywords.
2011-09-08 06:34:18 +00:00
Bart Trzynadlowski
d318efe58c
- Program settings are now managed by the CConfig class.
...
- Moved Logger.h to OSD/, cleaned up comments.
- Command line and config file parsing have been rewritten.
- Began replacing C standard library headers with C++ versions (eg. stdio.h -> cstdio). I think I got most of them, but not all.
2011-08-19 20:43:07 +00:00
Bart Trzynadlowski
fce3c7ad7c
- skichamp now works, but controls are not hooked up and seems to overload the display lists like many non-working Step 2.x games do. To bypass the drive board error, enter the test menu and exit again. It will reboot and run.
...
- Added some notes on the cause of the "NO DAUGHTER BOARD DETECTED" error in Real3D.cpp.
- Removed some debug code from texture uploader.
2011-08-02 03:33:40 +00:00
Bart Trzynadlowski
ddd6fa92ef
- Improved 68K interface. Now supports context switching.
...
- CSoundBoard is not derived from CBus.
- Optimized sound board memory handlers (now using switch statements).
- Added DSB emulation (based on R. Belmont's M1 source code).
- Improved ROM loading: only unique ROMs (those not shared amongst games) are used to identify games. The ROM loader will no longer get confused as easily.
- General cleanup here and there, removed unused Render.h file.
2011-07-31 02:37:31 +00:00
Bart Trzynadlowski
79e8172340
- Textures are no longer decoded for un-textured polygons (not sure if this fixes anything yet).
2011-07-22 19:01:45 +00:00
Bart Trzynadlowski
d2ecec7997
- Textures are no longer decoded for un-textured polygons (not sure if this fixes anything yet).
2011-07-22 18:56:35 +00:00
Bart Trzynadlowski
a033058deb
- Texture offsets: models are now decoded for each individual texture offset state and texture coordinates are adjusted while generating the vertex data.
...
- Model LUT now capable of differentiating between texture offset states (linked list of different texture offsets for each model address).
- Removed texOffset uniform attribute from vertex shader -- no longer needed.
2011-07-21 08:12:16 +00:00
Bart Trzynadlowski
a90075830c
Texture offsets.
2011-07-06 05:05:38 +00:00
Bart Trzynadlowski
cd2621b2ce
Added texture offsets. Vertex shader has been updated in Shaders/Vertex.glsl.
...
Added palette initialization to 2D renderer. Fixes 2D graphics corruption when loading states (most visible in Scud Race).
2011-07-04 20:53:37 +00:00
Bart Trzynadlowski
783446fca2
Fixing import mistake: moving source code to trunk/Src.
2011-04-24 01:19:40 +00:00