/// <summary> /// Builds the star box (dome, sphere, thing) /// </summary> public StarBox( ) { EffectAssetHandle effect = new EffectAssetHandle( "Effects/Planets/stars.cgfx", false ); m_Technique = new TechniqueSelector( effect, "DefaultTechnique" ); Draw.ISurface surface = Graphics.Draw.NewSurface( Graphics.Draw.NewBrush( Color.Black ), null ); surface.FaceBrush.State.CullFaces = false; surface.FaceBrush.State.DepthWrite = false; surface.FaceBrush.State.DepthTest = false; Graphics.Draw.StartCache( ); Graphics.Draw.Sphere( surface, Point3.Origin, 100, 10, 10 ); m_Box = Graphics.Draw.StopCache( ); m_Texture = Graphics.Factory.CreateCubeMapTexture( ); LoadStarBoxTextures( m_Texture, "Star Fields/Default/" ); //int imageIndex = 0; //foreach ( Bitmap bmp in m_Texture.ToBitmaps( ) ) //{ // bmp.Save( "StarBoxCubeMapFace" + imageIndex++ + ".bmp", ImageFormat.Bmp ); //} }
/// <summary> /// Loads star box textures from a given folder into a cube map texture /// </summary> private static void LoadStarBoxTextures( ICubeMapTexture texture, string path ) { texture.Build ( LoadCubeMapFace( path + "starBox_rt.jpg" ), LoadCubeMapFace( path + "starBox_lf.jpg" ), LoadCubeMapFace( path + "starBox_up.jpg" ), LoadCubeMapFace( path + "starBox_dn.jpg" ), LoadCubeMapFace( path + "starBox_fr.jpg" ), LoadCubeMapFace( path + "starBox_bk.jpg" ), true ); }