Merge gravity-grid-lowering
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
55cc7eda41
57 changed files with 1346 additions and 1575 deletions
|
|
@ -81,87 +81,6 @@ MeshRenderer:
|
|||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &7783244517717541194
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7783244517717541195}
|
||||
- component: {fileID: 7783244517717541175}
|
||||
- component: {fileID: 7783244517717541174}
|
||||
m_Layer: 9
|
||||
m_Name: Gravity Well
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7783244517717541195
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7783244517717541194}
|
||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7783244518521719148}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!33 &7783244517717541175
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7783244517717541194}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &7783244517717541174
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7783244517717541194}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 44a8bbb89acb4e34c9f41a9da5842bb4, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &7783244518317531027
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -289,7 +208,6 @@ Transform:
|
|||
m_Children:
|
||||
- {fileID: 589192530128514016}
|
||||
- {fileID: 7783244518317531036}
|
||||
- {fileID: 7783244517717541195}
|
||||
- {fileID: 7783244516809707565}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
|
@ -307,7 +225,6 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Body: {fileID: 7783244518317531038}
|
||||
GravityWell: {fileID: 7783244517717541174}
|
||||
Icon: {fileID: 7783244516809707566}
|
||||
Generator: {fileID: 741236912059895623}
|
||||
--- !u!114 &741236912059895623
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ Material:
|
|||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Gravity Well
|
||||
m_Shader: {fileID: 4800000, guid: 268da230635cfb34ab4ed6ad39503fa0, type: 3}
|
||||
m_Name: Gravity Field
|
||||
m_Shader: {fileID: 4800000, guid: 08d8efa80af84065b54c9bfed784e435, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
|
|
@ -57,8 +57,6 @@ Material:
|
|||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 1
|
||||
- _Depth: 80
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
|
|
@ -68,7 +66,6 @@ Material:
|
|||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Power: 16
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Gravity Waves
|
||||
m_Shader: {fileID: 4800000, guid: 8a8e593b17063b54ea02f7ea5363b59d, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _Depth: 3.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _Frequency: 27.43
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Phase: 0
|
||||
- _Power: 8
|
||||
- _SinePower: 1.25
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 11fbaa87dcc7a3743a6bd3aa5c86e5ae
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Wormhole Gravity 1
|
||||
m_Shader: {fileID: 4800000, guid: 268da230635cfb34ab4ed6ad39503fa0, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 1
|
||||
- _Depth: 54
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Power: 4
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 244f3e4c0c030a24b8d7aa944895bdcf
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Wormhole Gravity 1
|
||||
m_Shader: {fileID: 4800000, guid: 268da230635cfb34ab4ed6ad39503fa0, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 1
|
||||
- _Depth: 54
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Power: 4
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ec0689c58b99c64297b3e429e1d9112
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Wormhole Gravity
|
||||
m_Shader: {fileID: 4800000, guid: 268da230635cfb34ab4ed6ad39503fa0, type: 3}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.15
|
||||
- _Depth: 2000
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Power: 64
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a9ef17c902709ce41a837c54b809184b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Wormhole Waves
|
||||
m_Shader: {fileID: 4800000, guid: 8681ac064d59d15458d16cc9b884262c, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _Depth: 33.9
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _Frequency: 2
|
||||
- _FrequencyDist: 60
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Power: 2
|
||||
- _SinePower: 1.25
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _Speed: 15
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ef2f6090d5cc14a4e9ce38def3bed9ac
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -30,7 +30,6 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3973935122748960680}
|
||||
- {fileID: 3973935121058605868}
|
||||
- {fileID: 3973935121358855036}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
|
@ -48,93 +47,9 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Body: {fileID: 3973935122748960683}
|
||||
GravityWell: {fileID: 3973935121058605871}
|
||||
Icon: {fileID: 3973935121358855037}
|
||||
Generator: {fileID: 0}
|
||||
SunMaterial: {fileID: 3973935122748960685}
|
||||
--- !u!1 &3973935121058605867
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3973935121058605868}
|
||||
- component: {fileID: 3973935121058605856}
|
||||
- component: {fileID: 3973935121058605871}
|
||||
m_Layer: 9
|
||||
m_Name: Gravity Well
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3973935121058605868
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3973935121058605867}
|
||||
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3973935120991099173}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!33 &3973935121058605856
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3973935121058605867}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &3973935121058605871
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3973935121058605867}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 44a8bbb89acb4e34c9f41a9da5842bb4, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &3973935121358855035
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -83,89 +83,6 @@ MeshRenderer:
|
|||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &8859079004671924238
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8859079004671924239}
|
||||
- component: {fileID: 8859079004671924339}
|
||||
- component: {fileID: 8859079004671924338}
|
||||
m_Layer: 9
|
||||
m_Name: Gravity Well
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8859079004671924239
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8859079004671924238}
|
||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8859079004937162792}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!33 &8859079004671924339
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8859079004671924238}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &8859079004671924338
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8859079004671924238}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 44a8bbb89acb4e34c9f41a9da5842bb4, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &8859079004937162791
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -197,7 +114,6 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8859079005270853336}
|
||||
- {fileID: 8859079004671924239}
|
||||
- {fileID: 8859079003226229097}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
|
@ -215,7 +131,6 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Body: {fileID: 8859079005270853338}
|
||||
GravityWell: {fileID: 8859079004671924338}
|
||||
Icon: {fileID: 8859079003226229098}
|
||||
Generator: {fileID: -7153121627769399805}
|
||||
--- !u!114 &-7153121627769399805
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 7852221720971737233}
|
||||
- {fileID: 7852221720969441490}
|
||||
- {fileID: 7852221720816817928}
|
||||
- {fileID: 7852221720964551245}
|
||||
m_Father: {fileID: 0}
|
||||
|
|
@ -49,7 +48,6 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Body: {fileID: 7852221720971737229}
|
||||
GravityWell: {fileID: 7852221720969441484}
|
||||
Icon: {fileID: 7852221720964551246}
|
||||
Generator: {fileID: 0}
|
||||
SunMaterial: {fileID: 7852221720971737234}
|
||||
|
|
@ -221,89 +219,6 @@ MeshRenderer:
|
|||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &7852221720969441489
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7852221720969441490}
|
||||
- component: {fileID: 7852221720969441485}
|
||||
- component: {fileID: 7852221720969441484}
|
||||
m_Layer: 9
|
||||
m_Name: Gravity Well
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7852221720969441490
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7852221720969441489}
|
||||
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7852221720480299767}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!33 &7852221720969441485
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7852221720969441489}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &7852221720969441484
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7852221720969441489}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 44a8bbb89acb4e34c9f41a9da5842bb4, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &7852221720971737232
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1,167 +1,5 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1826894967093516808
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1030590306481442051}
|
||||
- component: {fileID: 3216580199816124320}
|
||||
- component: {fileID: 3211969211988968959}
|
||||
m_Layer: 9
|
||||
m_Name: Gravity Well
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1030590306481442051
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1826894967093516808}
|
||||
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1024, y: 1024, z: 1024}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 463084220523011477}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!33 &3216580199816124320
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1826894967093516808}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &3211969211988968959
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1826894967093516808}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 244f3e4c0c030a24b8d7aa944895bdcf, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &3908760799087214860
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 581261949390603689}
|
||||
- component: {fileID: 987447324816385543}
|
||||
- component: {fileID: 3959510878930752720}
|
||||
m_Layer: 9
|
||||
m_Name: Gravity Waves
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &581261949390603689
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3908760799087214860}
|
||||
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 512, y: 512, z: 512}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 463084220523011477}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!33 &987447324816385543
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3908760799087214860}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &3959510878930752720
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3908760799087214860}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: ef2f6090d5cc14a4e9ce38def3bed9ac, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &4837153162502999620
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -189,9 +27,6 @@ Transform:
|
|||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 8222188360457572195}
|
||||
- {fileID: 1030590306481442051}
|
||||
- {fileID: 581261949390603689}
|
||||
- {fileID: 8249320701965103923}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
|
@ -277,84 +112,3 @@ MeshRenderer:
|
|||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &7647029665738834910
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8222188360457572195}
|
||||
- component: {fileID: 2468954688819198096}
|
||||
- component: {fileID: 8290522694236574882}
|
||||
m_Layer: 9
|
||||
m_Name: Gravity Pit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8222188360457572195
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7647029665738834910}
|
||||
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 512, y: 512, z: 512}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 463084220523011477}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!33 &2468954688819198096
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7647029665738834910}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &8290522694236574882
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7647029665738834910}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a9ef17c902709ce41a837c54b809184b, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
|
|
|
|||
|
|
@ -223,7 +223,6 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5321404120083801960}
|
||||
- {fileID: 5321404118931821940}
|
||||
- {fileID: 5321404119494867799}
|
||||
- {fileID: 1093865191529778971}
|
||||
|
|
@ -245,7 +244,7 @@ MonoBehaviour:
|
|||
Label: {fileID: 5321404119494867796}
|
||||
Message: {fileID: 6196070888394201391}
|
||||
Children: []
|
||||
GravityMesh: {fileID: 5321404120083801962}
|
||||
GravityMesh: {fileID: 0}
|
||||
--- !u!1 &5321404118931821943
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -564,93 +563,3 @@ MonoBehaviour:
|
|||
m_hasFontAssetChanged: 0
|
||||
m_renderer: {fileID: 5321404119494867795}
|
||||
m_maskType: 0
|
||||
--- !u!1 &5321404120083801964
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5321404120083801960}
|
||||
- component: {fileID: 5321404120083801963}
|
||||
- component: {fileID: 5321404120083801962}
|
||||
m_Layer: 8
|
||||
m_Name: Gravity Well
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5321404120083801960
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5321404120083801964}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 10, y: 10, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5321404118521994135}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5321404120083801963
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5321404120083801964}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &5321404120083801962
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5321404120083801964}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 44a8bbb89acb4e34c9f41a9da5842bb4, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
|
|
|
|||
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
Binary file not shown.
|
|
@ -16416,6 +16416,7 @@ MonoBehaviour:
|
|||
MapGravityMaterials:
|
||||
- {fileID: 2100000, guid: 841e4091d19548347bd59115047b4e49, type: 2}
|
||||
- {fileID: 2100000, guid: a92fc6d958edb9f46b6e58134f609cc0, type: 2}
|
||||
GravityField: {fileID: 2100000, guid: 44a8bbb89acb4e34c9f41a9da5842bb4, type: 2}
|
||||
Tour: 0
|
||||
TourSwitchTime: 10
|
||||
TourFollowDistance: 100
|
||||
|
|
@ -23473,7 +23474,7 @@ Camera:
|
|||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1536
|
||||
m_Bits: 512
|
||||
m_RenderingPath: 1
|
||||
m_TargetTexture: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
|
||||
m_TargetDisplay: 0
|
||||
|
|
|
|||
|
|
@ -1076,16 +1076,6 @@ PrefabInstance:
|
|||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: b9f52544f98f47146b486fb6e27179bb, type: 2}
|
||||
- target: {fileID: 7852221720969441490, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 512
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720969441490, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 512
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720971737233, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
|
|
|
|||
|
|
@ -911,16 +911,6 @@ PrefabInstance:
|
|||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720969441490, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720969441490, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720971737233, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
|
|
@ -1768,16 +1758,6 @@ PrefabInstance:
|
|||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720969441490, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720969441490, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720971737233, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
|
|
@ -5277,16 +5257,6 @@ PrefabInstance:
|
|||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720969441490, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720969441490, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7852221720971737233, guid: 046dde0f4600bce41ad33c476f99b309,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
|
|
|
|||
334
Assets/Scripts/Editor/GravityFieldParityVerify.cs
Normal file
334
Assets/Scripts/Editor/GravityFieldParityVerify.cs
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using GameCult.Caching;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using CultMath;
|
||||
|
||||
namespace Aetheria.EditorTools
|
||||
{
|
||||
/// <summary>
|
||||
/// Batchmode check for campaign aetheria-gravity, cut grid-lowering: what the Gravity Field pass draws is the sim's
|
||||
/// height. It builds a zone from Settings.asset's PlanetSettings with three bodies, runs the real lowering
|
||||
/// (GravityLowering.Lower and CreateField), renders the field through an orthographic camera that culls layer 9 into
|
||||
/// a float target, and compares every texel with -Zone.GetHeight at the texel centre's world position. It then checks
|
||||
/// that the texture's gradient points where Zone.GetForce does, and that ARPG.unity and the body prefabs are wired
|
||||
/// the way the cut leaves them (the gravity cameras cull layer 9 alone, nothing but the run-time field sits on it).
|
||||
///
|
||||
/// Renders, so it needs a graphics device: run WITHOUT -nographics (as FlowFieldParityVerify).
|
||||
/// Unity -batchmode -projectPath <repo> -executeMethod Aetheria.EditorTools.GravityFieldParityVerify.Run -logFile <path>
|
||||
/// Do not pass -quit: Run exits the Editor itself, 0 on success and 1 on any failure.
|
||||
/// </summary>
|
||||
public static class GravityFieldParityVerify
|
||||
{
|
||||
const string Tag = "[GravityFieldParityVerify]";
|
||||
const int Size = 256;
|
||||
// Measured on this tree (the "max error" line this run prints): the largest |texel + GetHeight| over the windows of the three
|
||||
// frames and windows is 0.0065 u, in the last frame's planetoid window (float32 on both sides, the GPU's log against the CPU's, the
|
||||
// quad's interpolated world position). The tolerance is 4.6x that. A 0.1% error in the tail constant (.5 -> .501)
|
||||
// moves the drawn height by 0.053 u where all three tails reach (the planetoid and zone windows), 1.8x the
|
||||
// tolerance; a reference of zero moves it by about 150 u.
|
||||
const float Tolerance = 0.03f;
|
||||
// The worst angle between the texture's central difference and GetForce (B28: 1.0 degrees median zone, 2.9 worst).
|
||||
const float GradientDegrees = 3f;
|
||||
static float _maxError, _maxAngle;
|
||||
static bool _ok = true;
|
||||
|
||||
static void OnLog(string message, string stack, LogType type)
|
||||
{
|
||||
if ((type == LogType.Error || type == LogType.Exception || type == LogType.Assert) && !message.StartsWith(Tag))
|
||||
Fail("logged-error", message.Split('\n')[0]);
|
||||
}
|
||||
|
||||
static void Fail(string check, string detail)
|
||||
{
|
||||
Debug.LogError($"{Tag} FAIL {check}: {detail}");
|
||||
_ok = false;
|
||||
}
|
||||
|
||||
public static void Run()
|
||||
{
|
||||
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null)
|
||||
{
|
||||
Debug.LogError($"{Tag} FAIL: no graphics device in this session; rerun batchmode without -nographics.");
|
||||
EditorApplication.Exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
Application.logMessageReceived += OnLog;
|
||||
var work = Path.Combine(Path.GetTempPath(), "gravity-parity-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(work);
|
||||
ComputeBuffer wells = null;
|
||||
GameObject field = null;
|
||||
try
|
||||
{
|
||||
var settings = AssetDatabase.LoadAssetAtPath<GameSettings>("Assets/Resources/Settings.asset")
|
||||
?? throw new InvalidOperationException("No Settings.asset.");
|
||||
var material = AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/Brushes/Gravity Field.mat")
|
||||
?? throw new InvalidOperationException("No Gravity Field.mat.");
|
||||
|
||||
var zone = BuildZone(settings, work, out var orbits);
|
||||
GravityLowering.Lower(zone, ref wells);
|
||||
field = GravityLowering.CreateField(material);
|
||||
|
||||
// Three frames through the one buffer, as ZoneRenderer.Update runs it: the bodies as built, then two moves
|
||||
// (an orbit's Position is what Zone.GetHeight reads). A lowering that mirrors an axis or stops refreshing
|
||||
// the upload agrees with the sim in the first frame only where it is symmetric, and not after a move.
|
||||
CheckFrame("built", zone, orbits);
|
||||
orbits[1].Position = new float2(-420f, 560f);
|
||||
orbits[2].Position = new float2(900f, -700f);
|
||||
GravityLowering.Lower(zone, ref wells);
|
||||
CheckFrame("moved", zone, orbits);
|
||||
orbits[0].Position = new float2(210f, -95f);
|
||||
orbits[2].Position = new float2(-1800f, 1300f);
|
||||
GravityLowering.Lower(zone, ref wells);
|
||||
CheckFrame("moved-again", zone, orbits);
|
||||
Debug.Log($"{Tag} max error {_maxError:G4} u (tolerance {Tolerance:G4}); max gradient angle {_maxAngle:F2} degrees (limit {GradientDegrees:F0})");
|
||||
|
||||
CheckWiring(settings);
|
||||
Debug.Log(_ok ? $"{Tag} PASS" : $"{Tag} FAIL: see errors above");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"{Tag} FAIL exception: {e}");
|
||||
_ok = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.logMessageReceived -= OnLog;
|
||||
if (field != null) UnityEngine.Object.DestroyImmediate(field);
|
||||
wells?.Release();
|
||||
try { Directory.Delete(work, true); } catch { }
|
||||
}
|
||||
EditorApplication.Exit(_ok ? 0 : 1);
|
||||
}
|
||||
|
||||
static float Core(Zone zone, float mass) => zone.Settings.RocheLimit.Evaluate(mass);
|
||||
|
||||
static Vector2 At(Orbit orbit) => new Vector2(orbit.Position.x, orbit.Position.y);
|
||||
|
||||
// Orbits 0-2 are the sun, the planet and the planetoid, each window centred where the body is now; orbit 3 is the
|
||||
// body of no strength. The zone window holds all four.
|
||||
static void CheckFrame(string frame, Zone zone, Orbit[] orbits)
|
||||
{
|
||||
CheckTexels(frame + "-planetoid", zone, At(orbits[2]), 4f * Core(zone, 29.2f));
|
||||
CheckTexels(frame + "-sun", zone, At(orbits[0]), 4f * Core(zone, 14152f));
|
||||
CheckTexels(frame + "-zone", zone, Vector2.zero, 1.05f * zone.Pack.Radius);
|
||||
CheckGradient(zone, orbits.Select(At).ToArray());
|
||||
}
|
||||
|
||||
// A sun (14152 at (-130, 85)), a planet (273.9 at (610, -240)), a planetoid (29.2 at (670, -270)) and a body of
|
||||
// mass 0, whose well has no strength (a legal body; its curves give c = 0 and R = 0), at (1700, 300): parentless,
|
||||
// fixed, off both axes and asymmetric, so the zone's wells sit where the verify says before any Update and a
|
||||
// mirrored or swapped axis cannot agree with the sim.
|
||||
static Zone BuildZone(GameSettings settings, string work, out Orbit[] orbits)
|
||||
{
|
||||
var cache = AetheriaStores.Open(Path.Combine(work, "catalog.cc"), Path.Combine(work, "run.cc"), catalogWritable: true);
|
||||
cache.Upsert(new VerseGrammar { Revision = 1 });
|
||||
cache.FlushAsync().Wait();
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), settings.GameplaySettings, _ => { });
|
||||
var positions = new[] { new Vector2(-130f, 85f), new Vector2(610f, -240f), new Vector2(670f, -270f), new Vector2(1700f, 300f) };
|
||||
var masses = new[] { 14152f, 273.9f, 29.2f, 0f };
|
||||
var keys = new CultRecordKey[positions.Length];
|
||||
var pack = new ZonePack { Radius = 4182f };
|
||||
for (var i = 0; i < positions.Length; i++)
|
||||
{
|
||||
var orbit = keys[i] = cache.Upsert(new OrbitData { FixedPosition = new float2(positions[i].x, positions[i].y) }).Key;
|
||||
var body = cache.Upsert(new PlanetData
|
||||
{ Name = "Body " + i, Orbit = new CultRecordRef<OrbitData>(orbit), Mass = masses[i] }).Key;
|
||||
pack.Orbits.Add(new CultRecordRef<OrbitData>(orbit));
|
||||
pack.Planets.Add(new CultRecordRef<BodyData>(body));
|
||||
}
|
||||
var zone = new Zone(items, settings.PlanetSettings, pack, new GalaxyZone { Name = "Gravity Parity", Owner = null }, null);
|
||||
orbits = keys.Select(k => zone.Orbits[k]).ToArray();
|
||||
return zone;
|
||||
}
|
||||
|
||||
// Renders the field through a downward orthographic camera that culls layer 9 only, centred on `centre` with
|
||||
// half-size `half`, and returns the depth of every texel with the world xz of the texel's centre, which is asked
|
||||
// of the camera rather than assumed.
|
||||
static void Render(Vector2 centre, float half, out float[] depth, out Vector2[] world)
|
||||
{
|
||||
var rt = new RenderTexture(Size, Size, 0, RenderTextureFormat.RFloat) { filterMode = FilterMode.Point };
|
||||
var cameraObject = new GameObject("Gravity Parity Camera");
|
||||
var read = new Texture2D(Size, Size, TextureFormat.RFloat, false);
|
||||
var previous = RenderTexture.active;
|
||||
try
|
||||
{
|
||||
var camera = cameraObject.AddComponent<Camera>();
|
||||
camera.orthographic = true;
|
||||
camera.orthographicSize = half;
|
||||
camera.aspect = 1f;
|
||||
camera.nearClipPlane = .3f;
|
||||
camera.farClipPlane = 1000f;
|
||||
camera.cullingMask = 1 << GravityLowering.FieldLayer;
|
||||
camera.clearFlags = CameraClearFlags.SolidColor;
|
||||
camera.backgroundColor = Color.black;
|
||||
camera.allowHDR = false;
|
||||
camera.allowMSAA = false;
|
||||
camera.targetTexture = rt;
|
||||
cameraObject.transform.SetPositionAndRotation(new Vector3(centre.x, 100f, centre.y), Quaternion.Euler(90f, 0f, 0f));
|
||||
camera.Render();
|
||||
|
||||
RenderTexture.active = rt;
|
||||
read.ReadPixels(new Rect(0, 0, Size, Size), 0, 0);
|
||||
read.Apply();
|
||||
depth = read.GetPixelData<float>(0).ToArray();
|
||||
world = new Vector2[Size * Size];
|
||||
for (var y = 0; y < Size; y++)
|
||||
for (var x = 0; x < Size; x++)
|
||||
{
|
||||
var p = camera.ViewportToWorldPoint(new Vector3((x + .5f) / Size, (y + .5f) / Size, 100f));
|
||||
world[y * Size + x] = new Vector2(p.x, p.z);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
RenderTexture.active = previous;
|
||||
UnityEngine.Object.DestroyImmediate(cameraObject);
|
||||
UnityEngine.Object.DestroyImmediate(read);
|
||||
rt.Release();
|
||||
UnityEngine.Object.DestroyImmediate(rt);
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckTexels(string window, Zone zone, Vector2 centre, float half)
|
||||
{
|
||||
Render(centre, half, out var depth, out var world);
|
||||
var worst = 0f;
|
||||
var live = 0;
|
||||
for (var i = 0; i < depth.Length; i++)
|
||||
{
|
||||
var expected = -zone.GetHeight(new float2(world[i].x, world[i].y));
|
||||
if (float.IsNaN(depth[i])) { Fail($"{window}-texels", $"texel {i}: NaN"); return; }
|
||||
var error = Math.Abs(depth[i] - expected);
|
||||
worst = Math.Max(worst, error);
|
||||
if (Math.Abs(expected) > 1f) live++;
|
||||
if (error > Tolerance)
|
||||
{
|
||||
Fail($"{window}-texels", $"texel {i} at ({world[i].x:F2}, {world[i].y:F2}): expected {expected:G6}, drawn {depth[i]:G6}, error {error:G4} > {Tolerance:G4}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
_maxError = Math.Max(_maxError, worst);
|
||||
// A window that draws nothing agrees with a zone that is flat: the check must be live.
|
||||
if (live < depth.Length / 2) Fail($"{window}-texels", $"only {live} of {depth.Length} texels are deeper than 1 u; the check is vacuous");
|
||||
Debug.Log($"{Tag} {window}: {depth.Length} texels, max error {worst:G4} u");
|
||||
}
|
||||
|
||||
// The texture's central difference (over two 4 u texels, mid-zone) points where GetForce does: depth = -h, so its
|
||||
// gradient is the force over the exaggeration. This is what the slope readers (the shader's slopeFlow, the nebula
|
||||
// surface normal, the drawn grid) take from the texture.
|
||||
static void CheckGradient(Zone zone, Vector2[] bodies)
|
||||
{
|
||||
Render(new Vector2(1500f, 0f), 512f, out var depth, out var world);
|
||||
var compared = 0;
|
||||
for (var y = 1; y < Size - 1; y++)
|
||||
for (var x = 1; x < Size - 1; x++)
|
||||
{
|
||||
var here = world[y * Size + x];
|
||||
if (bodies.Any(b => (b - here).magnitude < 16f)) continue;
|
||||
// The world step of each texel axis is read from the camera, so a flipped or rotated target is still measured.
|
||||
var au = world[y * Size + x + 1] - world[y * Size + x - 1];
|
||||
var av = world[(y + 1) * Size + x] - world[(y - 1) * Size + x];
|
||||
var du = depth[y * Size + x + 1] - depth[y * Size + x - 1];
|
||||
var dv = depth[(y + 1) * Size + x] - depth[(y - 1) * Size + x];
|
||||
var det = au.x * av.y - au.y * av.x;
|
||||
var g = new Vector2((du * av.y - dv * au.y) / det, (dv * au.x - du * av.x) / det);
|
||||
var f = zone.GetForce(new float2(here.x, here.y));
|
||||
var angle = Vector2.Angle(g, new Vector2(f.x, f.y));
|
||||
if (float.IsNaN(angle) || angle > GradientDegrees)
|
||||
{
|
||||
Fail("gradient", $"at ({here.x:F1}, {here.y:F1}) the drawn slope points {angle:F2} degrees from the force (limit {GradientDegrees:F0})");
|
||||
return;
|
||||
}
|
||||
_maxAngle = Math.Max(_maxAngle, angle);
|
||||
compared++;
|
||||
}
|
||||
if (compared < Size * Size / 2) Fail("gradient", $"only {compared} texels were compared");
|
||||
}
|
||||
|
||||
// Main Menu.unity has no ZoneRenderer, so no Gravity Field and no lowered potential: its gravity cameras draw the
|
||||
// menu's own brush objects (Boundary on layer 9, the Waves on layer 10) and are presentation by spec (follow-up
|
||||
// menu-grid-brushes), not a reader of the potential. This pins that: a ZoneRenderer in the menu would make its
|
||||
// cameras readers of the field, and they would have to cull layer 9 alone like ARPG's.
|
||||
static void CheckMenuWiring()
|
||||
{
|
||||
var scene = EditorSceneManager.OpenScene("Assets/Scenes/Main Menu.unity", OpenSceneMode.Single);
|
||||
try
|
||||
{
|
||||
if (UnityEngine.Object.FindFirstObjectByType<ZoneRenderer>(FindObjectsInactive.Include) != null)
|
||||
Fail("wiring", "Main Menu.unity has a ZoneRenderer: its gravity cameras now read the Gravity Field and must cull layer 9 alone");
|
||||
var seen = 0;
|
||||
foreach (var camera in UnityEngine.Object.FindObjectsByType<Camera>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
||||
{
|
||||
if (camera.targetTexture == null || camera.targetTexture.name != "Fog Surface Displacement") continue;
|
||||
seen++;
|
||||
const int menuBrushLayers = (1 << 9) | (1 << 10);
|
||||
if (camera.cullingMask != menuBrushLayers)
|
||||
Fail("wiring", $"Main Menu camera {camera.name} culls mask {camera.cullingMask}, not the menu brush layers 9 and 10");
|
||||
}
|
||||
if (seen != 1) Fail("wiring", $"{seen} Fog Surface Displacement cameras in Main Menu.unity, expected 1");
|
||||
}
|
||||
finally
|
||||
{
|
||||
EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckWiring(GameSettings settings)
|
||||
{
|
||||
var scene = EditorSceneManager.OpenScene("Assets/Scenes/ARPG.unity", OpenSceneMode.Single);
|
||||
try
|
||||
{
|
||||
var gravityTargets = new[] { "Fog Surface Displacement", "Slime Gravity", "MinimapGravity" };
|
||||
var seen = 0;
|
||||
foreach (var camera in UnityEngine.Object.FindObjectsByType<Camera>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
||||
{
|
||||
if (camera.targetTexture == null || !gravityTargets.Contains(camera.targetTexture.name)) continue;
|
||||
seen++;
|
||||
if (camera.cullingMask != 1 << GravityLowering.FieldLayer)
|
||||
Fail("wiring", $"camera {camera.name} (target {camera.targetTexture.name}) culls mask {camera.cullingMask}, not layer {GravityLowering.FieldLayer} alone");
|
||||
}
|
||||
if (seen < gravityTargets.Length) Fail("wiring", $"only {seen} gravity cameras found in ARPG.unity");
|
||||
|
||||
// The map screen's gravity camera has no target until MapRenderer gives it one at run time.
|
||||
var map = UnityEngine.Object.FindFirstObjectByType<MapRenderer>(FindObjectsInactive.Include);
|
||||
if (map == null || map.GravityCamera == null) Fail("wiring", "no MapRenderer.GravityCamera in ARPG.unity");
|
||||
else if (map.GravityCamera.cullingMask != 1 << GravityLowering.FieldLayer)
|
||||
Fail("wiring", $"MapRenderer.GravityCamera culls mask {map.GravityCamera.cullingMask}, not layer {GravityLowering.FieldLayer} alone");
|
||||
|
||||
var renderer = UnityEngine.Object.FindFirstObjectByType<ZoneRenderer>(FindObjectsInactive.Include);
|
||||
if (renderer == null) Fail("wiring", "no ZoneRenderer in ARPG.unity");
|
||||
else if (renderer.GravityField == null || renderer.GravityField.shader.name != "Brushes/Gravity Field")
|
||||
Fail("wiring", "ZoneRenderer.GravityField is not a Brushes/Gravity Field material");
|
||||
|
||||
foreach (var r in UnityEngine.Object.FindObjectsByType<Renderer>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
||||
if (r.gameObject.layer == GravityLowering.FieldLayer)
|
||||
Fail("wiring", $"renderer {r.name} in ARPG.unity sits on layer {GravityLowering.FieldLayer}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
|
||||
}
|
||||
|
||||
CheckMenuWiring();
|
||||
|
||||
foreach (var path in new[]
|
||||
{
|
||||
"Assets/Prefabs/RPG/Planets/Planet.prefab", "Assets/Prefabs/RPG/Planets/Gas Giant.prefab",
|
||||
"Assets/Prefabs/RPG/Planets/Sun.prefab", "Assets/Prefabs/RPG/Wormhole 1.prefab"
|
||||
})
|
||||
{
|
||||
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(path);
|
||||
if (prefab == null) { Fail("wiring", $"no prefab at {path}"); continue; }
|
||||
foreach (var r in prefab.GetComponentsInChildren<Renderer>(true))
|
||||
if (r.gameObject.layer == GravityLowering.FieldLayer)
|
||||
Fail("wiring", $"renderer {r.name} in {path} sits on layer {GravityLowering.FieldLayer}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Editor/GravityFieldParityVerify.cs.meta
Normal file
11
Assets/Scripts/Editor/GravityFieldParityVerify.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1ceb2bdab0804463b1998471d47e82fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/ServerShared/GravityField.cs
Normal file
32
Assets/Scripts/ServerShared/GravityField.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using CultMath;
|
||||
using static CultMath.math;
|
||||
using float2 = CultMath.float2;
|
||||
|
||||
/// <summary>
|
||||
/// The law of one gravity well: a 2D point mass with a softened core. Outside the core radius the potential is
|
||||
/// logarithmic and the pull is c / r; inside it the pull falls linearly to zero at the centre and meets the tail in
|
||||
/// value and slope at the core radius. c is the well's strength (u^2/s^2), R its core radius (u). No threshold
|
||||
/// anywhere: a well pulls at every distance. Zone.GetForce and Zone.GetHeight sum this over a zone's bodies.
|
||||
/// </summary>
|
||||
public static class GravityField
|
||||
{
|
||||
// The tail's additive constant: it makes the tail meet the core in value at the core radius. Gravity.cginc is generated from it.
|
||||
public const float TailOffset = .5f;
|
||||
|
||||
// The potential at distance r from the body, defined up to a constant (callers subtract their reference).
|
||||
// A well of no strength (a body whose curves are unauthored, so c = 0 and R = 0) digs nothing.
|
||||
public static float Potential(float c, float coreRadius, float r) =>
|
||||
c == 0f ? 0f :
|
||||
r < coreRadius
|
||||
? c * r * r / (2 * coreRadius * coreRadius)
|
||||
: c * (log(r / coreRadius) + TailOffset);
|
||||
|
||||
// The acceleration at `offsetFromBody`, toward the body: zero at the body itself.
|
||||
public static float2 Acceleration(float c, float coreRadius, float2 offsetFromBody)
|
||||
{
|
||||
var r = length(offsetFromBody);
|
||||
if (r == 0f) return float2.zero;
|
||||
var pull = r < coreRadius ? c * r / (coreRadius * coreRadius) : c / r;
|
||||
return -offsetFromBody / r * pull;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/ServerShared/GravityField.cs.meta
Normal file
11
Assets/Scripts/ServerShared/GravityField.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5b0c7d3e9a1f4e2c8d6a7f1b3c9e0a42
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Assets/Scripts/ServerShared/GravityShader.cs
Normal file
63
Assets/Scripts/ServerShared/GravityShader.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using System.Globalization;
|
||||
|
||||
/// <summary>
|
||||
/// The single author of Assets/Shaders/Gravity.cginc, the GPU lowering of the zone's potential. The law is
|
||||
/// GravityField's (its constants are read here, not respelled) and the height is Zone.GetHeight: each well's
|
||||
/// potential minus its reference, summed, divided by the exaggeration. Unity does not run C# when it imports a
|
||||
/// shader, so the committed cginc is this output; GravityShaderTests fails unless it equals Source() exactly.
|
||||
/// To change the shader, change this file and regenerate: AETHERIA_REGENERATE_GRAVITY_CGINC=1 dotnet test --filter GravityShaderTests.
|
||||
/// </summary>
|
||||
public static class GravityShader
|
||||
{
|
||||
public const string Path = "Assets/Shaders/Gravity.cginc";
|
||||
|
||||
/// <summary>The whole file, with LF line ends.</summary>
|
||||
public static string Source() => (Template
|
||||
.Replace("@TAIL@", GravityField.TailOffset.ToString("R", CultureInfo.InvariantCulture)))
|
||||
.Replace("\r\n", "\n");
|
||||
|
||||
private const string Template = @"#ifndef AETHERIA_GRAVITY_INCLUDED
|
||||
#define AETHERIA_GRAVITY_INCLUDED
|
||||
|
||||
// GENERATED by ServerShared/GravityShader.cs from GravityField; do not edit (GravityShaderTests fails on any difference).
|
||||
// The lowering of the zone's potential (aetheria-gravity, cut grid-lowering). The law is ServerShared's GravityField
|
||||
// and the height is Zone.GetHeight; this file decides nothing. GravityLowering.Lower fills the buffer and the globals
|
||||
// from the zone (positions from Orbit.Position, reference from Zone.WellReference) each frame.
|
||||
// GravityFieldParityVerify renders it and compares every texel with -Zone.GetHeight.
|
||||
|
||||
struct GravityWell
|
||||
{
|
||||
float2 position;
|
||||
float strength;
|
||||
float coreRadius;
|
||||
float reference;
|
||||
};
|
||||
|
||||
StructuredBuffer<GravityWell> _GravityWells;
|
||||
int _GravityWellCount;
|
||||
float _HeightExaggeration;
|
||||
|
||||
// GravityField.Potential: c is the well's strength, R its core radius, r the distance.
|
||||
float gravityPotential(float c, float R, float r)
|
||||
{
|
||||
return c == 0 ? 0 :
|
||||
r < R
|
||||
? c * r * r / (2 * R * R)
|
||||
: c * (log(r / R) + @TAIL@);
|
||||
}
|
||||
|
||||
// Zone.GetHeight at world xz: each well's potential minus its own reference, summed, divided by the exaggeration.
|
||||
float gravityHeight(float2 p)
|
||||
{
|
||||
float result = 0;
|
||||
for (int i = 0; i < _GravityWellCount; i++)
|
||||
{
|
||||
GravityWell well = _GravityWells[i];
|
||||
result += gravityPotential(well.strength, well.coreRadius, length(p - well.position)) - well.reference;
|
||||
}
|
||||
return result / _HeightExaggeration;
|
||||
}
|
||||
|
||||
#endif
|
||||
";
|
||||
}
|
||||
11
Assets/Scripts/ServerShared/GravityShader.cs.meta
Normal file
11
Assets/Scripts/ServerShared/GravityShader.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9a3fa1e9df764459b709270e58e79974
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -4,20 +4,26 @@ using static ItemRotation;
|
|||
public sealed class Crossing : Scenario
|
||||
{
|
||||
public override string Name => "Crossing";
|
||||
public override string Brief => "A Lightning Projector at the starboard gun and a Cell Blaster at the port gun, a fast Djinni crossing close ahead and an " +
|
||||
"unpiloted one waiting at range. The Djinni starts to port moving across the bow; the arena's gravity bends its run. Make the pass coasting: give no throttle until the Djinni has crossed the bow, then fly freely (thrusting from the start carries you past it). Verify: as the Djinni crosses close, FastBlast lands some and projector " +
|
||||
public override string Brief => "A Lightning Projector at the starboard gun and a Cell Blaster at the port gun, an unpiloted Djinni coasting across the bow " +
|
||||
"close ahead and an unpiloted one waiting at range. The crosser is launched to port at 50 m/s and only coasts: nothing steers it, " +
|
||||
"its hull drag slows it to about 25 m/s at the bow line, and it does not shoot back. Make the pass coasting: give no throttle until the Djinni has crossed the bow, then fly freely " +
|
||||
"(thrusting from the start carries you past it). Verify: as the Djinni crosses close, FastBlast lands some and projector " +
|
||||
"almost none; against the Djinni at range both land. Fly it again without the Fire Control Array: " +
|
||||
"with it the small gun lands more.";
|
||||
public override uint Seed => 112;
|
||||
public override bool Ambient => false;
|
||||
|
||||
// Where the Djinni sit: the player is at the origin facing +z. The crosser starts ahead and to port, facing across
|
||||
// the bow and already moving at the Djinni's 50 m/s cap, so its run sweeps across the bow within seconds (the arena
|
||||
// pulls the player to port, which brings the two together). The waiting Djinni sits inside the Lightning Projector's arc at 80% of
|
||||
// its Range.
|
||||
public static readonly CultMath.float2 CrosserAt = float2(-150, 200), CrosserFacing = float2(1, 0), CrosserVelocity = float2(50, 0);
|
||||
// Where the Djinni sit: the player is at Origin facing +z. Origin is 250 m or more from every body, where the zone's
|
||||
// pull is weakest (about 1.4 u/s^2; the sum of the wells never drops to nothing, and at the old origin the player sat on the star).
|
||||
// The crosser is unpiloted and placed moving at the Djinni's 50 m/s cap, so its pass is ballistic: bent by the field and slowed
|
||||
// by hull drag (it reaches the bow line at about 25 m/s relative to the player, 3.6 s in), and nothing steers it.
|
||||
// CrosserAt is the centre of the start window in which the pass holds: shifting it by 10 m along either axis keeps the pass
|
||||
// inside the test's time and distance windows (CrossingHoldsAcrossTheStartWindow).
|
||||
// The waiting Djinni sits inside the Lightning Projector's arc at 80% of its Range.
|
||||
public static readonly CultMath.float2 Origin = float2(724, 124);
|
||||
public static readonly CultMath.float2 CrosserAt = Origin + float2(-128, 45), CrosserFacing = float2(1, 0), CrosserVelocity = float2(50, 0);
|
||||
public const float ProjectorRange = 1216f; // the Lightning Projector's Range in metres, 1216.4 as the fit stands settled at rest
|
||||
public static readonly CultMath.float2 Waiting = float2(0, ProjectorRange * .8f);
|
||||
public static readonly CultMath.float2 Waiting = Origin + float2(0, ProjectorRange * .8f);
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
|
||||
|
|
@ -39,8 +45,8 @@ public sealed class Crossing : Scenario
|
|||
("Compact Sensor", int2(3, 10), None),
|
||||
("Fire Control Array", int2(1, 6), Clockwise));
|
||||
|
||||
stage.Player(fighter, float2(0, 0), facing: float2(0, 1));
|
||||
stage.Place(stage.Generated("Djinni"), CrosserAt, facing: CrosserFacing, stance: ScenarioStance.Hostile, piloted: true, velocity: CrosserVelocity);
|
||||
stage.Player(fighter, Origin, facing: float2(0, 1));
|
||||
stage.Place(stage.Generated("Djinni"), CrosserAt, facing: CrosserFacing, stance: ScenarioStance.Hostile, velocity: CrosserVelocity);
|
||||
stage.Place(stage.Bare("Djinni"), Waiting);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ public sealed class LockOn : Scenario
|
|||
public override uint Seed => 113;
|
||||
public override bool Ambient => false;
|
||||
|
||||
// The hostile starts about 4000 m off, to the side of the player's axis, facing the player. At that range its passive
|
||||
// sensors hold no track of the player (the test asks the sim's own PassiveInfo against the detection threshold); the
|
||||
// player sees the hostile a little sooner, at about tick 20. The hostile closes, sees the player some eight seconds in,
|
||||
// and locks two ticks later. At Duel's 900 m (and at 600 m) it sees and locks within a second.
|
||||
public static readonly CultMath.float2 HostileAt = float2(1500, 3700);
|
||||
// The hostile starts about 4000 m off, ahead and to port of the player, facing the player. At that range its passive
|
||||
// sensors hold no track of the player (the test asks the sim's own PassiveInfo against the detection threshold). The
|
||||
// hostile closes, sees the player some fourteen seconds in and locks. The zone's pull bends the hostile's run and moves the
|
||||
// player, and the warning must still point at where the hostile was staged to within 5 degrees at the lock: this side keeps
|
||||
// the bend under one degree (on the far side it is more than seven). At Duel's 900 m (and at 600 m) it sees and locks
|
||||
// within a second.
|
||||
public static readonly CultMath.float2 HostileAt = float2(-2000, 3450);
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,22 @@ using static CultMath.math;
|
|||
[Serializable, MessagePackObject(keyAsPropertyName:true), JsonObject]
|
||||
public class PlanetSettings
|
||||
{
|
||||
public ExponentialCurve GravityDepth;
|
||||
public ExponentialCurve GravityRadius;
|
||||
public ExponentialCurve LightRadius;
|
||||
public ExponentialCurve BodyRadius;
|
||||
|
||||
// The closest a child may orbit its parent, in u, by the parent's mass, and the softened core radius of the parent's
|
||||
// well (the steepest drawn slope sits at the Roche limit). Authored like BodyRadius, never per body.
|
||||
public ExponentialCurve RocheLimit = new ExponentialCurve();
|
||||
|
||||
// A body's well strength by its mass (GravityField): c in u^2/s^2 (the pull is c / r beyond the core, which is the Roche limit).
|
||||
public ExponentialCurve WellStrength = new ExponentialCurve();
|
||||
|
||||
// The one global exaggeration of gravity height: height = potential / K, in u/s^2 per unit of height.
|
||||
public float HeightExaggeration = 1f;
|
||||
public float AsteroidVerticalOffset = -5f;
|
||||
public ExponentialLerp AsteroidSize;
|
||||
public ExponentialLerp AsteroidHitpoints;
|
||||
public ExponentialLerp AsteroidRespawnTime;
|
||||
public float GravityStrength;
|
||||
public float SecureAreaRadiusMultiplier = .45f;
|
||||
|
||||
public ExponentialCurve OrbitPeriod;
|
||||
|
|
|
|||
|
|
@ -130,9 +130,8 @@ public class Ship : Entity
|
|||
|
||||
Position.xz += Velocity * delta;
|
||||
|
||||
Velocity += Zone.GetForce(Position.xz) * delta;
|
||||
var normal = Zone.GetNormal(Position.xz);
|
||||
var force = new float2(normal.x, normal.z);
|
||||
Velocity += Zone.GravityAcceleration(force, Zone.Settings.GravityStrength) * delta;
|
||||
var shipRight = Direction.Rotate(ItemRotation.Clockwise);
|
||||
var forward = cross(float3(shipRight.x, 0, shipRight.y), normal);
|
||||
Rotation = quaternion.LookRotation(forward, normal);
|
||||
|
|
|
|||
|
|
@ -612,22 +612,20 @@ public class Zone
|
|||
return security;
|
||||
}
|
||||
|
||||
// The potential of a body's well at the zone's edge, subtracted so every well is zero there: the one owner of the
|
||||
// reference. GetHeight sums with it and the renderer's lowering (GravityLowering) hands it to the shader unchanged.
|
||||
public float WellReference(Planet body) => GravityField.Potential(body.WellStrength, body.RocheLimit, Pack.Radius);
|
||||
|
||||
public float GetHeight(float2 position)
|
||||
{
|
||||
var result = 0f;
|
||||
foreach (var body in PlanetInstances.Values)
|
||||
{
|
||||
var p = position - body.Orbit.Position; //GetOrbitPosition(body.BodyData.Orbit)
|
||||
var distSqr = lengthsq(p);
|
||||
var gravityRadius = body.GravityWellRadius;
|
||||
if (distSqr < gravityRadius*gravityRadius)
|
||||
{
|
||||
var depth = body.GravityWellDepth;
|
||||
result -= PowerPulse(sqrt(distSqr) / gravityRadius, body.BodyData.GravityDepthExponent) * depth;
|
||||
}
|
||||
var offset = position - body.Orbit.Position;
|
||||
result += GravityField.Potential(body.WellStrength, body.RocheLimit, length(offset)) - WellReference(body);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result / Settings.HeightExaggeration;
|
||||
}
|
||||
|
||||
public float GetLight(float2 position)
|
||||
|
|
@ -647,33 +645,21 @@ public class Zone
|
|||
internal float SchematicCellSize => _itemManager.GameplaySettings.SchematicCellSize;
|
||||
internal float FieldCrossSection(AsteroidBeltData belt) => _itemManager.ItemData.Get(belt.Kind)?.CrossSection ?? 0f;
|
||||
|
||||
// The one law of how a gravity well pushes anything: ships, floating items and mines all read it. The shape is
|
||||
// the one ships have always felt, normalize(f) * strength * (1 / (1 - |f|^2) - 1), gated off below |f|^2 = .001.
|
||||
// It is an acceleration, per second: the legacy law added that amount once per 60 fps frame with no dt, so
|
||||
// GravityReferenceRate (60) restates it and `acceleration * dt` gives the legacy push at 60 fps.
|
||||
public const float GravityReferenceRate = 60f;
|
||||
|
||||
public static float2 GravityAcceleration(float2 normalXz, float strength)
|
||||
{
|
||||
var magnitude = lengthsq(normalXz);
|
||||
if (magnitude <= .001f) return float2.zero;
|
||||
return normalize(normalXz) * strength * (1 / (1 - magnitude) - 1) * GravityReferenceRate;
|
||||
}
|
||||
|
||||
// The acceleration the well exerts at `position`.
|
||||
// The one source of gravitational acceleration (u/s^2): the sum of every body's well (GravityField). Ships,
|
||||
// floating items, clouds and mines all read it, and so does Flow. It is the gradient of the potential GetHeight
|
||||
// draws, so the two cannot disagree.
|
||||
public float2 GetForce(float2 position)
|
||||
{
|
||||
var normal = GetNormal(position);
|
||||
return GravityAcceleration(new float2(normal.x, normal.z), Settings.GravityStrength);
|
||||
var force = float2.zero;
|
||||
foreach (var body in PlanetInstances.Values)
|
||||
force += GravityField.Acceleration(body.WellStrength, body.RocheLimit, position - body.Orbit.Position);
|
||||
return force;
|
||||
}
|
||||
|
||||
// The global flow velocity at `position` in zone time, in u/s (FlowField is the law). The slope term reads the
|
||||
// downhill gradient, which GetNormal's xz is proportional to.
|
||||
public float3 Flow(float3 position)
|
||||
{
|
||||
var normal = GetNormal(position.xz);
|
||||
return FlowField.At(Settings.Flow, position, FlowScroll, new float2(normal.x, normal.z));
|
||||
}
|
||||
// downhill direction, which is the force.
|
||||
public float3 Flow(float3 position) =>
|
||||
FlowField.At(Settings.Flow, position, FlowScroll, GetForce(position.xz));
|
||||
|
||||
// The flow's noise scroll at zone time (Zone.Flow evaluates at exactly this); lowered to the shaders' _FlowScroll.
|
||||
public float2 FlowScroll => FlowField.Scroll(Settings.Flow, _time);
|
||||
|
|
@ -688,16 +674,12 @@ public class Zone
|
|||
return pow((x + 1) * (1 - x), exponent);
|
||||
}
|
||||
|
||||
public float3 GetNormal(float2 pos, float step = .1f, float mul = 1)
|
||||
// The surface normal of the drawn height (potential / K), derived from the force. Display only (ship tilt): the
|
||||
// sim never reads it as a force.
|
||||
public float3 GetNormal(float2 pos)
|
||||
{
|
||||
float hL = GetHeight(new float2(pos.x - step, pos.y)) * mul;
|
||||
float hR = GetHeight(new float2(pos.x + step, pos.y)) * mul;
|
||||
float hD = GetHeight(new float2(pos.x, pos.y - step)) * mul;
|
||||
float hU = GetHeight(new float2(pos.x, pos.y + step)) * mul;
|
||||
|
||||
// Deduce terrain normal
|
||||
float3 normal = new float3((hL - hR), (hD - hU), step*2);
|
||||
return normalize(normal).xzy;
|
||||
var slope = GetForce(pos) / Settings.HeightExaggeration;
|
||||
return normalize(new float3(slope.x, 1f, slope.y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -706,10 +688,13 @@ public class Planet
|
|||
public Orbit Orbit;
|
||||
protected readonly PlanetSettings Settings;
|
||||
public BodyData BodyData;
|
||||
public float GravityWellDepth;
|
||||
public float GravityWellRadius;
|
||||
public float BodyRadius;
|
||||
|
||||
// The well (GravityField): strength c by mass, and the Roche limit, which is both the closest a child may orbit and
|
||||
// the well's softened core radius R (one curve of mass, never per body). Both are authored PlanetSettings curves.
|
||||
public float WellStrength;
|
||||
public float RocheLimit;
|
||||
|
||||
public Planet(PlanetSettings settings, BodyData data, Orbit orbit)
|
||||
{
|
||||
Settings = settings;
|
||||
|
|
@ -721,8 +706,12 @@ public class Planet
|
|||
public void CalculateProperties()
|
||||
{
|
||||
BodyRadius = Settings.BodyRadius.Evaluate(BodyData.Mass) * BodyData.BodyRadiusMultiplier;
|
||||
GravityWellRadius = Settings.GravityRadius.Evaluate(BodyData.Mass) * BodyData.GravityRadiusMultiplier;
|
||||
GravityWellDepth = Settings.GravityDepth.Evaluate(BodyData.Mass) * BodyData.GravityDepthMultiplier;
|
||||
WellStrength = Settings.WellStrength.Evaluate(BodyData.Mass);
|
||||
RocheLimit = Settings.RocheLimit.Evaluate(BodyData.Mass);
|
||||
if (!(WellStrength >= 0f) || float.IsInfinity(WellStrength))
|
||||
throw new InvalidOperationException("A body's well strength must be finite and not negative (PlanetSettings.WellStrength).");
|
||||
if (WellStrength > 0 && !(RocheLimit > 0f && !float.IsInfinity(RocheLimit)))
|
||||
throw new InvalidOperationException("A body's Roche limit, which is its core radius, must be positive and finite (PlanetSettings.RocheLimit).");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,15 +86,6 @@ public abstract class BodyData
|
|||
|
||||
[JsonProperty("bodyRadiusMul")] [Key(5)]
|
||||
public float BodyRadiusMultiplier = 1;
|
||||
|
||||
[JsonProperty("gravRadiusMul")] [Key(6)]
|
||||
public float GravityRadiusMultiplier = 1;
|
||||
|
||||
[JsonProperty("depthMul")] [Key(7)]
|
||||
public float GravityDepthMultiplier = 1;
|
||||
|
||||
[JsonProperty("depthExp")] [Key(8)]
|
||||
public float GravityDepthExponent = 16;
|
||||
}
|
||||
|
||||
[CultDocument("aetheria.planetdata", "1"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
|
|
|
|||
78
Assets/Scripts/Zone Display/GravityLowering.cs
Normal file
78
Assets/Scripts/Zone Display/GravityLowering.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// The renderer's lowering of the zone's potential (aetheria-gravity, cut grid-lowering). Zone.GetHeight owns the drawn
|
||||
/// height: this hands its inputs (each well's position, strength, core radius and reference, and the exaggeration) to
|
||||
/// Assets/Shaders/Gravity.cginc, which sums them per texel, and makes the one quad that carries the sum into every
|
||||
/// camera that culls layer 9. Nothing here decides a height.
|
||||
/// </summary>
|
||||
public static class GravityLowering
|
||||
{
|
||||
/// <summary>The layer the gravity cameras cull; nothing but the run-time field sits on it.</summary>
|
||||
public const int FieldLayer = 9;
|
||||
/// <summary>The quad's side in u: larger than any zone (10000) plus any view (4096); texels outside a camera cost nothing.</summary>
|
||||
public const float FieldExtent = 100000f;
|
||||
|
||||
// Mirrors the well record of Gravity.cginc: float2 position, strength, coreRadius, reference.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct WellRecord
|
||||
{
|
||||
public Vector2 Position;
|
||||
public float Strength;
|
||||
public float CoreRadius;
|
||||
public float Reference;
|
||||
}
|
||||
|
||||
static readonly int Stride = Marshal.SizeOf<WellRecord>();
|
||||
static readonly int WellsId = Shader.PropertyToID("_GravityWells");
|
||||
static readonly int CountId = Shader.PropertyToID("_GravityWellCount");
|
||||
static readonly int ExaggerationId = Shader.PropertyToID("_HeightExaggeration");
|
||||
static WellRecord[] _records = new WellRecord[0];
|
||||
|
||||
/// <summary>
|
||||
/// Fills one record per body of the zone (a null zone has none) and sets the shader globals. The buffer is the
|
||||
/// caller's, (re)allocated to the body count (at least one, so the global is always bound).
|
||||
/// </summary>
|
||||
public static void Lower(Zone zone, ref ComputeBuffer wells)
|
||||
{
|
||||
var count = zone?.PlanetInstances.Count ?? 0;
|
||||
var capacity = Mathf.Max(count, 1);
|
||||
if (wells == null || wells.count != capacity)
|
||||
{
|
||||
wells?.Release();
|
||||
wells = new ComputeBuffer(capacity, Stride);
|
||||
}
|
||||
|
||||
if (_records.Length != capacity) _records = new WellRecord[capacity];
|
||||
var i = 0;
|
||||
if (zone != null)
|
||||
foreach (var body in zone.PlanetInstances.Values)
|
||||
_records[i++] = new WellRecord
|
||||
{
|
||||
Position = new Vector2(body.Orbit.Position.x, body.Orbit.Position.y),
|
||||
Strength = body.WellStrength,
|
||||
CoreRadius = body.RocheLimit,
|
||||
Reference = zone.WellReference(body)
|
||||
};
|
||||
wells.SetData(_records);
|
||||
|
||||
Shader.SetGlobalBuffer(WellsId, wells);
|
||||
Shader.SetGlobalInt(CountId, count);
|
||||
Shader.SetGlobalFloat(ExaggerationId, zone?.Settings.HeightExaggeration ?? 1f);
|
||||
}
|
||||
|
||||
/// <summary>The one quad of the field: flat in xz at y 0 on layer 9, drawn with the Gravity Field material.</summary>
|
||||
public static GameObject CreateField(Material material)
|
||||
{
|
||||
var field = new GameObject("Gravity Field") { layer = FieldLayer };
|
||||
field.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
|
||||
field.transform.localScale = FieldExtent * Vector3.one;
|
||||
field.AddComponent<MeshFilter>().sharedMesh = Resources.GetBuiltinResource<Mesh>("Quad.fbx");
|
||||
var renderer = field.AddComponent<MeshRenderer>();
|
||||
renderer.sharedMaterial = material;
|
||||
renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
renderer.receiveShadows = false;
|
||||
return field;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Zone Display/GravityLowering.cs.meta
Normal file
11
Assets/Scripts/Zone Display/GravityLowering.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1a5e08474b514e509ed1477b3ac06e94
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -9,7 +9,6 @@ using UnityEngine;
|
|||
public class PlanetObject : MonoBehaviour
|
||||
{
|
||||
public MeshRenderer Body;
|
||||
public MeshRenderer GravityWell;
|
||||
public MeshRenderer Icon;
|
||||
public CelestialBodyGenerator Generator;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class ZoneRenderer : MonoBehaviour
|
|||
public MineInstance MinePrefab;
|
||||
public VapourCloudInstance CloudPrefab;
|
||||
public Material[] MapGravityMaterials;
|
||||
// The gravity field's material (Brushes/Gravity Field): GravityLowering makes the one quad that draws it.
|
||||
public Material GravityField;
|
||||
|
||||
[Header("Tour")] public bool Tour;
|
||||
public float TourSwitchTime = 5f;
|
||||
|
|
@ -77,7 +79,8 @@ public class ZoneRenderer : MonoBehaviour
|
|||
// is stored on AsteroidBelt any more.
|
||||
private Dictionary<CultRecordKey, float4[]> _beltTransforms = new Dictionary<CultRecordKey, float4[]>();
|
||||
private float _viewDistance;
|
||||
//private float _maxDepth;
|
||||
private GameObject _gravityField;
|
||||
private ComputeBuffer _gravityWells;
|
||||
private float _minimapDistance;
|
||||
|
||||
private int _tourIndex = -1;
|
||||
|
|
@ -195,6 +198,7 @@ public class ZoneRenderer : MonoBehaviour
|
|||
SectorBrushes.localScale = zone.Pack.Radius * 2 * Vector3.one;
|
||||
SlimeGravityCamera.orthographicSize = zone.Pack.Radius;
|
||||
SlimeRenderer.ZoneRadius = zone.Pack.Radius;
|
||||
if (_gravityField == null) _gravityField = GravityLowering.CreateField(GravityField);
|
||||
foreach (var p in zone.Planets)
|
||||
LoadPlanet(p.Key, p.Value);
|
||||
|
||||
|
|
@ -321,9 +325,17 @@ public class ZoneRenderer : MonoBehaviour
|
|||
WormholeInstances.Add(wormhole, (instance.gameObject, icon));
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
_gravityWells?.Release();
|
||||
_gravityWells = null;
|
||||
}
|
||||
|
||||
public void ClearZone()
|
||||
{
|
||||
if (Zone == null) return;
|
||||
_gravityWells?.Release();
|
||||
_gravityWells = null;
|
||||
foreach (var wormhole in WormholeInstances.Values)
|
||||
{
|
||||
Destroy(wormhole.gravity);
|
||||
|
|
@ -491,11 +503,6 @@ public class ZoneRenderer : MonoBehaviour
|
|||
|
||||
var planetInstance = Zone.PlanetInstances[key];
|
||||
planet.Body.transform.localScale = planetInstance.BodyRadius * Vector3.one;
|
||||
planet.GravityWell.transform.localScale = planetInstance.GravityWellRadius * Vector3.one;
|
||||
// var depth = planetInstance.GravityWellDepth;
|
||||
// if (depth > _maxDepth) _maxDepth = depth;
|
||||
planet.GravityWell.material.SetFloat("_Depth", planetInstance.GravityWellDepth);
|
||||
planet.Icon.transform.position = new Vector3(0, -planetInstance.GravityWellDepth, 0);
|
||||
planet.Icon.transform.localScale = Settings.IconSize.Evaluate(planetInstance.BodyData.Mass) * Vector3.one;
|
||||
|
||||
|
||||
|
|
@ -513,6 +520,7 @@ public class ZoneRenderer : MonoBehaviour
|
|||
void Update()
|
||||
{
|
||||
var maxDepth = 0f;
|
||||
GravityLowering.Lower(Zone, ref _gravityWells);
|
||||
foreach (var loot in _floatingItems.Values)
|
||||
{
|
||||
loot.ViewOrigin = PerspectiveEntity.Position;
|
||||
|
|
@ -576,6 +584,7 @@ public class ZoneRenderer : MonoBehaviour
|
|||
if (-height > maxDepth) maxDepth = -height;
|
||||
planet.Value.transform.position = new Vector3(p.x, 0, p.y);
|
||||
planet.Value.Body.transform.localPosition = new Vector3(0, height + planetInstance.BodyRadius * 2, 0);
|
||||
planet.Value.Icon.transform.localPosition = new Vector3(0, height, 0);
|
||||
if (planet.Value is GasGiantObject gasGiantObject)
|
||||
{
|
||||
if (!(planet.Value is SunObject))
|
||||
|
|
|
|||
47
Assets/Shaders/Brushes/GravityField.shader
Normal file
47
Assets/Shaders/Brushes/GravityField.shader
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// Draws the zone's gravity: depth = -Zone.GetHeight at the world xz of every texel, into whichever gravity camera culls
|
||||
// layer 9 (Surface Displacement, Patch Displacement, Slime Gravity, both Map Gravity). One quad covers the zone; the
|
||||
// law lives in Gravity.cginc, which mirrors ServerShared's GravityField.
|
||||
Shader "Brushes/Gravity Field" {
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend One One
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
|
||||
SubShader {
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 4.5
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "../Gravity.cginc"
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 world : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.world = mul(unity_ObjectToWorld, v.vertex).xz;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (v2f i) : SV_Target
|
||||
{
|
||||
return (-gravityHeight(i.world)).xxxx;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8a8e593b17063b54ea02f7ea5363b59d
|
||||
guid: 08d8efa80af84065b54c9bfed784e435
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
Shader "Brushes/Radial Wave Brush" {
|
||||
Properties {
|
||||
_Depth ("Depth", Float) = 0.5
|
||||
_Power("Envelope Power", Float) = 1.25
|
||||
_Frequency("Frequency", Float) = 6.2832
|
||||
_Phase("Phase", Float) = 0
|
||||
_SinePower("Sine Power", Float) = 1.25
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend One One
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
|
||||
SubShader {
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
float _Depth;
|
||||
float _Power;
|
||||
float _Frequency;
|
||||
float _Phase;
|
||||
float _SinePower;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.color = v.color;
|
||||
o.texcoord = v.texcoord;
|
||||
return o;
|
||||
}
|
||||
|
||||
float almostIdentity(float x, float m, float n)
|
||||
{
|
||||
if (x>m) return x;
|
||||
|
||||
const float a = 2.0f*n - m;
|
||||
const float b = 2.0f*m - 3.0f*n;
|
||||
const float t = x / m;
|
||||
|
||||
return (a*t + b)*t*t + n;
|
||||
}
|
||||
|
||||
float powerPulse( float x, float power )
|
||||
{
|
||||
x = saturate(abs(x));
|
||||
return pow((x + 1.0f) * (1.0f - x), power);
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
float dist = length(i.texcoord - float2(.5,.5)) * 2;
|
||||
return _Depth * powerPulse(dist,_Power) * cos(pow(dist, _SinePower)*_Frequency+_Phase);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
Shader "Brushes/Wormhole Brush" {
|
||||
Properties {
|
||||
_Depth ("Depth", Float) = 0.5
|
||||
_Power("Envelope Power", Float) = 1.25
|
||||
_Frequency("Frequency", Float) = 6.2832
|
||||
_FrequencyDist("Distance Frequency", Float) = 6.2832
|
||||
_Speed("Speed", Float) = 0
|
||||
_SinePower("Sine Power", Float) = 1.25
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
Blend One One
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
|
||||
SubShader {
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
float _Depth;
|
||||
float _Power;
|
||||
float _Frequency;
|
||||
float _FrequencyDist;
|
||||
float _Speed;
|
||||
float _SinePower;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.color = v.color;
|
||||
o.texcoord = v.texcoord;
|
||||
return o;
|
||||
}
|
||||
|
||||
float almostIdentity(float x, float m, float n)
|
||||
{
|
||||
if (x>m) return x;
|
||||
|
||||
const float a = 2.0f*n - m;
|
||||
const float b = 2.0f*m - 3.0f*n;
|
||||
const float t = x / m;
|
||||
|
||||
return (a*t + b)*t*t + n;
|
||||
}
|
||||
|
||||
float powerPulse( float x, float power )
|
||||
{
|
||||
x = saturate(abs(x));
|
||||
return pow((x + 1.0f) * (1.0f - x), power);
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
float2 uv2 = i.texcoord - float2(.5,.5);
|
||||
float dist = length(uv2);
|
||||
float ang = atan2(uv2.y,uv2.x);
|
||||
return _Depth * powerPulse(dist * 2,_Power) * (cos(ang*_Frequency+pow(dist, _SinePower)*_FrequencyDist+_Time.x*_Speed)+1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
43
Assets/Shaders/Gravity.cginc
Normal file
43
Assets/Shaders/Gravity.cginc
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef AETHERIA_GRAVITY_INCLUDED
|
||||
#define AETHERIA_GRAVITY_INCLUDED
|
||||
|
||||
// GENERATED by ServerShared/GravityShader.cs from GravityField; do not edit (GravityShaderTests fails on any difference).
|
||||
// The lowering of the zone's potential (aetheria-gravity, cut grid-lowering). The law is ServerShared's GravityField
|
||||
// and the height is Zone.GetHeight; this file decides nothing. GravityLowering.Lower fills the buffer and the globals
|
||||
// from the zone (positions from Orbit.Position, reference from Zone.WellReference) each frame.
|
||||
// GravityFieldParityVerify renders it and compares every texel with -Zone.GetHeight.
|
||||
|
||||
struct GravityWell
|
||||
{
|
||||
float2 position;
|
||||
float strength;
|
||||
float coreRadius;
|
||||
float reference;
|
||||
};
|
||||
|
||||
StructuredBuffer<GravityWell> _GravityWells;
|
||||
int _GravityWellCount;
|
||||
float _HeightExaggeration;
|
||||
|
||||
// GravityField.Potential: c is the well's strength, R its core radius, r the distance.
|
||||
float gravityPotential(float c, float R, float r)
|
||||
{
|
||||
return c == 0 ? 0 :
|
||||
r < R
|
||||
? c * r * r / (2 * R * R)
|
||||
: c * (log(r / R) + 0.5);
|
||||
}
|
||||
|
||||
// Zone.GetHeight at world xz: each well's potential minus its own reference, summed, divided by the exaggeration.
|
||||
float gravityHeight(float2 p)
|
||||
{
|
||||
float result = 0;
|
||||
for (int i = 0; i < _GravityWellCount; i++)
|
||||
{
|
||||
GravityWell well = _GravityWells[i];
|
||||
result += gravityPotential(well.strength, well.coreRadius, length(p - well.position)) - well.reference;
|
||||
}
|
||||
return result / _HeightExaggeration;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8681ac064d59d15458d16cc9b884262c
|
||||
guid: b8f69df89fde433c8263115c25267a10
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -10,7 +10,7 @@ using float3 = CultMath.float3;
|
|||
public sealed partial class RunStartTests
|
||||
{
|
||||
// Crossing: the demo's cast; projector and Cell Blaster fitted in separate weapon groups with the Fire Control Array
|
||||
// aboard; a piloted hostile Djinni that crosses the bow inside 400 m; and an unpiloted neutral one inside the Lightning Projector's
|
||||
// aboard; an unpiloted hostile Djinni, coasting at the Djinni's speed cap, that crosses the bow inside 400 m; and an unpiloted neutral one inside the Lightning Projector's
|
||||
// arc, short of its Range and beyond three quarters of it.
|
||||
[Fact]
|
||||
public void CrossingConditions()
|
||||
|
|
@ -37,7 +37,7 @@ public sealed partial class RunStartTests
|
|||
Assert.Contains(crosser.Equipment, item => item.Behaviors.OfType<Weapon>().Any());
|
||||
|
||||
Assert.True(player.IsHostileTo(crosser) && crosser.IsHostileTo(player), "the crosser is hostile both ways");
|
||||
Assert.Equal(1, AgentsOf(arena, crosser));
|
||||
Assert.Equal(0, AgentsOf(arena, crosser));
|
||||
var toCrosser = crosser.Position - player.Position;
|
||||
Assert.True(length(toCrosser) < 400f, "the crosser starts inside 400 m");
|
||||
Assert.True(toCrosser.z > 0, "the crosser starts ahead");
|
||||
|
|
@ -59,34 +59,79 @@ public sealed partial class RunStartTests
|
|||
Assert.True(length(toWaiting) <= range, "the waiting Djinni is inside the Lightning Projector's Range");
|
||||
Assert.True(length(toWaiting) > .75f * range, "the waiting Djinni is beyond three quarters of the Lightning Projector's Range");
|
||||
|
||||
// The crossing is what the sim does with that staging, read in the player's frame: the arena's gravity and the
|
||||
// crosser's pilot act from the first tick, so the t=0 facing proves nothing. Within CrossingSeconds the crosser's
|
||||
// bearing sweeps from port to starboard while it is ahead and inside CrossingMetres, and both guns bear on it.
|
||||
// The pass is made by a coasting player: the loop gives no input, and the Brief tells the operator to fly it that way.
|
||||
// The crossing is what the sim does with that staging, read in the player's frame: the arena's gravity acts from the
|
||||
// first tick, so the t=0 facing proves nothing. Within CrossingSeconds the crosser's bearing sweeps from port to
|
||||
// starboard while it is ahead and inside CrossingMetres, and both guns bear on it. The pass is made by a coasting
|
||||
// player: the loop gives no input, and the Brief tells the operator to fly it that way.
|
||||
Assert.Equal(float2.zero, player.MovementDirection);
|
||||
var swept = false;
|
||||
var crossedAt = 0f;
|
||||
var crossedMetres = 0f;
|
||||
for (var tick = 0; tick < 60 * CrossingSeconds && !swept; tick++)
|
||||
var pass = FlyPass(arena, player, crosser);
|
||||
Assert.True(pass.Swept, $"the crosser's bearing never swept across the bow within {CrossingSeconds} s");
|
||||
Assert.True(pass.Ahead.y > 0, "the crosser passes the bow line ahead of the player, not astern");
|
||||
Assert.True(length(pass.Ahead) < CrossingMetres, "the crosser passes inside the stated distance");
|
||||
Assert.True(FireControl.InArc(small, float3(pass.Ahead.x, 0, pass.Ahead.y)), "Cell Blaster bears on the crosser as it crosses");
|
||||
Assert.True(dot(FireControl.MountDirection(small), float3(player.Direction.x, 0, player.Direction.y)) > 0, "Cell Blaster mounts forward");
|
||||
// At seed 112 with no input the pass is at about 3.6 s and 45 m; a seed, field or staging change that loses it moves these.
|
||||
Assert.InRange(pass.Seconds, CrossingEarliest, CrossingLatest);
|
||||
Assert.InRange(length(pass.Ahead), 30f, 60f);
|
||||
}
|
||||
|
||||
// The unpiloted crosser's pass is ballistic, bent only by the field, so it does not hang on a lucky start: shifting where
|
||||
// the crosser starts by up to 10 m along either axis keeps the pass inside the test's time and distance windows, fast across
|
||||
// the line (relative speed at the bow line) and sweeping the player's view at a steady rate (angular rate seen from the player).
|
||||
// The shifts are applied to what Crossing stages, so the window is the scenario's own.
|
||||
[Fact]
|
||||
public void CrossingHoldsAcrossTheStartWindow()
|
||||
{
|
||||
var passes = new System.Collections.Generic.List<(float2 shift, CrossingPass pass)>();
|
||||
foreach (var along in new[] { true, false })
|
||||
for (var step = -4; step <= 4; step++)
|
||||
{
|
||||
var shift = along ? float2(step * 2.5f, 0) : float2(0, step * 2.5f);
|
||||
var (_, arena, staged, failures) = Launch(new Crossing(), Inputs(() => GalaxySeed));
|
||||
Assert.True(failures.Count == 0, string.Join("; ", failures));
|
||||
var crosser = staged.Entities[0];
|
||||
crosser.Position += float3(shift.x, 0, shift.y);
|
||||
passes.Add((shift, FlyPass(arena, staged.Player, crosser)));
|
||||
}
|
||||
foreach (var (shift, pass) in passes)
|
||||
{
|
||||
var at = $"crosser start shifted by ({shift.x}, {shift.y}) m";
|
||||
Assert.True(pass.Swept, $"{at}: never crosses the bow within {CrossingSeconds} s");
|
||||
Assert.True(pass.Ahead.y > 0 && length(pass.Ahead) < CrossingMetres, $"{at}: crosses astern or beyond {CrossingMetres} m");
|
||||
Assert.InRange(pass.Seconds, CrossingEarliest, CrossingLatest);
|
||||
Assert.InRange(length(pass.Ahead), 30f, 60f);
|
||||
Assert.InRange(pass.RelativeSpeed, 20f, 30f);
|
||||
Assert.InRange(pass.AngularRate, 0.3f, 0.7f);
|
||||
}
|
||||
|
||||
// The shifts took effect: starting 20 m further out along the crosser's track delays the pass, and starting 20 m further
|
||||
// ahead moves it 20 m further ahead (a sweep that stages the same pass eighteen times proves nothing).
|
||||
var outward = passes.Take(9).Select(entry => entry.pass).ToList();
|
||||
var lateral = passes.Skip(9).Select(entry => entry.pass).ToList();
|
||||
Assert.True(outward[0].Seconds - outward[8].Seconds > .5f, "a start 20 m further out delays the pass by more than half a second");
|
||||
Assert.InRange(lateral[8].Ahead.y - lateral[0].Ahead.y, 3f, 30f);
|
||||
}
|
||||
|
||||
// Where the crosser's bearing from the player sweeps from port to starboard: when, where it is then (x port-to-starboard,
|
||||
// y ahead), its speed relative to the player and the angular rate of its bearing in radians per second.
|
||||
private readonly record struct CrossingPass(bool Swept, float Seconds, float2 Ahead, float RelativeSpeed, float AngularRate);
|
||||
|
||||
private static CrossingPass FlyPass(Zone arena, Ship player, Entity crosser)
|
||||
{
|
||||
for (var tick = 0; tick < 60 * CrossingSeconds; tick++)
|
||||
{
|
||||
var before = crosser.Position - player.Position;
|
||||
arena.Update(1f / 60f);
|
||||
var after = crosser.Position - player.Position;
|
||||
if (before.x < 0 && after.x >= 0)
|
||||
{
|
||||
swept = true;
|
||||
crossedAt = (tick + 1) / 60f;
|
||||
crossedMetres = length(after);
|
||||
Assert.True(after.z > 0, "the crosser passes the bow line ahead of the player, not astern");
|
||||
Assert.True(length(after) < CrossingMetres, "the crosser passes inside the stated distance");
|
||||
Assert.True(FireControl.InArc(small, after), "Cell Blaster bears on the crosser as it crosses");
|
||||
Assert.True(dot(FireControl.MountDirection(small), float3(player.Direction.x, 0, player.Direction.y)) > 0, "Cell Blaster mounts forward");
|
||||
var at = float2(after.x, after.z);
|
||||
var relative = crosser.Velocity - player.Velocity;
|
||||
return new CrossingPass(true, (tick + 1) / 60f, at, length(relative), abs(at.x * relative.y - at.y * relative.x) / dot(at, at));
|
||||
}
|
||||
}
|
||||
Assert.True(swept, $"the crosser's bearing never swept across the bow within {CrossingSeconds} s");
|
||||
// At seed 112 with no input the pass is at 3.6 s and 45 m; a seed or staging change that loses it moves these.
|
||||
Assert.InRange(crossedAt, 3.0f, 4.2f);
|
||||
Assert.InRange(crossedMetres, 30f, 60f);
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
// Place with no velocity leaves the entity at rest: the unpiloted waiting Djinni and both Shakedown targets start with
|
||||
|
|
@ -104,6 +149,7 @@ public sealed partial class RunStartTests
|
|||
|
||||
private const int CrossingSeconds = 6;
|
||||
private const float CrossingMetres = 150f;
|
||||
private const float CrossingEarliest = 3.0f, CrossingLatest = 4.2f;
|
||||
|
||||
// Djinni Shakedown: the generated Djinni carries a gun on a Ballistic hardpoint (not a launcher); that mount bears on
|
||||
// Ahead and not on Abeam, and both targets are neutral.
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public sealed class FireControlTests : IDisposable
|
|||
var items = new ItemManager(_openCache, ledger, TestSettings(), _ => { });
|
||||
var planets = new PlanetSettings();
|
||||
var pack = new ZonePack();
|
||||
if (well) WellFixture.Dig(_openCache, pack, planets, pack.Radius, 1000f, 1f);
|
||||
if (well) WellFixture.Dig(_openCache, pack, planets, 300f, 100f);
|
||||
var zone = new Zone(items, planets, pack, new GalaxyZone { Name = "Test Zone", Owner = null }, null);
|
||||
|
||||
var hullRef = items.ItemData.RefOf<ItemData>(items.ItemData.GetByName<HullData>("TestHull"));
|
||||
|
|
|
|||
|
|
@ -168,53 +168,7 @@ public sealed class FloatingBodyTests : IDisposable
|
|||
Assert.NotEqual(new FloatingBodyId(7), new FloatingBodyId(8));
|
||||
}
|
||||
|
||||
// The law ships felt at 3035230b, written out here from that tree's Ship.Update (a per-tick velocity add, no dt)
|
||||
// and not from Zone: the pin must not move when Zone's law does.
|
||||
private static float2 LegacyPushPerFrame(float2 f, float strength)
|
||||
{
|
||||
var m = lengthsq(f);
|
||||
if (m <= .001f) return float2.zero;
|
||||
return normalize(f) * strength * (1 / (1 - m) - 1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheGravityLawPushesShipsAsItDidAtSixtyFps()
|
||||
{
|
||||
foreach (var strength in new[] { 1f, 7.5f })
|
||||
foreach (var f in new[] { new float2(.1f, 0), new float2(.2f, .1f), new float2(-.3f, .4f), new float2(.5f, -.5f), new float2(0, .7f) })
|
||||
{
|
||||
var legacy = LegacyPushPerFrame(f, strength);
|
||||
var perFrame = Zone.GravityAcceleration(f, strength) * (1f / 60f);
|
||||
var tolerance = Math.Max(1e-7f, length(legacy) * 1e-5f);
|
||||
Assert.InRange(perFrame.x, legacy.x - tolerance, legacy.x + tolerance);
|
||||
Assert.InRange(perFrame.y, legacy.y - tolerance, legacy.y + tolerance);
|
||||
}
|
||||
// Per second: halving dt halves the push, so the law holds at any tick rate.
|
||||
var a = Zone.GravityAcceleration(new float2(.3f, .1f), 2f);
|
||||
Assert.Equal(a.x * .5f, (a * (1f / 120f)).x * 60f, 5);
|
||||
// The gate: |f|^2 at or below .001 pushes nothing.
|
||||
Assert.Equal(float2.zero, Zone.GravityAcceleration(new float2(.03f, 0), 1f));
|
||||
Assert.NotEqual(float2.zero, Zone.GravityAcceleration(new float2(.0317f, 0), 1f));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DriftMatchesLegacyFloatingItemsAtSixtyFps()
|
||||
{
|
||||
// After 5 s at 60 fps with GravityStrength 1 and a normal of length |f| along x, the legacy GridObject drift
|
||||
// position (measured by Soul, 2026-10-07, off 3035230b's GridObject.Update): |f| .05 -> 1.7371, .1 -> 7.0012,
|
||||
// .3 -> 68.55, .5 -> 231.04. The sim steps the same law with exp decay where GridObject used 1 - k dt.
|
||||
var s = Settings();
|
||||
foreach (var (norm, expected) in new[] { (.05f, 1.7371f), (.1f, 7.0012f), (.3f, 68.55f), (.5f, 231.04f) })
|
||||
{
|
||||
var body = Run(new KinematicBody(), 5f, 1f / 60f, Zone.GravityAcceleration(new float2(norm, 0), 1f), s);
|
||||
Assert.InRange(body.Position.x, expected * .999f, expected * 1.001f);
|
||||
Assert.Equal(0f, body.Position.y, 4);
|
||||
}
|
||||
}
|
||||
|
||||
// Ship.Update's own gravity line, through the real ship and a real zone (no planets: the zone's well alone
|
||||
// gives a slope). The expectation is built from the zone's own normal and the 3035230b ship law, so flipping
|
||||
// the sign or changing how delta enters the line fails here, not only the Zone function's pin above.
|
||||
// Ship.Update's own gravity line, through the real ship and a real zone with one well at the origin.
|
||||
private Ship ShipAt(float x, out Zone zone)
|
||||
{
|
||||
var cache = AetheriaStores.Open(Path.Combine(_root, Guid.NewGuid().ToString("N") + ".cc"), Path.Combine(_root, Guid.NewGuid().ToString("N") + ".run.cc"), catalogWritable: true);
|
||||
|
|
@ -230,9 +184,9 @@ public sealed class FloatingBodyTests : IDisposable
|
|||
QualityPriceModifier = new ExponentialLerp()
|
||||
};
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), settings, _ => { });
|
||||
var planets = new PlanetSettings { GravityStrength = 1 };
|
||||
var planets = new PlanetSettings { HeightExaggeration = 10f }; // the tilt reads force / K, which K = 1 would hide
|
||||
var pack = new ZonePack { Radius = 1000 };
|
||||
WellFixture.Dig(cache, pack, planets, 1000, 1000, 1);
|
||||
WellFixture.Dig(cache, pack, planets, 300, 100);
|
||||
zone = new Zone(items, planets, pack, new GalaxyZone { Name = "Test Zone", Owner = null }, null);
|
||||
var design = cache.GetByName<HullData>("Skiff");
|
||||
var hull = new EquippableItem
|
||||
|
|
@ -248,21 +202,50 @@ public sealed class FloatingBodyTests : IDisposable
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void AShipInAWellIsPulledTowardItByTheLawPerSecond()
|
||||
public void AShipInAWellIsPulledByThePotential()
|
||||
{
|
||||
foreach (var delta in new[] { 1f / 60f, 1f / 30f })
|
||||
{
|
||||
var ship = ShipAt(400f, out var zone);
|
||||
var normal = zone.GetNormal(ship.Position.xz);
|
||||
var push = LegacyPushPerFrame(new float2(normal.x, normal.z), zone.Settings.GravityStrength) * (delta * 60f);
|
||||
Assert.True(push.x < 0f, "the well must pull a ship at +x toward the centre");
|
||||
var at = ship.Position.xz;
|
||||
var expected = zone.GetForce(at) * delta;
|
||||
Assert.True(expected.x < 0f, "the well must pull a ship at +x toward the centre");
|
||||
|
||||
ship.Update(delta);
|
||||
|
||||
var tolerance = Math.Max(1e-6f, length(push) * 1e-4f);
|
||||
Assert.InRange(ship.Velocity.x, push.x - tolerance, push.x + tolerance);
|
||||
Assert.InRange(ship.Velocity.y, push.y - tolerance, push.y + tolerance);
|
||||
var tolerance = Math.Max(1e-7f, length(expected) * 1e-4f);
|
||||
Assert.InRange(ship.Velocity.x, expected.x - tolerance, expected.x + tolerance);
|
||||
Assert.InRange(ship.Velocity.y, expected.y - tolerance, expected.y + tolerance);
|
||||
|
||||
// The tilt is the surface of the drawn height (potential / K): its slope is the force over K.
|
||||
var slope = zone.GetForce(at) / zone.Settings.HeightExaggeration;
|
||||
var normal = normalize(float3(slope.x, 1f, slope.y));
|
||||
var q = ship.Rotation;
|
||||
var u = float3(q.x, q.y, q.z);
|
||||
var v = float3(0, 1, 0);
|
||||
var up = v + 2 * (q.w * cross(u, v) + cross(u, cross(u, v)));
|
||||
Assert.True(length(up - normal) < 1e-4f, "the ship tilts to the zone's surface normal");
|
||||
}
|
||||
}
|
||||
|
||||
// Ship.Update's order: position first, then gravity sampled where the ship now is (leapfrog's kick after the drift). A
|
||||
// ship already moving falls toward the centre through the field at its new place, not the one it left.
|
||||
[Fact]
|
||||
public void AMovingShipFeelsTheFieldWhereItHasMoved()
|
||||
{
|
||||
var ship = ShipAt(400f, out var zone);
|
||||
ship.Velocity = float2(-200f, 0f);
|
||||
const float delta = .25f;
|
||||
|
||||
ship.Update(delta);
|
||||
|
||||
var moved = float2(400f, 0f) + float2(-200f, 0f) * delta;
|
||||
Assert.Equal(moved.x, ship.Position.x, 1e-3f);
|
||||
var pulled = (ship.Velocity - float2(-200f, 0f)) / delta;
|
||||
var expected = zone.GetForce(moved);
|
||||
Assert.True(expected.x < 0f, "the well pulls inward at the ship's new place");
|
||||
Assert.InRange(pulled.x, expected.x * (1f + 1e-3f), expected.x * (1f - 1e-3f));
|
||||
Assert.InRange(pulled.y, -1e-3f, 1e-3f);
|
||||
Assert.NotEqual(zone.GetForce(float2(400f, 0f)).x, expected.x); // the premise: the field differs between the two places
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ public sealed class FlowFieldTests : IDisposable
|
|||
SlopeAmplitude = slide, SwirlAmplitude = swirl
|
||||
};
|
||||
|
||||
// A zone at `time` (the pack's clock, as a saved zone restores it), flat unless `depth` digs the zone's own well.
|
||||
private Zone ZoneWith(FlowSettings flow, double time = 0, float depth = 0f)
|
||||
// A zone at `time` (the pack's clock, as a saved zone restores it), flat unless `strength` digs the zone's own well.
|
||||
private Zone ZoneWith(FlowSettings flow, double time = 0, float strength = 0f)
|
||||
{
|
||||
var planets = new PlanetSettings { Flow = flow };
|
||||
var pack = new ZonePack { Time = time };
|
||||
if (depth > 0f) WellFixture.Dig(_items.ItemData, pack, planets, pack.Radius, depth, 2f);
|
||||
if (strength > 0f) WellFixture.Dig(_items.ItemData, pack, planets, strength, 100f);
|
||||
return new Zone(_items, planets, pack, new GalaxyZone { Name = "Flow Zone", Owner = null }, null);
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +124,28 @@ public sealed class FlowFieldTests : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
// Zone.Flow's slope term reads the owner's superposed force, not any one body's: two equal wells, probes off the
|
||||
// axis between them where the nearest body's direction and the sum's differ.
|
||||
[Fact]
|
||||
public void TheSlopeTermFollowsTheSuperposedForce()
|
||||
{
|
||||
var planets = new PlanetSettings { Flow = Flow(amplitude: 0f, slide: 1.5f) };
|
||||
var pack = new ZonePack();
|
||||
WellFixture.Dig(_items.ItemData, pack, planets, 300f, 100f, new float2(-300f, 0f));
|
||||
WellFixture.Dig(_items.ItemData, pack, planets, 300f, 100f, new float2(300f, 0f));
|
||||
var zone = new Zone(_items, planets, pack, new GalaxyZone { Name = "Two Wells", Owner = null }, null);
|
||||
var checkedPoints = 0;
|
||||
foreach (var at in new[] { float2(100f, 400f), float2(-50f, -300f), float2(250f, 220f), float2(-420f, 90f) })
|
||||
{
|
||||
var flow = zone.Flow(float3(at.x, 3f, at.y));
|
||||
var expected = 1.5f * normalize(zone.GetForce(at));
|
||||
Assert.Equal(expected.x, flow.x, 3);
|
||||
Assert.Equal(expected.y, flow.z, 3);
|
||||
checkedPoints++;
|
||||
}
|
||||
Assert.Equal(4, checkedPoints);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SlopeTermSwirlsAndSlidesOnTheGradient()
|
||||
{
|
||||
|
|
@ -131,13 +153,13 @@ public sealed class FlowFieldTests : IDisposable
|
|||
var at = new float3(500f, 3f, 300f);
|
||||
var downhill = normalize(float2(-at.x, -at.z));
|
||||
|
||||
var slide = ZoneWith(Flow(amplitude: 0f, slide: 1.5f), depth: 64f).Flow(at);
|
||||
var slide = ZoneWith(Flow(amplitude: 0f, slide: 1.5f), strength: 300f).Flow(at);
|
||||
Assert.Equal(0f, slide.y, 4);
|
||||
Assert.Equal(1.5f * downhill.x, slide.x, 2);
|
||||
Assert.Equal(1.5f * downhill.y, slide.z, 2);
|
||||
|
||||
// Swirl is perpendicular to downhill, and has a handedness: (down.y, -down.x).
|
||||
var swirl = ZoneWith(Flow(amplitude: 0f, swirl: 2f), depth: 64f).Flow(at);
|
||||
var swirl = ZoneWith(Flow(amplitude: 0f, swirl: 2f), strength: 300f).Flow(at);
|
||||
Assert.Equal(0f, swirl.y, 4);
|
||||
Assert.Equal(2f * downhill.y, swirl.x, 2);
|
||||
Assert.Equal(-2f * downhill.x, swirl.z, 2);
|
||||
|
|
|
|||
23
tests/Aetheria.Shared.Tests/GravityShaderTests.cs
Normal file
23
tests/Aetheria.Shared.Tests/GravityShaderTests.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
|
||||
// potential-owns-gravity (aetheria-gravity, cut grid-lowering): Assets/Shaders/Gravity.cginc is the output of
|
||||
// GravityShader.Source(), which reads GravityField's constants and writes the one lowering of the potential, the
|
||||
// zero-strength guard, each well's reference and gravityHeight's sum. The committed file must equal it, character for
|
||||
// character (line ends aside): any added statement, respelling, flipped sign, swapped argument or macro fails here.
|
||||
// To change the shader, change GravityShader and run once with AETHERIA_REGENERATE_GRAVITY_CGINC=1.
|
||||
public sealed class GravityShaderTests
|
||||
{
|
||||
[Fact]
|
||||
public void TheCommittedShaderIsTheGeneratedOne()
|
||||
{
|
||||
var path = Path.Combine(RunStartTests.FindRepoRoot(), GravityShader.Path);
|
||||
if (Environment.GetEnvironmentVariable("AETHERIA_REGENERATE_GRAVITY_CGINC") == "1")
|
||||
File.WriteAllText(path, GravityShader.Source());
|
||||
var generated = GravityShader.Source();
|
||||
// The law was generated, not an empty template agreeing with an empty file.
|
||||
Assert.Contains("log(r / R) + 0.5", generated);
|
||||
Assert.Equal(generated, File.ReadAllText(path).Replace("\r\n", "\n"));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CultMath;
|
||||
using GameCult.Caching;
|
||||
using Xunit;
|
||||
|
|
@ -41,10 +42,9 @@ public sealed class GravitySubtractTests : IDisposable
|
|||
// mass or multiplier than its twin would show it.
|
||||
private static PlanetSettings Planets() => new PlanetSettings
|
||||
{
|
||||
GravityStrength = 1,
|
||||
WellStrength = new ExponentialCurve { Exponent = .2f, Multiplier = 45.08f },
|
||||
RocheLimit = new ExponentialCurve { Exponent = .25f, Multiplier = 7.32f },
|
||||
BodyRadius = new ExponentialCurve { Exponent = .25f, Multiplier = 3f },
|
||||
GravityRadius = new ExponentialCurve { Exponent = .25f, Multiplier = 500f },
|
||||
GravityDepth = new ExponentialCurve { Exponent = .175f, Multiplier = 30f },
|
||||
LightRadius = new ExponentialCurve { Exponent = .25f, Multiplier = 300f },
|
||||
OrbitPeriod = new ExponentialCurve()
|
||||
};
|
||||
|
|
@ -72,37 +72,14 @@ public sealed class GravitySubtractTests : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
// The fixture the five bowl tests share reproduces the zone bowl it replaced (map B14): the bowl was
|
||||
// -PowerPulse(r / (2 R), exponent) x depth, written out here from its definition, deepest at the centre and
|
||||
// zero from r = R on, so a fixture whose radius or depth drifted from the bowl would change every pull it feeds.
|
||||
[Fact]
|
||||
public void TheWellFixtureReproducesTheFormerBowl()
|
||||
{
|
||||
foreach (var (radius, depth, exponent, at, expected) in new[]
|
||||
{
|
||||
(1000f, 1000f, 1f, 0f, -1000f), (1000f, 1000f, 1f, 400f, -840f), (1000f, 1000f, 1f, 1000f, 0f),
|
||||
(2000f, 64f, 2f, 1000f, -36f), (2000f, 64f, 2f, 300f, -61.1524f)
|
||||
})
|
||||
{
|
||||
var planets = Planets();
|
||||
var pack = new ZonePack { Radius = radius };
|
||||
WellFixture.Dig(_cache, pack, planets, radius, depth, exponent);
|
||||
var zone = new Zone(_items, planets, pack, new GalaxyZone { Name = "Bowl Zone", Owner = null }, null);
|
||||
Assert.InRange(zone.GetHeight(new float2(at, 0)), expected - 1e-2f, expected + 1e-2f);
|
||||
}
|
||||
}
|
||||
|
||||
// One body of `data` at the origin of a zone whose only body it is.
|
||||
private Zone WithBody(BodyData data)
|
||||
{
|
||||
var orbit = _cache.Upsert(new OrbitData { FixedPosition = float2.zero }).Key;
|
||||
data.Orbit = new CultRecordRef<OrbitData>(orbit);
|
||||
data.Mass = 100f;
|
||||
data.GravityRadiusMultiplier = 1.5f;
|
||||
data.GravityDepthMultiplier = .7f;
|
||||
data.GravityDepthExponent = 2f;
|
||||
var body = _cache.Upsert(data).Key;
|
||||
var pack = new ZonePack { Radius = 1000f };
|
||||
var pack = new ZonePack { Radius = PackRadius };
|
||||
pack.Orbits.Add(new CultRecordRef<OrbitData>(orbit));
|
||||
pack.Planets.Add(new CultRecordRef<BodyData>(body));
|
||||
return new Zone(_items, Planets(), pack, new GalaxyZone { Name = "Giant " + data.GetType().Name, Owner = null }, null);
|
||||
|
|
@ -110,15 +87,18 @@ public sealed class GravitySubtractTests : IDisposable
|
|||
|
||||
// The wells are the whole of a giant's height at every point, not just at a few radii: a ripple confined to
|
||||
// any annulus, or to a band derived from the body's radius, shows against the plain body somewhere in a sweep
|
||||
// that runs from the centre to well past the well's support.
|
||||
// that runs from a quarter of the core to twice the pack's radius, the core radius itself included. The sweep
|
||||
// is derived from the body the zone built, not from constants.
|
||||
[Fact]
|
||||
public void AGiantsWellIsAPlainWellAtEveryTime()
|
||||
{
|
||||
var plain = WithBody(new PlanetData());
|
||||
var giants = new[] { WithBody(new GasGiantData()), WithBody(new SunData()) };
|
||||
var radii = new System.Collections.Generic.List<float> { 0.5f };
|
||||
for (var r = 1f; r <= 100f; r += 1f) radii.Add(r);
|
||||
for (var r = 105f; r <= 2000f; r += 5f) radii.Add(r);
|
||||
var core = plain.PlanetInstances.Values.Single().RocheLimit;
|
||||
Assert.True(core > 1f, "the fixture body has a core to sweep around");
|
||||
var radii = new System.Collections.Generic.List<float> { 0.5f, core };
|
||||
for (var r = core / 4f; r <= 4f * core; r += core / 16f) radii.Add(r);
|
||||
for (var r = 4f * core; r <= 2f * PackRadius; r += PackRadius / 200f) radii.Add(r);
|
||||
var angles = new[] { 0f, 0.7f, 2.1f, 4.0f };
|
||||
foreach (var time in new[] { 0f, 37.5f, 91.25f })
|
||||
{
|
||||
|
|
@ -146,19 +126,35 @@ public sealed class GravitySubtractTests : IDisposable
|
|||
}
|
||||
|
||||
private float _clock;
|
||||
private const float PackRadius = 1000f;
|
||||
|
||||
// CultCache has no primitive for reserving a removed MessagePack key; the wave keys of the gas giant (14-17)
|
||||
// must not come back with a different meaning, because stored records may still carry them.
|
||||
// CultCache has no primitive for reserving a removed MessagePack key. Keys 6 and 7 of a body record (its former
|
||||
// brush multipliers), key 8 (its former well exponent) and the wave keys of the gas giants (14-17) must not come back
|
||||
// with a different meaning, because stored records may still carry them. Every record type that is a BodyData is checked, bases walked, so a giant
|
||||
// kind added later (the sun is one) cannot take them.
|
||||
[Fact]
|
||||
public void AGasGiantRecordNeverReusesTheRetiredWaveKeys()
|
||||
public void ABodyRecordNeverReusesRetiredKeys()
|
||||
{
|
||||
var keys = new System.Collections.Generic.List<int>();
|
||||
for (var t = typeof(GasGiantData); t != null; t = t.BaseType)
|
||||
foreach (var m in t.GetMembers(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic |
|
||||
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly))
|
||||
if (m.GetCustomAttributes(typeof(MessagePack.KeyAttribute), false) is MessagePack.KeyAttribute[] ks)
|
||||
foreach (var k in ks) if (k.IntKey.HasValue) keys.Add(k.IntKey.Value);
|
||||
Assert.NotEmpty(keys);
|
||||
foreach (var retired in new[] { 14, 15, 16, 17 }) Assert.DoesNotContain(retired, keys);
|
||||
static System.Collections.Generic.List<int> KeysOf(System.Type type)
|
||||
{
|
||||
var keys = new System.Collections.Generic.List<int>();
|
||||
for (var t = type; t != null; t = t.BaseType)
|
||||
foreach (var m in t.GetMembers(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic |
|
||||
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly))
|
||||
if (m.GetCustomAttributes(typeof(MessagePack.KeyAttribute), false) is MessagePack.KeyAttribute[] ks)
|
||||
foreach (var k in ks) if (k.IntKey.HasValue) keys.Add(k.IntKey.Value);
|
||||
return keys;
|
||||
}
|
||||
|
||||
var bodies = typeof(BodyData).Assembly.GetTypes().Where(x => typeof(BodyData).IsAssignableFrom(x)).ToArray();
|
||||
Assert.Contains(typeof(SunData), bodies);
|
||||
foreach (var type in bodies)
|
||||
{
|
||||
var keys = KeysOf(type);
|
||||
Assert.NotEmpty(keys);
|
||||
foreach (var retired in new[] { 6, 7, 8 }) Assert.DoesNotContain(retired, keys);
|
||||
if (typeof(GasGiantData).IsAssignableFrom(type))
|
||||
foreach (var retired in new[] { 14, 15, 16, 17 }) Assert.DoesNotContain(retired, keys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,11 +110,7 @@ public sealed class LootTests : IDisposable
|
|||
var items = new ItemManager(cache, ledger, settings, _ => { });
|
||||
var planets = new PlanetSettings();
|
||||
var pack = new ZonePack { Radius = well ? 1000 : 0 };
|
||||
if (well)
|
||||
{
|
||||
planets.GravityStrength = 1;
|
||||
WellFixture.Dig(cache, pack, planets, 1000, 1000, 1);
|
||||
}
|
||||
if (well) WellFixture.Dig(cache, pack, planets, 300, 100);
|
||||
var zone = new Zone(items, planets, pack, new GalaxyZone { Name = zoneName, Owner = null }, null);
|
||||
return new Lab { Items = items, Zone = zone };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,9 +118,9 @@ public sealed class MineTests : IDisposable
|
|||
var ledger = new ProvenanceLedger();
|
||||
for (var i = 1; i <= 500; i++) ledger.Lots[i] = new Lot { Origin = new Attributed(), Quality = 1 };
|
||||
var items = new ItemManager(cache, ledger, settings, _ => { });
|
||||
var planets = well ? new PlanetSettings { GravityStrength = 1 } : new PlanetSettings();
|
||||
var planets = new PlanetSettings();
|
||||
var pack = new ZonePack { Radius = well ? 1000 : 0 };
|
||||
if (well) WellFixture.Dig(cache, pack, planets, 1000, 1000, 1);
|
||||
if (well) WellFixture.Dig(cache, pack, planets, 300, 100);
|
||||
var zone = new Zone(items, planets, pack, new GalaxyZone { Name = "Mines", Owner = null }, null);
|
||||
var lab = new Lab { Items = items, Zone = zone, Data = data, ItemData = cache.GetByName<WeaponItemData>("Mine Layer") };
|
||||
|
||||
|
|
|
|||
|
|
@ -44,10 +44,8 @@ public sealed class MiningCut2Tests : IDisposable
|
|||
AsteroidSize = new ExponentialLerp { Minimum = 2f, Maximum = 9f, Exponent = 1.7f },
|
||||
AsteroidHitpoints = new ExponentialLerp { Minimum = 20f, Maximum = 220f, Exponent = 1.6f },
|
||||
AsteroidRespawnTime = new ExponentialLerp { Minimum = 8f, Maximum = 96f, Exponent = 1.2f },
|
||||
// The zone builds a Planet for the fixture's non-belt body; its constructor reads these three.
|
||||
BodyRadius = new ExponentialCurve(),
|
||||
GravityRadius = new ExponentialCurve(),
|
||||
GravityDepth = new ExponentialCurve()
|
||||
// The zone builds a Planet for the fixture's non-belt body; its constructor reads this.
|
||||
BodyRadius = new ExponentialCurve()
|
||||
};
|
||||
|
||||
private sealed class Fixture
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ public sealed partial class MiningCut3Tests : IDisposable
|
|||
AsteroidHitpoints = new ExponentialLerp { Minimum = 20f, Maximum = 220f, Exponent = 1.6f },
|
||||
AsteroidRespawnTime = new ExponentialLerp { Minimum = 8f, Maximum = 96f, Exponent = 1.2f },
|
||||
BodyRadius = new ExponentialCurve(),
|
||||
GravityRadius = new ExponentialCurve(),
|
||||
GravityDepth = new ExponentialCurve(),
|
||||
LightRadius = new ExponentialCurve { Constant = lightRadius }
|
||||
};
|
||||
|
||||
|
|
|
|||
369
tests/Aetheria.Shared.Tests/PotentialOwnerTests.cs
Normal file
369
tests/Aetheria.Shared.Tests/PotentialOwnerTests.cs
Normal file
|
|
@ -0,0 +1,369 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CultMath;
|
||||
using GameCult.Caching;
|
||||
using Xunit;
|
||||
using static CultMath.math;
|
||||
using float2 = CultMath.float2;
|
||||
using float3 = CultMath.float3;
|
||||
|
||||
// aetheria-gravity target r4: one potential per zone owns gravity (potential-owns-gravity), built from the authored
|
||||
// curves of mass (well strength, core radius, Roche limit) and one global exaggeration. Each test builds the zone
|
||||
// through the production constructor from PlanetSettings and body records and reads the owner's GetForce and
|
||||
// GetHeight; the closed forms written here state the law, they are not Zone's code.
|
||||
public sealed class PotentialOwnerTests : IDisposable
|
||||
{
|
||||
private const float PackRadius = 1000f;
|
||||
private readonly string _root = Path.Combine(Path.GetTempPath(), "aetheria-potential-" + Guid.NewGuid().ToString("N"));
|
||||
private readonly CultCache _cache;
|
||||
private readonly ItemManager _items;
|
||||
|
||||
public PotentialOwnerTests()
|
||||
{
|
||||
Directory.CreateDirectory(_root);
|
||||
_cache = AetheriaStores.Open(Path.Combine(_root, "pot.cc"), Path.Combine(_root, "pot-run.cc"), catalogWritable: true);
|
||||
_cache.Upsert(new VerseGrammar { Revision = 1 });
|
||||
_cache.FlushAsync().Wait();
|
||||
var settings = new GameplaySettings
|
||||
{
|
||||
DefaultEntitySettings = new EntitySettings(),
|
||||
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
|
||||
QualityPriceModifier = new ExponentialLerp()
|
||||
};
|
||||
_items = new ItemManager(_cache, new ProvenanceLedger(), settings, _ => { });
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_cache.Dispose();
|
||||
Directory.Delete(_root, true);
|
||||
}
|
||||
|
||||
// The authored curves of the shipped Settings.asset: strength c = 45.08 m^.2, Roche limit and core R = 7.32 m^.25.
|
||||
private static PlanetSettings Curves(float exaggeration = 1f) => new PlanetSettings
|
||||
{
|
||||
WellStrength = new ExponentialCurve { Exponent = .2f, Multiplier = 45.08f },
|
||||
RocheLimit = new ExponentialCurve { Exponent = .25f, Multiplier = 7.32f },
|
||||
BodyRadius = new ExponentialCurve { Exponent = .25f, Multiplier = 2f },
|
||||
LightRadius = new ExponentialCurve(), OrbitPeriod = new ExponentialCurve(),
|
||||
HeightExaggeration = exaggeration
|
||||
};
|
||||
|
||||
private int _bodies;
|
||||
|
||||
private Zone ZoneOf(PlanetSettings planets, params (float mass, float2 at)[] bodies) => ZoneOf(planets, null, bodies);
|
||||
|
||||
// `author` edits each body's record before it is stored: the per-body knobs a body record carries.
|
||||
private Zone ZoneOf(PlanetSettings planets, Action<PlanetData> author, params (float mass, float2 at)[] bodies)
|
||||
{
|
||||
var pack = new ZonePack { Radius = PackRadius };
|
||||
foreach (var (mass, at) in bodies)
|
||||
{
|
||||
var orbit = _cache.Upsert(new OrbitData { FixedPosition = at }).Key;
|
||||
var data = new PlanetData { Name = "Body " + ++_bodies, Orbit = new CultRecordRef<OrbitData>(orbit), Mass = mass };
|
||||
author?.Invoke(data);
|
||||
var body = _cache.Upsert(data).Key;
|
||||
pack.Orbits.Add(new CultRecordRef<OrbitData>(orbit));
|
||||
pack.Planets.Add(new CultRecordRef<BodyData>(body));
|
||||
}
|
||||
return new Zone(_items, planets, pack, new GalaxyZone { Name = "Potential " + _bodies, Owner = null }, null);
|
||||
}
|
||||
|
||||
private static void Near(float expected, float actual, float relative) =>
|
||||
Assert.InRange(actual, expected - Math.Abs(expected) * relative - 1e-5f, expected + Math.Abs(expected) * relative + 1e-5f);
|
||||
|
||||
// The law written out: potential c r^2 / 2R^2 inside the core, c (ln(r / R) + 1/2) beyond.
|
||||
private static float Phi(float c, float core, float r) => r < core ? c * r * r / (2 * core * core) : c * (log(r / core) + .5f);
|
||||
|
||||
// A zone whose bodies have no authored gravity curves (most test zones) has no pull and no dip, and no NaN either.
|
||||
[Fact]
|
||||
public void BodiesWithNoAuthoredWellPullAndDigNothing()
|
||||
{
|
||||
var planets = new PlanetSettings
|
||||
{
|
||||
BodyRadius = new ExponentialCurve(),
|
||||
LightRadius = new ExponentialCurve(), OrbitPeriod = new ExponentialCurve()
|
||||
};
|
||||
var zone = ZoneOf(planets, (100f, float2.zero), (5000f, new float2(200f, 0f)));
|
||||
foreach (var p in new[] { float2.zero, float2(200f, 0f), float2(37f, -911f), float2(5000f, 5000f) })
|
||||
{
|
||||
Assert.Equal(0f, zone.GetHeight(p));
|
||||
Assert.Equal(0f, zone.GetForce(p).x);
|
||||
Assert.Equal(0f, zone.GetForce(p).y);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StrengthFollowsTheAuthoredMassCurve()
|
||||
{
|
||||
var planets = Curves();
|
||||
foreach (var mass in new[] { 29.2f, 273.9f, 14152.4f })
|
||||
{
|
||||
var zone = ZoneOf(planets, (mass, float2.zero));
|
||||
var core = planets.RocheLimit.Evaluate(mass);
|
||||
foreach (var r in new[] { 3f * core, 10f * core, PackRadius / 2f })
|
||||
Near(planets.WellStrength.Evaluate(mass), length(zone.GetForce(new float2(r, 0))) * r, 1e-3f);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheCoreRadiusIsTheRocheCurve()
|
||||
{
|
||||
var planets = Curves();
|
||||
foreach (var mass in new[] { 29.2f, 14152.4f })
|
||||
{
|
||||
var zone = ZoneOf(planets, (mass, float2.zero));
|
||||
var core = planets.RocheLimit.Evaluate(mass);
|
||||
float Pull(float r) => length(zone.GetForce(new float2(0, r)));
|
||||
var slope = Pull(.25f * core) / (.25f * core);
|
||||
Near(slope, Pull(.5f * core) / (.5f * core), 1e-3f);
|
||||
Near(slope, Pull(.9f * core) / (.9f * core), 1e-3f);
|
||||
Assert.True(Pull(core) > Pull(.98f * core), "the pull still rises up to the core radius");
|
||||
Assert.True(Pull(core) > Pull(1.02f * core), "and falls beyond it");
|
||||
}
|
||||
}
|
||||
|
||||
// core-at-roche-and-exaggeration-up: the one curve is both the Roche limit and the core. A body with a well and no
|
||||
// Roche limit has no core and is an authoring error; any positive, finite limit builds.
|
||||
[Fact]
|
||||
public void TheRocheLimitIsTheCore()
|
||||
{
|
||||
var planets = Curves();
|
||||
foreach (var mass in new[] { 29.2f, 14152.4f })
|
||||
Near(planets.RocheLimit.Evaluate(mass), ZoneOf(planets, (mass, float2.zero)).PlanetInstances.Values.Single().RocheLimit, 1e-6f);
|
||||
|
||||
PlanetSettings Constants(float roche) => new PlanetSettings
|
||||
{
|
||||
WellStrength = new ExponentialCurve { Constant = 100f },
|
||||
RocheLimit = new ExponentialCurve { Constant = roche },
|
||||
BodyRadius = new ExponentialCurve { Constant = 10f },
|
||||
LightRadius = new ExponentialCurve(), OrbitPeriod = new ExponentialCurve()
|
||||
};
|
||||
Assert.Throws<InvalidOperationException>(() => ZoneOf(Constants(0f), (100f, float2.zero)));
|
||||
Assert.Throws<InvalidOperationException>(() => ZoneOf(Constants(-5f), (100f, float2.zero)));
|
||||
Assert.Throws<InvalidOperationException>(() => ZoneOf(Constants(float.PositiveInfinity), (100f, float2.zero)));
|
||||
ZoneOf(Constants(50f), (100f, float2.zero));
|
||||
}
|
||||
|
||||
// core-at-roche-and-exaggeration-up: growing the core to the Roche limit (3 m^.25 to 7.32 m^.25, 2.44x) and dividing the
|
||||
// global K by that factor leaves the steepest drawn slope (|grad phi| / K, at the core) where it was, and draws every
|
||||
// slope outside the old core 2.44x steeper. The "before" side is the previous authoring, stated here from the ruling:
|
||||
// core 3 m^.25 and K 10. The "after" side is the shipped Settings.asset read through the production zone.
|
||||
[Fact]
|
||||
public void ThePeakDrawnSlopeStaysAndTheFunnelDrawsSteeper()
|
||||
{
|
||||
const float oldCoreMultiplier = 3f, oldExaggeration = 10f;
|
||||
var planets = AuthoredSettings.Load(RunStartTests.FindRepoRoot()).Read<PlanetSettings>("PlanetSettings");
|
||||
foreach (var mass in new[] { 29.2f, 273.9f, 14152.4f })
|
||||
{
|
||||
var zone = ZoneOf(planets, (mass, float2.zero));
|
||||
var c = planets.WellStrength.Evaluate(mass);
|
||||
var oldCore = oldCoreMultiplier * pow(mass, .25f);
|
||||
float Drawn(float r) => length(zone.GetForce(new float2(r, 0))) / zone.Settings.HeightExaggeration;
|
||||
|
||||
var peakBefore = c / oldCore / oldExaggeration;
|
||||
Assert.InRange(Drawn(planets.RocheLimit.Evaluate(mass)), peakBefore * .98f, peakBefore * 1.02f);
|
||||
|
||||
var rocheOverOldCore = planets.RocheLimit.Evaluate(mass) / oldCore;
|
||||
var farBefore = c / (3f * oldCore) / oldExaggeration;
|
||||
Near(rocheOverOldCore, Drawn(3f * oldCore) / farBefore, 1e-2f);
|
||||
Assert.InRange(Drawn(3f * oldCore) / farBefore, 2.44f * .99f, 2.44f * 1.01f);
|
||||
}
|
||||
}
|
||||
|
||||
// The shipped curves build a well at every mass of the generated range. The curves are the ones
|
||||
// Settings.asset carries, read the way RunStartTests reads them, so a retune of the asset is judged here.
|
||||
[Fact]
|
||||
public void TheAuthoredCurvesBuildAtEveryMass()
|
||||
{
|
||||
var planets = AuthoredSettings.Load(RunStartTests.FindRepoRoot()).Read<PlanetSettings>("PlanetSettings");
|
||||
Assert.True(planets.WellStrength.Evaluate(100f) > 0f && planets.RocheLimit.Evaluate(100f) > 0f, "the authored asset carries a well");
|
||||
for (var exponent10 = -3f; exponent10 <= 8f; exponent10 += .25f)
|
||||
ZoneOf(planets, (pow(10f, exponent10), float2.zero));
|
||||
}
|
||||
|
||||
// A well that is negative, not a number or infinite is an authoring error, not an antimass body. Zero is the unauthored
|
||||
// default and digs nothing (BodiesWithNoAuthoredWellPullAndDigNothing).
|
||||
[Theory]
|
||||
[InlineData(-10f)]
|
||||
[InlineData(float.NaN)]
|
||||
[InlineData(float.PositiveInfinity)]
|
||||
[InlineData(float.NegativeInfinity)]
|
||||
[InlineData(-1e-6f)]
|
||||
[InlineData(-float.Epsilon)]
|
||||
public void AnUnphysicalWellStrengthThrowsAtConstruction(float strength)
|
||||
{
|
||||
var planets = Curves();
|
||||
planets.WellStrength = new ExponentialCurve { Constant = strength };
|
||||
Assert.Throws<InvalidOperationException>(() => ZoneOf(planets, (100f, float2.zero)));
|
||||
planets.RocheLimit = new ExponentialCurve();
|
||||
Assert.Throws<InvalidOperationException>(() => ZoneOf(planets, (100f, float2.zero)));
|
||||
}
|
||||
|
||||
// Zero is the boundary: a well of no strength builds beside the authored Roche curve (it digs nothing), where
|
||||
// the smallest negative strength does not.
|
||||
[Theory]
|
||||
[InlineData(0f)]
|
||||
[InlineData(-0f)]
|
||||
public void AWellOfNoStrengthBuildsAndDigsNothing(float strength)
|
||||
{
|
||||
var planets = Curves();
|
||||
planets.WellStrength = new ExponentialCurve { Constant = strength };
|
||||
var zone = ZoneOf(planets, (100f, float2.zero));
|
||||
foreach (var p in new[] { float2.zero, float2(3f, 1f), float2(40f, -9f), float2(900f, 0f) })
|
||||
{
|
||||
Assert.Equal(0f, zone.GetHeight(p));
|
||||
Assert.Equal(0f, zone.GetForce(p).x);
|
||||
Assert.Equal(0f, zone.GetForce(p).y);
|
||||
}
|
||||
}
|
||||
|
||||
// The well is authored once, by curves of mass (target: no per-body authoring of a core or Roche limit): a body whose
|
||||
// record carries another radius multiplier has the same strength, core and Roche limit, and pulls and digs exactly as
|
||||
// its plain twin.
|
||||
[Theory]
|
||||
[InlineData(2.5f)]
|
||||
[InlineData(.5f)]
|
||||
public void PerBodyMultipliersDoNotMoveTheWell(float bodyRadius)
|
||||
{
|
||||
var planets = Curves();
|
||||
foreach (var mass in new[] { 29.2f, 14152.4f })
|
||||
{
|
||||
var plain = ZoneOf(planets, (mass, float2.zero));
|
||||
var scaled = ZoneOf(planets, data =>
|
||||
{
|
||||
data.BodyRadiusMultiplier = bodyRadius;
|
||||
}, (mass, float2.zero));
|
||||
var a = plain.PlanetInstances.Values.Single();
|
||||
var b = scaled.PlanetInstances.Values.Single();
|
||||
Assert.Equal(a.WellStrength, b.WellStrength);
|
||||
Assert.Equal(a.RocheLimit, b.RocheLimit);
|
||||
foreach (var p in new[] { float2(.4f * a.RocheLimit, 0), float2(0, 3f * a.RocheLimit), float2(400f, 300f) })
|
||||
{
|
||||
Assert.Equal(plain.GetForce(p), scaled.GetForce(p));
|
||||
Assert.Equal(plain.GetHeight(p), scaled.GetHeight(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheTailIsAPointMassWithNoRimAndNoGate()
|
||||
{
|
||||
var planets = Curves();
|
||||
var zone = ZoneOf(planets, (273.9f, float2.zero));
|
||||
var c = planets.WellStrength.Evaluate(273.9f);
|
||||
var core = planets.RocheLimit.Evaluate(273.9f);
|
||||
foreach (var r in new[] { core, 2f * core, PackRadius, 10f * PackRadius, 100f * PackRadius, 1000f * PackRadius })
|
||||
foreach (var angle in new[] { 0f, 1.1f, 3.5f })
|
||||
{
|
||||
var at = new float2(r * cos(angle), r * sin(angle));
|
||||
var force = zone.GetForce(at);
|
||||
Near(c, length(force) * r, 1e-3f);
|
||||
Assert.True(dot(normalize(force), normalize(-at)) > .9999f, "the pull points at the body");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WellsSuperpose()
|
||||
{
|
||||
var planets = Curves();
|
||||
var a = (mass: 29.2f, at: new float2(-300f, 0f));
|
||||
var b = (mass: 14152.4f, at: new float2(300f, 0f));
|
||||
var both = ZoneOf(planets, a, b);
|
||||
var onlyA = ZoneOf(planets, a);
|
||||
var onlyB = ZoneOf(planets, b);
|
||||
var probes = new[]
|
||||
{
|
||||
float2(-300f, 0f), float2(300f, 0f), float2(-310f, 4f), float2(305f, -9f), float2(0f, 0f), float2(0f, 250f),
|
||||
float2(-150f, 100f), float2(150f, -100f), float2(900f, 700f), float2(-1200f, -300f), float2(40f, 3000f), float2(-300f, -40f)
|
||||
};
|
||||
foreach (var p in probes)
|
||||
{
|
||||
var sum = onlyA.GetForce(p) + onlyB.GetForce(p);
|
||||
Near(sum.x, both.GetForce(p).x, 1e-4f);
|
||||
Near(sum.y, both.GetForce(p).y, 1e-4f);
|
||||
Near(onlyA.GetHeight(p) + onlyB.GetHeight(p), both.GetHeight(p), 1e-4f);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HeightIsThePotentialOverOneK()
|
||||
{
|
||||
foreach (var k in new[] { 1f, 10f })
|
||||
{
|
||||
var planets = Curves(k);
|
||||
var lone = ZoneOf(planets, (273.9f, float2.zero));
|
||||
var c = planets.WellStrength.Evaluate(273.9f);
|
||||
var core = planets.RocheLimit.Evaluate(273.9f);
|
||||
Assert.Equal(0f, lone.GetHeight(new float2(PackRadius, 0)), 4);
|
||||
Near(-c * (log(PackRadius / core) + .5f) / k, lone.GetHeight(float2.zero), 1e-4f);
|
||||
|
||||
var two = ZoneOf(planets, (29.2f, new float2(-300f, 0f)), (14152.4f, new float2(300f, 0f)));
|
||||
var c0 = planets.WellStrength.Evaluate(29.2f);
|
||||
var core0 = planets.RocheLimit.Evaluate(29.2f);
|
||||
var c1 = planets.WellStrength.Evaluate(14152.4f);
|
||||
var core1 = planets.RocheLimit.Evaluate(14152.4f);
|
||||
const float step = .5f;
|
||||
// Inside the two cores as well, out to their outer bands (0.5 R to R), where the potential is the quadratic bowl.
|
||||
var inCore = new[]
|
||||
{
|
||||
float2(-300f + .5f * core0, 0f), float2(-300f, .65f * core0), float2(-300f - .86f * core0, 0f), float2(-300f + .6f * core0, .6f * core0),
|
||||
float2(300f + .55f * core1, 0f), float2(300f, -.7f * core1), float2(300f - .86f * core1, 0f), float2(300f + .9f * core1, 0f)
|
||||
};
|
||||
foreach (var p in inCore.Concat(new[] { float2(-200f, 120f), float2(0f, 0f), float2(100f, -300f), float2(500f, 40f), float2(-290f, 12f), float2(310f, 20f), float2(700f, 700f), float2(-80f, -500f) }))
|
||||
{
|
||||
var expected = Phi(c0, core0, length(p - float2(-300f, 0f))) - Phi(c0, core0, PackRadius)
|
||||
+ Phi(c1, core1, length(p - float2(300f, 0f))) - Phi(c1, core1, PackRadius);
|
||||
Near(expected, two.GetHeight(p) * k, 1e-3f);
|
||||
|
||||
// The downhill slope of the potential is the force: the central difference of height * K is -GetForce.
|
||||
var gradient = float2(
|
||||
(two.GetHeight(p + float2(step, 0)) - two.GetHeight(p - float2(step, 0))) * k / (2 * step),
|
||||
(two.GetHeight(p + float2(0, step)) - two.GetHeight(p - float2(0, step))) * k / (2 * step));
|
||||
var force = two.GetForce(p);
|
||||
Assert.InRange(length(gradient + force), 0f, length(force) * 1e-2f + 1e-4f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inside the core the potential is the bowl c r^2 / 2R^2 all the way out to R: the drop from a lone body's centre to a point
|
||||
// at r is exactly that, from the middle of the core to a hair inside its edge (the log form agrees with the bowl to second
|
||||
// order at R, so only a tight tolerance sees a join that sits just inside it).
|
||||
[Fact]
|
||||
public void TheCoreIsTheBowlUpToItsEdge()
|
||||
{
|
||||
foreach (var k in new[] { 1f, 10f })
|
||||
{
|
||||
var planets = Curves(k);
|
||||
foreach (var mass in new[] { 29.2f, 14152.4f })
|
||||
{
|
||||
var zone = ZoneOf(planets, (mass, float2.zero));
|
||||
var c = planets.WellStrength.Evaluate(mass);
|
||||
var core = planets.RocheLimit.Evaluate(mass);
|
||||
foreach (var fraction in new[] { .5f, .75f, .9f, .95f, .98f, .99f, .996f })
|
||||
foreach (var angle in new[] { 0f, 2.3f })
|
||||
{
|
||||
var r = fraction * core;
|
||||
var drop = (zone.GetHeight(new float2(r * cos(angle), r * sin(angle))) - zone.GetHeight(float2.zero)) * k;
|
||||
Near(c * fraction * fraction / 2f, drop, 2e-5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheCoreMeetsTheTailAtItsRadius()
|
||||
{
|
||||
var planets = Curves();
|
||||
foreach (var mass in new[] { 29.2f, 14152.4f })
|
||||
{
|
||||
var zone = ZoneOf(planets, (mass, float2.zero));
|
||||
var core = planets.RocheLimit.Evaluate(mass);
|
||||
var inside = new float2(core * (1f - 1e-3f), 0);
|
||||
var outside = new float2(core * (1f + 1e-3f), 0);
|
||||
Assert.InRange(abs(zone.GetHeight(inside) - zone.GetHeight(outside)), 0f, abs(zone.GetHeight(outside)) * 1e-3f);
|
||||
Assert.InRange(abs(length(zone.GetForce(inside)) - length(zone.GetForce(outside))), 0f, length(zone.GetForce(outside)) * 1e-3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
using CultMath;
|
||||
using GameCult.Caching;
|
||||
|
||||
// The one fixture that gives a test zone a slope: a single body on a parentless orbit at the origin, with
|
||||
// the curves a body needs. Gravity height is the sum of body wells, so a test that wants ground to slide on
|
||||
// digs it here and nowhere else. `radius` is the zone radius the well is sized to (its well reaches 2 x radius,
|
||||
// as the former bowl did); the well is deepest at the centre and zero at and beyond half its radius.
|
||||
// The one fixture that gives a test zone a slope: a body on a parentless orbit (the origin unless `at` says otherwise; call again for more bodies), with the
|
||||
// curves a body needs. Gravity is the sum of body wells (GravityField), so a test that wants ground to slide on
|
||||
// digs it here and nowhere else. `strength` is the well's c (u^2/s^2) and `coreRadius` its softened core in u, which is
|
||||
// the Roche limit curve (the one curve of a body's core).
|
||||
internal static class WellFixture
|
||||
{
|
||||
public static void Dig(CultCache cache, ZonePack pack, PlanetSettings settings, float radius, float depth, float exponent)
|
||||
public static void Dig(CultCache cache, ZonePack pack, PlanetSettings settings, float strength, float coreRadius, float2 at = default)
|
||||
{
|
||||
settings.BodyRadius = new ExponentialCurve();
|
||||
settings.OrbitPeriod = new ExponentialCurve();
|
||||
settings.GravityRadius = new ExponentialCurve { Constant = 2f * radius };
|
||||
settings.GravityDepth = new ExponentialCurve { Constant = depth };
|
||||
var orbit = cache.Upsert(new OrbitData { FixedPosition = float2.zero }).Key;
|
||||
var body = cache.Upsert(new PlanetData { Orbit = new CultRecordRef<OrbitData>(orbit), GravityDepthExponent = exponent }).Key;
|
||||
settings.WellStrength = new ExponentialCurve { Constant = strength };
|
||||
settings.RocheLimit = new ExponentialCurve { Constant = coreRadius };
|
||||
var orbit = cache.Upsert(new OrbitData { FixedPosition = at }).Key;
|
||||
var body = cache.Upsert(new PlanetData { Name = $"Well {at.x},{at.y}", Orbit = new CultRecordRef<OrbitData>(orbit) }).Key;
|
||||
pack.Orbits.Add(new CultRecordRef<OrbitData>(orbit));
|
||||
pack.Planets.Add(new CultRecordRef<BodyData>(body));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,15 +38,14 @@ public sealed class ZonePlacedAtBuildTests : IDisposable
|
|||
|
||||
private static ExponentialCurve Flat(float v) => new ExponentialCurve { Constant = v };
|
||||
|
||||
// Flat space (no zone depth) with one planet whose well reaches 500 u, a fixed root orbit at RootAt and the
|
||||
// One planet with a well (c 100, Roche limit and core 20 u), a fixed root orbit at RootAt and the
|
||||
// planet orbiting it at Distance from `phase`. Every orbit period is Period seconds.
|
||||
private static PlanetSettings Settings() => new PlanetSettings
|
||||
{
|
||||
OrbitPeriod = Flat(Period),
|
||||
BodyRadius = Flat(20f),
|
||||
GravityRadius = Flat(500f),
|
||||
GravityDepth = Flat(100f),
|
||||
GravityStrength = 1f,
|
||||
WellStrength = Flat(100f),
|
||||
RocheLimit = Flat(20f),
|
||||
LightRadius = Flat(0f)
|
||||
};
|
||||
|
||||
|
|
@ -57,6 +56,8 @@ public sealed class ZonePlacedAtBuildTests : IDisposable
|
|||
public HullData Hull;
|
||||
public Zone Zone;
|
||||
public CultRecordKey PlanetOrbit;
|
||||
public CultRecordKey MoonOrbit;
|
||||
public CultRecordKey MoonsMoonOrbit;
|
||||
}
|
||||
|
||||
private Scene Build(float phase, double time, bool moonFirst = false)
|
||||
|
|
@ -81,6 +82,10 @@ public sealed class ZonePlacedAtBuildTests : IDisposable
|
|||
{
|
||||
Parent = new CultRecordRef<OrbitData>(planetOrbit), Distance = 100f
|
||||
}).Key;
|
||||
var moonsMoonOrbit = cache.Upsert(new OrbitData
|
||||
{
|
||||
Parent = new CultRecordRef<OrbitData>(moonOrbit), Distance = 40f
|
||||
}).Key;
|
||||
var planet = cache.Upsert(new PlanetData { Orbit = new CultRecordRef<OrbitData>(planetOrbit), Mass = 1f }).Key;
|
||||
var pack = new ZonePack
|
||||
{
|
||||
|
|
@ -90,10 +95,10 @@ public sealed class ZonePlacedAtBuildTests : IDisposable
|
|||
Time = time
|
||||
};
|
||||
// The same three orbits either way; only the order the pack lists them in differs.
|
||||
var listed = moonFirst ? new[] { moonOrbit, planetOrbit, rootOrbit } : new[] { rootOrbit, planetOrbit, moonOrbit };
|
||||
var listed = moonFirst ? new[] { moonsMoonOrbit, moonOrbit, planetOrbit, rootOrbit } : new[] { rootOrbit, planetOrbit, moonOrbit, moonsMoonOrbit };
|
||||
foreach (var key in listed) pack.Orbits.Add(new CultRecordRef<OrbitData>(key));
|
||||
var zone = new Zone(items, Settings(), pack, new GalaxyZone { Name = "Placed", Owner = null }, null);
|
||||
return new Scene { Cache = cache, Items = items, Hull = hull, Zone = zone, PlanetOrbit = planetOrbit };
|
||||
return new Scene { Cache = cache, Items = items, Hull = hull, Zone = zone, PlanetOrbit = planetOrbit, MoonOrbit = moonOrbit, MoonsMoonOrbit = moonsMoonOrbit };
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -116,6 +121,31 @@ public sealed class ZonePlacedAtBuildTests : IDisposable
|
|||
Assert.InRange(normalize(force).x, -1f, -.99f);
|
||||
}
|
||||
|
||||
// A moon's moon (the fourth orbit, a child of a child of the planet) is placed by the constructor too, whichever
|
||||
// order the pack lists the chain in: each orbit sits its distance from its parent at its own phase of its own period.
|
||||
[Theory]
|
||||
[InlineData(false, 0.0)]
|
||||
[InlineData(true, 0.0)]
|
||||
[InlineData(false, 123.0)]
|
||||
[InlineData(true, 123.0)]
|
||||
public void AMoonsMoonSitsOnItsOrbitBeforeTheFirstTick(bool moonFirst, double time)
|
||||
{
|
||||
var s = Build(.1f, time, moonFirst);
|
||||
var planet = s.Zone.Orbits[s.PlanetOrbit];
|
||||
var moon = s.Zone.Orbits[s.MoonOrbit];
|
||||
var moonsMoon = s.Zone.Orbits[s.MoonsMoonOrbit];
|
||||
float2 Offset(Orbit orbit) => OrbitData.Evaluate(frac((float) frac(time / orbit.Period) + orbit.Data.Phase)) * orbit.Data.Distance;
|
||||
|
||||
var planetAt = RootAt + Offset(planet);
|
||||
var moonAt = planetAt + Offset(moon);
|
||||
var moonsMoonAt = moonAt + Offset(moonsMoon);
|
||||
|
||||
Assert.True(moon.Period > .01f && moonsMoon.Period > .01f, "the chain's orbits move");
|
||||
Assert.InRange(length(moon.Position - moonAt), 0f, .01f);
|
||||
Assert.InRange(length(moonsMoon.Position - moonsMoonAt), 0f, .01f);
|
||||
Assert.True(length(moonsMoonAt - moonAt) > 1f, "the moon's moon is not on its parent");
|
||||
}
|
||||
|
||||
// A parent's velocity is its own orbital velocity on the first tick and every tick after, whichever order
|
||||
// the pack lists a moon and its planet in. dt differs per tick so a velocity taken from a fixed step fails.
|
||||
[Theory]
|
||||
|
|
|
|||
Loading…
Reference in a new issue