Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MD2Parser. Skips unused vars and supports jpg or png urls if found

  • Loading branch information...
commit 143591d3b5fa0a90b4b3ee69f2d4603342b0cba1 1 parent 8070f66
@Fabrice3D Fabrice3D authored
Showing with 26 additions and 20 deletions.
  1. +26 −20 src/away3d/loaders/parsers/MD2Parser.as
View
46 src/away3d/loaders/parsers/MD2Parser.as
@@ -37,18 +37,18 @@ package away3d.loaders.parsers
private var _version : uint;
private var _skinWidth : uint;
private var _skinHeight : uint;
- private var _frameSize : uint;
+ //private var _frameSize : uint;
private var _numSkins : uint;
private var _numVertices : uint;
private var _numST : uint;
private var _numTris : uint;
- private var _numGlCmds : uint;
+ //private var _numGlCmds : uint;
private var _numFrames : uint;
private var _offsetSkins : uint;
private var _offsetST : uint;
private var _offsetTris : uint;
private var _offsetFrames : uint;
- private var _offsetGlCmds : uint;
+ //private var _offsetGlCmds : uint;
private var _offsetEnd : uint;
private var _uvIndices : Vector.<Number>;
@@ -201,19 +201,22 @@ package away3d.loaders.parsers
_version = _byteData.readInt();
_skinWidth = _byteData.readInt();
_skinHeight = _byteData.readInt();
- _frameSize = _byteData.readInt();
- _numSkins = _byteData.readInt();
- _numVertices = _byteData.readInt();
- _numST = _byteData.readInt();
- _numTris = _byteData.readInt();
- _numGlCmds = _byteData.readInt();
- _numFrames = _byteData.readInt();
- _offsetSkins = _byteData.readInt();
- _offsetST = _byteData.readInt();
- _offsetTris = _byteData.readInt();
- _offsetFrames = _byteData.readInt();
- _offsetGlCmds = _byteData.readInt();
- _offsetEnd = _byteData.readInt();
+ //skip _frameSize
+ _byteData.readInt();
+ _numSkins = _byteData.readInt();
+ _numVertices = _byteData.readInt();
+ _numST = _byteData.readInt();
+ _numTris = _byteData.readInt();
+ //skip _numGlCmds
+ _byteData.readInt();
+ _numFrames = _byteData.readInt();
+ _offsetSkins = _byteData.readInt();
+ _offsetST = _byteData.readInt();
+ _offsetTris = _byteData.readInt();
+ _offsetFrames = _byteData.readInt();
+ //skip _offsetGlCmds
+ _byteData.readInt();
+ _offsetEnd = _byteData.readInt();
_parsedHeader = true;
}
@@ -237,10 +240,13 @@ package away3d.loaders.parsers
slashIndex = name.lastIndexOf("/");
if (slashIndex < 0) slashIndex = 0;
}
-
- name = name.substring(slashIndex+1, extIndex);
- url = name+"."+_textureType;
-
+ if(name.toLowerCase().indexOf(".jpg") == -1 && name.toLowerCase().indexOf(".png") == -1){
+ name = name.substring(slashIndex+1, extIndex);
+ url = name+"."+_textureType;
+ } else{
+ url = name;
+ }
+
_materialNames[i] = name;
// only support 1 skin
if (dependencies.length == 0)
Please sign in to comment.
Something went wrong with that request. Please try again.