Exemplo n.º 1
0
        protected override void SetTextureConstant(int index, IBaseTexture texture, bool linearSampling)
        {
            var tex = texture as ITexture2D;

            if (tex == null)
            {
                throw new NotSupportedException("Only 2D textures are supported in OpenCL");
            }

            Shader.SetInputTextureArg(index, tex, false);
        }
Exemplo n.º 2
0
 protected override void SetTextureConstant(int index, IBaseTexture texture, bool linearSampling)
 {
     if (texture is ITexture2D)
     {
         var tex = (ITexture2D)texture;
         Shader.SetTextureConstant(index, tex, linearSampling, false);
     }
     else
     {
         var tex = (ITexture3D)texture;
         Shader.SetTextureConstant(index, tex, linearSampling, false);
     }
 }
Exemplo n.º 3
0
 public static TextureSize GetSize(this IBaseTexture texture)
 {
     if (texture is ITexture2D)
     {
         var t = (ITexture2D)texture;
         return(new TextureSize(t.Width, t.Height));
     }
     if (texture is ITexture3D)
     {
         var t = (ITexture3D)texture;
         return(new TextureSize(t.Width, t.Height, t.Depth));
     }
     throw new ArgumentException("Invalid texture type");
 }
Exemplo n.º 4
0
 public static TextureSize GetSize(this IBaseTexture texture)
 {
     if (texture == null)
     {
         throw new NullReferenceException("GetSize() is called on a null texture");
     }
     if (texture is ITexture2D)
     {
         var t = (ITexture2D)texture;
         return(new TextureSize(t.Width, t.Height));
     }
     if (texture is ITexture3D)
     {
         var t = (ITexture3D)texture;
         return(new TextureSize(t.Width, t.Height, t.Depth));
     }
     throw new ArgumentException("Invalid texture type");
 }
Exemplo n.º 5
0
 protected abstract void SetTextureConstant(int index, IBaseTexture texture, bool linearSampling);