#include <mesh.h>
Public Member Functions | |
MeshBaryTriangle (const Mesh *m, int n) | |
virtual | ~MeshBaryTriangle () |
virtual BBox | ObjectBound () const |
virtual BBox | WorldBound () const |
virtual bool | CanIntersect () const |
virtual bool | Intersect (const Ray &ray, Intersection *isect) const |
virtual bool | IntersectP (const Ray &ray) const |
virtual void | GetShadingGeometry (const Transform &obj2world, const DifferentialGeometry &dg, DifferentialGeometry *dgShading) const |
virtual bool | CanSample () const |
virtual float | Area () const |
virtual void | Sample (float u1, float u2, float u3, DifferentialGeometry *dg) const |
virtual bool | isDegenerate () const |
void | GetUVs (float uv[3][2]) const |
const Point & | GetP (u_int i) const |
Public Attributes | |
const Mesh * | mesh |
const int * | v |
Definition at line 111 of file mesh.h.
Definition at line 114 of file mesh.h.
References mesh, lux::Shape::reverseOrientation, cimg_library::cimg::swap(), lux::Shape::transformSwapsHandedness, and v.
virtual lux::MeshBaryTriangle::~MeshBaryTriangle | ( | ) | [inline, virtual] |
float MeshBaryTriangle::Area | ( | ) | const [virtual] |
Returns the area of this primitive.
Reimplemented from lux::Primitive.
Definition at line 155 of file meshbarytriangle.cpp.
References lux::Cross(), lux::Vector::Length(), mesh, lux::Mesh::p, and v.
virtual bool lux::MeshBaryTriangle::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Implements lux::Primitive.
virtual bool lux::MeshBaryTriangle::CanSample | ( | ) | const [inline, virtual] |
Returns whether this primitive can be sampled.
Implements lux::Primitive.
Definition at line 157 of file mesh.h.
References mesh, lux::Mesh::p, and v.
void MeshBaryTriangle::GetShadingGeometry | ( | const Transform & | obj2world, | |
const DifferentialGeometry & | dg, | |||
DifferentialGeometry * | dgShading | |||
) | const [virtual] |
Calculates the shading geometry from the given intersection geometry.
obj2world | The object to world transformation to use. | |
dg | The intersection geometry. | |
dgShading | The destination for the shading geometry. |
Reimplemented from lux::Primitive.
Definition at line 184 of file meshbarytriangle.cpp.
References lux::Cross(), lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::DifferentialGeometry::dpdx, lux::DifferentialGeometry::dpdy, lux::DifferentialGeometry::dudx, lux::DifferentialGeometry::dudy, lux::DifferentialGeometry::dvdx, lux::DifferentialGeometry::dvdy, GetUVs(), lux::Vector::Length(), mesh, lux::Mesh::n, lux::Normalize(), lux::DifferentialGeometry::p, lux::DifferentialGeometry::triangleBaryCoords, lux::DifferentialGeometry::u, lux::DifferentialGeometry::v, and v.
void lux::MeshBaryTriangle::GetUVs | ( | float | uv[3][2] | ) | const [inline] |
Definition at line 140 of file mesh.h.
References mesh, lux::Mesh::uvs, and v.
Referenced by GetShadingGeometry(), lux::MeshWaldTriangle::Intersect(), Intersect(), lux::MeshWaldTriangle::MeshWaldTriangle(), lux::MeshWaldTriangle::Sample(), and Sample().
bool MeshBaryTriangle::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::Primitive.
Reimplemented in lux::MeshWaldTriangle.
Definition at line 48 of file meshbarytriangle.cpp.
References lux::CoordinateSystem(), lux::Cross(), lux::Ray::d, lux::Intersection::dg, lux::Dot(), lux::Shape::GetMaterial(), GetUVs(), lux::Ray::maxt, mesh, lux::Normalize(), lux::Ray::o, lux::Mesh::p, lux::Intersection::Set(), lux::DifferentialGeometry::triangleBaryCoords, v, and lux::Shape::WorldToObject.
bool MeshBaryTriangle::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::Primitive.
Reimplemented in lux::MeshWaldTriangle.
Definition at line 121 of file meshbarytriangle.cpp.
References lux::Cross(), lux::Ray::d, lux::Dot(), lux::Ray::maxt, mesh, lux::Ray::o, lux::Mesh::p, and v.
virtual bool lux::MeshBaryTriangle::isDegenerate | ( | ) | const [inline, virtual] |
Reimplemented in lux::MeshWaldTriangle.
Definition at line 136 of file mesh.h.
Referenced by lux::Mesh::Refine().
BBox MeshBaryTriangle::ObjectBound | ( | ) | const [virtual] |
Definition at line 29 of file meshbarytriangle.cpp.
References mesh, lux::Mesh::p, lux::Union(), v, and lux::Shape::WorldToObject.
void MeshBaryTriangle::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::Primitive.
Reimplemented in lux::MeshWaldTriangle.
Definition at line 164 of file meshbarytriangle.cpp.
References lux::CoordinateSystem(), lux::Cross(), lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, GetUVs(), mesh, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::Mesh::p, lux::DifferentialGeometry::u, lux::UniformSampleTriangle(), lux::DifferentialGeometry::v, and v.
BBox MeshBaryTriangle::WorldBound | ( | ) | const [virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Definition at line 39 of file meshbarytriangle.cpp.
References mesh, lux::Mesh::p, lux::Union(), and v.
const Mesh* lux::MeshBaryTriangle::mesh |
Definition at line 160 of file mesh.h.
Referenced by Area(), GetP(), GetShadingGeometry(), GetUVs(), lux::MeshWaldTriangle::Intersect(), Intersect(), IntersectP(), MeshBaryTriangle(), lux::MeshWaldTriangle::MeshWaldTriangle(), ObjectBound(), lux::MeshWaldTriangle::Sample(), Sample(), and WorldBound().
const int* lux::MeshBaryTriangle::v |
Definition at line 161 of file mesh.h.
Referenced by Area(), GetP(), GetShadingGeometry(), GetUVs(), lux::MeshWaldTriangle::Intersect(), Intersect(), IntersectP(), MeshBaryTriangle(), lux::MeshWaldTriangle::MeshWaldTriangle(), ObjectBound(), lux::MeshWaldTriangle::Sample(), Sample(), and WorldBound().