@@ -702,11 +702,11 @@ class AC3DModelLoader : public ModelLoader // documentation is at http://www.ini
702
702
}
703
703
return RGBAF (limit<float >(color.r , 0 , 1 ), limit<float >(color.g , 0 , 1 ), limit<float >(color.b , 0 , 1 ), limit<float >(color.a , 0 , 1 ));
704
704
}
705
- ColorF parseColorSpecifier (size_t startingIndex, function<void (string)> warningFunction)
705
+ ColorF parseColorSpecifier (size_t startingIndex, function<void (string)> warningFunction, float scale = 1.0f )
706
706
{
707
707
if (line.size () < 3 + startingIndex)
708
708
throw ModelLoadException (" too few arguments for " + line[0 ]);
709
- return validateColor (RGBF (parseFloat (line[startingIndex]), parseFloat (line[startingIndex + 1 ]), parseFloat (line[startingIndex + 2 ])), warningFunction);
709
+ return validateColor (RGBF (parseFloat (line[startingIndex]) * scale , parseFloat (line[startingIndex + 1 ]) * scale , parseFloat (line[startingIndex + 2 ]) * scale ), warningFunction);
710
710
}
711
711
shared_ptr<Texture> loadImage (string fileName)
712
712
{
@@ -912,9 +912,9 @@ class AC3DModelLoader : public ModelLoader // documentation is at http://www.ini
912
912
};
913
913
if ((flags & typeMask) > 2 )
914
914
throw ModelLoadException (" invalid SURF flags : invalid type" );
915
- bool isShaded = false ;
915
+ bool isShaded = true ;
916
916
if (flags & shadedFlagMask)
917
- isShaded = true ;
917
+ isShaded = false ;
918
918
bool isTwoSided = false ;
919
919
if (flags & twoSidedFlagMask)
920
920
isTwoSided = true ;
@@ -940,6 +940,10 @@ class AC3DModelLoader : public ModelLoader // documentation is at http://www.ini
940
940
material = materials[materialIndex];
941
941
material.texture = texture;
942
942
}
943
+ warning (!isShaded, warningFunction, []()->string
944
+ {
945
+ return " material specified for non-shaded SURF" ;
946
+ });
943
947
line = readTokenizedLine (is);
944
948
}
945
949
if (line[0 ] == " refs" )
@@ -1056,7 +1060,7 @@ class AC3DModelLoader : public ModelLoader // documentation is at http://www.ini
1056
1060
ColorF rgb = parseColorSpecifier (3 , warningFunction);
1057
1061
if (line[6 ] != " amb" )
1058
1062
throw ModelLoadException (" missing amb for " + line[0 ]);
1059
- ColorF amb = parseColorSpecifier (7 , warningFunction);
1063
+ ColorF amb = parseColorSpecifier (7 , warningFunction, 0 . 2f );
1060
1064
if (line[10 ] != " emis" )
1061
1065
throw ModelLoadException (" missing emis for " + line[0 ]);
1062
1066
ColorF emis = parseColorSpecifier (11 , warningFunction);
0 commit comments