OSDN Git Service

4a1c56f0ffd3b38a0c64049a53afe0f17e9493b8
[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     ParseStage MATERIAL_LIST = new ParseStage();
22
23     /**
24      * 材質の拡散光成分の通知を受け取る。
25      * <p>{@link #MATERIAL_LIST}ループの構成要素。
26      * @param red 0.0~1.0の範囲の赤成分
27      * @param green 0.0~1.0の範囲の緑成分
28      * @param blue 0.0~1.0の範囲の青成分
29      * @param alpha 0.0(透明)~1.0(不透明)のアルファ値。
30      * @throws MmdFormatException 不正フォーマットによる
31      * パース処理の中断をパーサに指示
32      */
33     void pmdMaterialDiffuse(float red, float green, float blue,
34                                float alpha )
35             throws MmdFormatException;
36
37     /**
38      * 材質の反射光成分の通知を受け取る。
39      * <p>{@link #MATERIAL_LIST}ループの構成要素。
40      * @param red 0.0~1.0の範囲の赤成分
41      * @param green 0.0~1.0の範囲の緑成分
42      * @param blue 0.0~1.0の範囲の青成分
43      * @param shininess 光沢強度(1~15ぐらい)
44      * @throws MmdFormatException 不正フォーマットによる
45      * パース処理の中断をパーサに指示
46      */
47     void pmdMaterialSpecular(float red, float green, float blue,
48                                 float shininess)
49             throws MmdFormatException;
50
51     /**
52      * 材質の環境色成分の通知を受け取る。
53      * <p>{@link #MATERIAL_LIST}ループの構成要素。
54      * @param red 0.0~1.0の範囲の赤成分
55      * @param green 0.0~1.0の範囲の緑成分
56      * @param blue 0.0~1.0の範囲の青成分
57      * @throws MmdFormatException 不正フォーマットによる
58      * パース処理の中断をパーサに指示
59      */
60     void pmdMaterialAmbient(float red, float green, float blue)
61             throws MmdFormatException;
62
63     /**
64      * シェーディング情報の通知を受け取る。
65      * <p>{@link #MATERIAL_LIST}ループの構成要素。
66      * @param toonIdx トゥーンファイル番号。
67      * 0ならtoon01.bmp。9ならtoon10.bmp。0xffならtoon0.bmp。
68      * @param textureFile テクスチャファイル名。
69      * 無ければ空文字。
70      * @param sphereFile スフィアマップファイル名。
71      * 無ければ空文字。
72      * @throws MmdFormatException 不正フォーマットによる
73      * パース処理の中断をパーサに指示
74      */
75     void pmdMaterialShading(int toonIdx,
76                                String textureFile, String sphereFile )
77             throws MmdFormatException;
78
79     /**
80      * 材質情報の通知を受け取る。
81      * <p>{@link #MATERIAL_LIST}ループの構成要素。
82      * @param hasEdge エッジを表示するならtrue
83      * @param vertexNum 面頂点数。
84      * 3の倍数のはず。
85      * 3で割ると、材質に属する面の数を表す。
86      * <p>通算した面数を面情報通知順と突き合わせることにより、
87      * 材質に属する面の集合を得ることが可能。
88      * @throws MmdFormatException 不正フォーマットによる
89      * パース処理の中断をパーサに指示
90      * @see PmdShapeHandler#pmdSurfaceTriangle(int, int, int)
91      */
92     void pmdMaterialInfo(boolean hasEdge, int vertexNum)
93             throws MmdFormatException;
94
95 }