public SkyMaterial(Viewer viewer) : base(viewer, null) { SkyShader = Viewer.MaterialManager.SkyShader; // TODO: This should happen on the loader thread. SkyTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "SkyDome1.png")); StarTextureN = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "Starmap_N.png")); StarTextureS = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "Starmap_S.png")); MoonTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "MoonMap.png")); MoonMask = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "MoonMask.png")); CloudTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "Clouds01.png")); ShaderPassesSky = SkyShader.Techniques["Sky"].Passes.GetEnumerator(); ShaderPassesMoon = SkyShader.Techniques["Moon"].Passes.GetEnumerator(); ShaderPassesClouds = SkyShader.Techniques["Clouds"].Passes.GetEnumerator(); SkyShader.SkyMapTexture = SkyTexture; SkyShader.StarMapTexture = StarTextureN; SkyShader.MoonMapTexture = MoonTexture; SkyShader.MoonMaskTexture = MoonMask; SkyShader.CloudMapTexture = CloudTexture; }
public MSTSSkyMaterial(Viewer viewer) : base(viewer, null) { MSTSSkyShader = Viewer.MaterialManager.SkyShader; //// TODO: This should happen on the loader thread. if (viewer.ENVFile.SkyLayers != null) { var mstsskytexture = Viewer.ENVFile.SkyLayers.ToArray(); int count = Viewer.ENVFile.SkyLayers.Count; string[] mstsSkyTexture = new string[Viewer.ENVFile.SkyLayers.Count]; for (int i = 0; i < Viewer.ENVFile.SkyLayers.Count; i++) { mstsSkyTexture[i] = Viewer.Simulator.RoutePath + @"\envfiles\textures\" + mstsskytexture[i].TextureName.ToString(); MSTSSkyTexture.Add(Orts.Formats.Msts.AceFile.Texture2DFromFile(Viewer.RenderProcess.GraphicsDevice, mstsSkyTexture[i])); if (i == 0) { MSTSDayTexture = MSTSSkyTexture[i]; mstsskytexturex = mstsskytexture[i].TileX; mstsskytexturey = mstsskytexture[i].TileY; } else if (mstsskytexture[i].Fadein_Begin_Time != null) { MSTSSkyStarTexture = MSTSSkyTexture[i]; mstsskytexturex = mstsskytexture[i].TileX; mstsskytexturey = mstsskytexture[i].TileY; } else { MSTSSkyCloudTexture.Add(Orts.Formats.Msts.AceFile.Texture2DFromFile(Viewer.RenderProcess.GraphicsDevice, mstsSkyTexture[i])); mstscloudtexturex = mstsskytexture[i].TileX; mstscloudtexturey = mstsskytexture[i].TileY; } } MSTSSkyConstants.mstsskyTileu = mstsskytexturex; MSTSSkyConstants.mstsskyTilev = mstsskytexturey; MSTSSkyConstants.mstscloudTileu = mstscloudtexturex; MSTSSkyConstants.mstscloudTilev = mstscloudtexturey; } else { MSTSSkyTexture.Add(SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "SkyDome1.png"))); MSTSSkyStarTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "Starmap_N.png")); } if (viewer.ENVFile.SkySatellite != null) { var mstsskysatellitetexture = Viewer.ENVFile.SkySatellite.ToArray(); string mstsSkySunTexture = Viewer.Simulator.RoutePath + @"\envfiles\textures\" + mstsskysatellitetexture[0].TextureName.ToString(); string mstsSkyMoonTexture = Viewer.Simulator.RoutePath + @"\envfiles\textures\" + mstsskysatellitetexture[1].TextureName.ToString(); MSTSSkySunTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, mstsSkySunTexture); MSTSSkyMoonTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, mstsSkyMoonTexture); } else { MSTSSkyMoonTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "MoonMap.png")); } MSTSSkyMoonMask = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "MoonMask.png")); //ToDo: No MSTS equivalent - will need to be fixed in MSTSSky.cs //MSTSSkyCloudTexture[0] = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "Clouds01.png")); ShaderPassesSky = MSTSSkyShader.Techniques["Sky"].Passes.GetEnumerator(); ShaderPassesMoon = MSTSSkyShader.Techniques["Moon"].Passes.GetEnumerator(); for (int i = 0; i < Viewer.ENVFile.SkyLayers.Count - 2; i++) { ShaderPassesClouds.Add(MSTSSkyShader.Techniques["Clouds"].Passes.GetEnumerator()); } MSTSSkyShader.SkyMapTexture = MSTSDayTexture; MSTSSkyShader.StarMapTexture = MSTSSkyStarTexture; MSTSSkyShader.MoonMapTexture = MSTSSkyMoonTexture; MSTSSkyShader.MoonMaskTexture = MSTSSkyMoonMask; MSTSSkyShader.CloudMapTexture = MSTSSkyCloudTexture[0]; }