Commit Graph

280 Commits (48ae42f87e82f26e696ba62c1f4de82d90949522)

Author SHA1 Message Date
Nicolas Hake c1bb56e1f1 Win32: Don't write log to stdout in GUI apps
In applications targeting the GUI subsystem, stdout and stderr aren't
valid file handles, and trying to write to them sets the system error
code to ERROR_INVALID_HANDLE.
2015-02-19 13:02:16 +01:00
Nicolas Hake ff263e5433 Fix potential buffer overflow in ssprintf
If vsnprintf fails for other reasons than too small a buffer, it returns
a negative value. Comparing that with a size_t value promotes the
negative value to unsigned, which makes for a very large result, almost
guaranteed to be larger than the buffer size.
2015-02-12 23:55:38 +01:00
Nicolas Hake 95641b5fb0 Add a dummy declaration to ssprintf
G++ doesn't allow attributes on function definitions for reasons. Add a
declaration immediately before the definition so it works.
2015-02-12 23:14:16 +01:00
Nicolas Hake e21a5bdd44 Rename BoundBy to Clamp
"BoundBy" sounds like a predicate. "Clamp" is a common function name for
the operation in graphics processing, so it should be familiar to users.
2015-02-12 23:05:55 +01:00
Nicolas Hake 35e7ca509b Replace NoPointer struct with template parameter deduction
We're trying to ensure that no caller passes a char* to ssprintf, but a
char array instead. This is way easier done by using template parameter
deduction than a specialized class template.
2015-02-12 22:25:36 +01:00
Nicolas Hake ea354218bb Remove unused private field StdMeshMaterialShader::Type
We'll keep the parameter just in case we'll ever need the info.
2015-02-11 20:48:18 +01:00
Sven Eberhardt cd3b969fc4 Silence a few warnings in render and SolidMask code. 2015-02-08 12:37:00 +01:00
Sven Eberhardt 4e65dccb1f Fix memory leak on CID_Animation_BaseInfo mesh chunk type.
Detected by a -Wunused warning.
2015-02-08 12:35:45 +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
Günther Brammer 5bcedb5bbf Remove some redundant #includes 2015-01-25 18:53:48 +01:00
Günther Brammer a92c22a7b3 Merge various build system fixes and cleanups 2015-01-25 18:50:29 +01:00
Sven Eberhardt 089b4794a8 Fix a few warnings in Win64 build. 2015-01-25 16:43:51 +01:00
Nicolas Hake 2ef2c637a7 Remove several instances of disabled legacy code 2015-01-18 22:59:45 +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
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
Armin Burgmeier 9580c46056 Fix assertion failure when definition to append/include does not exist 2015-01-06 19:33:33 +01:00
Mark af3efead76 Fix reloading of skeletons (#1180) 2015-01-06 18:35:16 +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
Armin Burgmeier d4ac1d0694 Fix possible crash after a mesh has been reloaded 2015-01-04 18:29:44 +01:00
Günther Brammer d9e3d9db3d Require filenames to be in unicode, remove iconv usage
Every modern operating system and Clonk uses UTF-8, and windows uses UTF-16
and has its own conversion code.
2015-01-03 20:41:03 +01:00
Sven Eberhardt ec7540e404 Fix ICONV build 2015-01-03 19:06:19 +01:00
Sven Eberhardt fed6f8d65f Fix Linux/Mac build. 2015-01-03 19:03:18 +01:00
Sven Eberhardt 49f991c819 Move shader logging into separate file and log only in editor mode (#1209) 2015-01-03 17:53:59 +01:00
Armin Burgmeier 1e77de1044 Merge branch 'lights'
Conflicts:
	src/c4group/C4Components.h
2015-01-03 16:00:20 +01:00
Armin Burgmeier 8686441d45 Make mesh shaders use the C4Shader slice machinery 2014-12-22 22:56:30 +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
Tobias Zwick 4981182cf8 Merge remote-tracking branch '_origin/master' into lights
Conflicts:
	src/c4group/C4Components.h
2014-12-15 21:16:40 +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 1f4f280539 Bugfix: Missing AttachParent in AttachedMesh
On loading a savegame with attached meshes, the AttachParent of their child is NULL.
2014-12-07 01:11:02 +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 db6df15377 Add SetAmbientBrightness and GetAmbientBrightness script functions 2014-11-20 17:07:31 -05:00
Armin Burgmeier 88f8f75441 Add ambient lighting
This introduces a new texture, an ambient light map, that is generated
automatically at the beginning of the round by the sky portion of the
landscape. This basically makes everything that is close to sky visible
by default.

The shaders have been adapted so that they deploy direction-independent
lighting for the ambient component, and the current (diffuse) behaviour
for the diffuse component. This makes the shaders use an additional
texture unit that represents the ambient light. We can think about merging
this information into the light texture, but the coordinate systems are
different at the moment, so this could be performed at the stage of light
texture generation.

For meshes, the ambient material is not actually used, but instead a
diffuse light from the front is used. This makes many meshes look more
interesting, maybe also because the ambient material setting of most
meshes are not set correctly at the moment.
2014-11-17 09:35:50 -05:00
Armin Burgmeier aed907e30d Remove old fog of war 2014-11-07 11:53:10 -05:00
Armin Burgmeier 219fa8597c Implement light calculations for meshes 2014-11-06 15:56:19 -05:00
Armin Burgmeier a34cd5711c Add support for custom shaders in mesh material scripts 2014-10-21 15:19:30 -04:00
Armin Burgmeier 2f6d1eaa1f Parse program definitions from the material file 2014-10-21 15:19:30 -04:00
Armin Burgmeier 99fe2eca4f Fix gcc warnings about missing initializers 2014-10-21 15:19:30 -04:00
Philipp Kern 20701562e8 Allow distributions to use the system tinyxml.
Add a new cmake option WITH_SYSTEM_TINYXML=ON that allows to use the system
tinyxml library and header instead of the bundled copy. Adjust the include
path in the single source file referencing the header and add the thirdparty
path to the include search path if the use system option is unset or off.
2014-10-16 11:52:44 -04:00
Sven Eberhardt 7450a83746 Add missing tuple header #include. 2014-10-09 20:35:43 +02:00
Armin Burgmeier d47a416c0f Keep track of shaders in StdMeshMatManager
This replaces the fragile ShaderRef construction in StdMeshMaterialPass, and
it allows to re-use shaders and/or programs between different materials. This
is some more preparatory work for custom shaders.
2014-10-07 12:38:08 -04: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
Sven Eberhardt 378bda5546 Added custom scenario parameters (SCENPAR_*).
Can currently only be set in network games in the lobby. In the future, maybe we can find a place somewhere in the scenario selection dialogue.
2014-09-23 23:02:52 +02:00
Kevin Zheng 6a1a551d01 Clean up deprecated headers and functions
"gdk_pixbuf_unref has been deprecated since version 2.0 and should not be
used in newly-written code. Use g_object_unref()."

sys/timeb.h isn't used anymore since 2005.
2014-05-27 00:30:20 +02:00
Günther Brammer 88e5608298 Improve grammar in comment 2014-04-19 19:02:22 +02:00
Günther Brammer a840774965 Move FixedRandom to C4Random.cpp
No need to inline this seldomly-called function, or have RandomHold in the
global namespace.
2014-04-19 19:02:21 +02:00
Nicolas Hake 3c80a745b0 MinGW: Use __mingw_vasprintf if available
Recent versions of MinGW do no longer declare vasprintf in <stdio.h>,
but they ship a compatible function called __mingw_vasprintf. Use this
function if vasprintf isn't available.
2014-03-25 23:20:34 +01:00
Tobias Zwick 9c1f4bcbef replace FIXME logs on each scenario start with a FIXME comment in the code (#1013) 2014-01-26 17:16:22 +07: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