Ogre Procedural
0.3.0 unstable
Procedural Geometry & Textures for Ogre3D
|
#include <ProceduralPath.h>
Public Member Functions | |
Path () | |
Default constructor. More... | |
Path & | addPoint (const Ogre::Vector3 &pt) |
Adds a point to the path, as a Vector3. More... | |
Path & | addPoint (Ogre::Real x, Ogre::Real y, Ogre::Real z) |
Adds a point to the path, using its 3 coordinates. More... | |
Path & | insertPoint (size_t index, Ogre::Real x, Ogre::Real y, Ogre::Real z) |
Inserts a point to the path. More... | |
Path & | insertPoint (size_t index, const Ogre::Vector3 &pt) |
Inserts a point to the path. More... | |
Path & | appendPath (const Path &other) |
Appends another path at the end of this one. More... | |
Path & | appendPathRel (const Path &other) |
Appends another path at the end of this one, relative to the last point of this path. More... | |
Path & | reset () |
Clears the content of the Path. More... | |
Path & | close () |
Define the path as being closed. More... | |
bool | isClosed () const |
Tells if the path is closed or not. More... | |
const std::vector< Ogre::Vector3 > & | getPoints () const |
Gets the list of points as a vector of Vector3. More... | |
std::vector< Ogre::Vector3 > & | getPointsReference () |
Gets raw vector data of this path as a non-const reference. More... | |
const Ogre::Vector3 & | getPoint (int i) const |
Safely gets a given point. More... | |
int | getSegCount () const |
Gets the number of segments in the path Takes into accound whether path is closed or not. More... | |
Ogre::Vector3 | getDirectionAfter (unsigned int i) const |
Returns local direction after the current point. More... | |
Ogre::Vector3 | getDirectionBefore (unsigned int i) const |
Returns local direction after the current point. More... | |
Ogre::Vector3 | getAvgDirection (unsigned int i) const |
Returns the local direction at the current point. More... | |
Ogre::Real | getTotalLength () const |
Returns the total lineic length of that shape. More... | |
Ogre::Real | getLengthAtPoint (size_t index) const |
Ogre::Vector3 | getPosition (unsigned int i, Ogre::Real coord) const |
Gets a position on the shape with index of the point and a percentage of position on the segment. More... | |
Ogre::Vector3 | getPosition (Ogre::Real coord) const |
Gets a position on the shape from lineic coordinate. More... | |
Ogre::MeshPtr | realizeMesh (const std::string &name="") const |
Outputs a mesh representing the path. More... | |
Path | mergeKeysWithTrack (const Track &track) const |
Creates a path with the keys of this path and extra keys coming from a track. More... | |
Path & | translate (const Ogre::Vector3 &translation) |
Applies the given translation to all the points already defined. More... | |
Path & | translate (Ogre::Real translationX, Ogre::Real translationY, Ogre::Real translationZ) |
Applies the given translation to all the points already defined. More... | |
Path & | scale (Ogre::Real amount) |
Applies the given scale to all the points already defined. More... | |
Path & | scale (Ogre::Real scaleX, Ogre::Real scaleY, Ogre::Real scaleZ) |
Applies the given scale to all the points already defined. More... | |
Path & | scale (const Ogre::Vector3 &amount) |
Applies the given scale to all the points already defined. More... | |
Path & | reflect (const Ogre::Vector3 &normal) |
Reflect all points in this path against a zero-origined plane with a given normal. More... | |
Path | extractSubPath (unsigned int first, unsigned int last) |
Extracts a part of the shape as a new path. More... | |
Path & | reverse () |
Reverses direction of the path. More... | |
void | buildFromSegmentSoup (const std::vector< Segment3D > &segList, std::vector< Path > &out) |
Shape | convertToShape () const |
Converts the path to a shape, with Y=0. More... | |
Succession of points in 3D space. Can be closed or not.
Procedural::Path::Path | ( | ) |
Default constructor.
Path& Procedural::Path::addPoint | ( | const Ogre::Vector3 & | pt | ) |
Adds a point to the path, as a Vector3.
Referenced by extractSubPath(), and Procedural::LinePath::realizePath().
Path& Procedural::Path::addPoint | ( | Ogre::Real | x, |
Ogre::Real | y, | ||
Ogre::Real | z | ||
) |
Adds a point to the path, using its 3 coordinates.
Appends another path at the end of this one.
Appends another path at the end of this one, relative to the last point of this path.
void Procedural::Path::buildFromSegmentSoup | ( | const std::vector< Segment3D > & | segList, |
std::vector< Path > & | out | ||
) |
Path& Procedural::Path::close | ( | ) |
Define the path as being closed.
Almost the same as adding a last point on the first point position
Ogre::InvalidStateException | Cannot close an empty path |
References Ogre::Exception::ERR_INVALID_STATE, and OGRE_EXCEPT.
Referenced by extractSubPath().
Shape Procedural::Path::convertToShape | ( | ) | const |
Converts the path to a shape, with Y=0.
Path Procedural::Path::extractSubPath | ( | unsigned int | first, |
unsigned int | last | ||
) |
Extracts a part of the shape as a new path.
first | first index to be in the new path |
last | last index to be in the new path |
References addPoint(), and close().
Ogre::Vector3 Procedural::Path::getAvgDirection | ( | unsigned int | i | ) | const |
Returns the local direction at the current point.
i | index of the point |
References Vector< 3, Real >::normalisedCopy().
Ogre::Vector3 Procedural::Path::getDirectionAfter | ( | unsigned int | i | ) | const |
Returns local direction after the current point.
References Vector< 3, Real >::normalisedCopy().
Ogre::Vector3 Procedural::Path::getDirectionBefore | ( | unsigned int | i | ) | const |
Returns local direction after the current point.
References Vector< 3, Real >::normalisedCopy().
Ogre::Real Procedural::Path::getLengthAtPoint | ( | size_t | index | ) | const |
const Ogre::Vector3& Procedural::Path::getPoint | ( | int | i | ) | const |
Safely gets a given point.
Takes into account whether the path is closed or not.
i | the index of the point. if it is <0 or >maxPoint, cycle through the list of points |
References Procedural::Utils::cap(), and Procedural::Utils::modulo().
const std::vector<Ogre::Vector3>& Procedural::Path::getPoints | ( | ) | const |
Gets the list of points as a vector of Vector3.
std::vector<Ogre::Vector3>& Procedural::Path::getPointsReference | ( | ) |
Gets raw vector data of this path as a non-const reference.
Ogre::Vector3 Procedural::Path::getPosition | ( | Ogre::Real | coord | ) | const |
Gets a position on the shape from lineic coordinate.
coord | lineic coordinate |
Ogre::InvalidStateException | The path must at least contain 2 points |
Ogre::Vector3 Procedural::Path::getPosition | ( | unsigned int | i, |
Ogre::Real | coord | ||
) | const |
Gets a position on the shape with index of the point and a percentage of position on the segment.
i | index of the segment |
coord | a number between 0 and 1 meaning the percentage of position on the segment |
Ogre::InvalidParametersException | i is out of bounds |
Ogre::InvalidParametersException | coord must be comprised between 0 and 1 |
References Ogre::Exception::ERR_INVALIDPARAMS, and OGRE_EXCEPT.
int Procedural::Path::getSegCount | ( | ) | const |
Gets the number of segments in the path Takes into accound whether path is closed or not.
Referenced by Procedural::MultiPath::getNoIntersectionParts().
Ogre::Real Procedural::Path::getTotalLength | ( | ) | const |
Returns the total lineic length of that shape.
Path& Procedural::Path::insertPoint | ( | size_t | index, |
const Ogre::Vector3 & | pt | ||
) |
Inserts a point to the path.
index | the index before the inserted point |
pt | new point's position |
Path& Procedural::Path::insertPoint | ( | size_t | index, |
Ogre::Real | x, | ||
Ogre::Real | y, | ||
Ogre::Real | z | ||
) |
Inserts a point to the path.
index | the index before the inserted point |
x | new point's x coordinate |
y | new point's y coordinate |
z | new point's z coordinate |
bool Procedural::Path::isClosed | ( | ) | const |
Tells if the path is closed or not.
Creates a path with the keys of this path and extra keys coming from a track.
Ogre::MeshPtr Procedural::Path::realizeMesh | ( | const std::string & | name = "" | ) | const |
Outputs a mesh representing the path.
Mostly for debugging purposes
Path& Procedural::Path::reflect | ( | const Ogre::Vector3 & | normal | ) |
Path& Procedural::Path::reverse | ( | ) |
Reverses direction of the path.
Path& Procedural::Path::scale | ( | const Ogre::Vector3 & | amount | ) |
Applies the given scale to all the points already defined.
Has strictly no effect on the points defined after that
amount | of scale |
Path& Procedural::Path::scale | ( | Ogre::Real | amount | ) |
Applies the given scale to all the points already defined.
Has strictly no effect on the points defined after that
amount | amount of scale |
Path& Procedural::Path::scale | ( | Ogre::Real | scaleX, |
Ogre::Real | scaleY, | ||
Ogre::Real | scaleZ | ||
) |
Applies the given scale to all the points already defined.
Has strictly no effect on the points defined after that
scaleX | amount of scale in the X direction |
scaleY | amount of scale in the Y direction |
scaleZ | amount of scale in the Z direction |
Path& Procedural::Path::translate | ( | const Ogre::Vector3 & | translation | ) |
Applies the given translation to all the points already defined.
Has strictly no effect on the points defined after that
translation | the translation vector |
Path& Procedural::Path::translate | ( | Ogre::Real | translationX, |
Ogre::Real | translationY, | ||
Ogre::Real | translationZ | ||
) |
Applies the given translation to all the points already defined.
Has strictly no effect on the points defined after that
translationX | X component of the translation vector |
translationY | Y component of the translation vector |
translationZ | Z component of the translation vector |
References translate().