public override void Draw(BoundingFrustum VisibleArea, Vector3 Position) { //Draw the Glow Manager.ResetFor2D(); MyGame.graphics.GraphicsDevice.VertexDeclaration = GlowDeclaration; Manager.OrdinaryEffect.CurrentTechnique = Manager.OrdinaryEffect.Techniques["Glow"]; Manager.OrdinaryEffect.Parameters["CameraPosition"].SetValue(Manager.CameraFocus + Manager.CameraLocation); Manager.OrdinaryEffect.Parameters["CameraUpVector"].SetValue(Manager.CameraUp); Manager.OrdinaryEffect.Parameters["PointSpriteSize"].SetValue(Transforms.Scale * 2.0f); Manager.OrdinaryEffect.Parameters["PositionValue"].SetValue(Transforms.Position); Manager.OrdinaryEffect.Parameters["Offset"].SetValue(RotationTime / 40.0f); Manager.OrdinaryEffect.Begin(); Manager.OrdinaryEffect.CurrentTechnique.Passes.First <EffectPass>().Begin(); MyGame.graphics.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColor>( PrimitiveType.TriangleList , Glow , 0 , Glow.Length , GlowIndex , 0 , GlowIndex.Length / 3); Manager.OrdinaryEffect.CurrentTechnique.Passes.First <EffectPass>().End(); Manager.OrdinaryEffect.End(); //Draw the Star, Planets, Asteroids, Etc. Manager.ResetFor3D(); Manager.TexturedEffect.CurrentTechnique = Manager.TexturedEffect.Techniques["Textured"]; Manager.TexturedEffect.Parameters["InputTexture"].SetValue(NoiseMap); Manager.TexturedEffect.Parameters["InputTextureInterpolation"].SetValue(0.0f); Manager.TexturedEffect.Parameters["ColorMapTexture"].SetValue(ColorMap); Manager.TexturedEffect.Parameters["TextureAlphaThreshold"].SetValue(0.0f); base.Draw(VisibleArea, Position); }
void DrawStars(float Scale) { Manager.ResetFor2D(); Manager.OrdinaryEffect.CurrentTechnique = Manager.OrdinaryEffect.Techniques["PointSprite"]; Manager.OrdinaryEffect.Parameters["OrdinaryTransparency"].SetValue(1.0f); Manager.OrdinaryEffect.Parameters["CameraPosition"].SetValue(Manager.CameraFocus + Manager.CameraLocation); Manager.OrdinaryEffect.Parameters["CameraUpVector"].SetValue(Manager.CameraUp); Manager.OrdinaryEffect.Parameters["PointSpriteSize"].SetValue(0.15f * Scale); Manager.OrdinaryEffect.Parameters["TextureFraction"].SetValue(0.1f); Manager.OrdinaryEffect.Parameters["InputTexture"].SetValue(StarMap); Manager.OrdinaryEffect.Parameters["World"].SetValue(Matrix.CreateScale(10.0f * Scale) * Matrix.CreateTranslation(Manager.CameraFocus)); Manager.OrdinaryEffect.Begin(); Manager.OrdinaryEffect.CurrentTechnique.Passes.First <EffectPass>().Begin(); MyGame.graphics.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColorTexture>( PrimitiveType.TriangleList , Stars , 0 , Stars.Length , StarIndex , 0 , StarIndex.Length / 3); Manager.OrdinaryEffect.CurrentTechnique.Passes.First <EffectPass>().End(); Manager.OrdinaryEffect.End(); }
public override void Draw(BoundingFrustum VisibleArea, Vector3 Position) { Manager.ResetFor2D(); MyGame.graphics.GraphicsDevice.RenderState.CullMode = CullMode.None; Manager.TexturedEffect.CurrentTechnique = Manager.TexturedEffect.Techniques["TexturedCloud"]; Manager.TexturedEffect.Parameters["InputTexture"].SetValue(NoiseMap); Manager.TexturedEffect.Parameters["ColorMapTexture"].SetValue(ColorMap); for (int i = 1; i < 2; i++) { Matrix transform = Transforms.Rotation * Matrix.CreateScale(Transforms.Scale * 0.75f * i / 3) * Matrix.CreateTranslation(Transforms.Position + Position); effect.Parameters["World"].SetValue(transform); Manager.TexturedEffect.Parameters["TextureAlphaThreshold"].SetValue(0.33f + 0.27f * i / 3); MyGame.graphics.GraphicsDevice.VertexDeclaration = DefaultDeclaration; effect.Begin(); effect.CurrentTechnique.Passes.First <EffectPass>().Begin(); MyGame.graphics.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionTexture>( PrimitiveType.TriangleList , ModelVertices , 0 , ModelVertices.Length , ModelIndices , 0 , ModelIndices.Length / 3); effect.CurrentTechnique.Passes.First <EffectPass>().End(); effect.End(); } Manager.TexturedEffect.Parameters["TextureAlphaThreshold"].SetValue(0.33f); base.Draw(VisibleArea, Position); MyGame.graphics.GraphicsDevice.RenderState.CullMode = CullMode.CullCounterClockwiseFace; }