|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef PLASTICHANDLE_H
|
|
Toshihiro Shimizu |
890ddd |
#define PLASTICHANDLE_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TTextureMesh;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Plastic Handle definition
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! The PlasticHandle class models the geometrical information of the
|
|
Shinya Kitaoka |
120a6e |
//! neighbourhood of a point
|
|
Toshihiro Shimizu |
890ddd |
//! that can be deformed with a PlasticDeformer instance.
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Shinya Kitaoka |
120a6e |
The PlasticDeformer class allows users to deform interactively a mesh object.
|
|
Shinya Kitaoka |
120a6e |
A Plastic Handle
|
|
Shinya Kitaoka |
120a6e |
models a point of the mesh that can be \a manually displaced by the user to
|
|
Shinya Kitaoka |
120a6e |
deform the mesh object.
|
|
Toshihiro Shimizu |
890ddd |
\n\n
|
|
Shinya Kitaoka |
120a6e |
It contains the initial position of the point to be displaced; eventually,
|
|
Shinya Kitaoka |
120a6e |
further implementation
|
|
Shinya Kitaoka |
120a6e |
may include a 'direction<\I>' that can be rotated by the user to force the
|
|
Shinya Kitaoka |
120a6e |
neighborhood into
|
|
Toshihiro Shimizu |
890ddd |
a specific rotational component.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
struct PlasticHandle {
|
|
Shinya Kitaoka |
120a6e |
TPointD m_pos; //!< Handle position
|
|
Shinya Kitaoka |
120a6e |
// TPointD m_dir; //!< Handle 'direction',
|
|
Shinya Kitaoka |
120a6e |
// used to specify the
|
|
Shinya Kitaoka |
120a6e |
//!< local rotational component
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_interpolate; //!< Whether the handle should be interpolated
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Interpolable data (unused by PlasticDeformer)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double m_so; //!< Local faces stacking order
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
PlasticHandle() : m_interpolate(true), m_so(0.0) {}
|
|
Shinya Kitaoka |
120a6e |
explicit PlasticHandle(const TPointD &pos)
|
|
Shinya Kitaoka |
120a6e |
: m_pos(pos), m_interpolate(true), m_so(0.0) {}
|
|
Shinya Kitaoka |
120a6e |
~PlasticHandle() {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Plastic Handle utility functions
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Shinya Kitaoka |
120a6e |
Fills the distances array with the distances of mesh vertices from the
|
|
Shinya Kitaoka |
120a6e |
specified pos.
|
|
Shinya Kitaoka |
120a6e |
Returns false in case the specified position is not inside the mesh; in this
|
|
Shinya Kitaoka |
120a6e |
case, the
|
|
Toshihiro Shimizu |
890ddd |
distances array remains untouched.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
bool buildDistances(float *distances, const TTextureMesh &mesh,
|
|
Shinya Kitaoka |
120a6e |
const TPointD &pos, int *faceHint = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
Interpolates the handles' stacking order (SO) values along the specified mesh.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
The SO interpolant base function is exponential to ensure that values'
|
|
Shinya Kitaoka |
120a6e |
influence decreases
|
|
Shinya Kitaoka |
120a6e |
by orders of magnitude with the distance (therefore making only the closest
|
|
Shinya Kitaoka |
120a6e |
interpolants
|
|
Shinya Kitaoka |
120a6e |
relevant). The interpolant value falls at 1e-8 at a distance of the mesh's
|
|
Shinya Kitaoka |
120a6e |
bbox.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void buildSO(double *so, const TTextureMesh &mesh,
|
|
Shinya Kitaoka |
120a6e |
const std::vector<plastichandle> &handles, int *faceHints = 0);</plastichandle>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // PLASTICHANDLE_H
|