NAP
Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ScatterPointsMesh Class Reference

#include <scatterpointsmesh.h>

Public Member Functions

 ScatterPointsMesh (Core &core)
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual MeshInstancegetMeshInstance () override
 
virtual const MeshInstancegetMeshInstance () const override
 
- 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

ResourcePtr< IMeshmReferenceMesh = nullptr
 Property: 'ReferenceMesh' link to the mesh that is used as a reference, can be null (ie: nothing) More...
 
int mNumberOfPoints = 1000
 Property: 'PointCount' number of points to scatter on the mesh. More...
 
EMemoryUsage mUsage = EMemoryUsage::Static
 Property: 'Usage' If the plane is created once or frequently updated. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Protected Types

using TriangleAreaMap = std::map< float, Triangle >
 

Protected Member Functions

bool createMeshInstance (nap::utility::ErrorState &error)
 
bool setup (nap::utility::ErrorState &error)
 
bool scatterPoints (nap::utility::ErrorState &error)
 
float computeArea (TriangleAreaMap &outMap)
 

Protected Attributes

std::unique_ptr< MeshInstancemMeshInstance = nullptr
 The actual mesh that contains all the points. More...
 
nap::Vec3VertexAttributemPositionAttr = nullptr
 Position Attribute data. More...
 
nap::Vec3VertexAttributemNormalsAttr = nullptr
 Normal attribute data. More...
 
std::vector< nap::Vec3VertexAttribute * > mUvAttrs
 UV attribute data. More...
 
std::vector< nap::Vec4VertexAttribute * > mColorAttrs
 Color attribute data. More...
 
RenderServicemRenderService = nullptr
 Handle to render service. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Randomly distributes a certain amount of points over the surface of a mesh The result is a new mesh that does not contain any triangles, only points as vertices The uv, color and normal attributes are copied over from the reference mesh if available!

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

Member Typedef Documentation

◆ TriangleAreaMap

using TriangleAreaMap = std::map<float, Triangle>
protected

Constructor & Destructor Documentation

◆ ScatterPointsMesh()

ScatterPointsMesh ( Core core)

Member Function Documentation

◆ computeArea()

float computeArea ( TriangleAreaMap outMap)
protected

◆ createMeshInstance()

bool createMeshInstance ( nap::utility::ErrorState error)
protected

◆ getMeshInstance() [1/2]

virtual const MeshInstance& getMeshInstance ( ) const
overridevirtual
Returns
the scattered point mesh

Implements IMesh.

◆ getMeshInstance() [2/2]

virtual MeshInstance& getMeshInstance ( )
overridevirtual
Returns
the scattered point mesh

Implements IMesh.

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initialize this object after de-serialization

Parameters
errorStatecontains the error message when initialization fails

Reimplemented from Object.

◆ scatterPoints()

bool scatterPoints ( nap::utility::ErrorState error)
protected

◆ setup()

bool setup ( nap::utility::ErrorState error)
protected

Member Data Documentation

◆ mColorAttrs

std::vector<nap::Vec4VertexAttribute*> mColorAttrs
protected

Color attribute data.

◆ mMeshInstance

std::unique_ptr<MeshInstance> mMeshInstance = nullptr
protected

The actual mesh that contains all the points.

◆ mNormalsAttr

nap::Vec3VertexAttribute* mNormalsAttr = nullptr
protected

Normal attribute data.

◆ mNumberOfPoints

int mNumberOfPoints = 1000

Property: 'PointCount' number of points to scatter on the mesh.

◆ mPositionAttr

nap::Vec3VertexAttribute* mPositionAttr = nullptr
protected

Position Attribute data.

◆ mReferenceMesh

ResourcePtr<IMesh> mReferenceMesh = nullptr

Property: 'ReferenceMesh' link to the mesh that is used as a reference, can be null (ie: nothing)

◆ mRenderService

RenderService* mRenderService = nullptr
protected

Handle to render service.

◆ mUsage

Property: 'Usage' If the plane is created once or frequently updated.

◆ mUvAttrs

std::vector<nap::Vec3VertexAttribute*> mUvAttrs
protected

UV attribute data.