#include <mesh.h>
Public Member Functions | |
MeshWaldTriangle (const Mesh *m, int n) | |
virtual | ~MeshWaldTriangle () |
virtual bool | Intersect (const Ray &ray, Intersection *isect) const |
virtual bool | IntersectP (const Ray &ray) const |
virtual void | Sample (float u1, float u2, float u3, DifferentialGeometry *dg) const |
virtual bool | isDegenerate () const |
Private Types | |
enum | IntersectionType { DOMINANT_X, DOMINANT_Y, DOMINANT_Z, DEGENERATE } |
Private Attributes | |
IntersectionType | intersectionType |
float | nu |
float | nv |
float | nd |
float | bnu |
float | bnv |
float | bnd |
float | cnu |
float | cnv |
float | cnd |
Vector | dpdu |
Vector | dpdv |
Normal | normalizedNormal |
Definition at line 164 of file mesh.h.
enum lux::MeshWaldTriangle::IntersectionType [private] |
Definition at line 29 of file meshwaldtriangle.cpp.
References bnd, bnu, bnv, cnd, cnu, cnv, lux::CoordinateSystem(), lux::Cross(), DEGENERATE, lux::DistanceSquared(), DOMINANT_X, DOMINANT_Y, DOMINANT_Z, dpdu, dpdv, lux::MeshBaryTriangle::GetUVs(), intersectionType, lux::MeshBaryTriangle::mesh, nd, lux::Normalize(), normalizedNormal, nu, nv, lux::Mesh::p, cimg_library::cimg::swap(), lux::MeshBaryTriangle::v, lux::Point::x, lux::Normal::x, lux::Point::y, lux::Normal::y, lux::Point::z, and lux::Normal::z.
virtual lux::MeshWaldTriangle::~MeshWaldTriangle | ( | ) | [inline, virtual] |
bool MeshWaldTriangle::Intersect | ( | const Ray & | r, | |
Intersection * | in | |||
) | const [virtual] |
Intersects this primitive with the given ray. If an intersection is found, the ray will (i.e. r.tmax) and all fields in the intersection info will be updated.
r | The ray to intersect with this primitive. | |
in | The destination of the intersection information. |
Reimplemented from lux::MeshBaryTriangle.
Definition at line 156 of file meshwaldtriangle.cpp.
References bnd, bnu, bnv, cnd, cnu, cnv, lux::Ray::d, lux::Intersection::dg, DOMINANT_X, DOMINANT_Y, DOMINANT_Z, dpdu, dpdv, lux::Shape::GetMaterial(), lux::MeshBaryTriangle::GetUVs(), intersectionType, lux::Ray::maxt, lux::MeshBaryTriangle::mesh, lux::Ray::mint, nd, normalizedNormal, nu, nv, lux::Ray::o, lux::Mesh::p, lux::Intersection::Set(), lux::DifferentialGeometry::triangleBaryCoords, lux::MeshBaryTriangle::v, lux::Shape::WorldToObject, lux::Vector::x, lux::Point::x, lux::Vector::y, lux::Point::y, lux::Vector::z, and lux::Point::z.
bool MeshWaldTriangle::IntersectP | ( | const Ray & | r | ) | const [virtual] |
Tests for intersection of this primitive with the given ray.
r | The ray to intersect with this primitive. |
Reimplemented from lux::MeshBaryTriangle.
Definition at line 238 of file meshwaldtriangle.cpp.
References bnd, bnu, bnv, cnd, cnu, cnv, lux::Ray::d, DOMINANT_X, DOMINANT_Y, DOMINANT_Z, intersectionType, lux::Ray::maxt, lux::Ray::mint, nd, nu, nv, lux::Ray::o, lux::Vector::x, lux::Point::x, lux::Vector::y, lux::Point::y, lux::Vector::z, and lux::Point::z.
bool MeshWaldTriangle::isDegenerate | ( | ) | const [virtual] |
Reimplemented from lux::MeshBaryTriangle.
Definition at line 318 of file meshwaldtriangle.cpp.
References DEGENERATE, and intersectionType.
Referenced by lux::Mesh::Refine().
void MeshWaldTriangle::Sample | ( | float | u1, | |
float | u2, | |||
float | u3, | |||
DifferentialGeometry * | dg | |||
) | const [virtual] |
Samples a point on this primitive. Only the p, nn, dpdu, dpdv, u and v need to be calculated.
u1 | The point coordinate in the first dimension. | |
u2 | The point coordinate in the second dimension. | |
u3 | The subprimitive to sample. | |
dg | The destination to store the sampled point in. |
Reimplemented from lux::MeshBaryTriangle.
Definition at line 298 of file meshwaldtriangle.cpp.
References dpdu, lux::DifferentialGeometry::dpdu, dpdv, lux::DifferentialGeometry::dpdv, lux::MeshBaryTriangle::GetUVs(), lux::MeshBaryTriangle::mesh, lux::DifferentialGeometry::nn, normalizedNormal, lux::DifferentialGeometry::p, lux::Mesh::p, lux::DifferentialGeometry::u, lux::UniformSampleTriangle(), lux::DifferentialGeometry::v, and lux::MeshBaryTriangle::v.
float lux::MeshWaldTriangle::bnd [private] |
Definition at line 187 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().
float lux::MeshWaldTriangle::bnu [private] |
Definition at line 187 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().
float lux::MeshWaldTriangle::bnv [private] |
Definition at line 187 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().
float lux::MeshWaldTriangle::cnd [private] |
Definition at line 188 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().
float lux::MeshWaldTriangle::cnu [private] |
Definition at line 188 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().
float lux::MeshWaldTriangle::cnv [private] |
Definition at line 188 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().
Vector lux::MeshWaldTriangle::dpdu [private] |
Definition at line 191 of file mesh.h.
Referenced by Intersect(), MeshWaldTriangle(), and Sample().
Vector lux::MeshWaldTriangle::dpdv [private] |
Definition at line 191 of file mesh.h.
Referenced by Intersect(), MeshWaldTriangle(), and Sample().
Definition at line 185 of file mesh.h.
Referenced by Intersect(), IntersectP(), isDegenerate(), and MeshWaldTriangle().
float lux::MeshWaldTriangle::nd [private] |
Definition at line 186 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().
Definition at line 192 of file mesh.h.
Referenced by Intersect(), MeshWaldTriangle(), and Sample().
float lux::MeshWaldTriangle::nu [private] |
Definition at line 186 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().
float lux::MeshWaldTriangle::nv [private] |
Definition at line 186 of file mesh.h.
Referenced by Intersect(), IntersectP(), and MeshWaldTriangle().