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); ; }