/// converts a cubemap texture to a lat long map public TextureArray2D ConvertToLatLong(TextureArray2D cube, int resolution) { Debug.Assert(cube.NumLayers == 6); var dst = new TextureArray2D(LayerMipmapCount.One, new Size3(resolution, Math.Max(resolution / 2, 1)), Format.R32G32B32A32_Float, false); var dev = Device.Get(); quad.Bind(false); dev.Pixel.Set(toLatLong.Pixel); var dim = dst.Size; dev.Pixel.SetShaderResource(0, cube.GetCubeView(0)); dev.Pixel.SetSampler(0, sampler); dev.OutputMerger.SetRenderTargets(dst.GetRtView(LayerMipmapSlice.Mip0)); dev.SetViewScissors(dim.Width, dim.Height); dev.DrawQuad(); dev.Pixel.SetShaderResource(0, null); dev.Pixel.SetSampler(0, null); dev.OutputMerger.SetRenderTargets((RenderTargetView)null); quad.Unbind(); return(dst); }