Split lighting and shading - add lightings.txt

This commit is contained in:
Mike Primm 2011-07-09 01:26:47 -05:00
parent 69baafe597
commit a3c00a1026
14 changed files with 387 additions and 151 deletions

View file

@ -20,16 +20,20 @@ import org.dynmap.utils.MapIterator;
public class HDMapManager {
public HashMap<String, HDShader> shaders = new HashMap<String, HDShader>();
public HashMap<String, HDPerspective> perspectives = new HashMap<String, HDPerspective>();
public HashMap<String, HDLighting> lightings = new HashMap<String, HDLighting>();
public HashSet<HDMap> maps = new HashSet<HDMap>();
public HashMap<String, ArrayList<HDMap>> maps_by_world_perspective = new HashMap<String, ArrayList<HDMap>>();
public void loadHDShaders(ConfigurationNode shadercfg) {
Log.verboseinfo("Loading shaders...");
for(HDShader shader : shadercfg.<HDShader>createInstances("shaders", new Class<?>[0], new Object[0])) {
if(shader.getName() == null) continue;
if(shaders.containsKey(shader.getName())) {
Log.severe("Duplicate shader name '" + shader.getName() + "' - shader ignored");
}
shaders.put(shader.getName(), shader);
else {
shaders.put(shader.getName(), shader);
}
}
Log.info("Loaded " + shaders.size() + " shaders.");
}
@ -37,14 +41,31 @@ public class HDMapManager {
public void loadHDPerspectives(ConfigurationNode perspectivecfg) {
Log.verboseinfo("Loading perspectives...");
for(HDPerspective perspective : perspectivecfg.<HDPerspective>createInstances("perspectives", new Class<?>[0], new Object[0])) {
if(perspective.getName() == null) continue;
if(perspectives.containsKey(perspective.getName())) {
Log.severe("Duplicate perspective name '" + perspective.getName() + "' - perspective ignored");
}
perspectives.put(perspective.getName(), perspective);
else {
perspectives.put(perspective.getName(), perspective);
}
}
Log.info("Loaded " + perspectives.size() + " perspectives.");
}
public void loadHDLightings(ConfigurationNode lightingcfg) {
Log.verboseinfo("Loading lightings...");
for(HDLighting lighting : lightingcfg.<HDLighting>createInstances("lightings", new Class<?>[0], new Object[0])) {
if(lighting.getName() == null) continue;
if(lightings.containsKey(lighting.getName())) {
Log.severe("Duplicate lighting name '" + lighting.getName() + "' - lighting ignored");
}
else {
lightings.put(lighting.getName(), lighting);
}
}
Log.info("Loaded " + lightings.size() + " lightings.");
}
/**
* Initialize shader states for all shaders for given tile
*/
@ -102,10 +123,11 @@ public class HDMapManager {
HDMap hdmap = (HDMap)map;
if(hdmap.getPerspective() == t.perspective) {
HDShader sh = hdmap.getShader();
flags[BIOMEDATAFLAG] |= sh.isBiomeDataNeeded();
flags[HIGHESTZFLAG] |= sh.isHightestBlockYDataNeeded();
flags[RAWBIOMEFLAG] |= sh.isRawBiomeDataNeeded();
flags[BLOCKTYPEFLAG] |= sh.isBlockTypeDataNeeded();
HDLighting lt = hdmap.getLighting();
flags[BIOMEDATAFLAG] |= sh.isBiomeDataNeeded() | lt.isBiomeDataNeeded();
flags[HIGHESTZFLAG] |= sh.isHightestBlockYDataNeeded() | lt.isHightestBlockYDataNeeded();
flags[RAWBIOMEFLAG] |= sh.isRawBiomeDataNeeded() | lt.isRawBiomeDataNeeded();
flags[BLOCKTYPEFLAG] |= sh.isBlockTypeDataNeeded() | lt.isBlockTypeDataNeeded();
}
}
}