NAP
renderable3dtextcomponent.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 "renderabletextcomponent.h"
9 
10 // External Includes
11 #include <component.h>
12 #include <materialcommon.h>
13 
14 namespace nap
15 {
16  class Renderable3DTextComponentInstance;
17 
37  {
38  RTTI_ENABLE(RenderableTextComponent)
40  public:
45  virtual void getDependentComponents(std::vector<rtti::TypeInfo>& components) const override;
46 
47  bool mNormalize = true;
49  };
50 
51 
67  {
69  public:
71  RenderableTextComponentInstance(entity, resource) { }
72 
78  virtual bool init(utility::ErrorState& errorState) override;
79 
86  void normalizeText(bool enable) { mNormalize = enable; }
87 
91  bool isNormalized() const { return mNormalize; }
92 
100  bool computeNormalizationFactor(const std::string& referenceText);
101 
109  virtual RenderableGlyph* getRenderableGlyph(uint index, float scale, utility::ErrorState& error) const override;
110 
111  protected:
124  virtual void onDraw(IRenderTarget& renderTarget, VkCommandBuffer commandBuffer, const glm::mat4& viewMatrix, const glm::mat4& projectionMatrix) override;
125 
126  private:
127  bool mNormalize = true;
128  float mNormalizationFactor = 1.0f;
129  };
130 }
nap::RenderableTextComponentInstance
Definition: renderabletextcomponent.h:53
nap::uint
unsigned int uint
Definition: numeric.h:23
nap::Renderable3DTextComponentInstance::normalizeText
void normalizeText(bool enable)
Definition: renderable3dtextcomponent.h:86
nap::IRenderTarget
Definition: irendertarget.h:21
nap::Renderable3DTextComponentInstance::isNormalized
bool isNormalized() const
Definition: renderable3dtextcomponent.h:91
nap::EDepthMode::InheritFromBlendMode
@ InheritFromBlendMode
Transparent objects do not write depth, but do read depth. Opaque objects read and write depth.
nap::EDepthMode
EDepthMode
Definition: materialcommon.h:40
nap::Renderable3DTextComponentInstance
Definition: renderable3dtextcomponent.h:66
nap::utility::ErrorState
Definition: errorstate.h:19
nap::RenderableTextComponent
Definition: renderabletextcomponent.h:32
nap::EntityInstance
Definition: entity.h:34
nap::Renderable3DTextComponent
Definition: renderable3dtextcomponent.h:36
nap::Renderable3DTextComponentInstance::Renderable3DTextComponentInstance
Renderable3DTextComponentInstance(EntityInstance &entity, Component &resource)
Definition: renderable3dtextcomponent.h:70
nap::Component
Definition: component.h:151
nap::RenderableGlyph
Definition: renderableglyph.h:24
nap
Definition: templateapp.h:17