Ray pixel intersection

Started by
1 comment, last by football94 10 years, 10 months ago

Hi guys

I have a ray intersection method(code below) that was created using java and have been trying to convert it to c#/xna

but Im having trouble trying to find the class equivalent of javas Image and Scene classes if anyone could help

me with this conversion it would be much appreciated. Thankyou

Image RayCast(Camera camera, Scene scene, int width, int height)
{

Image image = new Image(width, height);

for (int i = 0; i < width; i++)
{

for (int j = 0; j < height; j++)
{

Ray ray = ConstructRayThroughPixel(camera, i, j);

Intersection hit = FindIntersection(ray, scene);

image[j] = GetColor(hit);

}

}

return image;

}

Advertisement

XNA has no equivalent to Scene or Camera. The logical equivalent to Image would be Texture2D.

Thanks Dave I'll start experimenting right away.

Thanks again

This topic is closed to new replies.

Advertisement