Commit graph

181 commits

Author SHA1 Message Date
Christoph Oelckers
67334bfa2b - calculate weapon positions fully in floating point to avoid roundoff errors.
- In order to get reliable results the empty border around scaled sprites must be the same scale as the sprite (i.e. 2 pixels for 2x scale and 4 pixels for 4x scale.)
2015-04-04 12:35:10 +02:00
Christoph Oelckers
fad3a54100 - fixed positioning for sky textures that are less than 128 pixels tall. 2015-03-15 12:10:22 +01:00
Christoph Oelckers
a5a53c51e6 - fixed: The flat drawing code assumed that the first element of the light list originated from the sector itself. This had been true formerly but in some situations it no longer is. 2015-02-10 21:52:19 +01:00
Christoph Oelckers
00639121c0 - added the missed parts of camera roll in gl_scene.cpp. 2015-02-10 20:34:10 +01:00
Christoph Oelckers
8a9692c29f - fixed: The code which decided whether to clamp two sided middle textures used the texture size instead of the render size for the specific linedef, meaning that any per-sidedef scaling was ignored. 2015-02-10 20:16:25 +01:00
Christoph Oelckers
a8398e70b0 - fixed: The brightfog flag in the GL related map settings was never initialized.
- fixed: brightfog should not disable colored lighting for the weapon sprite.
2014-12-31 23:01:06 +01:00
Christoph Oelckers
e6d59ec429 - fixed: with aspect ratio compensation in the view matrix it is necessary to adjust the view pitch for this because the playsim does not know anything about pixel ratio. 2014-12-31 12:04:55 +01:00
Christoph Oelckers
315827015c - made aspect ratio correction factor configurable through MAPINFO. 2014-12-29 23:52:20 +01:00
Christoph Oelckers
45cf65afbd - moved the aspect ratio correction factor from the projection to the view matrix where it should have been from the start.
- removed the mCameraPos variable in FGLRenderer because it was only used in one place where it is just as easy to use the global viewx/y/z variables directly.
2014-12-29 22:42:19 +01:00
Christoph Oelckers
fbfe0f1e7a - fixed: y-clamped textures with negative scale need to shift their texture coordinates into the proper [0..1] range. 2014-12-26 11:53:38 +01:00
Christoph Oelckers
c66a211200 - fixed: The sky renderer must not only alter the light mode but also reset the software light level to a 'disabled' value. 2014-12-25 22:45:40 +01:00
Christoph Oelckers
ffa069205f - fixed: For fullbright sprites, a weapon's extra light must be ignored because it can be negative. 2014-12-25 18:30:34 +01:00
Christoph Oelckers
0bc2c0094a - fixed: For cubemapped skies with one texture for all 4 sides the texture was never set before rendering. 2014-12-19 16:35:34 +01:00
Christoph Oelckers
ec627d94dd - fixed: The depth clamp setting needs to be tracked per portal so that it can be properly restored afterward.
Regular skies need it off but SkyViewpoints need it on - and all others need to use the parent's setting.
So without engine side tracking we can end up rendering the sky with this setting off, resulting in omission of the fog layer.
2014-11-27 12:26:52 +01:00
Christoph Oelckers
eb753a0b7c - fixed: We also should use the proper 'copied' info for the non-inverted planes. 2014-11-27 10:49:03 +01:00
Christoph Oelckers
99d81621f9 - fixed: The 'copied' information of a 3D floor plane should only apply to that particular plane, but never the opposite one of the same 3D floor. 2014-11-27 10:46:28 +01:00
Christoph Oelckers
a7f4185981 - now that we don't have to care anymore about SVN-related merging problems, let's save the 3 global variables of the GL renderer unconditionally, even if the software renderer is running. 2014-11-16 09:08:47 +01:00
Christoph Oelckers
b0a6c94fa4 - fixed: the translucency flag for the flags renderer was inconsistent between the light pass and the render pass on GL 3.x hardware, resulting in bad buffer indices being sent to the shader. 2014-11-09 12:10:33 +01:00
Christoph Oelckers
3e50db9bf0 - fixed: When setting the object color for a shaded decal, the alpha channel must be forced to be 255. The decal's AlphaColor contains the palette index in those bits. 2014-10-26 15:11:04 +01:00
Christoph Oelckers
3c7664a460 - we don't really need a bBrightmap in a texture. All it did was duplicate some functionality of bMasked.
- renamed bBrightmapDisablesFullbright flag.
2014-10-26 08:41:52 +01:00
Christoph Oelckers
bca47bb9bc - removed debug code.
- fixed: planes that are created by splitting translucent 3D-floors may never be rendered.
2014-10-23 17:35:58 +02:00
Christoph Oelckers
066e53ae4c - fixed: sprites rendered as 'bright' should not be affected by dynamic lights. 2014-10-23 10:54:26 +02:00
Christoph Oelckers
9f1f17c306 - fixed: The PolyBSPs weren't fully initialized. Some GZDoom-only fields in the segs were skipped. 2014-10-14 08:54:08 +02:00
Christoph Oelckers
5d032f3fcf - fixed: Since the engine can no longer change renderers on the fly, thanks to ZDoom's messed up video startup code, we have to abort with a fatal error if we can't create a GL context. Otherwise the user will never see a meaningful message. 2014-10-06 10:00:02 +02:00
Christoph Oelckers
3e2a17538b - fixed: HUD weapons were affected by dynamic lights even when the CVARs said that they shouldn't. 2014-10-06 09:05:42 +02:00
Christoph Oelckers
48da2f87bb - fixed: The light buffer index must not be reset between rendering a camera texture and the main scene.
Since rendering is asynchronous, the camera texture scene may not be finished once the main scene's lights get filled in. Unfortunately forcing a synchronization with glFinisg has bad side effects on performance the only remaining option is to use separate parts of the buffer for both scenes, which in extreme cases may increase the light buffer's size - but on modern hardware that shouldn't be a problem.
2014-09-21 21:01:11 +02:00
Christoph Oelckers
7359631a43 - fixed weapon drawing rules to account for the death camera. 2014-09-21 11:08:38 +02:00
Christoph Oelckers
4682736585 - fixed: non-tiled mid textures on a fog boundary require some special clamping to be performed in the shader. 2014-09-21 11:08:17 +02:00
Christoph Oelckers
43e2d704a3 - always use glPolygonOffset to render translucent geometry. 2014-09-20 09:04:36 +02:00
Christoph Oelckers
92dcf2e5ef - fixed some of those supremely annoying and supremely pointless GCC/Clang compiler warnings. 2014-09-17 11:03:05 +02:00
Christoph Oelckers
a25ed3c807 - fixed: inverted rendering for fuzzy things with light powerup was switched off due to change of render style. 2014-09-15 12:15:19 +02:00
Christoph Oelckers
3c2f1952fd Merge branch 'master' into v2.x 2014-09-12 21:01:55 +02:00
Christoph Oelckers
25951362fc - fixed: When applying Boom's Transfer_Heights effect to a sector, gl_FakeFlat needs to remove all portals from the original sector planes that are being replaced in the sector copy. 2014-09-11 13:02:39 +02:00
Christoph Oelckers
4bb320a27c - route texture binding through the renderstate class for better control. Currently it's just a direct passthrough but this will change. 2014-09-09 12:00:42 +02:00
Christoph Oelckers
62880f113b - fix a render glitch with Back to Saturn X MAP06: Do not flood missing upper and lower textures with the backsector's flat if that backsector is malformed (i.e. has no area.) 2014-09-09 08:47:39 +02:00
Christoph Oelckers
9b8869e78d Merge branch 'master' into v2.x
Conflicts:
	src/gl/textures/gl_material.cpp
