/// <summary> /// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D10.Texture1D" /> class. /// </summary> /// <param name = "device">The device with which to associate the texture.</param> /// <param name = "description">The description of the texture.</param> /// <param name = "data">An array of initial texture data for each subresource.</param> public Texture1D(Device device, Texture1DDescription description, DataStream[] data) : base(IntPtr.Zero) { var subResourceDatas = new DataBox[data.Length]; for (int i = 0; i < subResourceDatas.Length; i++) subResourceDatas[i].DataPointer = data[i].DataPointer; device.CreateTexture1D(ref description, subResourceDatas, this); }
/// <summary> /// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D10.Texture1D" /> class. /// </summary> /// <param name = "device">The device with which to associate the texture.</param> /// <param name = "description">The description of the texture.</param> /// <param name = "data">An array of initial texture data for each subresource.</param> public Texture1D(Device device, Texture1DDescription description, DataStream[] data) : base(IntPtr.Zero) { System.Diagnostics.Debug.Assert(data != null); var subResourceDatas = new DataBox[data.Length]; for (int i = 0; i < subResourceDatas.Length; i++) subResourceDatas[i].DataPointer = data[i].DataPointer; device.CreateTexture1D(ref description, subResourceDatas, this); }
/// <summary> /// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D10.Texture1D" /> class. /// </summary> /// <param name = "device">The device with which to associate the texture.</param> /// <param name = "description">The description of the texture.</param> /// <param name = "data">The initial texture data.</param> public Texture1D(Device device, Texture1DDescription description, DataStream data) : this(device, description, new[] {data}) { System.Diagnostics.Debug.Assert(data != null); }
/// <summary> /// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D10.Texture1D" /> class. /// </summary> /// <param name = "device">The device with which to associate the texture.</param> /// <param name = "description">The description of the texture.</param> public Texture1D(Device device, Texture1DDescription description) : base(IntPtr.Zero) { device.CreateTexture1D(ref description, null, this); }
private void BindTextureFor1DColorProviders() { _descriptionTextureFor1DColorProvider = new Texture1DDescription() { ArraySize = 1, BindFlags = BindFlags.ShaderResource, CpuAccessFlags = CpuAccessFlags.Write, Format = Format.R32G32B32A32_Float, MipLevels = 1, OptionFlags = ResourceOptionFlags.None, Usage = ResourceUsage.Dynamic, Width = 1024 }; _textureFor1DColorProvider = new Texture1D(_hostDevice, _descriptionTextureFor1DColorProvider); var _textureFor1DColorMeshTextureView = new ShaderResourceView(_hostDevice, _textureFor1DColorProvider); var shaderResourceObj = this._lightingEffect.GetVariableByName("ColorGradient1DTexture"); EffectShaderResourceVariable shaderResource = shaderResourceObj.AsShaderResource(); shaderResource.SetResource(_textureFor1DColorMeshTextureView); }
/// <summary> /// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D10.Texture1D" /> class. /// </summary> /// <param name = "device">The device with which to associate the texture.</param> /// <param name = "description">The description of the texture.</param> /// <param name = "data">The initial texture data.</param> public Texture1D(Device device, Texture1DDescription description, DataStream data) : this(device, description, new[] {data}) { }