65 lines
1.9 KiB
Java
65 lines
1.9 KiB
Java
package electrosphere.RendererObjects.texture;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
*
|
|
* @author amaterasu
|
|
*/
|
|
public class TextureMap {
|
|
//The convention is
|
|
//Map of strings (the name of a model) to a model
|
|
//each model is a map of a string (the name of a mesh) to a list which contains
|
|
//First the model's diffuse, then the model's specular
|
|
//always in that order
|
|
//if either the diffuse or the specular isn't included then it should
|
|
//instead contain and empty string - ""
|
|
//this convention must be followed
|
|
Map<String,Map<String,ArrayList<String>>> texture_map = new HashMap();
|
|
|
|
public Map<String,ArrayList<String>> get_mesh_map(String name){
|
|
return texture_map.get(name);
|
|
}
|
|
|
|
public static ArrayList<String> get_mesh_textures(Map<String,ArrayList<String>> input, String name){
|
|
if(input == null){
|
|
//TODO: Add big fuckin' error here
|
|
return null;
|
|
}
|
|
return input.get(name);
|
|
}
|
|
|
|
//for the lazy
|
|
public static String get_diffuse_path(ArrayList<String> input){
|
|
if(input == null || input.size() < 2){
|
|
//TODO: Add big fuckin' error here
|
|
return null;
|
|
}
|
|
return input.get(0);
|
|
}
|
|
|
|
//for the lazy
|
|
public static String get_specular_path(ArrayList<String> input){
|
|
if(input == null || input.size() < 2){
|
|
//TODO: Add big fuckin' error here
|
|
return null;
|
|
}
|
|
return input.get(1);
|
|
}
|
|
|
|
public TextureMap(){
|
|
texture_map = new HashMap();
|
|
}
|
|
public void add_model(String model_name){
|
|
texture_map.put(model_name, new HashMap());
|
|
}
|
|
public void add_mesh_to_model(String model_name, String mesh_name){
|
|
ArrayList temp = new ArrayList();
|
|
temp.add("");
|
|
temp.add("");
|
|
texture_map.get(model_name).put(mesh_name, temp);
|
|
}
|
|
}
|