NAP
Public Member Functions | Public Attributes | List of all members
Line Class Reference

#include <polyline.h>

Public Member Functions

 Line (nap::Core &core)
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual bool isClosed () const override
 
- Public Member Functions inherited from PolyLine
 PolyLine (nap::Core &core)
 
virtual MeshInstancegetMeshInstance () override
 
virtual const MeshInstancegetMeshInstance () const override
 
Vec3VertexAttributegetPositionAttr ()
 
const Vec3VertexAttributegetPositionAttr () const
 
Vec4VertexAttributegetColorAttr ()
 
const Vec4VertexAttributegetColorAttr () const
 
Vec3VertexAttributegetNormalAttr ()
 
const Vec3VertexAttributegetNormalAttr () const
 
Vec3VertexAttributegetUvAttr ()
 
const Vec3VertexAttributegetUvAttr () 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
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

glm::vec3 mStart = { -0.5f, 0.0f, 0.0f }
 Property: 'Start' location of the line. More...
 
glm::vec3 mEnd = { 0.5f, 0.0f, 0.0f }
 Property: 'End' location of the line. More...
 
bool mClosed = false
 Property: 'Closed' if the line is considered closed. More...
 
int mVertexCount = 2
 Property: 'Vertices' number of line vertices, defaults to two. More...
 
- Public Attributes inherited from PolyLine
PolyLineProperties mLineProperties
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 
- Static Protected Member Functions inherited from PolyLine
static void createVertexAttributes (MeshInstance &instance)
 
- Protected Attributes inherited from PolyLine
std::unique_ptr< MeshInstancemMeshInstance
 
RenderServicemRenderService = nullptr
 

Description

Simple line from a to b. The uv coordinates are derived from start and end position of the line (x, y coordinates). The normals are perpendicular to the direction of the line, ie: cross({0,0,1}, normalize(End-Start)))

Inheritance diagram for Line:
[legend]
Collaboration diagram for Line:
[legend]

Constructor & Destructor Documentation

◆ Line()

Line ( nap::Core core)

Member Function Documentation

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Creates the line

Returns
if the line was successfully created

Reimplemented from PolyLine.

◆ isClosed()

virtual bool isClosed ( ) const
overridevirtual
Returns
closed or open based on the 'Closed' property.

Implements PolyLine.

Member Data Documentation

◆ mClosed

bool mClosed = false

Property: 'Closed' if the line is considered closed.

◆ mEnd

glm::vec3 mEnd = { 0.5f, 0.0f, 0.0f }

Property: 'End' location of the line.

◆ mStart

glm::vec3 mStart = { -0.5f, 0.0f, 0.0f }

Property: 'Start' location of the line.

◆ mVertexCount

int mVertexCount = 2

Property: 'Vertices' number of line vertices, defaults to two.