Skip to content

Vp::Shaper

A utility class for constructing simple shapes. More...

#include "Viewport/Shaper.h"

Public Functions

Name
voidinitDefaultShapes()
voidclear()<br>Clear prepared geometry (vertices and colors).
Core::Mesh *createLineMesh(const std::string & alias ="")<br>Create a line mesh from current shaper state and register it with ResourceManager.
Core::Mesh *createMesh(const std::string & alias ="")<br>Create a triangle mesh from current shaper state and register it with ResourceManager.
const std::vector< float > &getColors() const
const std::vector< float > &getVertices() const
voidline(const glm::vec3 a, const glm::vec3 b)<br>Prepare geometry for line from a to b using the single global color currentColor.
voidline(const glm::vec3 a, const glm::vec3 b, const glm::vec3 color)<br>Prepare geometry for line from a to b using the single color color for the whole line (both line ends)
voidline(const glm::vec3 a, const glm::vec3 b, const glm::vec3 color_a, const glm::vec3 color_b)<br>Prepare geometry for line from a to b using the single color color for the whole line (both line ends)
voidlineBox(glm::vec3 from, glm::vec3 to)
voidquad(const glm::vec3 a, const glm::vec3 b, const glm::vec3 c, const glm::vec3 d)<br>Creates a quad with two triangles.
voidquad(const glm::vec3 a, const glm::vec3 b, const glm::vec3 c, const glm::vec3 d, const glm::vec3 color)<br>Creates a quad with two triangles.
voidreserveBuffers(const int newCapacity)
voidsetColor(const glm::vec3 color)<br>Set the current drawing color.

Public Attributes

Name
std::stringplane
std::stringscreenQuad <br>Screen quad for post processing.
std::stringunitCube
std::stringunitLineCube
std::stringxyzAxes <br>Simple three color line axes.

Detailed Description

cpp
class Vp::Shaper;
class Vp::Shaper;

A utility class for constructing simple shapes.

Used in Viewport for drawing of world axes, axes of models and wireframe objects (such as projection frustum)

Public Functions Documentation

function initDefaultShapes

cpp
static void initDefaultShapes()
static void initDefaultShapes()

function clear

cpp
void clear()
void clear()

Clear prepared geometry (vertices and colors).

function createLineMesh

cpp
Core::Mesh * createLineMesh(
    const std::string & alias =""
)
Core::Mesh * createLineMesh(
    const std::string & alias =""
)

Create a line mesh from current shaper state and register it with ResourceManager.

Parameters:

  • alias Unique shape identifier

Return:

function createMesh

cpp
Core::Mesh * createMesh(
    const std::string & alias =""
)
Core::Mesh * createMesh(
    const std::string & alias =""
)

Create a triangle mesh from current shaper state and register it with ResourceManager.

Parameters:

  • alias Unique shape identifier

Return:

function getColors

cpp
const std::vector< float > & getColors() const
const std::vector< float > & getColors() const

function getVertices

cpp
const std::vector< float > & getVertices() const
const std::vector< float > & getVertices() const

function line

cpp
void line(
    const glm::vec3 a,
    const glm::vec3 b
)
void line(
    const glm::vec3 a,
    const glm::vec3 b
)

Prepare geometry for line from a to b using the single global color currentColor.

Parameters:

  • a point from
  • b point to

function line

cpp
void line(
    const glm::vec3 a,
    const glm::vec3 b,
    const glm::vec3 color
)
void line(
    const glm::vec3 a,
    const glm::vec3 b,
    const glm::vec3 color
)

Prepare geometry for line from a to b using the single color color for the whole line (both line ends)

Parameters:

  • a Start point
  • b End point
  • color Line color

function line

cpp
void line(
    const glm::vec3 a,
    const glm::vec3 b,
    const glm::vec3 color_a,
    const glm::vec3 color_b
)
void line(
    const glm::vec3 a,
    const glm::vec3 b,
    const glm::vec3 color_a,
    const glm::vec3 color_b
)

Prepare geometry for line from a to b using the single color color for the whole line (both line ends)

Parameters:

  • a Start point
  • b End point
  • color_a Start-point color
  • color_b End-point color

function lineBox

cpp
void lineBox(
    glm::vec3 from,
    glm::vec3 to
)
void lineBox(
    glm::vec3 from,
    glm::vec3 to
)

function quad

cpp
void quad(
    const glm::vec3 a,
    const glm::vec3 b,
    const glm::vec3 c,
    const glm::vec3 d
)
void quad(
    const glm::vec3 a,
    const glm::vec3 b,
    const glm::vec3 c,
    const glm::vec3 d
)

Creates a quad with two triangles.

Parameters:

  • a Top left corner
  • b Top right corner
  • c Bottom left corner
  • d Bottom right corner

Triangles are CCW acd and adb. a — b | \ | c — d

function quad

cpp
void quad(
    const glm::vec3 a,
    const glm::vec3 b,
    const glm::vec3 c,
    const glm::vec3 d,
    const glm::vec3 color
)
void quad(
    const glm::vec3 a,
    const glm::vec3 b,
    const glm::vec3 c,
    const glm::vec3 d,
    const glm::vec3 color
)

Creates a quad with two triangles.

Parameters:

  • a Top left corner
  • b Top right corner
  • c Bottom left corner
  • d Bottom right corner
  • color Color of the vertices

Triangles are CCW acd and adb. a — b | \ | c — d

function reserveBuffers

cpp
void reserveBuffers(
    const int newCapacity
)
void reserveBuffers(
    const int newCapacity
)

function setColor

cpp
void setColor(
    const glm::vec3 color
)
void setColor(
    const glm::vec3 color
)

Set the current drawing color.

Parameters:

  • color New drawing color "currentColor"

Public Attributes Documentation

variable plane

cpp
static std::string plane;
static std::string plane;

variable screenQuad

cpp
static std::string screenQuad;
static std::string screenQuad;

Screen quad for post processing.

variable unitCube

cpp
static std::string unitCube;
static std::string unitCube;

variable unitLineCube

cpp
static std::string unitLineCube;
static std::string unitLineCube;

variable xyzAxes

cpp
static std::string xyzAxes;
static std::string xyzAxes;

Simple three color line axes.


Updated on 2024-03-16 at 19:15:01 +0000