public void SetRenderTarget(CubeTexture environmentRT, CubeTexture ambientRT, Texture fullSizeRT)
        {
            m_setup.RenderTargets[0] = fullSizeRT;

            m_environmentRT = environmentRT;
            m_ambientRT = ambientRT;
            m_fullSizeRT = fullSizeRT;
        }
Example #2
0
        public static void DDSFromFile(string fileName, Device device, bool loadMipMap, int offsetMipMaps, out CubeTexture texture)
        {
            Stream stream = File.OpenRead(fileName);
            CubeTexture tex = null;
            InternalDDSFromStream(stream, device, 0, loadMipMap, 0, out tex);
            stream.Close();
            stream.Dispose();

            texture = tex as CubeTexture;
            if (texture == null)
            {
                throw new Exception("Error while loading TextureCube");
            }
        }
Example #3
0
 public static void DDSFromFile(string fileName, Device device, bool loadMipMap, int offsetMipMaps, out CubeTexture texture)
 {
     try
     {
         using (var stream = MyFileSystem.OpenRead(fileName))
         {
             InternalDDSFromStream(stream, device, 0, loadMipMap, 0, out texture);
         }
     }
     catch (Exception e)
     {
         MyLog.Default.WriteLine("ERROR: Failed loading texture " + fileName.ToString());
         MyLog.Default.WriteLine(e.ToString());
         throw;
     }
 }
Example #4
0
        public Direct3D9CubeMap(Device device, string name, BitmapSurface front, BitmapSurface back, BitmapSurface left, BitmapSurface right,
                                BitmapSurface up, BitmapSurface down)
            : base(name)
        {
            _cubeMap = new CubeTexture(device, front.Width, 0, Usage.AutoGenerateMipMap, Format.X8R8G8B8, Pool.Managed);
            writeFacePixels(CubeMapFace.PositiveX, front.Pixels, front.Width, front.Height);
            writeFacePixels(CubeMapFace.NegativeX, back.Pixels, back.Width, back.Height);
            writeFacePixels(CubeMapFace.PositiveZ, right.Pixels, right.Width, right.Height);
            writeFacePixels(CubeMapFace.NegativeZ, left.Pixels, left.Width, left.Height);
            writeFacePixels(CubeMapFace.PositiveY, up.Pixels, up.Width, up.Height);

            if (down != null)
            {
                writeFacePixels(CubeMapFace.NegativeY, down.Pixels, down.Width, down.Height);
            }
            else
            {
                // apparently the "down" face isn't needed. we'll just reuse the top.
                writeFacePixels(CubeMapFace.NegativeY, up.Pixels, up.Width, up.Height);
            }
        }
Example #5
0
 public static void DrawSpriteFast(CubeTexture texture, CubeMapFace face, int x, int y, int width, int height, Color color)
 {
     m_spriteBatch.Begin(SpriteSortMode.Immediate);
     m_spriteBatch.Draw(texture, face, new SharpDX.DrawingRectangle(x, y, width, height), SharpDXHelper.ToSharpDX(color));
     m_spriteBatch.End();
 }
Example #6
0
 //loads the data from a stream in to a texture object.
 private static void InternalDDSFromStream(Stream stream, Device device, int streamOffset, bool loadMipMap, int offsetMipMaps, out CubeTexture texture)
 {
     stream.Position = 0;
     texture = SharpDX.Direct3D9.CubeTexture.FromStream(device, stream, 0, 0, offsetMipMaps, Usage.None, Format.Unknown, Pool.Default, Filter.None, Filter.None, 0);
 }
 public void SetTextureAmbientAux(CubeTexture ambientMapAux)
 {
     m_D3DEffect.SetTexture(m_textureAmbientAux, ambientMapAux);
 }
 public void SetTextureAmbientMain(CubeTexture ambientMapMain)
 {
     m_D3DEffect.SetTexture(m_textureAmbientMain, ambientMapMain);
 }
 public void SetTextureEnvironmentAux(CubeTexture environmentMapAux)
 {
     m_D3DEffect.SetTexture(m_textureEnvironmentAux, environmentMapAux);
 }
 public void SetTextureEnvironmentMain(CubeTexture environmentMapMain)
 {
     m_D3DEffect.SetTexture(m_textureEnvironmentMain, environmentMapMain);
 }
        static void CreateRenderTargetCube(MyRenderTargets renderTarget, int size, Format surfaceFormat)
        {
            DisposeRenderTarget(renderTarget);
            if (size <= 0)
            {
                return;
            }

            m_renderTargets[(int)renderTarget] = new CubeTexture(GraphicsDevice, size, 0, Usage.RenderTarget | Usage.AutoGenerateMipMap, surfaceFormat, Pool.Default);
            m_renderTargets[(int)renderTarget].DebugName = renderTarget.ToString();
        }
 public void SetEnvironmentMap(CubeTexture envMap)
 {
     m_D3DEffect.SetTexture(m_environmentMap, envMap);
 }
 public void SetCubeTexture(CubeTexture textureToSet)
 {
     m_D3DEffect.SetTexture(effectCubeTexture, textureToSet);
 }
Example #14
0
			protected override void dispose( bool disposeManagedResources )
			{
				if ( !IsDisposed )
				{
					if ( disposeManagedResources )
					{
						this.NormalTexture.SafeDispose();
						this.NormalTexture = null;

						this.CubeTexture.SafeDispose();
						this.CubeTexture = null;

						this.VolumeTexture.SafeDispose();
						this.VolumeTexture = null;

						this.BaseTexture.SafeDispose();
						this.BaseTexture = null;

						this.FSAASurface.SafeDispose();
						this.FSAASurface = null;
					}
				}

				base.dispose( disposeManagedResources );
			}
Example #15
0
 public static void SetRenderTargets(CubeTexture envMain, CubeTexture envAux, CubeTexture ambMain, CubeTexture ambAux, Texture fullSizeRT)
 {
     m_environmentMapRendererMain.SetRenderTarget(envMain, ambMain, fullSizeRT);
     m_environmentMapRendererAux.SetRenderTarget(envAux, ambAux, fullSizeRT);
 }
 public void SetBackgroundTexture(CubeTexture texture)
 {
     m_D3DEffect.SetTexture(m_backgroundTexture, texture);
 }
Example #17
0
        static void CreateRenderTargetCube(MyRenderTargets renderTarget, int size, Format surfaceFormat)
        {
            MyMwcLog.WriteLine("MyRender.CreateRenderTargetCube - START");

            DisposeRenderTarget(renderTarget);
            if (size <= 0)
            {
                return;
            }

            m_renderTargets[(int)renderTarget] = new CubeTexture(m_device, size, 0, Usage.RenderTarget, surfaceFormat, Pool.Default);
            m_renderTargets[(int)renderTarget].DebugName = renderTarget.ToString();
            m_renderTargets[(int)renderTarget].Tag = new Vector2(size, size);

            MyMwcLog.WriteLine("MyRender.CreateRenderTargetCube - END");
        }
 public void SetEnvironmentMap(CubeTexture environmentMap)
 {
     m_D3DEffect.SetTexture(m_environmentMap, environmentMap);
     m_D3DEffect.SetValue(m_halfPixel, MyUtils.GetHalfPixel(environmentMap.GetLevelDescription(0).Width, environmentMap.GetLevelDescription(0).Height));
 }