Commit Graph

52 Commits (7005eae55d8fe61edd21d366894f183595f7c199)

Author SHA1 Message Date
Lukas Werling 7005eae55d Use PCG as random number generator 2016-04-20 22:42:00 +02:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Nicolas Hake 0537df5f23 C4Object: Move C4Def.h dep out of header
C4Def is only ever used as a pointer inside C4Object.h, so we don't need
to include C4Def.h from it.
2016-04-03 13:24:26 +02:00
Nicolas Hake 735f9cc06b C4Landscape: Pull everything private out of the header
Since LTCG is enabled now, we don't have to define every function inside
the headers for ~xXx super speed xXx~, which means we can strip the
headers down to their bare minimum and reduce interdependencies and
therefore recompilation times by a lot.
2016-04-03 13:24:24 +02:00
David Dormagen 3d71dfbfa9 Particles: added a "seed" parameter to PV_Random (#1198) 2016-02-27 12:24:15 +01:00
David Dormagen bc5fededaf particles: added PV_Cos 2016-02-27 11:45:13 +01:00
Nicolas Hake 64a5388d4d C4Surface: Remove broken "support" for split textures
Most code already didn't handle textures larger than GL_MAX_TEXTURE_SIZE
and only used the first one in case of a split texture.
2016-02-08 17:36:50 +01:00
Günther Brammer d0fb24adda Merge epoxy preparation branch
Various changes to make the commit switching to epoxy smaller.
2016-02-02 03:35:13 +01:00
Günther Brammer a1a6e36cde GL: Deduplicate the check for glObjectLabel 2016-01-29 18:37:32 +01:00
Günther Brammer 234101ddbc Remove C4Script.h from C4Aul.h 2016-01-24 12:27:23 +01:00
Armin Burgmeier e13cda4bd0 Use an IBO for the particle system
glDrawElements needs an IBO when using a core profile. The particle
system's IBO is actually quite static since it's always a triangle
strip with 2 triangles followed by a PRI. Therefore, this reduces the
amount of data we have to send to the GPU compared to the previous
solution.

Also, remove the workaround when glPrimitiveRestartIndex is not
available since it is always available with OpenGL 3.1 and when using
a core profile we are guaranteed to have OpenGL 3.1 anyway.
2016-01-17 11:37:17 -08:00
Armin Burgmeier 5de1bc70a9 Remove a stray glClientActiveTexture call 2016-01-17 11:37:17 -08:00
Armin Burgmeier 28aa1d1812 For each VBO, use a VAO to render it
For OpenGL 3.2 core compatibility, and to reduce the number of state
changes during rendering.
2016-01-17 11:37:17 -08:00
David Dormagen 1c35bdf8e3 particles: fix high severity OpenGL API error
glObjectLabel would result in invalid VBOs if called on a not-instantiated object. glGenBuffers does apparently only reserve the name and not create the buffer itself.
For me the landscape and some objects were drawn completely black.

More information: http://stackoverflow.com/questions/26614130/opengl-debug-extension-with-globjectlabel
Found via --debug-opengl
which lead to
gl: high severity API error: GL_INVALID_VALUE error generated. ObjectLabel: unknown buffer object <name>
2016-01-10 23:31:17 +01:00
David Dormagen e3553ca0cd particles: replaced "TODO" comment
This was actually part of a larger performance boosting commit, which turned out to not actually boost performance. But I want to retain the comment change even when I won't push the larger commit.
Having a "todo" comment is just misleading.

For an explanation of why that's needed, see http://stackoverflow.com/questions/21652546/what-is-the-role-of-glbindvertexarrays-vs-glbindbuffer-and-what-is-their-relatio
2016-01-07 09:55:35 +01:00
Armin Burgmeier 95774e0e8f Use generic vertex attributes for sprites, meshes, particles 2016-01-02 13:10:03 -08:00
Armin Burgmeier 1f4dbcc260 Particle system: make sure to always use a VBO
We are already using VBOs for meshes, so we can rely on them being available.
VBOs are shared between contexts, so #1195 is not an issue, either. However,
keep the workaround in place for the VAO, which is not shared between
contexts.
2016-01-01 22:28:22 -08:00
Armin Burgmeier a487457563 Add a 4x4 matrix class (StdProjectionMatrix)
This makes it easier to convert the projection and modelview matrices
to GLSL uniforms.
2015-12-24 23:01:52 -08:00
Armin Burgmeier a9967e7b16 Avoid built-in GL matrices for sprite rendering
Instead, compute the projection, modelview and normal matrices explictly
and upload them as shader uniforms. This is one step towards using the
OpenGL 3 core profile.
2015-12-19 22:37:36 -08:00
Nicolas Hake 617a0828fb Aul: Throw exceptions by value, not by pointer
Throwing values instead of pointers simplifies memory management at the
catch site.
2015-12-08 13:17:40 +01:00
Armin Burgmeier fd285f6656 Create mipmaps only for static textures that are expected to be zoomed
Hopefully fixes #1403.
2015-09-18 21:10:39 -04:00
Armin Burgmeier 061305c0c7 Don't enable textures in C4ShaderCall::AllocTexUnit
This was only necessary with the fixed function pipeline, but not when
using shaders.
2015-09-16 21:45:30 -04:00
David Dormagen cd82b41c06 particles: added CollisionDensity to specify with which kind of material a particle will collide 2015-09-12 10:53:23 +02:00
Nicolas Hake d951827f17 Particles: Don't force vertex buffer workaround on Win32
Win32 now uses a single rendering context, so it's no longer necessary
to disable VBA use in the editor.
2015-03-26 15:51:03 +01:00
Nicolas Hake b2f742f997 gl: Check glew for GL_KHR_debug support
Debian wheezy's glew doesn't support GL_KHR_debug yet, so make sure
we're only using it if we can.
2015-03-25 23:15:45 +01:00
Nicolas Hake cd266d2352 gl: Attach debug labels to objects
Doing GL debugging is way easier if your logs talk about "Clonk/VBO"
instead of "buffer object 21".
2015-03-25 22:00:36 +01:00
Nicolas Hake 5562b09dc4 Remove a lot of disabled legacy code, round 2
Maybe at some point we'll be rid of all the commented-out code that
nobody has looked at in years.
2015-03-25 20:02:53 +01:00
David Dormagen f555ca15d0 fix particles only rendering in one editor viewport by always enabling VBA&VBO workaround in editor mode (#1195)
The problem was caused by every window using an own OpenGL context and certain objects not being shared between those.
The best solution would still be to make all windows use ONE OpenGL context. But this would probably need a more or less large rewrite?

This solution has to be considered a workaround with basically no negative side-effects, as the loss of speed is most likely irrelevant in editor mode.
2015-03-22 09:52:34 +01:00
Nicolas Hake fef96eca9c Replace C4Surface::ppTex by a vector
This should improve cache coherency by having all surface tiles adjacent
instead of strewn across the heap. This will also remove an indirection
in the common case of only using one tile.
2015-01-18 22:59:44 +01:00
David Dormagen 7e7bbf17fa fixed additive blitting of particles (#1213)
This was accidentally removed by ck in 526b97c60c
2015-01-17 11:13:08 +01:00
Tobias Zwick 4981182cf8 Merge remote-tracking branch '_origin/master' into lights
Conflicts:
	src/c4group/C4Components.h
2014-12-15 21:16:40 +01:00
Armin Burgmeier e46c558671 Fix a delete / delete[] mismatch in C4ParticleSystem 2014-12-06 15:42:42 -05:00
Armin Burgmeier 5054322b6d Enable lighting shaders for particle rendering 2014-11-25 11:42:17 -05:00
Sven Eberhardt fafa97e72b Fix memory leak in particle system.
Particle chunks were removed from the list (in the particle thread), but never deleted. They must be deleted from the main thread since it will delete GL objects. So simply delete empty chunks in the drawing proc.
2014-07-20 19:21:00 +02:00
Sven Eberhardt 4556cb4890 Add particle value provider function PV_Sin 2014-06-30 01:00:15 +02:00
Julius Michaelis 405fc4f841 Fix dedicated 2014-04-02 20:53:12 +02:00
David Dormagen 6b25e54f0b PV_Step: added "maximumValue" parameter 2014-02-18 20:37:43 +01:00
Martin Plicht 3d9c965ebd mac: C4Particles: glGenVertexArrays fix for Mac OS X 2014-01-23 17:52:19 +01:00
Sven Eberhardt 33d85a145e Fix particle-related crash.
ClearAllParticles deleted the particle lists but never bothered to clear any pointers to them.
2013-12-28 21:30:45 +01:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
David Dormagen 921f21e9a6 allocate particle lists for C4Objects lazily
This should fix an error with incorrect particle lists after loading. This is also a cleaner way overall, since only a fraction of all objects will ever have particles attached to them
2013-12-22 18:51:05 +01:00
David Dormagen aeb057a4b1 made C4ParticleChunk uncopyable to prevent double-deletion of OpenGL buffers leading to a crash 2013-12-22 17:23:47 +01:00
David Dormagen b70b195e24 particles: use OpenGL buffer-objects and vertex-arrays-objects for particle drawing
Even though the whole data is (still) transmitted every frame, I get a pretty high (2x) performance increase on my system. I suspect that the graphics card has to allocate less memory every frame.
2013-12-21 14:07:14 +01:00
David Dormagen a10c9316ef renamed DynamicParticles* to Particles* and CreateParticleEx to CreateParticle 2013-12-17 22:32:01 +01:00
David Dormagen 02f54ba1eb removed the legacy particle system from the engine and docs 2013-12-17 22:32:01 +01:00
David Dormagen f9d7b63e2b dynamic particles: allowed lifetime of 0; allowed value providers for coordinate parameters of CreateParticleEx; load particles even if DrawFn etc. are missing (with warning for now) 2013-11-26 21:24:56 +01:00
Nicolas Hake ca09a74241 Remove some silent conversion from integer 1/100ths to float 1/1s (#994)
4e875f4 didn't quite catch all instances of C4BltTransfor::SetRotate
being called, and silent conversion from int to float meant that those
rotations were incorrect by a factor of 100.
2013-11-11 00:23:01 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Tobias Zwick d0a6bb099f fix #792: wouldn't load Overlay.*.png 2013-01-08 23:52:45 +01:00