diff --git a/.github/workflows/attachReleaseArtifacts.yml b/.github/workflows/attachReleaseArtifacts.yml index ca39575d..5b557d14 100644 --- a/.github/workflows/attachReleaseArtifacts.yml +++ b/.github/workflows/attachReleaseArtifacts.yml @@ -5,6 +5,9 @@ on: release: types: [published] +env: + KSP_ROOT: /tmp/ksp + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: attach-release-artifacts: @@ -27,16 +30,14 @@ jobs: - name: Download required assemblies id: download-assemblies - shell: bash - env: + uses: KSP-RO/BuildTools/download-assemblies-v2@master + with: KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }} - run: | - curl https://ksp-ro.s3-us-west-2.amazonaws.com/KSPAssemblies-1.12.zip --output /tmp/bins.zip - KSP_DLL_PATH="/opt/ksp/assembly" - echo "::set-output name=ksp-dll-path::${KSP_DLL_PATH}" - mkdir -p "${KSP_DLL_PATH}" - unzip -P "${KSP_ZIP_PASSWORD}" '/tmp/bins.zip' -d "${KSP_DLL_PATH}" - rm '/tmp/bins.zip' + dependency-identifiers: | + Harmony2 + Kopernicus + KSPBurst-Lite + BurstPQS - name: Build mod solution env: @@ -63,8 +64,7 @@ jobs: grep AssemblyFileVersion ${GITHUB_WORKSPACE}/Source/Properties/AssemblyInfo.cs rm -f ${GITHUB_WORKSPACE}/GameData/RealSolarSystem/Plugins/*.dll - msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${GITHUB_WORKSPACE}/Source/RealSolarSystem.sln - cp -v ${GITHUB_WORKSPACE}/Source/obj/Release/RealSolarSystem.dll ${GITHUB_WORKSPACE}/GameData/RealSolarSystem/Plugins/RealSolarSystem.dll + msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" /p:KSPRoot="${{ env.KSP_ROOT }}" ${GITHUB_WORKSPACE}/Source/RealSolarSystem.sln - name: Remove excess DLLs uses: KSP-RO/BuildTools/remove-excess-dlls@master diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ada1c556..0728ac35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,9 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +env: + KSP_ROOT: /tmp/ksp + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: check-secret: @@ -49,22 +52,19 @@ jobs: - name: Download required assemblies id: download-assemblies - shell: bash - env: + uses: KSP-RO/BuildTools/download-assemblies-v2@master + with: KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }} - run: | - curl https://ksp-ro.s3-us-west-2.amazonaws.com/KSPAssemblies-1.12.zip --output /tmp/bins.zip - KSP_DLL_PATH="/opt/ksp/assembly" - echo "::set-output name=ksp-dll-path::${KSP_DLL_PATH}" - mkdir -p "${KSP_DLL_PATH}" - unzip -P "${KSP_ZIP_PASSWORD}" '/tmp/bins.zip' -d "${KSP_DLL_PATH}" - rm '/tmp/bins.zip' + dependency-identifiers: | + Harmony2 + Kopernicus + KSPBurst-Lite + BurstPQS - name: Build mod solution run: | rm -f ${GITHUB_WORKSPACE}/GameData/RealSolarSystem/Plugins/*.dll - msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${GITHUB_WORKSPACE}/Source/RealSolarSystem.sln - cp -v ${GITHUB_WORKSPACE}/Source/obj/Release/RealSolarSystem.dll ${GITHUB_WORKSPACE}/GameData/RealSolarSystem/Plugins/RealSolarSystem.dll + msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" /p:KSPRoot="${{ env.KSP_ROOT }}" ${GITHUB_WORKSPACE}/Source/RealSolarSystem.sln - name: Remove excess DLLs uses: KSP-RO/BuildTools/remove-excess-dlls@master diff --git a/Source/RealSolarSystem.BurstPQS/BatchPQSMod_VertexDefineCoastSmooth.cs b/Source/RealSolarSystem.BurstPQS/BatchPQSMod_VertexDefineCoastSmooth.cs new file mode 100644 index 00000000..c35468b1 --- /dev/null +++ b/Source/RealSolarSystem.BurstPQS/BatchPQSMod_VertexDefineCoastSmooth.cs @@ -0,0 +1,52 @@ +using System; +using BurstPQS; +using BurstPQS.Util; +using RealSolarSystem; +using Unity.Burst; + +[BurstCompile] +[BatchPQSMod(typeof(PQSMod_VertexDefineCoastSmooth))] +public class BatchPQSMod_VertexDefineCoastSmooth : BatchPQSMod +{ + public BatchPQSMod_VertexDefineCoastSmooth(PQSMod_VertexDefineCoastSmooth mod) : base(mod) + { + } + + public override void OnQuadPreBuild(PQ quad, BatchPQSJobSet jobSet) + { + base.OnQuadPreBuild(quad, jobSet); + jobSet.Add(new BuildJob + { + minHeightOffset = Mod.minHeightOffset, + maxHeightOffset = Mod.maxHeightOffset, + slopeScale = Mod.slopeScale, + }); + } + + [BurstCompile] + struct BuildJob : IBatchPQSHeightJob + { + public double minHeightOffset; + public double maxHeightOffset; + public double slopeScale; + + public void BuildHeights(in BuildHeightsData data) + { + var minHeight = data.sphere.radius + minHeightOffset; + var maxHeight = data.sphere.radius + maxHeightOffset; + + for (int i = 0; i < data.VertexCount; ++i) + { + if (data.vertHeight[i] > minHeight && data.vertHeight[i] < maxHeight) + { + // 7th order polynomial smoothstep. + double x = (data.vertHeight[i] - minHeight) / (maxHeight - minHeight); + x = MathUtil.Clamp01((x - 0.5) * slopeScale + 0.5); + double y = -20.0 * Math.Pow(x, 7.0) + 70 * Math.Pow(x, 6.0) - 84.0 * Math.Pow(x, 5.0) + + 35.0 * Math.Pow(x, 4.0); + data.vertHeight[i] = y * (maxHeight - minHeight) + minHeight; + } + } + } + } +} \ No newline at end of file diff --git a/Source/RealSolarSystem.BurstPQS/Properties/AssemblyInfo.cs b/Source/RealSolarSystem.BurstPQS/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..a60d57fe --- /dev/null +++ b/Source/RealSolarSystem.BurstPQS/Properties/AssemblyInfo.cs @@ -0,0 +1,46 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("RealSolarSystem.BurstPQS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RealSolarSystem.BurstPQS")] +[assembly: AssemblyCopyright("Copyright © 2026, KSP-RO Team")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("40818121-9CD4-4452-8583-CDFD7528724F")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +#if CIBUILD +[assembly: AssemblyVersion("@MAJOR@.@MINOR@.@PATCH@.@BUILD@")] +[assembly: AssemblyFileVersion("@MAJOR@.@MINOR@.@PATCH@.@BUILD@")] +[assembly: KSPAssembly("RealSolarSystem.BurstPQS", @MAJOR@, @MINOR@)] +[assembly: KSPAssemblyDependency("RealSolarSystem", @MAJOR@, @MINOR@)] +#else +[assembly: AssemblyVersion("18.5.0.0")] +[assembly: AssemblyFileVersion("18.5.0.0")] +[assembly: KSPAssembly("RealSolarSystem.BurstPQS", 21, 0, 0)] +[assembly: KSPAssemblyDependency("RealSolarSystem", 21, 0, 0)] +#endif + +[assembly: KSPAssemblyDependency("BurstPQS", 0, 1)] diff --git a/Source/RealSolarSystem.BurstPQS/RealSolarSystem.BurstPQS.csproj b/Source/RealSolarSystem.BurstPQS/RealSolarSystem.BurstPQS.csproj new file mode 100644 index 00000000..40c5c094 --- /dev/null +++ b/Source/RealSolarSystem.BurstPQS/RealSolarSystem.BurstPQS.csproj @@ -0,0 +1,86 @@ + + + + + Debug + AnyCPU + {40818121-9CD4-4452-8583-CDFD7528724F} + Library + Properties + RealSolarSystem.BurstPQS + RealSolarSystem.BurstPQS + v4.8 + 512 + + + AnyCPU + true + portable + false + ..\..\GameData\RealSolarSystem\Plugins + DEBUG;TRACE + prompt + 4 + + + AnyCPU + none + true + ..\..\GameData\RealSolarSystem\Plugins + TRACE + prompt + 4 + + + + $(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar)) + + + + $(ReferencePath)/System.dll + False + + + $(ReferencePath)/System.Core.dll + False + + + $(ReferencePath)/Assembly-CSharp.dll + False + + + $(ReferencePath)/UnityEngine.dll + False + + + $(ReferencePath)/UnityEngine.CoreModule.dll + False + + + $(ReferencePath)/Unity.Burst.dll + False + + + $(ReferencePath)/BurstPQS.dll + False + + + + + + + + + {685bbbd5-86fa-43b0-bcad-72328d37ac94} + RealSolarSystem + + + + + \ No newline at end of file diff --git a/Source/RealSolarSystem.csproj b/Source/RealSolarSystem.csproj index 08b75d03..7be1754c 100644 --- a/Source/RealSolarSystem.csproj +++ b/Source/RealSolarSystem.csproj @@ -56,35 +56,49 @@ + + + $(ReferencePath.TrimEnd([System.IO.Path]::DirectorySeparatorChar)) + - + + $(ReferencePath)/0Harmony.dll False - + + $(ReferencePath)/Assembly-CSharp.dll False - + + $(ReferencePath)/Kopernicus.dll False - + + $(ReferencePath)/Kopernicus.Parser.dll False - + + $(ReferencePath)/System.dll False - + + $(ReferencePath)/UnityEngine.dll False - + + $(ReferencePath)/UnityEngine.CoreModule.dll False - + + $(ReferencePath)/UnityEngine.IMGUIModule.dll False - + + $(ReferencePath)/UnityEngine.InputLegacyModule.dll False - + + $(ReferencePath)/UnityEngine.PhysicsModule.dll False diff --git a/Source/RealSolarSystem.sln b/Source/RealSolarSystem.sln index 47238d84..210c1eec 100644 --- a/Source/RealSolarSystem.sln +++ b/Source/RealSolarSystem.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.28010.2048 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealSolarSystem", "RealSolarSystem.csproj", "{685BBBD5-86FA-43B0-BCAD-72328D37AC94}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealSolarSystem.BurstPQS", "RealSolarSystem.BurstPQS\RealSolarSystem.BurstPQS.csproj", "{40818121-9CD4-4452-8583-CDFD7528724F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {685BBBD5-86FA-43B0-BCAD-72328D37AC94}.Debug|Any CPU.Build.0 = Debug|Any CPU {685BBBD5-86FA-43B0-BCAD-72328D37AC94}.Release|Any CPU.ActiveCfg = Release|Any CPU {685BBBD5-86FA-43B0-BCAD-72328D37AC94}.Release|Any CPU.Build.0 = Release|Any CPU + {40818121-9CD4-4452-8583-CDFD7528724F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40818121-9CD4-4452-8583-CDFD7528724F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40818121-9CD4-4452-8583-CDFD7528724F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40818121-9CD4-4452-8583-CDFD7528724F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE