Commit graph

1239 commits

Author SHA1 Message Date
alexey.lysiuk
cb5ddeff25 Fixed compilation warnings reported by Clang
src/gl/scene/gl_clipper.h:150:23: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
src/gl/dynlights/gl_aabbtree.cpp:137:24: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:137:34: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:137:44: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:139:6: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:139:30: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:139:54: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:142:6: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:143:3: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:144:3: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:167:6: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_shadowmap.cpp:163:31: warning: '&&' within '||' [-Wlogical-op-parentheses]
src/p_saveg.cpp:367:16: warning: comparison of integers of different signs: 'unsigned int' and 'int' [-Wsign-compare]
src/p_saveg.cpp:402:60: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
src/p_setup.cpp:1553:39: warning: format specifies type 'ptrdiff_t' (aka 'long') but the argument has type 'int' [-Wformat]
src/scripting/zscript/zcc_compile.cpp:293:74: warning: field 'AST' will be initialized after field 'mVersion' [-Wreorder]
src/swrenderer/drawers/r_thread.cpp:113:21: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
2017-03-18 15:13:02 +02:00
Christoph Oelckers
c9296ead57 - moved the skybox texture files to the main textures directory. 2017-03-17 21:12:09 +01:00
Christoph Oelckers
fee18a6971 - fixed the attenuation check in gl_GetLight. 2017-03-17 20:16:49 +01:00
Christoph Oelckers
7d8d69d01b - fixed: The clipper for the main scene may not be initialized before the camera textures have been drawn.
It looks like the memory management at use here is not capable of maintaining multiple instances simultaneously and the camera textures create another scene drawer so the initialization of the main scene drawer has to be delayed until after the camera textures are done.
2017-03-17 19:28:47 +01:00
Christoph Oelckers
ea1d6634f7 - moved the Zones array into FLevelLocals.
- replaced TStaticArray with regular TArrays.

They had incomplete implementations preventing proper cleanup of the level loading code. It makes more sense to add the missing methods to the regular TArray and use that.
This also makes some changes to how the game nodes are used to avoid creating a copy: If the head node's pointer is stored in a separate variable, no code needs to check which of the two arrays gets used.
2017-03-17 12:11:37 +01:00
Christoph Oelckers
fea4079b7c - moved nodes into FLevelLocals. 2017-03-17 01:42:37 +01:00
Christoph Oelckers
f201dab534 - moved the subsectors into FLevelLocals. 2017-03-17 00:22:52 +01:00
Christoph Oelckers
59b684bdbc - moved the segs array into FLevelLocals. 2017-03-16 21:34:04 +01:00
Christoph Oelckers
2b2c986bd0 - cleanup of GL renderer interface and improper header use in software renderer. 2017-03-16 21:34:03 +01:00
Christoph Oelckers
b529b1e3a7 - removed several unneeded GL headers from the software renderer's sources.
- consolidated the code to calculate a sprite's display angle for all 3 renderers.

As it turned out, they all differed in their feature support because they had always been updated independently by different people.
2017-03-16 13:49:34 +01:00
Christoph Oelckers
3aa7687d91 - made 'nocoloredspritelighting' a global option and also implemented it in the software renderer. 2017-03-16 00:56:03 +01:00
Christoph Oelckers
921bc763fb - separated the software-renderer-specific parts of colormap processing from the common parts.
- moved testcolor and test fades into SWRenderer files.

