#include <visualizenormalsmesh.h>
Public Member Functions | |
VisualizeNormalsMesh (Core &core) | |
virtual bool | init (utility::ErrorState &errorState) override |
virtual MeshInstance & | getMeshInstance () override |
virtual const MeshInstance & | getMeshInstance () const override |
bool | calculateNormals (utility::ErrorState &error, bool push=true) |
bool | setReferenceMesh (IMesh &mesh, nap::utility::ErrorState &error) |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Public Attributes | |
ResourcePtr< IMesh > | mReferenceMesh = nullptr |
Property: 'ReferenceMesh' link to the mesh that is used as a reference, can be null (ie: nothing) More... | |
float | mNormalLength = 1.0f |
Property: 'Length' length of the normals. More... | |
EMemoryUsage | mUsage = EMemoryUsage::DynamicWrite |
Property: 'Usage' If the normals are created once or frequently updated. More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Protected Member Functions | |
bool | createMeshInstance (utility::ErrorState &error) |
Protected Attributes | |
std::unique_ptr< MeshInstance > | mMeshInstance = nullptr |
nap::Vec3VertexAttribute * | mPositionAttr = nullptr |
nap::FloatVertexAttribute * | mTipAttr = nullptr |
nap::Vec3VertexAttribute * | mNormalsAttr = nullptr |
std::vector< nap::Vec3VertexAttribute * > | mUvAttrs |
std::vector< nap::Vec4VertexAttribute * > | mColorAttrs |
nap::IMesh * | mCurrentReferenceMesh = nullptr |
nap::RenderService * | mRenderService = nullptr |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
This mesh builds a line structure based on the vertices of another mesh The line structure represents the normals of the reference mesh and can be drawn to screen. The mesh itself carries multiple attributes of which 'position' and 'típ' are default. Use the tip vertex attribute to identify the bottom / top part of the vertex. the tip value = 1 at the beginning of the normal line and 0 at the end. This resource also copies the color, normal and uv channels as attributes to both points of the normal line. The normal is scaled based on the normal length property and applied to both vertices of the normal line This operator needs a reference mesh to initialize itself, defined by the 'ReferenceMesh' property. It is possible to switch the reference mesh at runtime, although discouraged. When you switch the reference mesh at runtime make sure the new reference mesh has the same number of attributes!
VisualizeNormalsMesh | ( | Core & | core | ) |
bool calculateNormals | ( | utility::ErrorState & | error, |
bool | push = true |
||
) |
Updates the normals based on the data in the reference mesh
error | contains the error when normals could not be pushed to the GPU. |
push | if the new positions should be pushed on to the GPU. |
|
protected |
Creates the mesh instance and single shape associated with that mesh instance Called during init but can be called in derived classes to create the mesh instance
|
overridevirtual |
Implements IMesh.
|
overridevirtual |
Implements IMesh.
|
overridevirtual |
Creates the normals from the reference mesh
Reimplemented from Object.
bool setReferenceMesh | ( | IMesh & | mesh, |
nap::utility::ErrorState & | error | ||
) |
Set the mesh that is used as a reference to build the normals from. Called on init(). Note that it is not recommended setting this at runtime, if you do, make sure that the mesh you set has the same number of vertex attributes as the original reference mesh! This call automatically calls setup, where storage for the CPU side of the buffer is calculated Call calculateNormals() to actually calculate the normals based on the reference mesh and push the data to the GPU
|
protected |
|
protected |
|
protected |
float mNormalLength = 1.0f |
Property: 'Length' length of the normals.
|
protected |
|
protected |
ResourcePtr<IMesh> mReferenceMesh = nullptr |
Property: 'ReferenceMesh' link to the mesh that is used as a reference, can be null (ie: nothing)
|
protected |
|
protected |
EMemoryUsage mUsage = EMemoryUsage::DynamicWrite |
Property: 'Usage' If the normals are created once or frequently updated.
|
protected |