2011-11-16 30 views
0

我需要傳遞一個Vector3或Vector4的數組到我的像素着色器。有沒有像我可以從CPU設置的一維紋理和GPU上的樣本?XNA中是否有Texture1D?

+0

怎麼樣1維的Texture2D? Texture2D SimpleTexture =新的Texture2D(GraphicsDevice,1,100,false,SurfaceFormat.Color); – Elideb

+0

是的,我也在想,但它限制你在任何一個方面不超過4096,並且我需要類似76,800個條目 –

+1

是否真的有必要問一連串關於如何做的*** 6 ***問題這個? –

回答

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; 
    } 
} 
相關問題