/** * Load marker from configuration node * * @param node - configuration node */ boolean loadPersistentData(ConfigurationNode node) { label = node.getString("label", markerid); markup = node.getBoolean("markup", false); x = node.getDouble("x", 0); y = node.getDouble("y", 64); z = node.getDouble("z", 0); world = node.getString("world", "world"); desc = node.getString("desc", null); icon = MarkerAPIImpl.getMarkerIconImpl(node.getString("icon", MarkerIcon.DEFAULT)); ispersistent = true; /* Loaded from config, so must be */ return true; }
public IsoHDPerspective(ConfigurationNode configuration) { name = configuration.getString("name", null); if (name == null) { Log.severe("Perspective definition missing name - must be defined and unique"); return; } azimuth = configuration.getDouble("azimuth", 135.0); /* Get azimuth (default to classic kzed POV */ inclination = configuration.getDouble("inclination", 60.0); if (inclination > MAX_INCLINATION) inclination = MAX_INCLINATION; if (inclination < MIN_INCLINATION) inclination = MIN_INCLINATION; scale = configuration.getDouble("scale", MIN_SCALE); if (scale < MIN_SCALE) scale = MIN_SCALE; if (scale > MAX_SCALE) scale = MAX_SCALE; /* Get max and min height */ maxheight = configuration.getInteger("maximumheight", 127); if (maxheight > 127) maxheight = 127; minheight = configuration.getInteger("minimumheight", 0); if (minheight < 0) minheight = 0; /* Generate transform matrix for world-to-tile coordinate mapping */ /* First, need to fix basic coordinate mismatches before rotation - we want zero azimuth to have north to top * (world -X -> tile +Y) and east to right (world -Z to tile +X), with height being up (world +Y -> tile +Z) */ Matrix3D transform = new Matrix3D(0.0, 0.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0); /* Next, rotate world counterclockwise around Z axis by azumuth angle */ transform.rotateXY(180 - azimuth); /* Next, rotate world by (90-inclination) degrees clockwise around +X axis */ transform.rotateYZ(90.0 - inclination); /* Finally, shear along Z axis to normalize Z to be height above map plane */ transform.shearZ(0, Math.tan(Math.toRadians(90.0 - inclination))); /* And scale Z to be same scale as world coordinates, and scale X and Y based on setting */ transform.scale(scale, scale, Math.sin(Math.toRadians(inclination))); world_to_map = transform; /* Now, generate map to world tranform, by doing opposite actions in reverse order */ transform = new Matrix3D(); transform.scale(1.0 / scale, 1.0 / scale, 1 / Math.sin(Math.toRadians(inclination))); transform.shearZ(0, -Math.tan(Math.toRadians(90.0 - inclination))); transform.rotateYZ(-(90.0 - inclination)); transform.rotateXY(-180 + azimuth); Matrix3D coordswap = new Matrix3D(0.0, -1.0, 0.0, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0); transform.multiply(coordswap); map_to_world = transform; /* Scaled models for non-cube blocks */ modscale = (int) Math.ceil(scale); scalemodels = HDBlockModels.getModelsForScale(modscale); ; }
public DefaultTileRenderer(DynmapCore core, ConfigurationNode configuration) { name = configuration.getString("name", null); prefix = configuration.getString("prefix", name); maximumHeight = configuration.getInteger("maximumheight", 127); shadowstrength = configuration.getDouble("shadowstrength", 0.0); if (shadowstrength > 0.0) { shadowscale = new int[16]; shadowscale[15] = 256; /* Normal brightness weight in MC is a 20% relative dropoff per step */ for (int i = 14; i >= 0; i--) { double v = shadowscale[i + 1] * (1.0 - (0.2 * shadowstrength)); shadowscale[i] = (int) v; if (shadowscale[i] > 256) shadowscale[i] = 256; if (shadowscale[i] < 0) shadowscale[i] = 0; } } ambientlight = configuration.getInteger("ambientlight", 15); if (ambientlight < 15) { lightscale = new int[16]; for (int i = 0; i < 16; i++) { if (i < (15 - ambientlight)) lightscale[i] = 0; else lightscale[i] = i - (15 - ambientlight); } } colorScheme = ColorScheme.getScheme(core, (String) configuration.get("colorscheme")); night_and_day = configuration.getBoolean("night-and-day", false); transparency = configuration.getBoolean("transparency", true); /* Default on */ String biomeopt = configuration.getString("biomecolored", "none"); if (biomeopt.equals("biome")) { biomecolored = BiomeColorOption.BIOME; } else if (biomeopt.equals("temperature")) { biomecolored = BiomeColorOption.TEMPERATURE; } else if (biomeopt.equals("rainfall")) { biomecolored = BiomeColorOption.RAINFALL; } else { biomecolored = BiomeColorOption.NONE; } title = configuration.getString("title"); icon = configuration.getString("icon"); bg_cfg = configuration.getString("background"); bg_day_cfg = configuration.getString("backgroundday"); bg_night_cfg = configuration.getString("backgroundnight"); mapzoomin = configuration.getInteger("mapzoomin", 2); is_protected = configuration.getBoolean("protected", false); }
public ShadowHDLighting(DynmapCore core, ConfigurationNode configuration) { super(core, configuration); double shadowweight = configuration.getDouble("shadowstrength", 0.0); defLightingTable = new int[16]; defLightingTable[15] = 256; /* Normal brightness weight in MC is a 20% relative dropoff per step */ for (int i = 14; i >= 0; i--) { double v = defLightingTable[i + 1] * (1.0 - (0.2 * shadowweight)); defLightingTable[i] = (int) v; if (defLightingTable[i] > 256) defLightingTable[i] = 256; if (defLightingTable[i] < 0) defLightingTable[i] = 0; } int v = configuration.getInteger("ambientlight", -1); if (v < 0) v = 15; if (v > 15) v = 15; lightscale = new int[16]; for (int i = 0; i < 16; i++) { if (i < (15 - v)) lightscale[i] = 0; else lightscale[i] = i - (15 - v); } night_and_day = configuration.getBoolean("night-and-day", false); smooth = configuration.getBoolean("smooth-lighting", MapManager.mapman.getSmoothLighting()); }