283 lines
5.5 KiB
C#
283 lines
5.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class map_area_class
|
|
{
|
|
public string name;
|
|
|
|
public latlong_class upper_left;
|
|
|
|
public latlong_class lower_right;
|
|
|
|
public latlong_class center;
|
|
|
|
public int center_height;
|
|
|
|
public map_pixel_class size;
|
|
|
|
public bool normalizeHeightmap;
|
|
|
|
public float normalizedHeight;
|
|
|
|
public bool created;
|
|
|
|
public bool resize;
|
|
|
|
public bool resize_left;
|
|
|
|
public bool resize_right;
|
|
|
|
public bool resize_top;
|
|
|
|
public bool resize_bottom;
|
|
|
|
public bool resize_topLeft;
|
|
|
|
public bool resize_topRight;
|
|
|
|
public bool resize_bottomLeft;
|
|
|
|
public bool resize_bottomRight;
|
|
|
|
public bool resize_center;
|
|
|
|
public bool manual_area;
|
|
|
|
public Vector2 heightmap_offset;
|
|
|
|
public Vector2 heightmap_offset_e;
|
|
|
|
public Vector2 image_offset_e;
|
|
|
|
public bool image_stop_one;
|
|
|
|
public int select;
|
|
|
|
public float smooth_strength;
|
|
|
|
public float width;
|
|
|
|
public float height;
|
|
|
|
public Vector2 heightmap_resolution;
|
|
|
|
public double heightmap_scale;
|
|
|
|
public int heightmap_zoom;
|
|
|
|
public int elevation_zoom;
|
|
|
|
public bool heightmap_manual;
|
|
|
|
public double area_resolution;
|
|
|
|
public int resolution;
|
|
|
|
public int image_zoom;
|
|
|
|
public bool image_changed;
|
|
|
|
public bool start_tile_enabled;
|
|
|
|
public tile_class start_tile;
|
|
|
|
public tile_class tiles;
|
|
|
|
public bool export_heightmap_active;
|
|
|
|
public bool export_heightmap_call;
|
|
|
|
public string export_heightmap_path;
|
|
|
|
public string export_heightmap_filename;
|
|
|
|
public bool export_heightmap_changed;
|
|
|
|
public bool export_heightmap_not_fit;
|
|
|
|
public Vector2 export_heightmap_bres;
|
|
|
|
public bool export_image_active;
|
|
|
|
public bool export_image_call;
|
|
|
|
public string export_image_path;
|
|
|
|
public string export_image_filename;
|
|
|
|
public bool export_image_changed;
|
|
|
|
public bool export_image_import_settings;
|
|
|
|
public bool export_image_world_file;
|
|
|
|
public string export_terrain_path;
|
|
|
|
public bool export_terrain_changed;
|
|
|
|
public bool export_to_terraincomposer;
|
|
|
|
public string import_heightmap_path_full;
|
|
|
|
public bool import_heightmap;
|
|
|
|
public bool filter_perlin;
|
|
|
|
public string converter_source_path_full;
|
|
|
|
public string converter_destination_path_full;
|
|
|
|
public Vector2 converter_resolution;
|
|
|
|
public float converter_height;
|
|
|
|
public bool converter_import_heightmap;
|
|
|
|
public string terrain_asset_name;
|
|
|
|
public string terrain_scene_name;
|
|
|
|
public bool terrain_name_changed;
|
|
|
|
public float terrain_height;
|
|
|
|
public float terrain_scale;
|
|
|
|
public AnimationCurve terrain_curve;
|
|
|
|
public bool do_heightmap;
|
|
|
|
public bool do_image;
|
|
|
|
public int terrain_heightmap_resolution_select;
|
|
|
|
public int terrain_heightmap_resolution;
|
|
|
|
public bool terrain_heightmap_resolution_changed;
|
|
|
|
public bool mipmapEnabled;
|
|
|
|
public bool terrain_done;
|
|
|
|
public int anisoLevel;
|
|
|
|
public int maxTextureSize;
|
|
|
|
public int maxTextureSize_select;
|
|
|
|
public bool maxTextureSize_changed;
|
|
|
|
public bool auto_import_settings_apply;
|
|
|
|
public bool preimage_export_active;
|
|
|
|
public bool preimage_apply;
|
|
|
|
public bool preimage_save_new;
|
|
|
|
public string preimage_path;
|
|
|
|
public bool preimage_path_changed;
|
|
|
|
public string preimage_filename;
|
|
|
|
public int preimage_count;
|
|
|
|
public map_area_class(string name1, int index)
|
|
{
|
|
name = "Untitled";
|
|
upper_left = new latlong_class();
|
|
lower_right = new latlong_class();
|
|
center = new latlong_class();
|
|
size = new map_pixel_class();
|
|
normalizeHeightmap = true;
|
|
heightmap_offset = new Vector2(0f, 0f);
|
|
smooth_strength = 1f;
|
|
resolution = 2048;
|
|
image_zoom = 18;
|
|
start_tile = new tile_class();
|
|
tiles = new tile_class();
|
|
export_heightmap_path = string.Empty;
|
|
export_heightmap_filename = string.Empty;
|
|
export_image_path = string.Empty;
|
|
export_image_filename = string.Empty;
|
|
export_terrain_path = string.Empty;
|
|
export_to_terraincomposer = true;
|
|
converter_source_path_full = string.Empty;
|
|
converter_destination_path_full = string.Empty;
|
|
converter_height = 9000f;
|
|
terrain_asset_name = string.Empty;
|
|
terrain_scene_name = string.Empty;
|
|
terrain_height = 9000f;
|
|
terrain_scale = 1f;
|
|
do_heightmap = true;
|
|
do_image = true;
|
|
mipmapEnabled = true;
|
|
anisoLevel = 9;
|
|
maxTextureSize_select = 6;
|
|
auto_import_settings_apply = true;
|
|
preimage_path = string.Empty;
|
|
name = name1 + index.ToString();
|
|
terrain_curve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
|
|
terrain_curve.AddKey(1f, 0f);
|
|
terrain_curve = set_curve_linear(terrain_curve);
|
|
}
|
|
|
|
public virtual void reset()
|
|
{
|
|
upper_left.reset();
|
|
lower_right.reset();
|
|
center.reset();
|
|
size.reset();
|
|
}
|
|
|
|
public virtual AnimationCurve set_curve_linear(AnimationCurve curve)
|
|
{
|
|
AnimationCurve animationCurve = new AnimationCurve();
|
|
for (int i = 0; i < curve.keys.Length; i++)
|
|
{
|
|
float inTangent = 0f;
|
|
float outTangent = 0f;
|
|
bool flag = false;
|
|
bool flag2 = false;
|
|
Vector2 vector = default(Vector2);
|
|
Vector2 vector2 = default(Vector2);
|
|
Vector2 vector3 = default(Vector2);
|
|
Keyframe key = curve[i];
|
|
if (i == 0)
|
|
{
|
|
inTangent = 0f;
|
|
flag = true;
|
|
}
|
|
if (i == curve.keys.Length - 1)
|
|
{
|
|
outTangent = 0f;
|
|
flag2 = true;
|
|
}
|
|
if (!flag)
|
|
{
|
|
vector.x = curve.keys[i - 1].time;
|
|
vector.y = curve.keys[i - 1].value;
|
|
vector2.x = curve.keys[i].time;
|
|
vector2.y = curve.keys[i].value;
|
|
vector3 = vector2 - vector;
|
|
inTangent = vector3.y / vector3.x;
|
|
}
|
|
if (!flag2)
|
|
{
|
|
vector.x = curve.keys[i].time;
|
|
vector.y = curve.keys[i].value;
|
|
vector2.x = curve.keys[i + 1].time;
|
|
vector2.y = curve.keys[i + 1].value;
|
|
vector3 = vector2 - vector;
|
|
outTangent = vector3.y / vector3.x;
|
|
}
|
|
key.inTangent = inTangent;
|
|
key.outTangent = outTangent;
|
|
animationCurve.AddKey(key);
|
|
}
|
|
return animationCurve;
|
|
}
|
|
}
|