#include <loopsubdiv.h>
Classes | |
class | SubdivResult |
Public Member Functions | |
LoopSubdiv (const Transform &o2w, bool ro, int nt, int nv, const int *vi, const Point *P, const float *uv, int nlevels, const boost::shared_ptr< Texture< float > > dismap, float dmscale, float dmoffset, bool dmnormalsmooth, bool dmsharpboundary) | |
virtual | ~LoopSubdiv () |
virtual bool | CanIntersect () const |
virtual void | Refine (vector< boost::shared_ptr< Shape > > &refined) const |
virtual BBox | ObjectBound () const |
virtual BBox | WorldBound () const |
boost::shared_ptr< SubdivResult > | Refine () const |
Static Public Member Functions | |
static Shape * | CreateShape (const Transform &o2w, bool reverseOrientation, const ParamSet ¶ms) |
Private Member Functions | |
float | beta (int valence) const |
void | weightOneRing (SDVertex *destVert, SDVertex *vert, float beta) const |
void | weightBoundary (SDVertex *destVert, SDVertex *vert, float beta) const |
float | gamma (int valence) const |
void | ApplyDisplacementMap (const vector< SDVertex * > verts, const Normal *norms, const float *uvs) const |
Static Private Member Functions | |
static void | GenerateNormals (const vector< SDVertex * > verts, Normal *Ns) |
Private Attributes | |
int | nLevels |
vector< SDVertex * > | vertices |
vector< SDFace * > | faces |
boost::shared_ptr< Texture < float > > | displacementMap |
float | displacementMapScale |
float | displacementMapOffset |
bool | hasUV |
bool | displacementMapNormalSmooth |
bool | displacementMapSharpBoundary |
boost::shared_ptr< Shape > | refinedShape |
Definition at line 121 of file loopsubdiv.h.
LoopSubdiv::LoopSubdiv | ( | const Transform & | o2w, | |
bool | ro, | |||
int | nt, | |||
int | nv, | |||
const int * | vi, | |||
const Point * | P, | |||
const float * | uv, | |||
int | nlevels, | |||
const boost::shared_ptr< Texture< float > > | dismap, | |||
float | dmscale, | |||
float | dmoffset, | |||
bool | dmnormalsmooth, | |||
bool | dmsharpboundary | |||
) |
Definition at line 34 of file loopsubdiv.cpp.
References lux::SDVertex::boundary, lux::SDFace::f, lux::SDEdge::f, lux::SDEdge::f0edgeNum, faces, hasUV, if(), LUX_CONSISTENCY, LUX_ERROR, luxError, NEXT, lux::SDFace::nextFace(), nLevels, PREV, lux::SDVertex::regular, lux::SDVertex::startFace, lux::SDFace::v, lux::SDVertex::valence(), vertices, and lux::SDFace::vnum().
Referenced by CreateShape().
LoopSubdiv::~LoopSubdiv | ( | ) | [virtual] |
Definition at line 129 of file loopsubdiv.cpp.
void LoopSubdiv::ApplyDisplacementMap | ( | const vector< SDVertex * > | verts, | |
const Normal * | norms, | |||
const float * | uvs | |||
) | const [private] |
Definition at line 434 of file loopsubdiv.cpp.
References lux::CoordinateSystem(), displacementMap, displacementMapOffset, displacementMapScale, LUX_INFO, LUX_NOERROR, luxError, lux::Normalize(), lux::Shape::ObjectToWorld, lux::Point::x, and lux::Point::y.
Referenced by Refine().
float lux::LoopSubdiv::beta | ( | int | valence | ) | const [inline, private] |
Definition at line 168 of file loopsubdiv.h.
bool LoopSubdiv::CanIntersect | ( | ) | const [virtual] |
Returns whether this primitive can be intersected.
Reimplemented from lux::Shape.
Definition at line 150 of file loopsubdiv.cpp.
Shape * LoopSubdiv::CreateShape | ( | const Transform & | o2w, | |
bool | reverseOrientation, | |||
const ParamSet & | params | |||
) | [static] |
Definition at line 566 of file loopsubdiv.cpp.
References displacementMap, displacementMapNormalSmooth, displacementMapOffset, displacementMapScale, displacementMapSharpBoundary, lux::ParamSet::FindFloat(), lux::ParamSet::FindInt(), lux::ParamSet::FindOneBool(), lux::ParamSet::FindOneFloat(), lux::ParamSet::FindOneInt(), lux::ParamSet::FindOneString(), lux::ParamSet::FindPoint(), lux::Context::getActiveFloatTextures(), LoopSubdiv(), LUX_SYNTAX, LUX_WARNING, and luxError.
float lux::LoopSubdiv::gamma | ( | int | valence | ) | const [inline, private] |
void LoopSubdiv::GenerateNormals | ( | const vector< SDVertex * > | verts, | |
Normal * | Ns | |||
) | [static, private] |
Definition at line 389 of file loopsubdiv.cpp.
References lux::SDVertex::boundary, lux::Cross(), M_PI, lux::SDVertex::oneRing(), lux::SDVertex::P, and lux::SDVertex::valence().
Referenced by Refine().
BBox LoopSubdiv::ObjectBound | ( | ) | const [virtual] |
Reimplemented from lux::Shape.
Definition at line 134 of file loopsubdiv.cpp.
References b, lux::Union(), and vertices.
boost::shared_ptr< LoopSubdiv::SubdivResult > LoopSubdiv::Refine | ( | ) | const |
Definition at line 154 of file loopsubdiv.cpp.
References ApplyDisplacementMap(), beta(), lux::SDVertex::boundary, lux::SDVertex::child, lux::SDFace::children, displacementMap, displacementMapNormalSmooth, lux::SDFace::f, faces, gamma(), GenerateNormals(), hasUV, LUX_INFO, LUX_NOERROR, luxError, NEXT, nLevels, lux::SDFace::otherVert(), lux::SDVertex::P, PREV, lux::SDVertex::regular, lux::SDVertex::startFace, lux::SDVertex::u, lux::SDVertex::v, lux::SDEdge::v, lux::SDFace::v, vertices, lux::SDFace::vnum(), weightBoundary(), and weightOneRing().
Referenced by Refine().
void LoopSubdiv::Refine | ( | vector< boost::shared_ptr< Shape > > & | refined | ) | const [virtual] |
Reimplemented from lux::Shape.
Definition at line 366 of file loopsubdiv.cpp.
References lux::ParamSet::AddFloat(), lux::ParamSet::AddInt(), lux::ParamSet::AddNormal(), lux::ParamSet::AddPoint(), lux::MakeShape(), lux::Shape::ObjectToWorld, Refine(), refinedShape, and lux::Shape::reverseOrientation.
Referenced by lux::Mesh::Refine().
void LoopSubdiv::weightBoundary | ( | SDVertex * | destVert, | |
SDVertex * | vert, | |||
float | beta | |||
) | const [private] |
Definition at line 540 of file loopsubdiv.cpp.
References displacementMapSharpBoundary, lux::SDVertex::oneRing(), lux::SDVertex::P, lux::SDVertex::u, lux::SDVertex::v, and lux::SDVertex::valence().
Referenced by Refine().
Definition at line 474 of file loopsubdiv.cpp.
References lux::SDVertex::oneRing(), lux::SDVertex::P, lux::SDVertex::u, lux::SDVertex::v, and lux::SDVertex::valence().
Referenced by Refine().
BBox LoopSubdiv::WorldBound | ( | ) | const [virtual] |
Returns the world bounds of this primitive.
Reimplemented from lux::Shape.
Definition at line 142 of file loopsubdiv.cpp.
References b, lux::Shape::ObjectToWorld, lux::Union(), and vertices.
boost::shared_ptr<Texture<float> > lux::LoopSubdiv::displacementMap [private] |
Definition at line 190 of file loopsubdiv.h.
Referenced by ApplyDisplacementMap(), CreateShape(), and Refine().
bool lux::LoopSubdiv::displacementMapNormalSmooth [private] |
Definition at line 194 of file loopsubdiv.h.
Referenced by CreateShape(), and Refine().
float lux::LoopSubdiv::displacementMapOffset [private] |
Definition at line 192 of file loopsubdiv.h.
Referenced by ApplyDisplacementMap(), and CreateShape().
float lux::LoopSubdiv::displacementMapScale [private] |
Definition at line 191 of file loopsubdiv.h.
Referenced by ApplyDisplacementMap(), and CreateShape().
bool lux::LoopSubdiv::displacementMapSharpBoundary [private] |
Definition at line 194 of file loopsubdiv.h.
Referenced by CreateShape(), and weightBoundary().
vector<SDFace *> lux::LoopSubdiv::faces [private] |
Definition at line 187 of file loopsubdiv.h.
Referenced by LoopSubdiv(), Refine(), and ~LoopSubdiv().
bool lux::LoopSubdiv::hasUV [private] |
Definition at line 194 of file loopsubdiv.h.
Referenced by LoopSubdiv(), and Refine().
int lux::LoopSubdiv::nLevels [private] |
Definition at line 185 of file loopsubdiv.h.
Referenced by LoopSubdiv(), and Refine().
boost::shared_ptr<Shape> lux::LoopSubdiv::refinedShape [mutable, private] |
Definition at line 197 of file loopsubdiv.h.
Referenced by Refine().
vector<SDVertex *> lux::LoopSubdiv::vertices [private] |
Definition at line 186 of file loopsubdiv.h.
Referenced by LoopSubdiv(), ObjectBound(), Refine(), WorldBound(), and ~LoopSubdiv().