librtl

plane.h

This is the verbatim text of the plane.h include file.
#ifndef plane_h
#define plane_h

#include "object.h"


class rtl_plane : public rtl_object
{
public:

    rtl_plane();

protected:
    
    virtual jFlt lclintersect( const rtl_ray& ray )
    {
        jFlt t = ray.direction()[1] != 0
            ? -ray.origin()[1] / ray.direction()[1]
            : NOHIT;
        if(t>EPS)
        {
            flags().set(Entrance,sign(ray.origin()[1]) 
                        != sign(ray.direction()[1]));
        }
        return t;
    }
    
    jNorm3 lclnormal( const jVec3& )
    {
        return jNorm3(0,1,0);
    }

    jVec2 uv( const jVec3& p )
        {
            return jVec2(mod(p[0],1),mod(p[2],1));
        }
};

#endif

JSP / librtl v0.2 mtigges@cpsc.ucalgary.ca