Fixed Wavefront Object Importer reading files with integer values. Closes #1651, #1654

This commit is contained in:
Lex Manos 2015-06-17 15:48:22 -07:00
parent c50adf2433
commit e7724c13cc
1 changed files with 5 additions and 5 deletions

View File

@ -26,9 +26,9 @@ import cpw.mods.fml.relauncher.SideOnly;
*/ */
public class WavefrontObject implements IModelCustom public class WavefrontObject implements IModelCustom
{ {
private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+\\.\\d+){3,4} *\\n)|(v( (\\-){0,1}\\d+\\.\\d+){3,4} *$)"); private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *\\n)|(v( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *$)");
private static Pattern vertexNormalPattern = Pattern.compile("(vn( (\\-){0,1}\\d+\\.\\d+){3,4} *\\n)|(vn( (\\-){0,1}\\d+\\.\\d+){3,4} *$)"); private static Pattern vertexNormalPattern = Pattern.compile("(vn( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *\\n)|(vn( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *$)");
private static Pattern textureCoordinatePattern = Pattern.compile("(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *\\n)|(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *$)"); private static Pattern textureCoordinatePattern = Pattern.compile("(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *\\n)|(vt( (\\-){0,1}\\d+(\\.\\d+)?){2,3} *$)");
private static Pattern face_V_VT_VN_Pattern = Pattern.compile("(f( \\d+/\\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+/\\d+){3,4} *$)"); private static Pattern face_V_VT_VN_Pattern = Pattern.compile("(f( \\d+/\\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+/\\d+){3,4} *$)");
private static Pattern face_V_VT_Pattern = Pattern.compile("(f( \\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+){3,4} *$)"); private static Pattern face_V_VT_Pattern = Pattern.compile("(f( \\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+){3,4} *$)");
private static Pattern face_V_VN_Pattern = Pattern.compile("(f( \\d+//\\d+){3,4} *\\n)|(f( \\d+//\\d+){3,4} *$)"); private static Pattern face_V_VN_Pattern = Pattern.compile("(f( \\d+//\\d+){3,4} *\\n)|(f( \\d+//\\d+){3,4} *$)");
@ -49,7 +49,7 @@ public class WavefrontObject implements IModelCustom
public WavefrontObject(ResourceLocation resource) throws ModelFormatException public WavefrontObject(ResourceLocation resource) throws ModelFormatException
{ {
this.fileName = resource.toString(); this.fileName = resource.toString();
try try
{ {
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource); IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
@ -60,7 +60,7 @@ public class WavefrontObject implements IModelCustom
throw new ModelFormatException("IO Exception reading model format", e); throw new ModelFormatException("IO Exception reading model format", e);
} }
} }
public WavefrontObject(String filename, InputStream inputStream) throws ModelFormatException public WavefrontObject(String filename, InputStream inputStream) throws ModelFormatException
{ {
this.fileName = filename; this.fileName = filename;