13
13
import com .jme3 .material .MaterialList ;
14
14
import com .jme3 .scene .Node ;
15
15
import com .jme3 .scene .Spatial ;
16
- import com .jme3 .scene .plugins .ogre .OgreMeshKey ;
17
- import com .jme3 .scene .plugins .ogre .matext .MaterialExtension ;
18
- import com .jme3 .scene .plugins .ogre .matext .MaterialExtensionSet ;
19
- import com .jme3 .scene .plugins .ogre .matext .OgreMaterialKey ;
20
16
import java .io .File ;
21
17
import java .io .IOException ;
22
18
import java .util .ArrayList ;
@@ -115,61 +111,7 @@ private static Spatial loadSingleMesh(Element fileElement, NodeList fileNodeList
115
111
if ("" .equals (materialName )) {
116
112
materialName = null ;
117
113
}
118
-
119
- //PREPARE MATEXT
120
- MaterialExtensionSet matExts = new MaterialExtensionSet ();
121
- /**
122
- * /base/simple
123
- * /base/normalmap
124
- */
125
- MaterialExtension baseLightExt = new MaterialExtension ("/base/normalmap/specular" ,
126
- "Common/MatDefs/Light/Lighting.j3md" );
127
- baseLightExt .setTextureMapping ("DiffuseMap" , "DiffuseMap" );
128
- baseLightExt .setTextureMapping ("NormalHeightMap" , "NormalMap" );
129
- baseLightExt .setTextureMapping ("SpecularMap" , "SpecularMap" );
130
- matExts .addMaterialExtension (baseLightExt );
131
-
132
- MaterialExtension baseLightExt2 = new MaterialExtension ("/base/normalmap" ,
133
- "Common/MatDefs/Light/Lighting.j3md" );
134
- baseLightExt2 .setTextureMapping ("DiffuseMap" , "DiffuseMap" );
135
- baseLightExt2 .setTextureMapping ("NormalHeightMap" , "NormalMap" );
136
- baseLightExt2 .setTextureMapping ("SpecularMap" , "SpecularMap" );
137
- matExts .addMaterialExtension (baseLightExt2 );
138
-
139
- MaterialExtension baseLightExt3 = new MaterialExtension ("/base/simple" ,
140
- "Common/MatDefs/Light/Lighting.j3md" );
141
- baseLightExt3 .setTextureMapping ("DiffuseMap" , "DiffuseMap" );
142
- baseLightExt3 .setTextureMapping ("NormalHeightMap" , "NormalMap" );
143
- baseLightExt3 .setTextureMapping ("SpecularMap" , "SpecularMap" );
144
- matExts .addMaterialExtension (baseLightExt3 );
145
-
146
- //TODO: mesh.xml!!
147
- if (hasExtension (name , "xml" ) || hasExtension (name , "scene" )) {
148
- for (int i = 0 ; i < fileNodeList .getLength (); i ++) {
149
- Element fileElem = (Element ) fileNodeList .item (i );
150
- String type = fileElem .getAttribute ("type" );
151
- String path = fileElem .getAttribute ("path" );
152
- if ("material" .equals (type ) && (materialName == null || materialName .equals (path ))) {
153
- if (hasExtension (path , "j3m" )) {
154
- mat = pm .loadMaterial (path );
155
- } else if (hasExtension (path , "material" )) {
156
- if (matList == null ) {
157
- Logger .getLogger (AssetPackLoader .class .getName ()).log (Level .INFO , "Load Ogre Material" );
158
- OgreMaterialKey matKey = new OgreMaterialKey (path );
159
- matKey .setMaterialExtensionSet (matExts );
160
- matList = pm .loadAsset (matKey );
161
- key = new OgreMeshKey (name , matList );
162
- } else {
163
- Logger .getLogger (AssetPackLoader .class .getName ()).log (Level .INFO , "Add Ogre Material" );
164
- OgreMaterialKey matKey = new OgreMaterialKey (path );
165
- matKey .setMaterialExtensionSet (matExts );
166
- MaterialList newMatList = pm .loadAsset (matKey );
167
- matList .putAll (newMatList );
168
- }
169
- }
170
- }
171
- }
172
- } else if (hasExtension (name , "obj" )) {
114
+ if (hasExtension (name , "obj" )) {
173
115
for (int i = 0 ; i < fileNodeList .getLength (); i ++) {
174
116
Element fileElem = (Element ) fileNodeList .item (i );
175
117
String type = fileElem .getAttribute ("type" );
@@ -194,19 +136,7 @@ private static Spatial loadSingleMesh(Element fileElement, NodeList fileNodeList
194
136
if (hasExtension (path , "j3m" )) {
195
137
mat = pm .loadMaterial (path );
196
138
} else if (hasExtension (path , "material" )) {
197
- if (matList == null ) {
198
- Logger .getLogger (AssetPackLoader .class .getName ()).log (Level .INFO , "Load Ogre Material" );
199
- OgreMaterialKey matKey = new OgreMaterialKey (path );
200
- matKey .setMaterialExtensionSet (matExts );
201
- matList = pm .loadAsset (matKey );
202
- key = new OgreMeshKey (name , matList );
203
- } else {
204
- Logger .getLogger (AssetPackLoader .class .getName ()).log (Level .INFO , "Add Ogre Material" );
205
- OgreMaterialKey matKey = new OgreMaterialKey (path );
206
- matKey .setMaterialExtensionSet (matExts );
207
- MaterialList newMatList = pm .loadAsset (matKey );
208
- matList .putAll (newMatList );
209
- }
139
+ Logger .getLogger (AssetPackLoader .class .getName ()).log (Level .WARNING , "Ogre Material not supported." );
210
140
}
211
141
}
212
142
}
0 commit comments