summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>2012-10-27 01:49:01 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-11-25 18:14:15 +0200
commite42eeec8f626acbaa54ae31c10ca06c868c7931c (patch)
tree61ea64416548b5ad858c6d275da90ace607fd163 /src/util
parent118285e6babd511c285780b07c275d527d7da9b1 (diff)
downloadminetest-e42eeec8f626acbaa54ae31c10ca06c868c7931c.tar.gz
minetest-e42eeec8f626acbaa54ae31c10ca06c868c7931c.tar.bz2
minetest-e42eeec8f626acbaa54ae31c10ca06c868c7931c.zip
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
Diffstat (limited to 'src/util')
-rw-r--r--src/util/serialize.h33
1 files changed, 33 insertions, 0 deletions
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 <iostream>
@@ -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
*/