OSDN Git Service

PmdLimitsパッケージ移動
[mikutoga/TogaGem.git] / src / main / java / jp / sfjp / mikutoga / pmd / parser / PmdParserBase.java
index 720114c..659c82c 100644 (file)
@@ -15,6 +15,8 @@ import jp.sfjp.mikutoga.bin.parser.CommonParser;
 import jp.sfjp.mikutoga.bin.parser.MmdEofException;
 import jp.sfjp.mikutoga.bin.parser.MmdFormatException;
 import jp.sfjp.mikutoga.bin.parser.TextDecoder;
+import jp.sfjp.mikutoga.pmd.PmdLimits;
+import jp.sfjp.mikutoga.pmd.ShadingUtil;
 
 /**
  * PMDモデルファイルのパーサ基本部。
@@ -93,36 +95,6 @@ public class PmdParserBase extends CommonParser {
     }
 
     /**
-     * シェーディング用ファイル情報から
-     * テクスチャファイル名とスフィアマップファイル名を分離する。
-     * @param shadingFile シェーディング用ファイル情報
-     * @return [0]:テクスチャファイル名 [1]:スフィアマップファイル名。
-     * 該当ファイル名が無い場合は空文字列。
-     */
-    public static String[] splitShadingFileInfo(String shadingFile){
-        String[] result;
-
-        result = shadingFile.split('\\'+"*", 2);
-        assert result.length == 1 || result.length == 2;
-
-        if(result.length == 1){
-            String onlyFile = result[0];
-            result = new String[2];
-            result[0] = "";
-            result[1] = "";
-            if(onlyFile.endsWith(".sph") || onlyFile.endsWith(".spa")){
-                result[1] = onlyFile;
-            }else{
-                result[0] = onlyFile;
-            }
-        }
-
-        assert result.length == 2;
-
-        return result;
-    }
-
-    /**
      * 基本情報通知ハンドラを登録する。
      * @param handler ハンドラ
      */
@@ -384,7 +356,7 @@ public class PmdParserBase extends CommonParser {
 
             String shadingFile =
                     parsePmdText(PmdLimits.MAXBYTES_TEXTUREFILENAME);
-            String[] splitted = splitShadingFileInfo(shadingFile);
+            String[] splitted = ShadingUtil.splitShadingFileInfo(shadingFile);
             String textureFile = splitted[0];
             String sphereFile  = splitted[1];