diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1-e.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1-e.tga deleted file mode 100644 index 1e3b91bb..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1-e.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1-n.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1-n.tga deleted file mode 100644 index 4e4da76c..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1-n.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1.tga deleted file mode 100644 index 06621b8a..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-1.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-e.dds b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-e.dds index 84850cc9..55846867 100644 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-e.dds and b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-e.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-e.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-e.tga deleted file mode 100644 index e92970d0..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-e.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-n.dds b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-n.dds index 2c432c32..c6e60228 100644 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-n.dds and b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-n.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-n.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-n.tga deleted file mode 100644 index 2d792894..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2-n.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2.tga deleted file mode 100644 index deae1b0d..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-2.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-e.dds b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-e.dds index 38fd66fa..e9600520 100644 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-e.dds and b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-e.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-e.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-e.tga deleted file mode 100644 index 01b11c85..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-e.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-n.dds b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-n.dds index 5b2049c3..ea785891 100644 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-n.dds and b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-n.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-n.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-n.tga deleted file mode 100644 index 45eb8f8d..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3-n.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3.dds b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3.dds index bdbe8870..66e6ad7d 100644 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3.dds and b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3.tga deleted file mode 100644 index bb11f843..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-3.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4-n.dds b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4-n.dds index 9328d706..a37775f9 100644 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4-n.dds and b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4-n.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4-n.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4-n.tga deleted file mode 100644 index 1f030a05..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4-n.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4.dds b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4.dds index 230f1b96..143a6abc 100644 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4.dds and b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4.tga deleted file mode 100644 index 5e189de0..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-4.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-1-n.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-1-n.tga deleted file mode 100644 index 03e27e27..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-1-n.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-1.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-1.tga deleted file mode 100644 index 05bea880..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-1.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-3.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-3.tga deleted file mode 100644 index 8174d798..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-1875-shrouds-3.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-glow-basic-1.tga b/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-glow-basic-1.tga deleted file mode 100644 index dfbf5c93..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/Engine/restock-engine-glow-basic-1.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/FuelTank/restock-fuel-tank-25-1.tga b/Distribution/Restock/GameData/ReStock/Assets/FuelTank/restock-fuel-tank-25-1.tga deleted file mode 100644 index 16d83b38..00000000 Binary files a/Distribution/Restock/GameData/ReStock/Assets/FuelTank/restock-fuel-tank-25-1.tga and /dev/null differ diff --git a/Distribution/Restock/GameData/ReStock/Patches/Structural/restock-structural-125.cfg b/Distribution/Restock/GameData/ReStock/Patches/Structural/restock-structural-125.cfg index 4110aed0..2764e2df 100644 --- a/Distribution/Restock/GameData/ReStock/Patches/Structural/restock-structural-125.cfg +++ b/Distribution/Restock/GameData/ReStock/Patches/Structural/restock-structural-125.cfg @@ -5,8 +5,8 @@ // - Rockomax HubMax Multi-Point Connector (stationHub) // - BZ-52 Radial Attachment Point (stackPoint1) // - TVR-200 Stack Bi-Coupler (stackBiCoupler_v2) -// - TVR-300 Stack Tri-Coupler (stackTriCoupler_v2) -// - TVR-400 Stack Quad-Coupler (stackQuadCoupler) +// - TVR-1180C Mk1 Stack Tri-Coupler (stackTriCoupler_v2) +// - TVR-2160C Mk2 Stack Quad-Coupler (stackQuadCoupler) @PART[adapterSmallMiniTall] { diff --git a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll index 74a4d823..8f43cb39 100644 Binary files a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll and b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll differ diff --git a/Distribution/Restock/readme.txt b/Distribution/Restock/readme.txt index 3deb0e91..5db370dd 100644 --- a/Distribution/Restock/readme.txt +++ b/Distribution/Restock/readme.txt @@ -81,6 +81,7 @@ This mod primarily uses vanilla-provided localization, but for additional string - French (Challyss) - Brazilian Portuguese (AluisioASG) - Spanish (Niako) +- Simplified Chinese (Duck1998) ========= LICENSING diff --git a/Distribution/RestockExtras/RestockRigidLegs/readme.txt b/Distribution/RestockExtras/RestockRigidLegs/readme.txt index a230fb75..68da5a1e 100644 --- a/Distribution/RestockExtras/RestockRigidLegs/readme.txt +++ b/Distribution/RestockExtras/RestockRigidLegs/readme.txt @@ -36,6 +36,7 @@ LOCALIZATION This mod primarily uses vanilla-provided localization, but for additional strings, it provides localization support for the following languages: - English +- Simplified Chinese (Duck1998) ========= LICENSING diff --git a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-fueltank-0625-1-n.tga b/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-fueltank-0625-1-n.tga deleted file mode 100644 index 6153ec35..00000000 Binary files a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-fueltank-0625-1-n.tga and /dev/null differ diff --git a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-fueltank-0625-1.tga b/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-fueltank-0625-1.tga deleted file mode 100644 index 2b2382d1..00000000 Binary files a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-fueltank-0625-1.tga and /dev/null differ diff --git a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-1-n.tga b/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-1-n.tga deleted file mode 100644 index 025561be..00000000 Binary files a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-1-n.tga and /dev/null differ diff --git a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-1.tga b/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-1.tga deleted file mode 100644 index de9cf359..00000000 Binary files a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-1.tga and /dev/null differ diff --git a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-2-n.tga b/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-2-n.tga deleted file mode 100644 index 228ce6a7..00000000 Binary files a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-2-n.tga and /dev/null differ diff --git a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-2.tga b/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-2.tga deleted file mode 100644 index f56fb19e..00000000 Binary files a/Distribution/RestockPlus/GameData/ReStockPlus/Assets/FuelTank/restock-nosecone-spheres-2.tga and /dev/null differ diff --git a/Distribution/RestockPlus/changelog.txt b/Distribution/RestockPlus/changelog.txt index b22c6a54..b6509014 100644 --- a/Distribution/RestockPlus/changelog.txt +++ b/Distribution/RestockPlus/changelog.txt @@ -1,6 +1,6 @@ -v0.2.0 +v1.0.0 ------ -- KSP 1.8 support +- KSP 1.8 compatability - Phase 2 release - Changes to existing parts (as a result of KSP 1.8) - Redundant overlapping parts were removed diff --git a/Distribution/RestockPlus/readme.txt b/Distribution/RestockPlus/readme.txt index e05585ef..fadb966c 100644 --- a/Distribution/RestockPlus/readme.txt +++ b/Distribution/RestockPlus/readme.txt @@ -71,6 +71,7 @@ This mod provides localization support for the following languages: - German (woeller) - Brazilian Portuguese (AluisioASG) - Spanish (Niako) +- Simplified Chinese (Duck1998) ========= LICENSING diff --git a/Source/Restock/ModuleRestockLaunchClamp.cs b/Source/Restock/ModuleRestockLaunchClamp.cs index cc0b0cef..38d9cc53 100644 --- a/Source/Restock/ModuleRestockLaunchClamp.cs +++ b/Source/Restock/ModuleRestockLaunchClamp.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Reflection; using UnityEngine; namespace Restock @@ -9,156 +7,88 @@ namespace Restock { [KSPField] public string trf_towerGirder_name = ""; [KSPField] public string trf_towerYoke_name = ""; - + [KSPField] public Transform towerPivot; [KSPField] public Transform towerYoke; [KSPField] public Transform towerAnchor; [KSPField] public Transform towerGirder; [KSPField] public Transform towerStretch; + [KSPField] public int maxSegments = 100; - [KSPField] public Mesh girderSegmentMesh; - [KSPField] public Mesh girderMesh; - - private List _girderVerts; - private List _girderUVs; - private List _girderNormals; - private List _girderTangents; - private List _girderColors; - private List _girderTris; - private int _girderSegments; - - private bool _girderHasTangents = false; - private bool _girderHasColors = false; - private int _girderVertCount; - private int _girderTriCount; - private bool _flightUpdate = false; + private Material _girderMaterial; + private Mesh _girderMesh; + + private int _girderSegments; + private Matrix4x4[] _girderMatrices; public override void OnLoad(ConfigNode node) { - Debug.Log("OnLoad Called"); - towerPivot = base.part.FindModelTransform(trf_towerPivot_name); towerYoke = base.part.FindModelTransform(trf_towerYoke_name); towerAnchor = base.part.FindModelTransform(trf_anchor_name); towerGirder = base.part.FindModelTransform(trf_towerGirder_name); towerStretch = base.part.FindModelTransform(trf_towerStretch_name); - - girderMesh = towerGirder.GetComponent().mesh; - girderSegmentMesh = Instantiate(girderMesh); - + base.OnLoad(node); } public override void OnStart(StartState state) { - - Debug.Log("OnStart Called"); - Debug.Log(girderSegmentMesh == null); - girderMesh = towerGirder.GetComponent().mesh; - - _girderVertCount = girderSegmentMesh.vertexCount; - _girderTriCount = girderSegmentMesh.triangles.Length; - - _girderVerts = new List(girderSegmentMesh.vertices); - _girderUVs = new List(girderSegmentMesh.uv); - _girderNormals = new List(girderSegmentMesh.normals); - if (girderSegmentMesh.tangents.Length > 0) - { - _girderHasTangents = true; - _girderTangents = new List(girderSegmentMesh.tangents); - } - if (girderSegmentMesh.colors32.Length > 0) - { - _girderHasColors = true; - _girderColors = new List(girderSegmentMesh.colors32); - } - _girderTris = new List(girderSegmentMesh.triangles); - _girderSegments = 1; - base.OnStart(state); + + var girderRenderer = towerGirder.GetComponent(); + _girderMaterial = girderRenderer.material; + _girderMesh = towerGirder.GetComponent().mesh; + + girderRenderer.enabled = false; // we'll render manually from now on - UpdateClamp(); + _girderSegments = 0; + _girderMatrices = new Matrix4x4[maxSegments]; + + _girderMaterial.enableInstancing = true; + if (!_girderMaterial.enableInstancing) + { + this.LogError("Could not enable instancing! Aborting"); + _girderSegments = -1; + return; + } } - + public void LateUpdate() { + + if (_girderSegments < 0) return; + if (!HighLogic.LoadedSceneIsEditor) { if (_flightUpdate) return; else _flightUpdate = true; } - - UpdateClamp(); - } - - public void UpdateClamp() - { - var height = base.height; - var initialHeight = base.initialHeight; - - towerAnchor.position = towerStretch.position - (towerStretch.up * height); - + + var height1 = HighLogic.LoadedSceneIsEditor ? towerStretch.position.y : base.height; + var initialHeight1 = base.initialHeight; + + towerAnchor.position = towerStretch.position - (towerStretch.up * height1); + var vec1 = Vector3.down; - var vec2 = towerAnchor.localPosition - towerYoke.localPosition ; + var vec2 = towerAnchor.localPosition - towerYoke.localPosition; towerYoke.localRotation = Quaternion.FromToRotation(vec1, vec2); - - var segments = Mathf.CeilToInt(height / initialHeight); - if (segments != _girderSegments) - { - UpdateGirder(segments); - } - } - - private void UpdateGirder(int length) - { - if (length > _girderSegments) - { - for (int i = _girderSegments; i < length; i++) - { - var offset = Vector3.down * base.initialHeight * i; - var indexOffset = _girderVertCount * i; - for (int v = 0; v < _girderVertCount; v++) - { - _girderVerts.Add(girderSegmentMesh.vertices[v] + offset); - } - _girderNormals.AddRange(girderSegmentMesh.normals); - _girderUVs.AddRange(girderSegmentMesh.uv); - - if (_girderHasTangents) _girderTangents.AddRange(girderSegmentMesh.tangents); - if (_girderHasColors) _girderColors.AddRange(girderSegmentMesh.colors32); - - for (int t = 0; t < _girderTriCount; t++) - { - _girderTris.Add(girderSegmentMesh.triangles[t] + indexOffset); - } - } - - } - else - { - var startIndex = length * _girderVertCount; - var count = (_girderSegments - length) * _girderVertCount; - _girderVerts.RemoveRange(startIndex, count); - _girderNormals.RemoveRange(startIndex, count); - _girderUVs.RemoveRange(startIndex, count); - if (_girderHasTangents) _girderTangents.RemoveRange(startIndex, count); - if (_girderHasColors) _girderColors.RemoveRange(startIndex, count); - - _girderTris.RemoveRange(length * _girderTriCount, (_girderSegments - length) * _girderTriCount); - } - girderMesh.Clear(); + _girderSegments = Mathf.CeilToInt(height1 / base.initialHeight); + _girderSegments = Math.Min(_girderSegments, maxSegments); + _girderSegments = Math.Max(_girderSegments, 0); - girderMesh.SetVertices(_girderVerts); - girderMesh.SetNormals(_girderNormals); - girderMesh.SetUVs(0, _girderUVs); - if (_girderHasTangents) girderMesh.SetTangents(_girderTangents); - if (_girderHasColors) girderMesh.SetColors(_girderColors); - girderMesh.SetTriangles(_girderTris, 0); + var matrix = towerGirder.localToWorldMatrix; + var offset = Matrix4x4.Translate(matrix.MultiplyVector(Vector3.down * base.initialHeight)); - girderMesh.RecalculateBounds(); - _girderSegments = length; + for (int i = 0; i < _girderSegments; i++) + { + _girderMatrices[i] = matrix; + matrix *= offset; + } + + Graphics.DrawMeshInstanced(_girderMesh, 0, _girderMaterial, _girderMatrices, _girderSegments, part.mpb); } } } \ No newline at end of file