NAP
torusmesh.h
1 #pragma once
2 
3 // External Includes
4 #include <nap/core.h>
5 #include <mesh.h>
6 #include <renderservice.h>
7 
8 namespace nap
9 {
13  class TorusMesh : public IMesh
14  {
15  RTTI_ENABLE(IMesh)
16  public:
17  TorusMesh(nap::Core& core);
18 
24  virtual bool init(utility::ErrorState& errorState) override;
25 
30  bool setup(utility::ErrorState& errorState);
31 
35  virtual MeshInstance& getMeshInstance() override { return *mMeshInstance; }
36 
40  virtual const MeshInstance& getMeshInstance() const override { return *mMeshInstance; }
41 
42  float mRadius = 0.75f;
43  float mTubeRadius = 0.25f;
44  uint mSegments = 64;
46  float mAngleOffset = 0.0f;
50  RGBAColorFloat mColor = { 1.0f, 1.0f, 1.0f, 1.0f };
51 
52  protected:
53  RenderService* mRenderService = nullptr; //< The render service
54  std::unique_ptr<MeshInstance> mMeshInstance = nullptr; //< Runtime mesh instance
55  };
56 }
nap::uint
unsigned int uint
Definition: numeric.h:23
nap::TorusMesh::mCullMode
ECullMode mCullMode
Property: 'CullMode' the cull mode.
Definition: torusmesh.h:49
nap::TorusMesh::mRenderService
RenderService * mRenderService
Definition: torusmesh.h:53
nap::EMemoryUsage::Static
@ Static
Buffer data is uploaded only once from the CPU to the GPU.
nap::EPolygonMode
EPolygonMode
Definition: mesh.h:55
nap::RGBAColor< float >
nap::ECullMode
ECullMode
Definition: mesh.h:43
nap::EMemoryUsage
EMemoryUsage
Definition: gpubuffer.h:41
nap::TorusMesh::mAngleOffset
float mAngleOffset
Property: 'AngleOffset' the angle offset in degrees.
Definition: torusmesh.h:46
nap::utility::ErrorState
Definition: errorstate.h:19
nap::TorusMesh::mMeshInstance
std::unique_ptr< MeshInstance > mMeshInstance
Definition: torusmesh.h:54
nap::TorusMesh::getMeshInstance
virtual const MeshInstance & getMeshInstance() const override
Definition: torusmesh.h:40
nap::IMesh
Definition: mesh.h:394
nap::TorusMesh::getMeshInstance
virtual MeshInstance & getMeshInstance() override
Definition: torusmesh.h:35
nap::TorusMesh::mRadius
float mRadius
Property: 'Radius' torus radius.
Definition: torusmesh.h:42
nap::RenderService
Definition: renderservice.h:275
nap::TorusMesh::mColor
RGBAColorFloat mColor
Property: 'Color' Vertex color.
Definition: torusmesh.h:50
nap::Core
Definition: core.h:82
nap::ECullMode::Back
@ Back
Cull back facing triangles.
nap::TorusMesh::init
virtual bool init(utility::ErrorState &errorState) override
nap::TorusMesh::mSegments
uint mSegments
Property: 'Segments' number of segments.
Definition: torusmesh.h:44
nap::EPolygonMode::Fill
@ Fill
Polygons are interpreted and rendered using the specified 'EDrawMode'.
nap::TorusMesh::mTubeSegments
uint mTubeSegments
Property: 'TubeSegments' number of tubular segments.
Definition: torusmesh.h:45
nap::TorusMesh::setup
bool setup(utility::ErrorState &errorState)
nap::TorusMesh::mTubeRadius
float mTubeRadius
Property: 'Height' tube segment radius.
Definition: torusmesh.h:43
nap
Definition: templateapp.h:17
nap::MeshInstance
Definition: mesh.h:196
nap::TorusMesh
Definition: torusmesh.h:13
nap::TorusMesh::mPolygonMode
EPolygonMode mPolygonMode
Property: 'PolygonMode' the polygon mode.
Definition: torusmesh.h:48
nap::TorusMesh::mUsage
EMemoryUsage mUsage
Property: 'Usage' If the mesh is uploaded once or frequently updated.
Definition: torusmesh.h:47
nap::TorusMesh::TorusMesh
TorusMesh(nap::Core &core)