#include <polyline.h>
Public Member Functions | |
PolyLine (nap::Core &core) | |
virtual bool | init (utility::ErrorState &errorState) override |
virtual MeshInstance & | getMeshInstance () override |
virtual const MeshInstance & | getMeshInstance () const override |
Vec3VertexAttribute & | getPositionAttr () |
const Vec3VertexAttribute & | getPositionAttr () const |
Vec4VertexAttribute & | getColorAttr () |
const Vec4VertexAttribute & | getColorAttr () const |
Vec3VertexAttribute & | getNormalAttr () |
const Vec3VertexAttribute & | getNormalAttr () const |
Vec3VertexAttribute & | getUvAttr () |
const Vec3VertexAttribute & | getUvAttr () const |
template<typename T > | |
void | getValue (const VertexAttribute< T > &attr, float location, T &outValue) const |
template<typename T > | |
void | getValue (const std::map< float, int > &distanceMap, const VertexAttribute< T > &attr, float location, T &outValue) const |
void | getNormal (const std::map< float, int > &distanceMap, const Vec3VertexAttribute &attr, float location, glm::vec3 &outValue) const |
float | getDistances (std::map< float, int > &outDistances) const |
virtual bool | isClosed () const =0 |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Public Attributes | |
PolyLineProperties | mLineProperties |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Static Protected Member Functions | |
static void | createVertexAttributes (MeshInstance &instance) |
Protected Attributes | |
std::unique_ptr< MeshInstance > | mMeshInstance |
RenderService * | mRenderService = nullptr |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Base class for all line specific mesh types. A PolyLine is a mesh that is always drawn using: LINE_STRIP. It also has a fixed set of (initial) vertex attributes: Position, Color0, UV0 and Normal.
|
staticprotected |
Utility function, creates all the default line attributes: Position, Normal, UV0 and Color0.
instance | the instance to add the attributes to. |
Vec4VertexAttribute& getColorAttr | ( | ) |
const Vec4VertexAttribute& getColorAttr | ( | ) | const |
float getDistances | ( | std::map< float, int > & | outDistances | ) | const |
Utility function that retrieves the distance along the line for every vertex Note that this call is relatively heavy
outDistances | a list of distances that will be populated with the length at every vertex |
|
overridevirtual |
Implements IMesh.
|
overridevirtual |
Implements IMesh.
void getNormal | ( | const std::map< float, int > & | distanceMap, |
const Vec3VertexAttribute & | attr, | ||
float | location, | ||
glm::vec3 & | outValue | ||
) | const |
Returns the interpolated normal value along the line, where the normal is correctly interpolated (rotated) based on it's location along the line This method is more accurate but requires a distance map that contains the distance of every vertex along the line You can acquire this map by calling the getDistances function
distanceMap | the map that contains the distance of every vertex along the line |
attr | the normal attribute to get the interpolated (rotated) value for |
location | the location on the line to get the value for, needs to be within the 0-1 range |
outValue | the interpolated output normal |
Vec3VertexAttribute& getNormalAttr | ( | ) |
const Vec3VertexAttribute& getNormalAttr | ( | ) | const |
Vec3VertexAttribute& getPositionAttr | ( | ) |
const Vec3VertexAttribute& getPositionAttr | ( | ) | const |
Vec3VertexAttribute& getUvAttr | ( | ) |
const Vec3VertexAttribute& getUvAttr | ( | ) | const |
void getValue | ( | const std::map< float, int > & | distanceMap, |
const VertexAttribute< T > & | attr, | ||
float | location, | ||
T & | outValue | ||
) | const |
distanceMap | map that contains the distance of every vertex along the line |
attr | the attribute to get the value for |
location | the location on the line to get the value for, needs to be within the 0-1 range |
outValue | the interpolated output value |
void getValue | ( | const VertexAttribute< T > & | attr, |
float | location, | ||
T & | outValue | ||
) | const |
This call does not accurately interpolate the vertex attribute, therefore this function works best with equally distributed vertices
attr | the attribute to get the value for |
location | the location on the line to get the value for, needs to be within the 0-1 range |
outValue | the interpolated output value |
|
overridevirtual |
Create the mesh instance and required vertex attributes (P, Cd, N, Uv) When implementing a derived PolyLine, make sure to call this init first.
errorState | contains the error if the line could not be created. |
Reimplemented from Object.
Reimplemented in TriangleLine, Hexagon, Circle, Rectangle, Line, and LineFromFile.
|
pure virtual |
Implemented in TriangleLine, Hexagon, Circle, Rectangle, Line, and LineFromFile.
PolyLineProperties mLineProperties |
|
protected |
|
protected |