mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-13 06:59:46 +07:00
new sorting wip
This commit is contained in:
@@ -111,7 +111,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 118226}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 5.19999981, y: 1.29999995, z: 0}
|
||||
m_LocalPosition: {x: 128, y: 32, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 465650}
|
||||
|
||||
@@ -83,7 +83,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 179380}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 1.94999993, y: 1.625, z: 33.9285774}
|
||||
m_LocalPosition: {x: 48, y: 40, z: 33.9285774}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 454690}
|
||||
|
||||
@@ -51,7 +51,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 167384}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1.6444999, z: 3.70370364}
|
||||
m_LocalPosition: {x: 0, y: 40.4799995, z: 3.70370364}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 427722}
|
||||
|
||||
@@ -51,7 +51,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 147772}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: .455000013, y: 1.87199998, z: 14.8148146}
|
||||
m_LocalPosition: {x: 11.2000008, y: 46.0800018, z: 14.8148146}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 442410}
|
||||
|
||||
@@ -39,7 +39,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 114888}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 1.29999995, y: .649999976, z: 22.2222233}
|
||||
m_LocalPosition: {x: 32, y: 16, z: 22.2222233}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 483872}
|
||||
|
||||
@@ -39,7 +39,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 155780}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -2.5999999, y: 0, z: 0}
|
||||
m_LocalPosition: {x: -64, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 457334}
|
||||
|
||||
@@ -51,7 +51,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 112436}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 1.29999995, y: -.649999976, z: 0}
|
||||
m_LocalPosition: {x: 32, y: -16, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 400788}
|
||||
|
||||
@@ -51,7 +51,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 189540}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 1.29999995, y: 1.94999993, z: 51.1110992}
|
||||
m_LocalPosition: {x: 32, y: 48, z: 51.1110992}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 482346}
|
||||
|
||||
@@ -51,7 +51,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 149682}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 3.25, z: 97.7777481}
|
||||
m_LocalPosition: {x: 0, y: 80, z: 97.7777481}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 469780}
|
||||
|
||||
@@ -39,7 +39,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 136960}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -.649999976, y: 2.92499995, z: 95.5555267}
|
||||
m_LocalPosition: {x: -16, y: 72, z: 95.5555267}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 438130}
|
||||
|
||||
@@ -51,7 +51,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 107490}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -1.29999995, y: 2.5999999, z: 93.3333054}
|
||||
m_LocalPosition: {x: -32, y: 64, z: 93.3333054}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 433840}
|
||||
|
||||
@@ -56,7 +56,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 194730}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -.649999976, y: -.974999964, z: 3.125}
|
||||
m_LocalPosition: {x: -16, y: -24, z: 3.125}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 458188}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@ namespace IsoTools {
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// size
|
||||
// Size
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace IsoTools {
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// position
|
||||
// Position
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace IsoTools {
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// tilePosition
|
||||
// TilePosition
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace IsoTools {
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// bounds
|
||||
// Bounds
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -149,12 +149,12 @@ namespace IsoTools {
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// internal
|
||||
// Internal
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public class InternalState {
|
||||
public bool Moved = false;
|
||||
public bool Dirty = false;
|
||||
public bool Visited = false;
|
||||
public Vector3 MinSector = Vector3.zero;
|
||||
public Vector3 MaxSector = Vector3.zero;
|
||||
@@ -255,11 +255,10 @@ namespace IsoTools {
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
void Awake() {
|
||||
Internal.SelfDepends = new HashSet<IsoObject>(new IsoObject[51]);
|
||||
Internal.TheirDepends = new HashSet<IsoObject>(new IsoObject[51]);
|
||||
Internal.SelfDepends = new HashSet<IsoObject>(new IsoObject[19]);
|
||||
Internal.SelfDepends.Clear();
|
||||
Internal.TheirDepends = new HashSet<IsoObject>(new IsoObject[19]);
|
||||
Internal.TheirDepends.Clear();
|
||||
|
||||
FixLastProperties();
|
||||
FixIsoPosition();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
@@ -8,36 +7,6 @@ using UnityEditor;
|
||||
namespace IsoTools {
|
||||
public static class IsoUtils {
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Poolable/Pool
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
public interface IPoolable {
|
||||
void Reset();
|
||||
}
|
||||
|
||||
public class Pool<T> where T : IPoolable {
|
||||
System.Func<T> _createFn = null;
|
||||
Stack<T> _capacity = new Stack<T>();
|
||||
|
||||
public Pool(System.Func<T> create_fn) {
|
||||
_createFn = create_fn;
|
||||
}
|
||||
|
||||
public T Pop() {
|
||||
return _capacity.Count > 0
|
||||
? _capacity.Pop()
|
||||
: _createFn();
|
||||
}
|
||||
|
||||
public void Push(T value) {
|
||||
value.Reset();
|
||||
_capacity.Push(value);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Consts
|
||||
@@ -379,27 +348,6 @@ namespace IsoTools {
|
||||
return a == b;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// LookUpCube
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
public static void LookUpCube(Vector2 min, Vector2 max, System.Action<Vector2> act) {
|
||||
for ( var y = min.y; y < max.y; ++y ) {
|
||||
for ( var x = min.x; x < max.x; ++x ) {
|
||||
act(new Vector2(x, y));
|
||||
}}
|
||||
}
|
||||
|
||||
public static void LookUpCube(Vector3 min, Vector3 max, System.Action<Vector3> act) {
|
||||
for ( var z = min.z; z < max.z; ++z ) {
|
||||
for ( var y = min.y; y < max.y; ++y ) {
|
||||
for ( var x = min.x; x < max.x; ++x ) {
|
||||
act(new Vector3(x, y, z));
|
||||
}}}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Helpers
|
||||
|
||||
@@ -14,12 +14,14 @@ namespace IsoTools {
|
||||
HashSet<IsoObject> _visibles = new HashSet<IsoObject>();
|
||||
HashSet<IsoObject> _oldVisibles = new HashSet<IsoObject>();
|
||||
|
||||
class SectorInfo {
|
||||
public List<IsoObject> objects = new List<IsoObject>();
|
||||
class Sector {
|
||||
public List<IsoObject> objects = new List<IsoObject>();
|
||||
public void Reset() {
|
||||
objects.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
List<SectorInfo> _sectors = new List<SectorInfo>();
|
||||
Stack<SectorInfo> _sectorsPool = new Stack<SectorInfo>();
|
||||
List<Sector> _sectors = new List<Sector>();
|
||||
float _sectorsSize = 0.0f;
|
||||
Vector3 _sectorsMinNumPos = Vector3.zero;
|
||||
Vector3 _sectorsMaxNumPos = Vector3.zero;
|
||||
@@ -61,20 +63,6 @@ namespace IsoTools {
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkDirty() {
|
||||
if ( !_dirty ) {
|
||||
_dirty = true;
|
||||
MarkEditorWorldDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkDirty(IsoObject iso_object) {
|
||||
if ( iso_object && _visibles.Contains(iso_object) ) {
|
||||
iso_object.Internal.Moved = true;
|
||||
MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 IsoToScreen(Vector3 pos) {
|
||||
return new Vector2(
|
||||
(pos.x - pos.y),
|
||||
@@ -94,6 +82,26 @@ namespace IsoTools {
|
||||
iso_z);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// Internal
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void MarkDirty() {
|
||||
if ( !_dirty ) {
|
||||
_dirty = true;
|
||||
MarkEditorWorldDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkDirty(IsoObject iso_object) {
|
||||
if ( iso_object && _visibles.Contains(iso_object) ) {
|
||||
iso_object.Internal.Dirty = true;
|
||||
MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddIsoObject(IsoObject iso_object) {
|
||||
_objects.Add(iso_object);
|
||||
}
|
||||
@@ -132,26 +140,6 @@ namespace IsoTools {
|
||||
: false;
|
||||
}
|
||||
|
||||
/*
|
||||
bool IsGameObjectVisible(GameObject obj) {
|
||||
var renderer = obj.GetComponent<Renderer>();
|
||||
if ( renderer && renderer.isVisible ) {
|
||||
return true;
|
||||
}
|
||||
var obj_transform = obj.transform;
|
||||
for ( var i = 0; i < obj_transform.childCount; ++i ) {
|
||||
var child_obj = obj_transform.GetChild(i).gameObject;
|
||||
if ( IsGameObjectVisible(child_obj) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsIsoObjectVisible(IsoObject iso_object) {
|
||||
return IsGameObjectVisible(iso_object.gameObject);
|
||||
}*/
|
||||
|
||||
bool IsIsoObjectDepends(Vector3 a_min, Vector3 a_size, Vector3 b_min, Vector3 b_size) {
|
||||
var a_max = a_min + a_size;
|
||||
var b_max = b_min + b_size;
|
||||
@@ -176,17 +164,6 @@ namespace IsoTools {
|
||||
return IsIsoObjectDepends(a.position, a.size, b.position, b.size);
|
||||
}
|
||||
|
||||
void PushSectorPool(SectorInfo sector) {
|
||||
sector.objects.Clear();
|
||||
_sectorsPool.Push(sector);
|
||||
}
|
||||
|
||||
SectorInfo PopSectorPool() {
|
||||
return _sectorsPool.Count > 0
|
||||
? _sectorsPool.Pop()
|
||||
: new SectorInfo();
|
||||
}
|
||||
|
||||
int SectorIndex(Vector3 num_pos) {
|
||||
return Mathf.FloorToInt(
|
||||
num_pos.x + _sectorsNumPosCount.x * (num_pos.y + num_pos.z * _sectorsNumPosCount.y));
|
||||
@@ -201,7 +178,7 @@ namespace IsoTools {
|
||||
return new Vector3(vx, vy, vz);
|
||||
}
|
||||
|
||||
SectorInfo FindSector(Vector3 num_pos) {
|
||||
Sector FindSector(Vector3 num_pos) {
|
||||
if ( num_pos.x < 0 || num_pos.y < 0 || num_pos.z < 0 ) {
|
||||
return null;
|
||||
}
|
||||
@@ -214,13 +191,13 @@ namespace IsoTools {
|
||||
void LookUpSectorDepends(Vector3 num_pos, IsoObject obj_a) {
|
||||
var ms = FindSector(num_pos);
|
||||
if ( ms != null ) {
|
||||
Fun1(ms, obj_a);
|
||||
LookUpSectorDepends(ms, obj_a);
|
||||
var s1 = FindSector(num_pos + new Vector3(-1, 0, 0));
|
||||
var s2 = FindSector(num_pos + new Vector3( 0, -1, 0));
|
||||
var s3 = FindSector(num_pos + new Vector3(-1, -1, 0));
|
||||
if ( s1 != null ) Fun1(s1, obj_a);
|
||||
if ( s2 != null ) Fun1(s2, obj_a);
|
||||
if ( s3 != null ) Fun1(s3, obj_a);
|
||||
if ( s1 != null ) LookUpSectorDepends(s1, obj_a);
|
||||
if ( s2 != null ) LookUpSectorDepends(s2, obj_a);
|
||||
if ( s3 != null ) LookUpSectorDepends(s3, obj_a);
|
||||
for ( var i = 0; i <= _sectorsNumPosCount.z; ++i ) {
|
||||
var ss1 = FindSector(num_pos + new Vector3( 0 - i, 0 - i, i + 1));
|
||||
var ss2 = FindSector(num_pos + new Vector3(-1 - i, 0 - i, i + 1));
|
||||
@@ -229,13 +206,24 @@ namespace IsoTools {
|
||||
var ss5 = FindSector(num_pos + new Vector3(-2 - i, -1 - i, i + 1));
|
||||
var ss6 = FindSector(num_pos + new Vector3(-1 - i, -2 - i, i + 1));
|
||||
var ss7 = FindSector(num_pos + new Vector3(-2 - i, -2 - i, i + 1));
|
||||
if ( ss1 != null ) Fun1(ss1, obj_a);
|
||||
if ( ss2 != null ) Fun1(ss2, obj_a);
|
||||
if ( ss3 != null ) Fun1(ss3, obj_a);
|
||||
if ( ss4 != null ) Fun1(ss4, obj_a);
|
||||
if ( ss5 != null ) Fun1(ss5, obj_a);
|
||||
if ( ss6 != null ) Fun1(ss6, obj_a);
|
||||
if ( ss7 != null ) Fun1(ss7, obj_a);
|
||||
if ( ss1 != null ) LookUpSectorDepends(ss1, obj_a);
|
||||
if ( ss2 != null ) LookUpSectorDepends(ss2, obj_a);
|
||||
if ( ss3 != null ) LookUpSectorDepends(ss3, obj_a);
|
||||
if ( ss4 != null ) LookUpSectorDepends(ss4, obj_a);
|
||||
if ( ss5 != null ) LookUpSectorDepends(ss5, obj_a);
|
||||
if ( ss6 != null ) LookUpSectorDepends(ss6, obj_a);
|
||||
if ( ss7 != null ) LookUpSectorDepends(ss7, obj_a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LookUpSectorDepends(Sector sec, IsoObject obj_a) {
|
||||
var sec_objects_iter = sec.objects.GetEnumerator();
|
||||
while ( sec_objects_iter.MoveNext() ) {
|
||||
var obj_b = sec_objects_iter.Current;
|
||||
if ( obj_a != obj_b && !obj_b.Internal.Dirty && IsIsoObjectDepends(obj_a, obj_b) ) {
|
||||
obj_a.Internal.SelfDepends.Add(obj_b);
|
||||
obj_b.Internal.TheirDepends.Add(obj_a);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,13 +231,13 @@ namespace IsoTools {
|
||||
void LookUpSectorRDepends(Vector3 num_pos, IsoObject obj_a) {
|
||||
var ms = FindSector(num_pos);
|
||||
if ( ms != null ) {
|
||||
Fun2(ms, obj_a);
|
||||
LookUpSectorRDepends(ms, obj_a);
|
||||
var s1 = FindSector(num_pos + new Vector3( 1, 0, 0));
|
||||
var s2 = FindSector(num_pos + new Vector3( 0, 1, 0));
|
||||
var s3 = FindSector(num_pos + new Vector3( 1, 1, 0));
|
||||
if ( s1 != null ) Fun2(s1, obj_a);
|
||||
if ( s2 != null ) Fun2(s2, obj_a);
|
||||
if ( s3 != null ) Fun2(s3, obj_a);
|
||||
if ( s1 != null ) LookUpSectorRDepends(s1, obj_a);
|
||||
if ( s2 != null ) LookUpSectorRDepends(s2, obj_a);
|
||||
if ( s3 != null ) LookUpSectorRDepends(s3, obj_a);
|
||||
for ( var i = 0; i <= _sectorsNumPosCount.z; ++i ) {
|
||||
var ss1 = FindSector(num_pos + new Vector3( 0 + i, 0 + i, -i - 1));
|
||||
var ss2 = FindSector(num_pos + new Vector3( 1 + i, 0 + i, -i - 1));
|
||||
@@ -258,13 +246,24 @@ namespace IsoTools {
|
||||
var ss5 = FindSector(num_pos + new Vector3( 2 + i, 1 + i, -i - 1));
|
||||
var ss6 = FindSector(num_pos + new Vector3( 1 + i, 2 + i, -i - 1));
|
||||
var ss7 = FindSector(num_pos + new Vector3( 2 + i, 2 + i, -i - 1));
|
||||
if ( ss1 != null ) Fun2(ss1, obj_a);
|
||||
if ( ss2 != null ) Fun2(ss2, obj_a);
|
||||
if ( ss3 != null ) Fun2(ss3, obj_a);
|
||||
if ( ss4 != null ) Fun2(ss4, obj_a);
|
||||
if ( ss5 != null ) Fun2(ss5, obj_a);
|
||||
if ( ss6 != null ) Fun2(ss6, obj_a);
|
||||
if ( ss7 != null ) Fun2(ss7, obj_a);
|
||||
if ( ss1 != null ) LookUpSectorRDepends(ss1, obj_a);
|
||||
if ( ss2 != null ) LookUpSectorRDepends(ss2, obj_a);
|
||||
if ( ss3 != null ) LookUpSectorRDepends(ss3, obj_a);
|
||||
if ( ss4 != null ) LookUpSectorRDepends(ss4, obj_a);
|
||||
if ( ss5 != null ) LookUpSectorRDepends(ss5, obj_a);
|
||||
if ( ss6 != null ) LookUpSectorRDepends(ss6, obj_a);
|
||||
if ( ss7 != null ) LookUpSectorRDepends(ss7, obj_a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LookUpSectorRDepends(Sector sec, IsoObject obj_a) {
|
||||
var sec_objects_iter = sec.objects.GetEnumerator();
|
||||
while ( sec_objects_iter.MoveNext() ) {
|
||||
var obj_b = sec_objects_iter.Current;
|
||||
if ( obj_a != obj_b && !obj_b.Internal.Dirty && IsIsoObjectDepends(obj_b, obj_a) ) {
|
||||
obj_b.Internal.SelfDepends.Add(obj_a);
|
||||
obj_a.Internal.TheirDepends.Add(obj_b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,19 +294,19 @@ namespace IsoTools {
|
||||
_sectorsNumPosCount = _sectorsMaxNumPos - _sectorsMinNumPos;
|
||||
}
|
||||
|
||||
void ClearSectors() {
|
||||
void ResizeSectors(int count) {
|
||||
if ( _sectors.Count < count ) {
|
||||
if ( _sectors.Capacity < count ) {
|
||||
_sectors.Capacity = count;
|
||||
}
|
||||
while ( _sectors.Count < _sectors.Capacity ) {
|
||||
_sectors.Add(new Sector());
|
||||
}
|
||||
}
|
||||
|
||||
var sectors_iter = _sectors.GetEnumerator();
|
||||
while ( sectors_iter.MoveNext() ) {
|
||||
PushSectorPool(sectors_iter.Current);
|
||||
}
|
||||
_sectors.Clear();
|
||||
}
|
||||
|
||||
void ResizeSectors(int count) {
|
||||
_sectors.Capacity = count;
|
||||
while ( _sectors.Count < _sectors.Capacity ) {
|
||||
var sector = PopSectorPool();
|
||||
_sectors.Add(sector);
|
||||
sectors_iter.Current.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,15 +316,6 @@ namespace IsoTools {
|
||||
var iso_object = visibles_iter.Current;
|
||||
iso_object.Internal.MinSector -= _sectorsMinNumPos;
|
||||
iso_object.Internal.MaxSector -= _sectorsMinNumPos;
|
||||
|
||||
/*
|
||||
IsoUtils.LookUpCube(iso_object.Internal.MinSector, iso_object.Internal.MaxSector, p => {
|
||||
var sector = FindSector(p);
|
||||
if ( sector != null ) {
|
||||
sector.objects.Add(iso_object);
|
||||
}
|
||||
});*/
|
||||
|
||||
var min = iso_object.Internal.MinSector;
|
||||
var max = iso_object.Internal.MaxSector;
|
||||
for ( var z = min.z; z < max.z; ++z ) {
|
||||
@@ -340,19 +330,18 @@ namespace IsoTools {
|
||||
}
|
||||
|
||||
void SetupSectors() {
|
||||
ClearSectors();
|
||||
ResizeSectors(Mathf.FloorToInt(_sectorsNumPosCount.x * _sectorsNumPosCount.y * _sectorsNumPosCount.z));
|
||||
TuneSectors();
|
||||
}
|
||||
|
||||
void StepSort() {
|
||||
//Profiler.BeginSample("UpdateVisibles");
|
||||
Profiler.BeginSample("UpdateVisibles");
|
||||
UpdateVisibles();
|
||||
//Profiler.EndSample();
|
||||
Profiler.EndSample();
|
||||
if ( _dirty ) {
|
||||
//Profiler.BeginSample("PlaceAllVisibles");
|
||||
Profiler.BeginSample("PlaceAllVisibles");
|
||||
PlaceAllVisibles();
|
||||
//Profiler.EndSample();
|
||||
Profiler.EndSample();
|
||||
_dirty = false;
|
||||
}
|
||||
}
|
||||
@@ -367,18 +356,18 @@ namespace IsoTools {
|
||||
var visibles_iter = _visibles.GetEnumerator();
|
||||
while ( visibles_iter.MoveNext() ) {
|
||||
var iso_object = visibles_iter.Current;
|
||||
if ( iso_object.Internal.Moved || !_oldVisibles.Contains(iso_object) ) {
|
||||
iso_object.Internal.Moved = true;
|
||||
if ( iso_object.Internal.Dirty || !_oldVisibles.Contains(iso_object) ) {
|
||||
iso_object.Internal.Dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
visibles_iter = _visibles.GetEnumerator();
|
||||
while ( visibles_iter.MoveNext() ) {
|
||||
var iso_object = visibles_iter.Current;
|
||||
if ( iso_object.Internal.Moved ) {
|
||||
if ( iso_object.Internal.Dirty ) {
|
||||
MarkDirty();
|
||||
SetupIsoObjectDepends(iso_object);
|
||||
iso_object.Internal.Moved = false;
|
||||
iso_object.Internal.Dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,27 +407,6 @@ namespace IsoTools {
|
||||
iso_object.Internal.SelfDepends.Clear();
|
||||
iso_object.Internal.TheirDepends.Clear();
|
||||
}
|
||||
|
||||
void Fun1(SectorInfo sec, IsoObject obj_a) {
|
||||
var sec_objects_iter = sec.objects.GetEnumerator();
|
||||
while ( sec_objects_iter.MoveNext() ) {
|
||||
var obj_b = sec_objects_iter.Current;
|
||||
if ( obj_a != obj_b && !obj_b.Internal.Moved && IsIsoObjectDepends(obj_a, obj_b) ) {
|
||||
obj_a.Internal.SelfDepends.Add(obj_b);
|
||||
obj_b.Internal.TheirDepends.Add(obj_a);
|
||||
}
|
||||
}
|
||||
}
|
||||
void Fun2(SectorInfo sec, IsoObject obj_a) {
|
||||
var sec_objects_iter = sec.objects.GetEnumerator();
|
||||
while ( sec_objects_iter.MoveNext() ) {
|
||||
var obj_b = sec_objects_iter.Current;
|
||||
if ( obj_a != obj_b && !obj_b.Internal.Moved && IsIsoObjectDepends(obj_b, obj_a) ) {
|
||||
obj_b.Internal.SelfDepends.Add(obj_a);
|
||||
obj_a.Internal.TheirDepends.Add(obj_b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetupIsoObjectDepends(IsoObject obj_a) {
|
||||
ClearIsoObjectDepends(obj_a);
|
||||
@@ -451,9 +419,6 @@ namespace IsoTools {
|
||||
LookUpSectorDepends(v, obj_a);
|
||||
LookUpSectorRDepends(v, obj_a);
|
||||
}}}
|
||||
if ( obj_a.Internal.SelfDepends.Count > 45 ) {
|
||||
//Debug.LogFormat("Self: {0}, Their: {1}", obj_a.Internal.SelfDepends.Count, obj_a.Internal.TheirDepends.Count);
|
||||
}
|
||||
}
|
||||
|
||||
void PlaceAllVisibles() {
|
||||
|
||||
@@ -14,12 +14,16 @@ QualitySettings:
|
||||
shadowProjection: 1
|
||||
shadowCascades: 1
|
||||
shadowDistance: 15
|
||||
shadowCascade2Split: .333333343
|
||||
shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
|
||||
blendWeights: 1
|
||||
textureQuality: 1
|
||||
anisotropicTextures: 0
|
||||
antiAliasing: 0
|
||||
softParticles: 0
|
||||
softVegetation: 0
|
||||
realtimeReflectionProbes: 0
|
||||
billboardsFaceCameraPosition: 0
|
||||
vSyncCount: 0
|
||||
lodBias: .300000012
|
||||
maximumLODLevel: 0
|
||||
@@ -33,12 +37,16 @@ QualitySettings:
|
||||
shadowProjection: 1
|
||||
shadowCascades: 1
|
||||
shadowDistance: 20
|
||||
shadowCascade2Split: .333333343
|
||||
shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
|
||||
blendWeights: 2
|
||||
textureQuality: 0
|
||||
anisotropicTextures: 0
|
||||
antiAliasing: 0
|
||||
softParticles: 0
|
||||
softVegetation: 0
|
||||
realtimeReflectionProbes: 0
|
||||
billboardsFaceCameraPosition: 0
|
||||
vSyncCount: 0
|
||||
lodBias: .400000006
|
||||
maximumLODLevel: 0
|
||||
@@ -52,12 +60,16 @@ QualitySettings:
|
||||
shadowProjection: 1
|
||||
shadowCascades: 1
|
||||
shadowDistance: 20
|
||||
shadowCascade2Split: .333333343
|
||||
shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
|
||||
blendWeights: 2
|
||||
textureQuality: 0
|
||||
anisotropicTextures: 1
|
||||
antiAliasing: 0
|
||||
softParticles: 0
|
||||
softVegetation: 0
|
||||
realtimeReflectionProbes: 0
|
||||
billboardsFaceCameraPosition: 0
|
||||
vSyncCount: 0
|
||||
lodBias: .699999988
|
||||
maximumLODLevel: 0
|
||||
@@ -71,12 +83,16 @@ QualitySettings:
|
||||
shadowProjection: 1
|
||||
shadowCascades: 2
|
||||
shadowDistance: 40
|
||||
shadowCascade2Split: .333333343
|
||||
shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
|
||||
blendWeights: 2
|
||||
textureQuality: 0
|
||||
anisotropicTextures: 1
|
||||
antiAliasing: 0
|
||||
softParticles: 0
|
||||
softVegetation: 1
|
||||
realtimeReflectionProbes: 1
|
||||
billboardsFaceCameraPosition: 1
|
||||
vSyncCount: 1
|
||||
lodBias: 1
|
||||
maximumLODLevel: 0
|
||||
@@ -90,12 +106,16 @@ QualitySettings:
|
||||
shadowProjection: 1
|
||||
shadowCascades: 2
|
||||
shadowDistance: 70
|
||||
shadowCascade2Split: .333333343
|
||||
shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
|
||||
blendWeights: 4
|
||||
textureQuality: 0
|
||||
anisotropicTextures: 2
|
||||
antiAliasing: 2
|
||||
softParticles: 1
|
||||
softVegetation: 1
|
||||
realtimeReflectionProbes: 1
|
||||
billboardsFaceCameraPosition: 1
|
||||
vSyncCount: 1
|
||||
lodBias: 1.5
|
||||
maximumLODLevel: 0
|
||||
@@ -109,32 +129,30 @@ QualitySettings:
|
||||
shadowProjection: 1
|
||||
shadowCascades: 4
|
||||
shadowDistance: 150
|
||||
shadowCascade2Split: .333333343
|
||||
shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
|
||||
blendWeights: 4
|
||||
textureQuality: 0
|
||||
anisotropicTextures: 2
|
||||
antiAliasing: 2
|
||||
softParticles: 1
|
||||
softVegetation: 1
|
||||
realtimeReflectionProbes: 1
|
||||
billboardsFaceCameraPosition: 1
|
||||
vSyncCount: 1
|
||||
lodBias: 2
|
||||
maximumLODLevel: 0
|
||||
particleRaycastBudget: 4096
|
||||
excludedTargetPlatforms: []
|
||||
m_PerPlatformDefaultQuality:
|
||||
Android: 2
|
||||
BlackBerry: 2
|
||||
FlashPlayer: 3
|
||||
GLES Emulation: 3
|
||||
PS3: 3
|
||||
PS4: 3
|
||||
PSM: 3
|
||||
PSP2: 3
|
||||
Samsung TV: 2
|
||||
Standalone: 3
|
||||
Tizen: 2
|
||||
WP8: 3
|
||||
Web: 3
|
||||
'': 0
|
||||
Android: 0
|
||||
BlackBerry: 0
|
||||
Samsung TV: 0
|
||||
Standalone: 0
|
||||
Web: 0
|
||||
WebGL: 0
|
||||
Windows Store Apps: 3
|
||||
XBOX360: 3
|
||||
XboxOne: 3
|
||||
iPhone: 2
|
||||
XBOX360: 0
|
||||
XboxOne: 0
|
||||
iPhone: 0
|
||||
|
||||
@@ -23,7 +23,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Assembly-CSharp.csproj
|
||||
Policies = $0
|
||||
$0.TextStylePolicy = $1
|
||||
|
||||
@@ -23,7 +23,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Assembly-CSharp.csproj
|
||||
Policies = $0
|
||||
$0.TextStylePolicy = $1
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<Properties>
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="MonoDevelop.Default" />
|
||||
<MonoDevelop.Ide.Workspace />
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/IsoTools/Scripts/IsoWorld.cs">
|
||||
<Files>
|
||||
<File FileName="Assets/IsoTools/Scripts/IsoObject.cs" Line="258" Column="70" />
|
||||
<File FileName="Assets/IsoTools/Scripts/IsoWorld.cs" Line="169" Column="29" />
|
||||
<File FileName="Assets/IsoTools/Scripts/IsoWorld.cs" Line="191" Column="4" />
|
||||
<File FileName="Assets/IsoTools/Scripts/IsoUtils.cs" Line="385" Column="4" />
|
||||
<File FileName="Assets/IsoTools/Scripts/IsoObject.cs" Line="157" Column="30" />
|
||||
</Files>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
|
||||
Reference in New Issue
Block a user