18 template <
typename Real>
38 bool sampleByArcLength =
false);
41 inline std::shared_ptr<ParametricCurve<2, Real>>
const&
GetCurve()
const;
53 std::shared_ptr<ParametricCurve<2, Real>>
mCurve;
65 template <
typename Real>
69 Mesh<Real>(description,
83 LogWarning(
"A nonnull revolution curve is required.");
137 template <
typename Real>
143 template <
typename Real>
149 template <
typename Real>
166 Real invDenom = ((Real)1) / (Real)(
mSamples.size() - 1);
169 Real factor =
mCurve->GetTotalLength() * invDenom;
170 mTSampler = [
this, factor](
unsigned int i)
172 return mCurve->GetTime(i * factor);
177 Real factor = (
mCurve->GetTMax() -
mCurve->GetTMin()) * invDenom;
178 mTSampler = [
this, factor](
unsigned int i)
180 return mCurve->GetTMin() + i * factor;
185 template <
typename Real>
225 radius = std::min(radius, (Real)0.5);
229 this->TCoord(i) = { radius * (float)cos(angle), radius * (float)sin(angle) };
247 this->
TCoord(i++) = { (Real)0.5, (Real)0 };
248 this->
TCoord(i) = { (Real)0.5, (Real)1 };
258 template <
typename Real>
261 unsigned int const numSamples =
static_cast<unsigned int>(
mSamples.size());
262 for (
unsigned int i = 0; i < numSamples; ++i)
290 template <
typename Real>
303 template <
typename Real>
316 template <
typename Real>
331 template <
typename Real>
void UpdateTorusPositions()
void UpdateCylinderPositions()
MeshDescription mDescription
RevolutionMesh(MeshDescription const &description, std::shared_ptr< ParametricCurve< 2, Real >> const &curve, bool sampleByArcLength=false)
std::vector< Vector2< Real > > mDefaultTCoords
virtual void UpdateNormals()
std::vector< Real > mCosAngle
std::shared_ptr< ParametricCurve< 2, Real > > const & GetCurve() const
std::shared_ptr< ParametricCurve< 2, Real > > mCurve
bool wantDynamicTangentSpaceUpdate
Vector3< Real > * mNormals
virtual void UpdatePositions() override
std::function< Real(unsigned int)> mTSampler
#define LogWarning(message)
virtual void UpdateFrame()
Vector2< Real > & TCoord(uint32_t i)
Vector2< Real > * mTCoords
std::vector< Real > mSinAngle
std::vector< Vector3< Real > > mSamples
bool hasTangentSpaceVectors
void UpdateDiskPositions()
Vector3< Real > & Position(uint32_t i)
bool IsSampleByArcLength() const
void UpdateSpherePositions()