@@ -132,6 +132,7 @@ public class SkyPrimitive : RenderPrimitive
132132 public const float SkyRadius = 6020 ;
133133 public const float MoonRadius = 6010 ;
134134 public const float CloudsRadius = 6000 ;
135+ public const float CloudsFlatness = 0.1f ;
135136
136137 public SkyElement Element ;
137138
@@ -175,7 +176,7 @@ public SkyPrimitive(RenderProcess renderProcess)
175176 var vertexIndex = 0 ;
176177 var indexIndex = 0 ;
177178 InitializeDomeVertexList ( ref vertexIndex , SkyRadius ) ;
178- InitializeDomeVertexList ( ref vertexIndex , CloudsRadius ) ;
179+ InitializeDomeVertexList ( ref vertexIndex , CloudsRadius , CloudsFlatness ) ;
179180 InitializeDomeIndexList ( ref indexIndex ) ;
180181 InitializeMoonLists ( ref vertexIndex , ref indexIndex ) ;
181182 Debug . Assert ( vertexIndex == VertexCount , $ "Did not initialize all verticies; expected { VertexCount } , got { vertexIndex } ") ;
@@ -223,10 +224,10 @@ public override void Draw(GraphicsDevice graphicsDevice)
223224 }
224225 }
225226
226- void InitializeDomeVertexList ( ref int index , float radius )
227+ void InitializeDomeVertexList ( ref int index , float radius , float flatness = 1 )
227228 {
228229 // Single vertex at zenith
229- VertexList [ index ] . Position = new Vector3 ( 0 , radius , 0 ) ;
230+ VertexList [ index ] . Position = new Vector3 ( 0 , radius * flatness , 0 ) ;
230231 VertexList [ index ] . Normal = Vector3 . Normalize ( VertexList [ index ] . Position ) ;
231232 VertexList [ index ] . TextureCoordinate = new Vector2 ( 0.5f , 0.5f ) ;
232233 index ++ ;
@@ -236,7 +237,7 @@ void InitializeDomeVertexList(ref int index, float radius)
236237 var stepCos = ( float ) Math . Cos ( MathHelper . ToRadians ( 90f * step / DomeStepsMain ) ) ;
237238 var stepSin = ( float ) Math . Sin ( MathHelper . ToRadians ( 90f * step / DomeStepsMain ) ) ;
238239
239- var y = radius * stepCos ;
240+ var y = radius * stepCos * flatness ;
240241 var d = radius * stepSin ;
241242
242243 for ( var side = 0 ; side < DomeSides ; side ++ )
0 commit comments