paysages3d/src/render/software/RayIntersector.h
2016-07-25 18:27:48 +02:00

44 lines
1.2 KiB
C++

#pragma once
#include "software_global.h"
namespace paysages {
namespace software {
/**
* Abstract class to handle intersection with a ray.
*/
class SOFTWARESHARED_EXPORT RayIntersector {
public:
RayIntersector();
virtual ~RayIntersector();
/**
* Get the priority of this intersector.
*
* Higher priority intersectors are tested first, and should be the easy ones.
*/
virtual int getPriority() const;
/**
* Find the nearest intersection with the ray (within *limit* length).
*
* By default, it will perform ray marching, using isInside as intersection checker.
*/
virtual bool findIntersection(const Vector3 &eye, const Vector3 &direction, double limit, Vector3 *out_hit) const;
/**
* Indicate if a given location is inside a solid volume.
*/
virtual bool isInside(const Vector3 &location, double *out_distance = nullptr) const;
/**
* Get the incident color for a ray intersection at a given hit point.
*
* This should already have lighting apply, but not medium traversal between *eye* and *location*.
*/
virtual Color getColorAtHit(const Vector3 &eye, const Vector3 &location) const;
};
}
}