Commit graph

1225 commits

Author SHA1 Message Date
Christoph Oelckers
47bcd8aaa2 - added per-layer translucency support to the OpenGL PSprite drawer. 2017-04-15 17:25:46 +02:00
Christoph Oelckers
47bb29bac6 - check the return value of ogl_LoadFunctions and abort if it indicates failure.
If this happens there is normally something very wrong on the system side so continuing is not advised.
2017-04-14 15:32:04 +02:00
Christoph Oelckers
dc5a5419fc - took DCanvas and all its subtypes out of the DObject tree.
I have no idea why they were even in there, as they intentionally circumvented all GC related features - they declared themselves fixed if prone to getting collected, they all used OF_YesReallyDelete when destroying themselves and they never used any of the object creation or RTTI features, aside from a single assert in V_Init2.

Essentially they were a drag on the system and OF_YesReallyDelete was effectively added just to deal with the canvases which were DObjects but not supposed to behave like them in the first place.
2017-04-14 10:48:18 +02:00
alexey.lysiuk
c99cecea8e Fixed warnings reported by GCC/Clang
src/p_pspr.cpp:363:37: warning: more '%' conversions than data arguments [-Wformat]
src/gl/textures/gl_texture.cpp:845:21: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
2017-04-13 10:40:44 +03:00
Christoph Oelckers
6599e2c425 - moved the VM types into their own file and only include it where really needed. 2017-04-13 01:12:04 +02:00
Christoph Oelckers
e4d2380775 - moved all remaining fields from PClassActor to FActorInfo.
- added a few access functions for FActorInfo variables.

With PClassActor now empty the class descriptors can finally be converted back to static data outside the class hierarchy, like they were before the scripting merge, and untangle the game data from VM internals.
2017-04-12 00:07:41 +02:00
Christoph Oelckers
4afe2d4218 - moved OwnedStates and NumOwnedStates out of PClassActor. 2017-04-11 22:44:35 +02:00
Magnus Norddahl
f049e6145b - remove all usage of std::make_unique to keep things C++11 compliant 2017-04-11 01:25:44 +02:00
Christoph Oelckers
18d6fb7f49 - fixed: USEACTORPITCH in the model code was still using inverted pitch. 2017-04-08 10:24:12 +02:00
Magnus Norddahl
9f180b29b9 - Remove GL_MAJOR_VERSION check for OpenGL ES as apparently not even this can be done right by driver writers 2017-04-08 00:19:39 +02:00
Magnus Norddahl
73effc70bb - The legacy OpenGL path resets the GLSL version, which in turn makes #version 0 crash the AMD driver. Old stuff that uses the legacy path will not get glswfb acceleration. 2017-04-07 15:45:08 +02:00
Magnus Norddahl
35c35fc26f - Check if glCreateProgram or glCreateShader fails, because apparently AMD found a way to make exactly that happen 2017-04-07 15:27:04 +02:00
Rachael Alexanderson
b1e1f25218 - detect gl es shaders and request them 2017-04-06 23:34:50 -04:00
Magnus Norddahl
85a9984807 - Add OpenGL ES 3 support to GL renderer 2017-04-06 23:34:42 -04:00
Magnus Norddahl
b7482e10e2 - Detect dinosaur OpenGL and refuse to use it 2017-04-06 23:34:37 -04:00
Magnus Norddahl
e690de25a8 - Use SDL_GL_GetProcAddress on platforms where the SDL is being used. Since SDL initialized OpenGL for us, it is the only reliable way of retrieving proc addresses.
- Check if ogl_LoadFunctions failed and make OpenGLSWFrameBuffer gracefully recover from that
2017-04-06 23:33:56 -04:00
Major Cooke
d3ef3b585b - fixed: Flat sprites did not rotate their sprite angles when given the FLATSPRITE flag. 2017-04-03 17:06:33 +02:00
alexey.lysiuk
659f75c84a Avoid duplication of member in OpenGL software framebuffer class 2017-04-02 10:13:25 +03:00
Magnus Norddahl
4268090738 - switch OpenGLSWFrameBuffer to use m_Lock instead of LockCount 2017-04-02 00:47:18 +02:00
Magnus Norddahl
0ed60b8df6 - fix OpenGLSWFrameBuffer::Begin2D 2017-04-01 22:14:04 +02:00
Christoph Oelckers
54764c136d - changed the 2D draw abort check to use a dedicated variable, that gets set in Begin2D and unset at the end of D_Display.
This is really all the extent where 2D draw operations may be allowed. Trying to detect this from other variables is not reliable.
2017-04-01 12:59:58 +02:00
alexey.lysiuk
59ae50aecb Fixed compilation warning reported by GCC/Clang
src/gl/textures/gl_texture.cpp:691:25: warning: comparison of integers of different signs: 'unsigned int' and 'int' [-Wsign-compare]
2017-04-01 10:24:05 +03:00
Christoph Oelckers
bde73fc530 - added automatic brightmaps.
Everything in the brightmaps/auto directory will automatically be assigned to the same-named texture.
2017-03-29 23:13:11 +02:00
Christoph Oelckers
01b095c911 - added colorization for untranslated fonts. This uses the light color of the vertices. The software rendered 2D code will ignore this infomation.
- added a virtual OnRetrun method to menus.
2017-03-29 21:22:05 +02:00
Christoph Oelckers
1d4ab0cc2a - implemented proper scaling for the status bar itself.
This allows using the UI scale or its own value, like all other scaling values.
In addition there is a choice between preserving equal pixel size or aspect ratio because the squashed non-corrected versions tend to look odd, but since proper scaling requires ununiform pixel sizes it is an option.

