XNA中有Texture1D吗?

时间:2011-11-16 14:52:40

标签: xna-4.0 pixel-shader

我需要将一个Vector3或Vector4数组传递给我的像素着色器。是否有类似于一维纹理的东西我可以从CPU设置并在GPU上进行采样?

1 个答案:

答案 0 :(得分:0)

没有没有可以使用的内置类,但您可以创建自己的类(未经测试):

public class Texture1D
{
    GraphicsDevice device;
    Vector4[] pixels;

    bool mipMap = false;
    SurfaceFormat Format;

    public Texture1D (GraphicsDevice Device, int Length)
    {
        pixels = new Vector4[Length];
        device = Device;
        Format = SurfaceFormat.Color;
    }

    public Texture1D (GraphicsDevice Device, int Length, bool mipMap, SurfaceFormat format)
    {
        pixels = new Vector4[Length];
        device = Device;
        this.mipMap = mipMap;
        Format = format;
    }
}