Commit Graph

36 Commits (376ca5a9dfb6b51ad02253a429ef0bd935d85799)

Author SHA1 Message Date
Julius Michaelis 376ca5a9df Prevent using USE_CONSOLE in lib{misc,c4script} 2016-10-22 17:42:23 +02:00
Julius Michaelis 34a9a1de8d Twiddle with header organization: lib{misc,c4script} do no longer include GL/glew.h
(Yes, it is just that complicated.)
2016-10-20 18:46:32 +02:00
Nicolas Hake 5bdddff139 Remove MS CRT memory management debugging
Redefining new breaks perfectly valid code, but only on MSVC and only in
one particular configuration (Debug). This is very annoying because it
means people not using MSVC, or even people doing Release builds, can
write standards-conforming code which then may fail to build for other
people.
2016-07-25 18:39:44 +02:00
Nicolas Hake be2fdaaae3 C4Particles: Fix build with MSVC memory tracing 2016-05-12 18:47:52 +02:00
David Dormagen 29333ef87a particles: initialize primitive restart index IBO lazily
Otherwise the IBO is created from scratch for every particle that is e.g. created in a for loop. This is extremely slow and unnecessary.
The symptoms was that OneMillionParticles appeared to 'freeze' on the non-batch creation test. (Hint: it didn't freeze, it just took forever).
2016-05-10 21:46:32 +02:00
Lukas Werling e734f15117 Remove RNG implementation from C4Random.h 2016-04-25 17:28:04 +02:00
Lukas Werling e6a39392dd Use PCG for C4Particle 2016-04-21 20:39:40 +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
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
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 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
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
Julius Michaelis ee859d85e0 Remove boost any usage of boost libraries 2015-09-30 00:16:12 +02: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 bc6ce0251f Make private funcs in C4ParticleValueProvider, well, private
We're not inheriting from C4PVP, and all of these internal functions
really shouldn't be called from outside the class. So private is what
they should be.
2015-02-22 11:30:12 +01:00
Nicolas Hake e2a8f6d303 Reorder some declarations and initializations to avoid order mismatch
While none of the mismatches were having a side-effect, this silences a
number of -Wreorder warnings which were drowning out potentially
important diagnostics.
2015-02-04 22:12:42 +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 a792a1c6a2 Fix possible race condition in C4ParticleSystem construction
Previously, the calculation thread was initialized before the event it was
going to wait for after it is launched. However, since the thread starts its
execution in its constructor, it might access the event before the event
itself has been constructed.

This is fixed by making sure the event is fully constructed before the thread
is constructed (and launched).
2014-12-03 11:03:51 -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
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
Günther Brammer 6a6190564f Remove some forward declarations that are already in C4Prototypes.h 2012-12-31 22:03:12 +01:00
Günther Brammer 1a29f8625d Reorder engine source file organization a bit
This mostly consists of flattening the hierarchy, splitting the
graphics stuff out of platform, and a few smaller cleanups.
2012-04-27 19:04:43 +02:00