OSDN Git Service

Merge develop into pomconfig
[mikutoga/TogaGem.git] / src / main / java / jp / sfjp / mikutoga / pmd / parser / PmdMaterialHandler.java
1 /*
2  * PMD material information handler
3  *
4  * License : The MIT License
5  * Copyright(c) 2010 MikuToga Partners
6  */
7
8 package jp.sfjp.mikutoga.pmd.parser;
9
10 import jp.sfjp.mikutoga.bin.parser.LoopHandler;
11 import jp.sfjp.mikutoga.bin.parser.MmdFormatException;
12 import jp.sfjp.mikutoga.bin.parser.ParseStage;
13
14 /**
15  * PMDモデルの各種材質情報の通知用ハンドラ。
16  * 色空間はsRGB?
17  */
18 public interface PmdMaterialHandler extends LoopHandler {
19
20     /** 材質抽出ループ。 */
21     public static final ParseStage MATERIAL_LIST = new ParseStage();
22
23     /**
24      * 材質の拡散光成分の通知を受け取る。
25      *
26      * <p>{@link #MATERIAL_LIST}ループの構成要素。
27      *
28      * @param red 0.0~1.0の範囲の赤成分
29      * @param green 0.0~1.0の範囲の緑成分
30      * @param blue 0.0~1.0の範囲の青成分
31      * @param alpha 0.0(透明)~1.0(不透明)のアルファ値。
32      * @throws MmdFormatException 不正フォーマットによる
33      *     パース処理の中断をパーサに指示
34      */
35     public abstract void pmdMaterialDiffuse(
36             float red, float green, float blue, float alpha)
37             throws MmdFormatException;
38
39     /**
40      * 材質の反射光成分の通知を受け取る。
41      *
42      * <p>{@link #MATERIAL_LIST}ループの構成要素。
43      *
44      * @param red 0.0~1.0の範囲の赤成分
45      * @param green 0.0~1.0の範囲の緑成分
46      * @param blue 0.0~1.0の範囲の青成分
47      * @param shininess 光沢強度(1~15ぐらい)
48      * @throws MmdFormatException 不正フォーマットによる
49      *     パース処理の中断をパーサに指示
50      */
51     public abstract void pmdMaterialSpecular(
52             float red, float green, float blue, float shininess)
53             throws MmdFormatException;
54
55     /**
56      * 材質の環境色成分の通知を受け取る。
57      *
58      * <p>{@link #MATERIAL_LIST}ループの構成要素。
59      *
60      * @param red 0.0~1.0の範囲の赤成分
61      * @param green 0.0~1.0の範囲の緑成分
62      * @param blue 0.0~1.0の範囲の青成分
63      * @throws MmdFormatException 不正フォーマットによる
64      *     パース処理の中断をパーサに指示
65      */
66     public abstract void pmdMaterialAmbient(
67             float red, float green, float blue)
68             throws MmdFormatException;
69
70     /**
71      * シェーディング情報の通知を受け取る。
72      *
73      * <p>{@link #MATERIAL_LIST}ループの構成要素。
74      *
75      * @param toonIdx トゥーンファイル番号。
76      *     0ならtoon01.bmp。9ならtoon10.bmp。0xffならtoon0.bmp。
77      * @param textureFile テクスチャファイル名。
78      *     無ければ空文字。
79      * @param sphereFile スフィアマップファイル名。
80      *     無ければ空文字。
81      * @throws MmdFormatException 不正フォーマットによる
82      *     パース処理の中断をパーサに指示
83      */
84     public abstract void pmdMaterialShading(int toonIdx,
85                                String textureFile, String sphereFile )
86             throws MmdFormatException;
87
88     /**
89      * 材質情報の通知を受け取る。
90      *
91      * <p>{@link #MATERIAL_LIST}ループの構成要素。
92      *
93      * @param hasEdge エッジを表示するならtrue
94      * @param vertexNum 面頂点数。
95      *     3の倍数のはず。
96      *     3で割ると、材質に属する面の数を表す。
97      *
98      *     <p>通算した面数を面情報通知順と突き合わせることにより、
99      *     材質に属する面の集合を得ることが可能。</p>
100      *
101      * @throws MmdFormatException 不正フォーマットによる
102      *     パース処理の中断をパーサに指示
103      * @see PmdShapeHandler#pmdSurfaceTriangle(int, int, int)
104      */
105     public abstract void pmdMaterialInfo(boolean hasEdge, int vertexNum)
106             throws MmdFormatException;
107
108 }