Start refactor to use templates
This commit is contained in:
@@ -32,12 +32,12 @@ public class Terrain {
|
||||
public Terrain(Zone zone) {
|
||||
|
||||
this.zone = zone;
|
||||
this.heightmap = this.zone.terrain_image;
|
||||
this.heightmap = this.zone.template.terrain_image;
|
||||
|
||||
// Configure PLANAR zones to use the same 16x16 pixel image
|
||||
// that all similar terrains share. (See JSON)
|
||||
|
||||
if (this.zone.terrain_type.equals("PLANAR"))
|
||||
if (this.zone.template.terrain_type.equals("PLANAR"))
|
||||
this.heightmap = 1006300; // all 0
|
||||
|
||||
// Load pixel data for this terrain from cache
|
||||
@@ -49,8 +49,8 @@ public class Terrain {
|
||||
|
||||
// Configure terrain based on zone properties
|
||||
|
||||
this.terrain_size.x = this.zone.major_radius * 2;
|
||||
this.terrain_size.y = this.zone.minor_radius * 2;
|
||||
this.terrain_size.x = this.zone.template.major_radius * 2;
|
||||
this.terrain_size.y = this.zone.template.minor_radius * 2;
|
||||
|
||||
this.cell_count.x = this.terrain_pixel_data.length - 1;
|
||||
this.cell_count.y = this.terrain_pixel_data[0].length - 1;
|
||||
@@ -62,11 +62,11 @@ public class Terrain {
|
||||
// the blending area between child and parent terrains when
|
||||
// they are stitched together.
|
||||
|
||||
Vector2f major_blend = new Vector2f(this.zone.max_blend / this.zone.major_radius,
|
||||
this.zone.min_blend / this.zone.major_radius);
|
||||
Vector2f major_blend = new Vector2f(this.zone.template.max_blend / this.zone.template.major_radius,
|
||||
this.zone.template.min_blend / this.zone.template.major_radius);
|
||||
|
||||
Vector2f minor_blend = new Vector2f(this.zone.max_blend / this.zone.minor_radius,
|
||||
this.zone.min_blend / this.zone.minor_radius);
|
||||
Vector2f minor_blend = new Vector2f(this.zone.template.max_blend / this.zone.template.minor_radius,
|
||||
this.zone.template.min_blend / this.zone.template.minor_radius);
|
||||
|
||||
if (major_blend.y > 0.4f)
|
||||
blend_ratio.x = major_blend.y;
|
||||
@@ -80,7 +80,7 @@ public class Terrain {
|
||||
|
||||
// Scale coefficient for this terrain
|
||||
|
||||
this.terrain_scale = this.zone.terrain_max_y / 255f;
|
||||
this.terrain_scale = this.zone.template.terrain_max_y / 255f;
|
||||
}
|
||||
|
||||
public static Zone getNextZoneWithTerrain(Zone zone) {
|
||||
@@ -205,8 +205,8 @@ public class Terrain {
|
||||
|
||||
// Normalize terrain offset
|
||||
|
||||
Vector2f normalizedOffset = new Vector2f(Math.abs(zone_offset.x) / this.zone.major_radius,
|
||||
Math.abs(zone_offset.y) / this.zone.minor_radius);
|
||||
Vector2f normalizedOffset = new Vector2f(Math.abs(zone_offset.x) / this.zone.template.major_radius,
|
||||
Math.abs(zone_offset.y) / this.zone.template.minor_radius);
|
||||
|
||||
float blendCoefficient;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user