NAP
boxframemesh.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Local Includes
8 #include "mesh.h"
9 
10 // External includes
11 #include <box.h>
12 
13 namespace nap
14 {
15  class RenderService;
16  class CameraComponentInstance;
17 
22  class NAPAPI BoxFrameMesh : public IMesh
23  {
24  RTTI_ENABLE(IMesh)
25  public:
26  BoxFrameMesh(Core& core);
27 
33  virtual bool init(utility::ErrorState& errorState) override;
34 
40  bool setup(const math::Box& box, utility::ErrorState& errorState);
41 
45  virtual MeshInstance& getMeshInstance() override { return *mMeshInstance; }
46 
50  virtual const MeshInstance& getMeshInstance() const override { return *mMeshInstance; }
51 
55  const std::vector<glm::vec3>& getUnitLineBox();
56 
60  const std::vector<glm::vec3>& getNormalizedLineBox();
61 
63  bool mUnit = false;
64 
65  protected:
71  void setup();
72 
74  std::unique_ptr<MeshInstance> mMeshInstance;
75 
76  private:
77  bool mIsSetup = false;
78  };
79 }
nap::BoxFrameMesh::getMeshInstance
virtual MeshInstance & getMeshInstance() override
Definition: boxframemesh.h:45
nap::math::Box
Definition: box.h:20
nap::EMemoryUsage::Static
@ Static
Buffer data is uploaded only once from the CPU to the GPU.
nap::EMemoryUsage
EMemoryUsage
Definition: gpubuffer.h:41
nap::utility::ErrorState
Definition: errorstate.h:19
nap::IMesh
Definition: mesh.h:394
nap::BoxFrameMesh::mRenderService
RenderService * mRenderService
Definition: boxframemesh.h:73
nap::BoxFrameMesh
Definition: boxframemesh.h:22
nap::RenderService
Definition: renderservice.h:275
nap::Core
Definition: core.h:82
nap::BoxFrameMesh::mMeshInstance
std::unique_ptr< MeshInstance > mMeshInstance
Definition: boxframemesh.h:74
nap
Definition: templateapp.h:17
nap::MeshInstance
Definition: mesh.h:196
nap::BoxFrameMesh::getMeshInstance
virtual const MeshInstance & getMeshInstance() const override
Definition: boxframemesh.h:50