diff --git a/include/NIF_IO.h b/include/NIF_IO.h index 70b58b92a1fa16e593d108f5e380b86a59fe391e..ed1456cffa7dc1abeb678f2c2ea9f17d5cdfd288 100644 --- a/include/NIF_IO.h +++ b/include/NIF_IO.h @@ -214,6 +214,12 @@ ostream & operator<<( ostream & out, Char8String const & val ); void NifStream( InertiaMatrix & val, istream& in, const NifInfo & info); void NifStream( InertiaMatrix const & val, ostream& out, const NifInfo & info); +//ByteColor4 +class ByteColor4; +void NifStream( ByteColor4 & val, istream& in, const NifInfo & info); +void NifStream( ByteColor4 const & val, ostream& out, const NifInfo & info); +ostream & operator<<( ostream & out, ByteColor4 const & val ); + //--Templates--// void NifStream( Key<Quaternion> & key, istream& file, const NifInfo & info, KeyType type ); diff --git a/include/obj/NiPSSimulatorGeneralStep.h b/include/obj/NiPSSimulatorGeneralStep.h index dd069e48be3f0d9e201f99c63c80fc4328670269..e6a5cc600a2b0ffd826759e08bf1048177f824b4 100644 --- a/include/obj/NiPSSimulatorGeneralStep.h +++ b/include/obj/NiPSSimulatorGeneralStep.h @@ -12,6 +12,8 @@ All rights reserved. Please see niflib.h for license. */ //--BEGIN FILE HEAD CUSTOM CODE--// +#include "../gen/ByteColor4.h" + //--END CUSTOM CODE--// #include "NiPSSimulatorStep.h" diff --git a/src/NIF_IO.cpp b/src/NIF_IO.cpp index f39cb7445ec5b610a23792e09c24525862f29e62..c815c995faf441334260c8a26af11f55de8e5614 100644 --- a/src/NIF_IO.cpp +++ b/src/NIF_IO.cpp @@ -4,6 +4,7 @@ All rights reserved. Please see niflib.h for license. */ #include "../include/NIF_IO.h" #include "../include/niflib.h" #include "../include/gen/Header.h" +#include "../include/gen/ByteColor4.h" namespace Niflib { //--Endian Support Functions--// @@ -890,6 +891,26 @@ void NifStream( InertiaMatrix const & val, ostream& out, const NifInfo & info ) } } +//ByteColor4 +void NifStream( ByteColor4 & val, istream& in, const NifInfo & info ) { + val.r = ReadByte(in); + val.g = ReadByte(in); + val.b = ReadByte(in); + val.a = ReadByte(in); +} + +void NifStream( ByteColor4 const & val, ostream& out, const NifInfo & info ) { + WriteByte( val.r, out); + WriteByte( val.g, out); + WriteByte( val.b, out); + WriteByte( val.a, out); +} + +ostream & operator<<( ostream & out, ByteColor4 const & val ) { + out << "RGBA: " << val.r << " " << val.g << " " << val.b << " " << val.a; + return out; +} + ostream & operator<<( ostream & out, hdrInfo const & val ) { out.pword(hdrInfo::infoIdx) = (void*)val.info; return (out);