These CCMDs work by hacking the default colormap and were never implemented for hardware rendering because they require many checks throughout the code.
2017-03-15 22:04:59 +01:00
Christoph Oelckers
9a24771a7d - refactored FDynamicColormap out of sector_t.
This has increasingly become an obstacle with the hardware renderer, so now the values are being stored as plain data in the sector, with the software renderer getting the actual color tables when needed. While this is a bit slower than storing the pregenerated colormap, in realistic situations the added time is mostly negligible in the microseconds range.
2017-03-15 22:04:59 +01:00
Christoph Oelckers
d86bd470e5 - moved two MAPINFO settings that are not exclusively used by the OpenGL renderer to the common code. 2017-03-14 18:31:11 +01:00
Christoph Oelckers
3c6e9f361c - fixed typo in fog boundary check. 2017-03-14 16:13:00 +01:00
Christoph Oelckers
44a087554f - moved the OpenGL fog properties to FLevelLocals to simplify their handling.
- added access to the glow properties for ZSCript and ACS.
2017-03-14 13:54:24 +01:00
Christoph Oelckers
0ebe98d1e0 - added support for reading JASC palette files. I hope it's correct, considering I have no such files to test. The format should be simple enough, though. 2017-03-14 12:16:42 +01:00
Christoph Oelckers
5141fee8c0 - reverted the change of position where polyobjects get linked to the subsectors. 2017-03-13 21:17:25 +01:00
Christoph Oelckers
feb680a4eb - Removed the RSQRTSS code from GLSeg::Normal.
If we have to write compiler specific code for micro-optimizations I am out.
The Posix compatible version nullified most the advantage on MSVC by writing out the XMM register to memory and then reading back the float.
That's not worth the hassle for an optimization that brings a few microseconds at best.
2017-03-13 13:17:15 +01:00
alexey.lysiuk
fc8b697e33 Fixed compilation of POSIX targets
TODO: Need better way to detect SSE support
2017-03-13 12:51:06 +02:00
Christoph Oelckers
60fd79ce23 - some menu reorganization:
* dynamic lights also work in the true color software renderer and have been moved out of the OpenGL menu.
* created a separate software renderer menu and moved all relevant options there.
* delete non-applicable options when running in legacy mode.
* moved the OpenGL preferences menu one level up to eliminate a two-entry GL top level menu.
2017-03-13 01:17:46 +01:00
Christoph Oelckers
4965cdfd9a - removed some unused global variables. 2017-03-12 23:56:17 +01:00
Christoph Oelckers
d72623b9b5 - eliminated global in_area variable.
Removing this made me realize that calling the renderers' FakeFlat functions from the automap is inherently unsafe with the recent refactorings because there is absolutely no guarantee that the data may actually still be defined when the automap is being drawn.
So the best approach here is to give the automap its own FakeFlat function that runs independently of render data and assumptions of data preservation. This one can also be a lot simpler because it only needs the floor, not the ceiling info.
2017-03-12 23:13:07 +01:00
Christoph Oelckers
4c61048278 - moved gl_fixedcolormap into GLSceneDrawer.
This means that one of the most extensively used global variables is gone.
2017-03-12 21:57:39 +01:00
Christoph Oelckers
438b983ab1 - inlined the 4 remaining short functions of the Plane class and removed gl_geometric.cpp.
# Conflicts:
#	src/CMakeLists.txt

# Conflicts:
#	src/CMakeLists.txt
2017-03-12 20:11:57 +01:00
Christoph Oelckers
4cd0d3d454 - removed the Vector class in the GL renderer and replaced all its uses with FVector3.
- optimized the math to get a plane equation from a linedef. The original code used a generic algorithm that knew nothing about the fact that Doom walls are always perfectly vertical. With this knowledge the plane calculation can be reduced to a lot less code because retrieving the normal is trivial in this special case.
- use the SSE2 rsqrtss instruction to calculate a wall's length, because this is by far the most frequent use of square roots in the GL renderer. So far this is only active on x64, it may be activated on 32 bit later as well, but only after it has been decided if 32 bit builds should be x87 or SSE2.

# Conflicts:
#	src/gl/dynlights/gl_dynlight.cpp

