Commit Graph

45 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 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 3641509462 Mesh rotation: Keep rendered mesh inside shape 2016-04-03 13:37:04 +02:00
Nicolas Hake f64f131f1b StdMesh*: Explicitly delete copy ctors/assignment ops 2016-02-24 01:46:58 +01:00
Sven Eberhardt 1f81b87c33 PlayAnimation: Delete previous animations in same slot if no weight is given.
This will simplify fixing several animation leaks.
2016-01-28 22:02:27 -05:00
Armin Burgmeier 6bda0b4ec8 Use an element array buffer (IBO) for meshes
This is required for glDrawElements() with a core profile. Furthermore, for
meshes that have a fixed face ordering (non-transparent meshes at 100%
completion), this puts more static data on the GPU that we don't have to
upload every frame.

For meshes with non-fixed face ordering, we still have to upload faces every
frame, since the ordering might change if the mesh rotates. We could still
improve this by figuring out if the order actually changed after the sort
step, and only update to the GPU if it has. In many cases it hasn't, so there
is some potential for more optimization there. But that's for later.
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 9fd7e88afd Fix crash when changing mesh material of incomplete mesh
Changing the mesh material to something that does not use alpha blending
restores the originial face order. This caused a crash for meshes with
Completion below 1, since all original faces were copied, but the buffer
in the mesh instance was only large enough to hold the number of faces of
the incompleted mesh. To fix this, simply run the standard
select-faces-for-a-given-completion-value procedure.
2016-01-01 17:01:10 -08:00
Armin Burgmeier 703f028392 Fix animation when position is beyond last keyframe (#1406)
In this case, an interpolation between the last and the first keyframe is
performed, so that the animation can be looped smoothly.
2015-09-22 22:11:55 -04:00
Armin Burgmeier a40792013f Add "AttachNumber" parameter to AttachMesh
This allows to create nested definition-based attached meshes.
2015-09-12 19:57:00 -04:00
Armin Burgmeier 380724a017 Choose attach mesh number uniquely from entire (owned) attach tree 2015-09-12 19:28:53 -04:00
Armin Burgmeier ecaedb7106 Add GetAnimationList() script function (#1344) 2015-06-22 19:58:58 -04:00
Nicolas Hake 9eb8eedf82 Fix headless build
Several rendering changes have resulted in a non-rendering build that
failed to build from source. Dummy out all of these functions to make it
work again.
2015-06-17 21:30:56 +02:00
Nicolas Hake 7a4dc6ac79 Remove superfluous return value qualifier
Type qualifiers on a function return value are ignored anyway.
2015-05-25 16:28:04 +02: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
Nicolas Hake d2563fe345 Do skinning in hardware
Instead of transforming all vertices on the CPU every time an animation
progresses, we now only recalculate the skeleton, leaving the heavy
lifting for the GPU. This also means we no longer have to push all
vertices onto the bus every frame, because the mesh isn't changing and
can therefore be stored in a GL_STATIC_DRAW VBO when it's first loaded.
The downside of this approach is that there's only a limited number of
uniforms and vertex attributes we can pass to the shader. At the moment
these limits are a maximum of 128 bones per skeleton, and no vertex can
be influenced by more than 8 bones at once. So far this is no problem,
as the most complex skeleton in the base game uses less than 64 bones
and no more than 6 bone weights per vertex.
2015-02-27 21:51:58 +01:00
Nicolas Hake c66833e2db GL: Render meshes out of a VBO
While we're still not doing skinning on the GPU, copying the vertex data
to a VBO immediately after updating the animation allows us to re-use
that data for unanimated meshes. It also allows us to store unanimated
data on the GPU, instead of transferring it over the bus for each frame.
2015-02-24 18:36:58 +01:00
Mark 43c924d00e Restructuring of StdMeshSkeleton::MirrorAnimation
Mirroring the name happens in MirrorAnimation now, no double checks anymore, no double copying of buffers.
2015-01-07 22:48:04 +01:00
Mark 10b343dba9 Append and include skeletons (#1180)
Appending and including skeletons works now. Documentation updated.
Skins such as appendto.Clonk.Farmer.skeleton are handled as if the skin name were not included: appendto.Clonk.skeleton

This also changes a bit the structure of how meshes are reloaded in general,
in particular mesh materials are only reloaded once and not once per
C4DefGraphics instance. (Fix crash on reload with included skeletons, cherry picked from commit 2f69aa4850ab7a4b621e5f30cbc537d40f32c0df)

Fix linking of C4Script standalone tool (cherry picked from commit b03a332b73463b378c94e4e92b66d45b923b3b9c)
2015-01-06 18:25:08 +01:00
Mark 305637b246 Loading skeletons separately (#1180)
Animations are now part of the skeleton, and skeletons are loaded before meshes. They are stored in a map in StdMeshSkeletonLoader. This is only the first part of changes for #1180.
2014-12-20 23:11:33 +01:00
Mark 3971d60614 Match partial skeletons (#1177)
When using AttachMesh() with the flag AM_MatchSkeleton the behaviour was changed. The child mesh no longer uses the transformation of the bone in the parent skeleton by order, but by name.
2014-12-07 01:11:04 +01:00
Mark 0e9c0e9be4 AttachMesh with added functionality (#1177)
Simple implementation of matching skeletons/animations. Short description added to the documentation. More functionality to follow.
2014-12-03 20:05:36 +01:00
Mark dda9599003 Extracted skeleton from StdMesh.
Skeleton is now represented by the class StdMeshSkeleton.
2014-12-03 20:04:54 +01:00
Armin Burgmeier f23d745b1d Reorder submeshes by opacity after material change (#1125) 2014-10-04 16:12:13 -04:00
Armin Burgmeier 15c2497311 Serialize mesh materials in savegames (#1121) 2014-10-03 16:39:03 -04: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 fe28104f98 prevent crash when StdSubMeshInstance face count is 0, added assertion though, because this should not happen to my knowledge
I believe a possible cause for this is a object's model with a very low completion. However, I am not sure where the right place is to make sure everything goes alright in that case.
2013-11-26 21:25:07 +01:00
Armin Burgmeier 695a9a88c3 Add TransformBone and SetAnimationBoneTransform script functions 2013-05-27 21:33:29 +02:00
Armin Burgmeier 90ee4d2380 Fix crash when an object whose mesh is attached to another mesh is removed 2013-05-27 15:55:18 +02:00
Nicolas Hake 459fce0758 Replace std::auto_ptr with std::unique_ptr
std::auto_ptr has awkward copy semantics and is deprecated in C++11.
2013-03-26 15:43:01 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Günther Brammer 6a6190564f Remove some forward declarations that are already in C4Prototypes.h 2012-12-31 22:03:12 +01:00
Armin Burgmeier 7f5f916e76 Draw only partial set of faces for buildings in construction 2012-02-26 01:09:42 +01:00
Armin Burgmeier 8dae8c111d Implement XML loading support for geometry shared between submeshes
The new OGRE blender exporter (2.6) creates meshes which make use of this
feature.
2012-02-15 23:04:19 +01:00
Armin Burgmeier 7e532c2bd6 Split math functions into StdMeshMath.{h,cpp} 2011-12-29 15:41:52 +01:00
Armin Burgmeier e44b216230 Enable face ordering individually for all submeshes 2011-10-15 21:35:39 +02:00
Günther Brammer 9bc61db360 copyright notices update 2011 2011-09-01 16:58:52 +02:00
Armin Burgmeier 6c156a22a7 Implement mesh update on definition reload (#76) 2011-08-20 00:01:08 +02:00
Armin Burgmeier 771163be4b Correctly reload mesh materials on definition reload
This does not fix #76 yet, but it's a first step.
2011-08-17 23:50:33 +02:00
Armin Burgmeier 5cba420382 Make sure [ChildInstance] named section always exists
Otherwise loading a savegame with an attached def mesh fails if the mesh
has neither attached meshes or animation nodes since the [ChildInstance]
section ends up empty in which case StdCompilerIniWrite does not write the
section at all.
2011-06-05 14:12:02 +02:00
Günther Brammer 2031fb0644 Do not enumerate pointers before saving
Instead, retrieve the number on demand during serialization. This saves
lots of unnecessary code and makes serialization actually not modify the
objects. At least with the exception of nInfo, but that should be save.
2011-03-28 00:15:06 +02:00
Günther Brammer 83322f596a Move Mesh loaders from src/platform to src/lib
They are entirely platform-independent.
2011-01-19 22:55:18 +01:00