# cee::vis::MarkupPartText3d

class `MarkupPartText3d` : public MarkupPart

  A MarkupModel part for drawing text positioned and oriented in 3D.

  The part can contain any number of text items (MarkupText3dItem). Each text item’s position, orientation and size described by:

  - position: World coordinate position of the bottom left corner of the text
  - directionVector: The horizontal direction (local x axis) of the text
  - upVector: The vertical axis (local y axis) of the text
  - textHeight: The height of the text along the upVector axis. This determines the size of the text

  The texts support picking through the MarkupModel::rayIntersect() method, but as this only returns the part index, you will have to split your text into parts according to the granularity required for picking.

  Example:

          cee::PtrRef<cee::vis::MarkupModel> myModel = new cee::vis::MarkupModel;
          m_view->addModel(myModel.get());

          std::vector<cee::Vec3d> tris;
          tris.push_back(cee::Vec3d(0, 0, 0));    tris.push_back(cee::Vec3d(2, 2, 0));    tris.push_back(cee::Vec3d(2, 2, 1));
          tris.push_back(cee::Vec3d(0, 0, 0));    tris.push_back(cee::Vec3d(2, 2, 1));    tris.push_back(cee::Vec3d(0, 0, 1));
          myModel->addPart(cee::vis::MarkupPartTriangles::create(tris, cee::Color3f(0.0f, 0.51f, 0.64f), 1.0f).get());

          cee::PtrRef<cee::vis::MarkupPartText3d> myText = new cee::vis::MarkupPartText3d();
          myText->setTextColor(cee::Color3f(0,0,0));

      #ifdef WIN32
          {
              cee::Str trueTypeFontName;
              TCHAR windir[MAX_PATH];
              GetWindowsDirectory(windir, MAX_PATH);
              cee::Str fontFilename = cee::Str(windir) + "\\Fonts\\arial.ttf";
              cee::PtrRef<cee::vis::Font> font = new cee::vis::TrueTypeFont(fontFilename, 144);
              myText->setFont(font.get());
          }
      #endif

          myText->add("HOOPS", cee::Vec3d(0.1, 0.1, 0.6), cee::Vec3d(1,1,0), cee::Vec3d(0,0,1), 0.3);
          myText->add("Envision", cee::Vec3d(0.1, 0.1, 0.1), cee::Vec3d(1,1,0), cee::Vec3d(0,0,1), 0.25);

          myModel->addPart(myText.get());

  See also

  MarkupModel

  Public Functions

  `MarkupPartText3d`()

    Constructs an empty part.

  virtual PartType `type`() const

    Returns the type of the part. Always MarkupPart::TEXT_3D.

  virtual BoundingBox `boundingBox`() const

    Returns the current bounding box of the part.

  virtual void `setPriority`(int priority)

    Sets render priority of the part.

    The render priority determines the order in which parts get rendered. Parts with lower priorities get rendered first. The default priority is 100.

  virtual int `priority`() const

    Returns the render priority of the part.

  virtual const Mat4d &`transformation`() const

    Returns the current transformation matrix for the part.

  virtual void `setTransformation`(const Mat4d &matrix)

    Sets the transformation matrix to use for the part.

  const Font *`font`() const

    Returns the font used to draw the labels in the part.

  void `setFont`(Font *labelFont)

    Sets the font to use for drawing the labels in the part.

    Default is the large built-in font (Font::createLargeFont())

  const Color3f &`textColor`() const

    Returns the current text color.

  void `setTextColor`(const Color3f &color)

    Sets the text color of the text items in this part.

  float `eyeLiftFactor`() const

    Returns the eye lift factor of the 3d text.

    See also

    setEyeLiftFactor

  void `setEyeLiftFactor`(float factor)

    Sets the eye lift factor for the 3d text.

    The eye lift factor specifies if the text should be moved towards the camera (or away from the camera if the factor is negative).

    This is useful for controlling the ordering of items that are defined in the same plane.

  unsigned int `maximumNumberOfLabelsToDraw`() const

    Returns the maximum number of text items to draw in this part.

  void `setMaximumNumberOfLabelsToDraw`(unsigned int maximumNumberToDraw)

    Sets the maximum number of text items to draw in the part.

    The text items within the view volume will be sorted and the closest items up to the given number will be drawn.

  size_t `count`() const

    Returns the number of text items in the part.

  MarkupText3dItem `textItem`(size_t index) const

    Returns the text item at the given index.

    See also

    MarkupText3dItem

  size_t `add`(const MarkupText3dItem &item)

    Adds the given text item to the part.

    See also

    MarkupText3dItem

  size_t `add`(const Str &text, const Vec3d &position, const Vec3d &directionVector, const Vec3d &upVector, double textHeight)

    Adds a text item to the part with the given parameters.

    Note that directionVector and upVector cannot be zero vectors and they do not need to be normalized

    The textHeight is the height of the text (in world coordinates) (in the upVector direction).

  void `set`(size_t index, const MarkupText3dItem &item)

    Sets the text item at the given index.

    See also

    MarkupText3dItem

  void `remove`(size_t index)

    Removes the text item at the given index.

    See also

    MarkupText3dItem

  void `removeAll`()

    Removes all labels in the part.

  Public Static Functions

  static PtrRef<MarkupPartText3d> `create`(const Str &text, const Color3f &color, const Vec3d &position, const Vec3d &directionVector, const Vec3d &upVector, double textHeight)

    Returns a newly created part with the given settings.

    The returned part will have the specified color and have one text item with the given parameters

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Envision for Desktop or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...