# Conflicts:
#	src/g_shared/a_dynlightdata.cpp
2017-03-12 19:59:45 +01:00
Christoph Oelckers
ef3421eee5 - moved dynamic lights out of the GL code into the common game code.
Since the true color software renderer also handles them there is no point keeping them on the GL side.
This also optimized how they are stored, because we no longer need to be aware of a base engine which doesn't have them.
2017-03-12 19:57:06 +01:00
Christoph Oelckers
e7330cfa03 - all main functions in gl_scene.cpp now belong to the new GLSceneDrawer class. 2017-03-12 12:51:26 +01:00
Christoph Oelckers
e4d7d9de8b - moved several more functions from FGLRenderer to GLSceneDrawer. 2017-03-12 12:03:54 +01:00
Christoph Oelckers
64183fc3cd - moved GL texture precaching to gl_texture.cpp. 2017-03-12 01:49:44 +01:00
Christoph Oelckers
9b33d1dd18 Merge branch 'scene_multithreaded' of https://github.com/raa-eruanna/qzdoom into 3.0_work
# Conflicts:
#	src/gl/scene/gl_clipper.cpp
#	src/gl/scene/gl_portal.cpp
#	src/gl/scene/gl_scene.cpp
#	src/swrenderer/scene/r_scene.cpp
2017-03-12 00:38:55 +01:00
Magnus Norddahl
c79051126e Fix ssao being applied to skybox portals 2017-03-12 00:22:58 +01:00
Christoph Oelckers
0aa0db637c - started adding a SceneDrawer class to the OpenGL renderer.
This will eventually hold all the global variables for the rendering.
2017-03-12 00:19:20 +01:00
Magnus Norddahl
0c9014b984 - move r_utility globals into r_viewpoint and r_viewwindow
- change r_utility functions to only work on FRenderViewpoint and FViewWindow
2017-03-11 23:28:07 +01:00
Christoph Oelckers
8e2ebe15fe - removed several unused variables from OpenGLFrameBuffer.
- removed the LastCamera logic in RenderView. This code predates the first GZDoom release and apparently was only added because back then R_SetupFrame was not fully compatible with the hardware renderer. Today it is not needed anymore.
2017-03-11 21:10:21 +01:00
Christoph Oelckers
9e70771da3 - Added a check to allow shader storage buffers on GL 4.3 Intel drivers. It doesn't work if GLSL version is set to 4.0 and the feature activated via extension. 2017-03-11 20:14:18 +01:00
Christoph Oelckers
9eae422dab Merge branch 'shadowmaps' of https://github.com/raa-eruanna/qzdoom into 3.0_work
# Conflicts:
#	src/CMakeLists.txt
#	wadsrc/static/language.enu
2017-03-11 19:55:43 +01:00
Christoph Oelckers
28aba3469d - missed 2 includes 2017-03-11 19:18:31 +01:00
Christoph Oelckers
921abc404d - fixed GCC warnings and errors
(Is there anyway to tone down GCC's warning level? It outputs too many false positives for potentially uninitialized variables in which the genuine errors get drowned.)
2017-03-11 19:02:35 +01:00
Rachael Alexanderson
81291e6892 - fixed: Clang on Linux compile 2017-03-11 11:01:30 -05:00
Magnus Norddahl
b407ea2164 Change gl_light_shadowmap to default to being off 2017-03-10 22:12:13 +01:00
Magnus Norddahl
59ec97d2d5 Fix shadow map acne and the attenuate flag 2017-03-10 22:08:55 +01:00
Christoph Oelckers
fec958cc0a - finally managed to get rid of the DWORD type.
This one was particularly nasty because Windows also defines a DWORD, but in Windows it is an unsigned long, not an unsigned int so changing types caused type conflicts and not all could be removed.
Those referring to the Windows type have to be kept, fortunately they are mostly in the Win32 directory, with a handful of exceptions elsewhere.
2017-03-10 19:46:22 +01:00
Magnus Norddahl
b660493051 Add menu option for disabling shadow maps and detecting if storage buffers are available or not 2017-03-10 19:10:40 +01:00
Magnus Norddahl
1e7ea1c7ff Fix crash HOM effect when vid_hw2d is off 2017-03-10 12:25:05 -05:00
Christoph Oelckers
4ed5b91b0f - added a few missing includes which were not triggered as error in a debug build. 2017-03-10 09:57:10 +01:00
Christoph Oelckers
bd7476fb8d - untangled r_defs.h from actor.h
Both files can now be included independently without causing problems.
This also required moving some inline functions into separate files and splitting off the GC definitions from dobject.h to ensure that r_defs does not need to pull in any part of the object hierarchy.
2017-03-10 02:22:42 +01:00
Christoph Oelckers
4de0f8b1fa - compile both poly and sw renderer as one unit, because due to the includes this gets really slow otherwise. Lumping these together saves 50 seconds per build on my system with a 3.4 GHz Core i7 and an SSD for storage, so on other systems it may be even more. 2017-03-10 00:43:36 +01:00
Christoph Oelckers
a4710bcdb0 - did a bit of header cleanup to reduce the dependency on dobject.h. 2017-03-09 23:30:42 +01:00
Christoph Oelckers
9b87a167d7 - replaced a large batch of DWORDs.
Most of those which still rely on ZDoom's own definition should be gone, unfortunately the code in files that include Windows headers is a gigantic mess with DWORDs being longs there intead of ints, so this needs to be done with care. DWORD should only remain where the Windows type is actually wanted.
2017-03-09 20:19:55 +01:00
Christoph Oelckers
a17685f3fd - removed some long longs, to reduce that type's use to the necessary minimum
.
2017-03-09 20:05:22 +01:00
Christoph Oelckers
d2beacfc5f - except for DWORD, all homegrown integer types are gone - a handful were left where they represent genuine Windows types. 2017-03-09 19:54:41 +01:00
Christoph Oelckers
c008ddaf66 - replaced homegrown SWORD, SBYTE and uint32_t types. 2017-03-09 19:31:45 +01:00
Christoph Oelckers
cc1241a4b8 Merge branch 'make-qzdoom-gzdoom-again' of https://github.com/raa-eruanna/qzdoom into 3.0_work
# Conflicts:
#	src/win32/win32gliface.h
#	src/win32/win32iface.h

This compiles but no guarantees otherwise.
2017-03-09 19:09:13 +01:00
Christoph Oelckers
e080f0cf89 - removed Windows.h include from gl_system.h and cleaned up that file. This means that most OpenGL sources can now be compiled without any Windows dependencies, which is significantly faster. 2017-03-09 13:19:51 +01:00
Christoph Oelckers
05919a2926 - remove Windows includes from gl_load.h
This is one of two places that unconditionally pulled in all Windows headers into the GL code.
We also do not need the cruft for defining the standard integer types. GZDoom is C++11 which means that stdint.h will be present. So the madness with the definitions should be avoided to ensure that the types are always the same.
2017-03-09 13:03:49 +01:00
Christoph Oelckers
03e1cbcfc0 - removed Windows types from several files which don't need them.
- split out the software renderer's video classes into their own file because they got included by all OpenGL sources.
2017-03-09 12:52:31 +01:00
Rachael Alexanderson
cc9a2e5121 Merge https://github.com/coelckers/gzdoom 2017-03-08 21:25:24 -05:00
Christoph Oelckers
ba0f5a3f94 - most WORD and SWORD are gone. 2017-03-08 18:55:55 +01:00
Christoph Oelckers
8ab562ef13 - the fourth. 2017-03-08 18:55:54 +01:00
Magnus Norddahl
b281a697ce Document the algorithm used for generating the 1D shadow maps 2017-03-08 14:12:59 +01:00
Magnus Norddahl
d09c3ad305 Move all GPU handling to gl_shadowmap and rename gl_lightbsp to gl_aabbtree 2017-03-08 13:31:19 +01:00
Magnus Norddahl
8687a9868a Rename Level2DShape to LevelAABBTree and add a bit of documentation to it 2017-03-08 12:40:45 +01:00
Rachael Alexanderson
527a172fcd Merge https://github.com/coelckers/gzdoom 2017-03-07 22:03:56 -05:00
Magnus Norddahl
850e61d1c9 Add shadow test to sprites 2017-03-08 00:34:08 +01:00
Christoph Oelckers
7a0c466b24 - fixed: For reflective floors, closed doors need to be considered an outer boundary, even if the floor below the door is reflective itself. 2017-03-07 18:59:48 +01:00
Magnus Norddahl
6df3b3fbca Changed the light collision structure uploaded to the GPU to be a binary tree using AABBs for the nodes instead of a BSP plane 2017-03-07 15:58:22 +01:00
Magnus Norddahl
65f8d65858 Minor code clean up 2017-03-06 23:27:02 +01:00
Rachael Alexanderson
28abc96aef - fully implemented "nolightfade" to turn off diminishing lights in the software renderer.
- unfortunately, LIGHT2SHADE had to be transformed into a namespaced function.
2017-03-06 16:14:54 -05:00
Rachael Alexanderson
7ef8ed5867 Merge https://github.com/coelckers/gzdoom 2017-03-05 18:40:44 -05:00
alexey.lysiuk
f9e543bed3 Fixed black target screen during wipe (legacy renderer only)
Credits: NiTROACTiVE and Erick194
https://www.doomworld.com/vb/source-ports/93179-two-issues-im-having-with-gzdoom-v2-3-2/
2017-03-05 20:51:48 +02:00
Magnus Norddahl
8515f9720a 1D shadow maps are now working 2017-03-04 09:14:01 +01:00
Rachael Alexanderson
21a8964bea Merge remote-tracking branch 'gzdoom/master'
# Conflicts:
#	src/v_video.cpp
2017-03-03 16:29:33 -05:00
Christoph Oelckers
c630b07011 - replaced SDWORD with int32_t globally.
This type wasn't used in the software rendering code so it could be removed already. The other homegrown types will have to be dealt with later.
2017-03-03 19:35:08 +01:00
Magnus Norddahl
6055f136d8 Make sure SwapInterval is only ever called while the default frame buffer is bound to avoid problems with some drivers 2017-03-03 16:55:18 +01:00
Rachael Alexanderson
b3a69e1df8 Merge https://github.com/coelckers/gzdoom 2017-03-02 18:13:33 -05:00
Magnus Norddahl
0d1deddae5 Bind shadow map texture for main.fp and sample from the shadowmap texture 2017-03-02 19:10:57 +01:00
Magnus Norddahl
538d516c9a Upload shadow map index for each light to main.fp
Move storage buffer binding location
2017-03-02 18:07:47 +01:00
Magnus Norddahl
62c285f7b3 Create a shadowmap texture and upload light list 2017-03-02 16:19:06 +01:00
Magnus Norddahl
7a4b01471d Add class updating and managing the shadow map texture 2017-03-02 16:19:06 +01:00
Magnus Norddahl
6363c6cf58 Add a shadowmap shader 2017-03-02 16:19:06 +01:00
Magnus Norddahl
58c7c3c902 Upload BSP tree to the GPU 2017-03-02 16:19:06 +01:00
Christoph Oelckers
3532e50575 - check for RF_MASKROTATION before calling IsInsideVisibleAngles, because it is a bit faster this way. 2017-03-02 12:14:00 +01:00
Rachael Alexanderson
d84ba4b953 Merge https://github.com/coelckers/gzdoom 2017-03-02 04:22:32 -05:00
Christoph Oelckers
9b2f31e692 - had to add a hack because some people had to exploit implementation-dependent behavior of the PulseLight type. 2017-03-01 20:54:37 +01:00
Rachael Alexanderson
2a847ca570 Merge https://github.com/coelckers/gzdoom 2017-02-27 01:06:00 -05:00
Christoph Oelckers
c7cf619ff4 - Caution: Wads.GetLumpName with a char pointer is stupid because it doesn't 0-terminate its return. 2017-02-27 01:58:21 +01:00
Rachael Alexanderson
257f48de97 Merge https://github.com/coelckers/gzdoom 2017-02-20 04:55:54 -05:00
Christoph Oelckers
bb6e667f33 - removed some unneeded version.h #includes. 2017-02-20 01:42:53 +01:00
Rachael Alexanderson
5dad292c56 Merge remote-tracking branch 'remotes/gzdoom/master' 2017-02-15 05:43:15 -05:00
Rachael Alexanderson
2b8db72cef Merge commit '2234d36c7ac531fd802803216f747f82b58be8c2'
# Conflicts:
#	src/r_main.cpp
#	src/r_plane.cpp
#	src/r_things.cpp
2017-02-15 05:42:57 -05:00
Rachael Alexanderson
959ac8c65b Merge commit '9caf5c641b374848c065059b5152339806fa7734' 2017-02-15 05:28:38 -05:00
Christoph Oelckers
a6156297ce - don't adjust sprite offsets of IWAD sprites in sequences which have been replaced partially. This can be overridden by specifying 'iwadforced' in the SPROFS lump. 2017-02-14 22:04:52 +01:00
Christoph Oelckers
2234d36c7a Merge branch 'thereisnospoon' of https://github.com/jewalky/gzdoom
# Conflicts:
#	src/dobject.h
2017-02-14 19:10:02 +01:00
Christoph Oelckers
2e5ada5f25 - fixed texture clamping calculations for negative scales. 2017-02-14 18:20:21 +01:00
Rachael Alexanderson
2a71ec89de Merge https://github.com/coelckers/gzdoom 2017-02-13 17:02:56 -05:00
Christoph Oelckers
32da1de385 - fixed: negative texture scales should not affect the direction a wall scrolls in. 2017-02-13 22:37:16 +01:00
Christoph Oelckers
cb758f6dab - added a 'nolightfade' MAPINFO option which disables light diminishing in OpenGL. Note that this only works for light modes 0-3. Modes 4 and 8 use special light math that would not work if such a setting was forced. 2017-02-13 22:17:15 +01:00
Rachael Alexanderson
a52f79055d Merge https://github.com/coelckers/gzdoom
# Conflicts:
#	src/menu/playerdisplay.cpp
2017-02-11 05:05:24 -05:00
Christoph Oelckers
98de1fcfcb - make the pixel buffer of the player backdrop dynamic. 2017-02-10 14:18:00 +01:00