2014-09-09 01:30:11 +02:00
Christoph Oelckers
86d9c7ec8e - add some compatibility settings to fix rendering glitches in BTSX_E1 MAP12. 2014-09-09 01:27:41 +02:00
Christoph Oelckers
b96dd6c421 - fixed: The missing fourth component of the texture coordinate must be filled with 1.0, not 0.0 before applying the texture matrix. Not doing so will cancel out the translation part of the matrix. 2014-09-02 10:31:48 +02:00
Christoph Oelckers
fa3a62e954 - fix a render glitch with Back to Saturn X MAP06: Do not flood missing upper and lower textures with the backsector's flat if that backsector is malformed (i.e. has no area.) 2014-08-31 23:01:53 +02:00
Christoph Oelckers
12160bd29c - remove some obsolete code from decal rendering.
- avoid rebinding the same texture multiple times, as there's considerable overhead in the texture manager.
- check gl_sort_textures only once per scene, not per draw list.
2014-08-30 15:34:14 +02:00
Christoph Oelckers
6a3cd6378a - found out that reading the CPU's real time clock costs a not insignificant amount of time so this is now only done when either the benchmark command is running or the rendertimes are shown. 2014-08-30 14:33:06 +02:00
Christoph Oelckers
49ec7beb8f - separate draw lists for walls and flats. This makes the sorting much more efficient because draw types no longer need to be checked in the compare function. This is a lot more important than having perfect texture order. 2014-08-30 13:04:41 +02:00
Christoph Oelckers
a903cbe12e - sorting draw items by light level no longer makes sense so remove all corresponding code from dicmp. 2014-08-24 13:10:45 +02:00
Christoph Oelckers
904cc2e158 - some code cleanup. 2014-08-23 18:54:24 +02:00
Christoph Oelckers
1050013017 major cleanup of the texture manager:
- use sampler objects to avoid creating up to 4 different system textures for one game texture just because of different clamping settings.
- avoids flushing all textures for change of texture filter mode.
- separate sprite and regular dimensions on the material level to have better control over which one gets used. It's now an explicit parameter of ValidateTexture. The main reason for this change is better handling of wall sprites which may not be subjected to such handling.
- create mipmaps based on use case, not texture type.
- allows removal of FCloneTexture hack for proper sharing of the same sprite for decals and other purposes.
- better precaching of skyboxes.
2014-08-22 23:50:38 +02:00
Christoph Oelckers
a2dc4afe3f - screwed by the editor's autocompletion... (wrong GL flag was used...) 2014-08-19 14:25:47 +02:00
Christoph Oelckers
00d7707aef - allow reallocation of light buffer if more lights are needed.
- added a light preprocessing pass to the renderer so that a non-persistent buffer can be used with minimal mapping/unmapping. This only gets used if necessary because it adds some overhead to the renderer.
2014-08-19 14:18:21 +02:00
Christoph Oelckers
38796e7714 - removed some obsolete and useless GL calls. 2014-08-17 11:41:03 +02:00
Christoph Oelckers
b9ffb51d0c - small but important optimization: Two-sided lines with both sides in the same sector don't really require vertex splitting for precise rendering. 2014-08-04 23:00:40 +02:00
Christoph Oelckers
19cfffebb3 - fixed: the WallTypes enum contained a value that no longer was valid. This was fixed orignally last week but it seems to have gotten lost. 2014-08-03 12:21:05 +02:00
Christoph Oelckers
c98e3ca99d Merge branch 'master' into v2.x 2014-08-03 10:58:41 +02:00
Christoph Oelckers
b3e0d93385 - implemented rendering of wall sprites. 2014-08-03 10:57:58 +02:00
Christoph Oelckers
398d902e7e - split off sprite clipping adjustment code into its own function. 2014-08-03 10:22:12 +02:00
Christoph Oelckers
7967082e60 - use the light buffer to handle dynamic lighting. 2014-08-01 20:59:39 +02:00
Christoph Oelckers
1ec58011d2 - start of light buffer implementation so that we don't have to use uniform arrays which appear to be broken on AMD. 2014-07-31 00:44:22 +02:00
Christoph Oelckers
192daf1d5a Merge branch 'master' into Glew_Version_For_Real 2014-07-27 21:57:38 +02:00
Christoph Oelckers
ece10bb57f - fixed several incorrect uses of abs instead of fabs. 2014-07-27 21:57:05 +02:00
Christoph Oelckers
c9c93a58a2 - fixed bad constant and potential use of uninitialized variable. 2014-07-27 21:55:25 +02:00
Christoph Oelckers
e07d06fa2a Merge branch 'master' into Glew_Version_For_Real 2014-07-26 22:26:58 +02:00
Christoph Oelckers
7ae25906fd - fixed: fog must be disabled before drawing the HUD model, not after it. 2014-07-26 22:26:17 +02:00
Christoph Oelckers
e0b756e511 - fixed: The cubemapped skybox renderer did not set up the model matrix properly. 2014-07-17 10:04:20 +02:00
Christoph Oelckers
eb9d2d9917 - reactivate compatibility profile so that immediate mode drawing can be used on older hardware not supporting persistently mapped buffers.
- reactivate alpha testing per fixed function pipeline
- use the 'modern' way to define clip planes (GL_CLIP_DISTANCE). This is far more portable than the old glClipPlane method and a lot more robust than checking this in the fragment shader.
2014-07-17 02:37:18 +02:00
Christoph Oelckers
6b9d6787d9 - move models into their own draw list to avoid frequent buffer changes.
- same for SKYHACK walls. Although rare, they would get in the way of optimizing the draw calls if not being separated out.
2014-07-15 21:16:59 +02:00
Christoph Oelckers
b8bcbe819b - removed texture based dynamic lighting. For GL 3.x the shader approach is always better.
- fixed: sky fog was not unset.
2014-07-15 20:49:21 +02:00
Christoph Oelckers
fb6b4238ed - fixed: glProgramUniform is only present from GL 4.1 or a specific extension so it may not be used on systems not supporting it. 2014-07-15 02:48:59 +02:00
Christoph Oelckers
eedc5a69be - replaced builtin position vertex attribute. 2014-07-15 01:02:48 +02:00
Christoph Oelckers
1b7f5a2e6a - replaced builtin texture coordinate vertex attribute. 2014-07-15 00:59:01 +02:00
Christoph Oelckers
5a322742c3 - remove use of builtin and deprecated color vertex attribute. 2014-07-15 00:37:13 +02:00
Christoph Oelckers
ed8a21fd86 - replaced deprecated alpha testing with shader code. 2014-07-14 21:14:43 +02:00
Christoph Oelckers
84a49e37ee - handle normals for spheremapped mirror surfaces using non-deprecated features.
- move all WGL references out of global header files so that global wgl header include is no longer necessary
2014-07-14 19:54:07 +02:00
Christoph Oelckers
ce3653f6e1 - remove all uses of builtin matrices. 2014-07-13 23:13:40 +02:00
Christoph Oelckers
2214c0ac06 - remove all uses of builtin matrix manipulation. Only glLoadMatrix for view and projection matrix are left. 2014-07-13 22:37:34 +02:00
Christoph Oelckers
dbb05c5f33 - remove use of builtin texture matrices.
- make matrix class single precision.
2014-07-13 20:41:20 +02:00
Christoph Oelckers
9230a20f18 - added some checks to the wall rendering code that will allow to disable the clip planes in many cases, even when a plane mirror portal is active. This also solves the precision issue with using world coordinates for clip checks. 2014-07-13 17:15:17 +02:00
Christoph Oelckers
00fcf4bc06 - for some reason using world coordinates for clipping in the shader is somewhat imprecise so the clip plane heights have to be adjusted a bit for it. 2014-07-13 13:25:42 +02:00
Christoph Oelckers
d868f60f6c - since the clip planes for plane mirrors did not work anymore I reimplemented them using shader based logic. It still needs to be seen if this affects performance on older hardware. 2014-07-13 12:14:12 +02:00
Christoph Oelckers
9a6bc64381 - use vertex array objects to manage vertex buffers. 2014-07-01 00:51:02 +02:00
Christoph Oelckers
54297acde4 - removed obsolete gl_lightbuffer code.
This never worked properly and by now far better options are available to solve the problem of dynamic light data uploads.
2014-06-30 13:30:10 +02:00
Christoph Oelckers
1efc2938b7 - implement model vertex buffer and draw MD2 models using it instead of using the GLCommands from the model. 2014-06-29 23:24:16 +02:00
Christoph Oelckers
2925c96b59 removed all GL 2.x code.
After thinking about it for a day or so I believe it's the best option to remove all compatibility code because it's a major obstacle for a transition to a core profile.
2014-06-21 15:50:32 +02:00
Christoph Oelckers
3e9b9c280b - initialize model data at engine start, not at level start. 2014-06-19 15:22:00 +02:00
Christoph Oelckers
e6f14b055a - use buffer based rendering for dynamic light pass and horizon portals. 2014-06-15 20:28:23 +02:00
Christoph Oelckers
1aaa1b7bad - removed gl_usevbo CVAR because with recent code changes it has become useless. If GL_ARB_buffer_storage is present, buffers will always be used. 2014-06-15 12:12:24 +02:00
Christoph Oelckers
ea332383a8 - convert skybox rendering to use the buffer interface. 2014-06-15 11:50:54 +02:00
Christoph Oelckers
6b038a5dae - fixed: GLPortal::DrawPortalStencil must apply the render state before drawing anything. 2014-06-15 10:30:03 +02:00
Christoph Oelckers
1b91a8f88c - removed old immediate mode path for generating stencils. 2014-06-15 10:15:44 +02:00
Christoph Oelckers
3644073bbd - use a software buffer for immediate mode rendering. This allows using the regular buffer code to collect data for both render modes and allows removal of a lot of duplicated code. 2014-06-15 01:14:41 +02:00
Christoph Oelckers
5b302ed3a6 - added benchmarking calls for glDrawArrays to see how well issunig draw calls performs on different hardware. 2014-06-14 15:16:33 +02:00
Christoph Oelckers
0ce6b40672 - fixed compile error in gl_skydome.cpp
- disable GL_ARB_buffer_storage when a -glversion parameter less than 4.0 is given. According to the spec this extension requires 4.0 so if emulating something lower it should not be used.
2014-06-14 14:58:17 +02:00
Christoph Oelckers
5e22c82e79 - use buffer for rendering the sky on all GL versions since the differences for making GL2.0 work are rather small. 2014-06-14 10:38:30 +02:00
Christoph Oelckers
8d9a90cd22 - rewrote sky dome rendering to use a static vertex buffer if not on OpenGL 2.x. 2014-06-14 01:24:28 +02:00
Christoph Oelckers
c39318f406 - use vertex buffer and reuse of data for stencil drawing. A stencil needs to be drawn multiple times with the same polygons so this is a good place to optimize. 2014-05-31 09:32:17 +02:00
Christoph Oelckers
a1ec6ab1ba - fixed some Linux warnings. 2014-05-24 16:53:57 +02:00
Christoph Oelckers
09ba62fbef - put all the common part of buffer based drawing into a separate method of the vertex buffer. 2014-05-20 22:37:38 +02:00
Christoph Oelckers
23fbd69963 - 4 more places where immediate mode drawing has been substituted with a buffer-based alternative. 2014-05-20 22:20:15 +02:00
Christoph Oelckers
579eff5b96 - add vertex buffer based rendering for decals. 2014-05-12 22:46:30 +02:00
Christoph Oelckers
cf45f2d718 - added missing shader files. 2014-05-12 22:24:26 +02:00
Christoph Oelckers
b514a815f4 - enable use of vertex buffer for sprite rendering. 2014-05-12 20:23:54 +02:00
Christoph Oelckers
4d005bdfa0 shader rework
All those special shaders have been merged together.
Mostly working but the non-shader lighting seems a bit broken.
2014-05-12 14:45:41 +02:00
Christoph Oelckers
98cc7eeb99 pass softlightlevel through render state. 2014-05-12 00:13:19 +02:00