From e42eeec8f626acbaa54ae31c10ca06c868c7931c Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 27 Oct 2012 01:49:01 +0300 Subject: Framework for the attachment system, new object property which allows changing the color and alpha of mesh materials New object property which allows changing the color and alpha of mesh materials. Due to the current lighting systems it doesn't work yet, but the full implementation is there Framework for the attachment system, with no actual functionality yet Send bone and player object to the setAttachment function in content_sao.cpp, but we need a way to translate it there and send it to the client I will also want position and rotation offsets to be possible to apply to attachments Network object ID from server to client. This will be used to identify the parent client-side and know what to attach to --- src/util/serialize.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/util') diff --git a/src/util/serialize.h b/src/util/serialize.h index 50a002c10..d552dec94 100644 --- a/src/util/serialize.h +++ b/src/util/serialize.h @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define UTIL_SERIALIZE_HEADER #include "../irrlichttypes.h" +#include "../irrlichttypes_bloated.h" #include "../irr_v2d.h" #include "../irr_v3d.h" #include @@ -197,6 +198,24 @@ inline v3s16 readV3S16(u8 *data) return p; } +inline void writeARGB8(u8 *data, video::SColor p) +{ + writeU8(&data[0], p.getAlpha()); + writeU8(&data[1], p.getRed()); + writeU8(&data[2], p.getGreen()); + writeU8(&data[3], p.getBlue()); +} + +inline video::SColor readARGB8(u8 *data) +{ + video::SColor p; + p.setAlpha(readU8(&data[0])); + p.setRed(readU8(&data[1])); + p.setGreen(readU8(&data[2])); + p.setBlue(readU8(&data[3])); + return p; +} + /* The above stuff directly interfaced to iostream */ @@ -344,6 +363,20 @@ inline v3s16 readV3S16(std::istream &is) return readV3S16((u8*)buf); } +inline void writeARGB8(std::ostream &os, video::SColor p) +{ + char buf[4] = {0}; + writeARGB8((u8*)buf, p); + os.write(buf, 4); +} + +inline video::SColor readARGB8(std::istream &is) +{ + char buf[4] = {0}; + is.read(buf, 4); + return readARGB8((u8*)buf); +} + /* More serialization stuff */ -- cgit v1.2.3