0

これが、非常に単純なレイ トレーサーのビューポート クラスです。

public sealed class ViewPort
{
    public readonly Rectangle3D Rectangle;

    public readonly int Width;
    public readonly int Height;

    public Bitmap Image { get; private set; }

    public ViewPort(Rectangle3D rec, int width, int height)
    {
        this.Rectangle = rec;

        this.Width = width;
        this.Height = height;

        this.Image = new Bitmap(this.Width, this.Height);
    }

    public bool TryRecord(Ray ray)
    {
        Point3D cross;
        if (this.Rectangle.Intersect(ray, out cross))
        {
            this.Image.SetPixel(cross...,ray.Light);
        }
        else
        {
            return false;
        }
    }
}

では、3 次元の点を 2 次元の画像にマッピングするにはどうすればよいでしょうか。助けていただければ幸いです。ありがとうございました。

4

1 に答える 1

0

この種のことについてはいつものように、これらすべての概念を詳細に説明している Scratchapixel.com を見るのが最善です。Web で少し検索すると、次の素晴らしいリソースにたどり着いたと思います。

http://scratchapixel.com/lessons/3d-basic-lessons/lesson-1-writing-a-simple-raytracer/

于 2013-09-04T15:14:03.457 に答える