OSDN Git Service

オペレーションミス
[mikutoga/TogaGem.git] / src / main / java / jp / sourceforge / mikutoga / pmd / ShadeInfo.java
1 /*
2  * shading information
3  *
4  * License : The MIT License
5  * Copyright(c) 2010 MikuToga Partners
6  */
7
8 package jp.sourceforge.mikutoga.pmd;
9
10 /**
11  * シェーディング情報。
12  */
13 public class ShadeInfo {
14
15     private ToonMap toonMap = new ToonMap();
16     private int toonIdx;
17
18     private String textureFileName = null;
19     private String spheremapFileName = null;
20
21     /**
22      * コンストラクタ。
23      */
24     public ShadeInfo(){
25         super();
26         return;
27     }
28
29     /**
30      * トゥーンマップを設定する。
31      * @param map トゥーンマップ
32      */
33     public void setToonMap(ToonMap map){
34         this.toonMap = map;
35         return;
36     }
37
38     /**
39      * トゥーンマップを返す。
40      * @return トゥーンマップ
41      */
42     public ToonMap getToonMap(){
43         return this.toonMap;
44     }
45
46     /**
47      * トゥーンインデックスを設定する。
48      * @param idx トゥーンインデックス
49      */
50     public void setToonIndex(int idx){
51         this.toonIdx = idx;
52         return;
53     }
54
55     /**
56      * トゥーンインデックス値を返す。
57      * @return トゥーンインデックス値
58      */
59     public int getToonIndex(){
60         return this.toonIdx;
61     }
62
63     /**
64      * トゥーンインデックス値が有効か判定する。
65      * 現時点では0から9までの値を有効とする。
66      * @return 有効ならtrue
67      */
68     public boolean isValidToonIndex(){
69         if(0 <= this.toonIdx && this.toonIdx <= 9) return true;
70         return false;
71     }
72
73     /**
74      * トゥーンファイル名を返す。
75      * @return トゥーンファイル名
76      * @throws IllegalStateException トゥーンマップが設定されていない。
77      */
78     public String getToonFileName() throws IllegalStateException{
79         if(this.toonMap == null) throw new IllegalStateException();
80         String result = this.toonMap.getIndexedToon(this.toonIdx);
81         return result;
82     }
83
84     /**
85      * テクスチャファイル名を設定する。
86      * @param fileName テクスチャファイル名
87      */
88     public void setTextureFileName(String fileName){
89         this.textureFileName = fileName;
90         return;
91     }
92
93     /**
94      * テクスチャファイル名を返す。
95      * @return テクスチャファイル名
96      */
97     public String getTextureFileName(){
98         return this.textureFileName;
99     }
100
101     /**
102      * スフィアマップファイル名を設定する。
103      * @param fileName スフィアマップファイル名
104      */
105     public void setSpheremapFileName(String fileName){
106         this.spheremapFileName = fileName;
107         return;
108     }
109
110     /**
111      * スフィアマップファイル名を返す。
112      * @return スフィアマップファイル名
113      */
114     public String getSpheremapFileName(){
115         return this.spheremapFileName;
116     }
117
118     /**
119      * {@inheritDoc}
120      * @return {@inheritDoc}
121      */
122     @Override
123     public String toString(){
124         StringBuilder result = new StringBuilder();
125
126         result.append("toon(")
127               .append(this.toonIdx)
128               .append(")=")
129               .append(getToonFileName())
130               .append(' ');
131         result.append("texture=")
132               .append(this.textureFileName)
133               .append(' ');
134         result.append("sphere=")
135               .append(this.spheremapFileName);
136
137         return result.toString();
138     }
139
140 }