|
|
@ -29,7 +29,6 @@ |
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
package com.jme3.scene.plugins.ogre.matext; |
|
|
|
package com.jme3.scene.plugins.ogre.matext; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
@ -42,44 +41,46 @@ import java.util.List; |
|
|
|
* {@link OgreMaterialKey}s used. |
|
|
|
* {@link OgreMaterialKey}s used. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class MaterialExtensionSet { |
|
|
|
public class MaterialExtensionSet { |
|
|
|
private HashMap<String, MaterialExtension> extensions |
|
|
|
|
|
|
|
= new HashMap<String, MaterialExtension>(); |
|
|
|
private HashMap<String, MaterialExtension> extensions = new HashMap<String, MaterialExtension>(); |
|
|
|
private HashMap<String, List<String>> nameMappings = new HashMap<String, List<String>>(); |
|
|
|
private HashMap<String, List<String>> nameMappings = new HashMap<String, List<String>>(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Adds a new material extension to the set of extensions. |
|
|
|
* Adds a new material extension to the set of extensions. |
|
|
|
|
|
|
|
* |
|
|
|
* @param extension The {@link MaterialExtension} to add. |
|
|
|
* @param extension The {@link MaterialExtension} to add. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addMaterialExtension(MaterialExtension extension){ |
|
|
|
public void addMaterialExtension(MaterialExtension extension) { |
|
|
|
extensions.put(extension.getBaseMaterialName(), extension); |
|
|
|
extensions.put(extension.getBaseMaterialName(), extension); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns the {@link MaterialExtension} for a given Ogre3D base |
|
|
|
* Returns the {@link MaterialExtension} for a given Ogre3D base material |
|
|
|
* material name. |
|
|
|
* name. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param baseMatName The ogre3D base material name. |
|
|
|
* @param baseMatName The ogre3D base material name. |
|
|
|
* @return {@link MaterialExtension} that is set, or null if not set. |
|
|
|
* @return {@link MaterialExtension} that is set, or null if not set. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public MaterialExtension getMaterialExtension(String baseMatName){ |
|
|
|
public MaterialExtension getMaterialExtension(String baseMatName) { |
|
|
|
return extensions.get(baseMatName); |
|
|
|
return extensions.get(baseMatName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Adds an alternative name for a material |
|
|
|
* Adds an alternative name for a material |
|
|
|
|
|
|
|
* |
|
|
|
* @param name The material name to be found in a .mesh.xml file |
|
|
|
* @param name The material name to be found in a .mesh.xml file |
|
|
|
* @param alias The material name to be found in a .material file |
|
|
|
* @param alias The material name to be found in a .material file |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setNameMapping(String name, String alias){ |
|
|
|
public void setNameMapping(String name, String alias) { |
|
|
|
List<String> list = nameMappings.get(name); |
|
|
|
List<String> list = nameMappings.get(name); |
|
|
|
if(list==null){ |
|
|
|
if (list == null) { |
|
|
|
list = new ArrayList<String>(); |
|
|
|
list = new ArrayList<String>(); |
|
|
|
nameMappings.put(name, list); |
|
|
|
nameMappings.put(name, list); |
|
|
|
} |
|
|
|
} |
|
|
|
list.add(alias); |
|
|
|
list.add(alias); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<String> getNameMappings(String name){ |
|
|
|
public List<String> getNameMappings(String name) { |
|
|
|
return nameMappings.get(name); |
|
|
|
return nameMappings.get(name); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|