*/
public static final String MORPHNAME_BASE = "base";
- /**
- * ボーンモーションデータの個別サイズ。バイト単位。
- */
- public static final int BONEMOTION_DATA_SZ = 111;
-
- /**
- * モーフデータの個別サイズ。バイト単位。
- */
- public static final int MORPH_DATA_SZ = 23;
-
- /**
- * カメラデータの個別サイズ。バイト単位。
- */
- public static final int CAMERA_DATA_SZ = 61;
-
- /**
- * 光源データの個別サイズ。バイト単位。
- */
- public static final int LUMINOUS_DATA_SZ = 28;
-
- /**
- * 影演出データの個別サイズ。バイト単位。
- */
- public static final int SHADOW_DATA_SZ = 9;
-
private static final Charset CS_ASCII = Charset.forName("US-ASCII");
private static final byte[] MAGIC_BYTES;
private final byte[] motionIntplt = new byte[BZTOTAL_SIZE];
- private VmdBasicHandler handler = null;
+ private VmdBasicHandler handler = VmdUnifiedHandler.EMPTY;
private boolean hasStageActName = false;
private boolean strictMode = true;
* @param basicHandler ハンドラ
*/
void setBasicHandler(VmdBasicHandler basicHandler){
- this.handler = basicHandler;
+ if(basicHandler == null){
+ this.handler = VmdUnifiedHandler.EMPTY;
+ }else{
+ this.handler = basicHandler;
+ }
+
return;
}
throw new MmdFormatException("unknown VMD-header type");
}
- if(this.handler != null){
- this.handler.vmdHeaderInfo(header);
- }
+ this.handler.vmdHeaderInfo(header);
return;
}
this.hasStageActName = true;
}
- if(this.handler != null){
- this.handler.vmdModelName(modelName);
- }
+ this.handler.vmdModelName(modelName);
return;
}
throws IOException, MmdFormatException{
int boneMotionNo = parseLeInt();
- if(this.handler == null){
- skip(VmdConst.BONEMOTION_DATA_SZ * boneMotionNo);
- return;
- }
-
this.handler.loopStart(
VmdBasicHandler.BONEMOTION_LIST, boneMotionNo);
*/
private void parseVmdMotionInterpolation()
throws IOException, MmdFormatException{
- if(this.handler == null){
- skip(this.motionIntplt.length);
- return;
- }
-
parseByteArray(this.motionIntplt);
if(this.strictMode){
private void parseVmdMorph() throws IOException, MmdFormatException{
int morphMotionNo = parseLeInt();
- if(this.handler == null){
- skip(VmdConst.MORPH_DATA_SZ * morphMotionNo);
- return;
- }
-
this.handler.loopStart(
VmdBasicHandler.MORPH_LIST, morphMotionNo);
import java.io.InputStream;
import jp.sfjp.mikutoga.bin.parser.CommonParser;
import jp.sfjp.mikutoga.bin.parser.MmdFormatException;
-import jp.sourceforge.mikutoga.vmd.VmdConst;
/**
* VMDモーションファイルのカメラモーションパーサ。
private final byte[] xyzIntplt = new byte[BZXYZ_SIZE];
private final byte[] etcIntplt = new byte[BZETC_SIZE];
- private VmdCameraHandler handler = null;
+ private VmdCameraHandler handler = VmdUnifiedHandler.EMPTY;
/**
* @param cameraHandler ハンドラ
*/
void setCameraHandler(VmdCameraHandler cameraHandler){
- this.handler = cameraHandler;
+ if(cameraHandler == null){
+ this.handler = VmdUnifiedHandler.EMPTY;
+ }else{
+ this.handler = cameraHandler;
+ }
+
return;
}
void parse() throws IOException, MmdFormatException {
int cameraMotionNo = parseLeInt();
- if(this.handler == null){
- skip(VmdConst.CAMERA_DATA_SZ * cameraMotionNo);
- return;
- }
-
this.handler.loopStart(VmdCameraHandler.CAMERA_LIST, cameraMotionNo);
for(int ct = 0; ct < cameraMotionNo; ct++){
*/
private void parseCameraXyzInterpolation()
throws IOException, MmdFormatException{
- if(this.handler == null){
- skip(this.xyzIntplt.length);
- return;
- }
-
parseByteArray(this.xyzIntplt);
int idx = 0;
*/
private void parseCameraEtcInterpolation()
throws IOException, MmdFormatException{
- if(this.handler == null){
- skip(this.etcIntplt.length);
- return;
- }
-
parseByteArray(this.etcIntplt);
int idx = 0;
import java.io.InputStream;
import jp.sfjp.mikutoga.bin.parser.CommonParser;
import jp.sfjp.mikutoga.bin.parser.MmdFormatException;
-import jp.sourceforge.mikutoga.vmd.VmdConst;
/**
* VMDモーションファイルのライティング情報パーサ。
*/
class VmdLightingParser extends CommonParser {
- private VmdLightingHandler handler = null;
+ private VmdLightingHandler handler = VmdUnifiedHandler.EMPTY;
/**
* @param lightingHandler ハンドラ
*/
void setLightingHandler(VmdLightingHandler lightingHandler){
- this.handler = lightingHandler;
+ if(lightingHandler == null){
+ this.handler = VmdUnifiedHandler.EMPTY;
+ }else{
+ this.handler = lightingHandler;
+ }
+
return;
}
private void parseVmdLighting() throws IOException, MmdFormatException{
int lightMotionNo = parseLeInt();
- if(this.handler == null){
- skip(VmdConst.LUMINOUS_DATA_SZ * lightMotionNo);
- return;
- }
-
this.handler.loopStart(VmdLightingHandler.LUMINOUS_LIST,
lightMotionNo);
private void parseVmdShadow() throws IOException, MmdFormatException{
int shadowMotionNo = parseLeInt();
- if(this.handler == null){
- skip(VmdConst.SHADOW_DATA_SZ * shadowMotionNo);
- return;
- }
-
this.handler.loopStart(VmdLightingHandler.SHADOW_LIST,
shadowMotionNo);
private final VmdCameraParser cameraParser;
private final VmdLightingParser lightingParser;
- private VmdBasicHandler basicHandler = null;
+ private VmdBasicHandler basicHandler = VmdUnifiedHandler.EMPTY;
private boolean strictMode = true;
*/
public void setBasicHandler(VmdBasicHandler handler){
this.basicParser.setBasicHandler(handler);
- this.basicHandler = handler;
+
+ if(handler == null){
+ this.basicHandler = VmdUnifiedHandler.EMPTY;
+ }else{
+ this.basicHandler = handler;
+ }
+
return;
}
* @throws MmdFormatException フォーマットエラー
*/
public void parseVmd() throws IOException, MmdFormatException {
- if(this.basicHandler != null){
- this.basicHandler.vmdParseStart();
- }
+ this.basicHandler.vmdParseStart();
parseBody();
boolean hasMoreData = this.lightingParser.hasMore();
- if(this.basicHandler != null){
- this.basicHandler.vmdParseEnd(hasMoreData);
- }
+ this.basicHandler.vmdParseEnd(hasMoreData);
return;
}