Add files via upload

fix blender vert colors being casted to signed char, which was causing negative values.

Also fix blender vert colors being way outside of 0 to 1 range which aiColor specifies
pull/953/head
TrianglesPCT 2016-07-24 02:23:59 -06:00 committed by GitHub
parent 86b7f12c18
commit bcb86bcc35
2 changed files with 18 additions and 2 deletions

View File

@ -532,7 +532,7 @@ template <typename T> struct signless;
template <> struct signless<char> {typedef unsigned char type;};
template <> struct signless<short> {typedef unsigned short type;};
template <> struct signless<int> {typedef unsigned int type;};
template <> struct signless<unsigned char> { typedef unsigned char type; };
template <typename T>
struct static_cast_silent {
template <typename V>
@ -614,6 +614,22 @@ template <> inline void Structure :: Convert<char> (char& dest,const FileDatab
ConvertDispatcher(dest,*this,db);
}
// ------------------------------------------------------------------------------------------------
template <> inline void Structure::Convert<unsigned char>(unsigned char& dest, const FileDatabase& db) const
{
// automatic rescaling from char to float and vice versa (seems useful for RGB colors)
if (name == "float") {
dest = static_cast<unsigned char>(db.reader->GetF4() * 255.f);
return;
}
else if (name == "double") {
dest = static_cast<unsigned char>(db.reader->GetF8() * 255.f);
return;
}
ConvertDispatcher(dest, *this, db);
}
// ------------------------------------------------------------------------------------------------
template <> inline void Structure :: Convert<float> (float& dest,const FileDatabase& db) const
{

View File

@ -175,7 +175,7 @@ struct MLoopUV : ElemBase {
// -------------------------------------------------------------------------------
// Note that red and blue are not swapped, as with MCol
struct MLoopCol : ElemBase {
char r, g, b, a;
unsigned char r, g, b, a;
};
// -------------------------------------------------------------------------------