- changed how status bar sizes are being handled.

This has to recalculate all scaling and positioning factors, which can cause problems if the drawer leaves with some temporary values that do not reflect the status bar as a whole.
Changed it so that the status bar stores the base values and restores them after drawing is complete.
2017-03-29 19:23:40 +02:00
Magnus Norddahl
d160424aea - added DFrameBuffer::HasBegun2D to allow scripting to test if 2D drawing is active (instead of using IsLocked, which may return false when vid_hw2d is active) 2017-03-29 00:45:53 +02:00
Christoph Oelckers
5e3e4a3bd1 - fixed: The wall spliter for 3D lights did not initialize the resulting colormap's fog density value. 2017-03-28 23:36:26 +02:00
nashmuhandes
99d1581c27 Added "DontLightActors" flag for dynamic lights. Actors will not be illuminated by lights that are given this flag. 2017-03-28 21:33:16 +02:00
Christoph Oelckers
71fe4a83c9 - fixed: the translucent flat drawer used a bad condition for dynamic light processing which caused a problem with the GL 3.x lighting method. 2017-03-28 21:18:03 +02:00
Christoph Oelckers
f3db5f3803 - added a clipping rectangle to DCanvas that can be used independently of DrawTexture calls.
Currently this is only being used for draw operations that are not automap related, i.e. DrawLine, DrawPixel and FillSimplePoly are not subjected to it.
2017-03-28 13:06:24 +02:00
alexey.lysiuk
093a05b588 Reset OpenGL 2D drawer state fully on each frame
https://mantis.zdoom.org/view.php?id=469
2017-03-25 11:32:39 +02:00
Christoph Oelckers
6760e01a0d - implemented the status bar's DrawString function and ported the fullscreen HUD part of the Strife status bar to use the new functionality. 2017-03-24 20:09:50 +01:00
Christoph Oelckers
9bffe4ee50 - scriptified the main statusbar interface and the Strife status bar.
Note that the Strife status bar does not draw the health bars yet. I tried to replace the hacky custom texture with a single fill operation but had to find out that all the coordinate mangling for the status bar is being done deep in the video code. This needs to be fixed before this can be made to work.

Currently this is not usable in mods because they cannot initialize custom status bars yet.
2017-03-22 00:32:52 +01:00
Magnus Norddahl
fc3cb01029 - only ray test sprites on lights that are shadowmapped 2017-03-21 14:32:48 +01:00
Christoph Oelckers
f45371e231 - reverted the counter for the vertex angle cache to a simple incrementing global variable.
Using I_MSTime is not precise enough, because some camera textures can be done quicker. It was pointless anyway trying to make this multithreading-safe, the entire caching idea here makes no sense if two clippers can simultaneously work on the same level data without changing the memory organization and rendering it ineffective.
2017-03-20 01:21:33 +01:00
Christoph Oelckers
1031481167 - added some checks to exclude dynamic lights from being subjected to shadowmapping if they do not touch any one-sided lines from the back side. This condition is a requirement for a 1D shadowmap to even have an effect. 2017-03-20 00:34:19 +01:00
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