Declaring 2d array in XNA

家住魔仙堡 提交于 2020-01-06 14:00:11

问题


6 images 800x640 need to be rendered from a point of view, and based on these images one new image 800x640, a sort of fish-eye view, should be created. At the moment the application draw each image and read the colors by calling this RenderTarget2D.GetData method and based on each pixel position it calculates new position for that final image. It works fine.

but since calling RenderTarget2D.GetData reduces the performance I tried to declare a 800x640 array in shader and then render 6 images consecutively. Then in pixel shader find the new coordinate of the new fish-eye view image.

float4 PSTooBasic(VertexPSInput pin) : COLOR
{
    int xCoord = GetWaldXCoordinate(pin.PositionWS.x); 
    int yCoord = GetWaldYCoordinate(pin.PositionWS.y);

    WaldPixs[xCoord][yCoord] = 1; 

    return BlackColor;
}

But this array declaration line: uniform int WaldPixs[800][640];

gives this compile error: error X3059: 'WaldPixs': array dimension must be between 1 and 65536

Any suggestion or workaround?

Thanks,

来源:https://stackoverflow.com/questions/18145237/declaring-2d-array-in-xna

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!