Vp::Shaper
A utility class for constructing simple shapes. More...
#include "Viewport/Shaper.h"
Public Functions
Name | |
---|---|
void | initDefaultShapes() |
void | clear()<br>Clear prepared geometry (vertices and colors). |
Core::Mesh * | createLineMesh(const std::string & alias ="", Core::Mesh::BufferType bufferType =Core::Mesh::BufferType::STATIC)<br>Create a line mesh from current shaper state. |
Core::Mesh * | createMesh(const std::string & alias ="", Core::Mesh::BufferType bufferType =Core::Mesh::BufferType::STATIC)<br>Create a triangle mesh from current shaper state. |
const std::vector< float > & | getColors() const |
const std::vector< float > & | getVertices() const |
void | line(const glm::vec3 a, const glm::vec3 b)<br>Prepare geometry for line from a to b using the single global color currentColor. |
void | line(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) |
void | line(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) |
void | lineBox(glm::vec3 from, glm::vec3 to) |
void | quad(const glm::vec3 a, const glm::vec3 b, const glm::vec3 c, const glm::vec3 d)<br>Creates a quad with two triangles. |
void | quad(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. |
void | reserveBuffers(const int newCapacity) |
void | setColor(const glm::vec3 color)<br>Set the current drawing color. |
void | updateLineMesh(Core::Mesh * mesh) |
void | updateMesh(Core::Mesh * mesh) |
Public Attributes
Name | |
---|---|
std::string | plane |
std::string | screenQuad <br>Screen quad for post processing. |
std::string | unitCube <br>Equivalent to standard OpenGL ndc space. |
std::string | unitLineCube <br>Equivalent to standard OpenGL ndc space. |
std::string | vulkanNdcCube |
std::string | vulkanNdcLineCube |
std::string | xyzAxes <br>Simple three color line axes. |
Detailed Description
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
static void initDefaultShapes()
static void initDefaultShapes()
function clear
void clear()
void clear()
Clear prepared geometry (vertices and colors).
function createLineMesh
Core::Mesh * createLineMesh(
const std::string & alias ="",
Core::Mesh::BufferType bufferType =Core::Mesh::BufferType::STATIC
)
Core::Mesh * createLineMesh(
const std::string & alias ="",
Core::Mesh::BufferType bufferType =Core::Mesh::BufferType::STATIC
)
Create a line mesh from current shaper state.
Parameters:
- alias Unique shape identifier, registered with ResourceManager if not empty
Return:
Note: Dynamic meshes should not provide an alias, as they would persist in ResourceManager.
function createMesh
Core::Mesh * createMesh(
const std::string & alias ="",
Core::Mesh::BufferType bufferType =Core::Mesh::BufferType::STATIC
)
Core::Mesh * createMesh(
const std::string & alias ="",
Core::Mesh::BufferType bufferType =Core::Mesh::BufferType::STATIC
)
Create a triangle mesh from current shaper state.
Parameters:
- alias Unique shape identifier, registered with ResourceManager if not empty
Return:
Note: Dynamic meshes should not provide an alias, as they would persist in ResourceManager.
function getColors
const std::vector< float > & getColors() const
const std::vector< float > & getColors() const
function getVertices
const std::vector< float > & getVertices() const
const std::vector< float > & getVertices() const
function line
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
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
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
void lineBox(
glm::vec3 from,
glm::vec3 to
)
void lineBox(
glm::vec3 from,
glm::vec3 to
)
function quad
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
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
void reserveBuffers(
const int newCapacity
)
void reserveBuffers(
const int newCapacity
)
function setColor
void setColor(
const glm::vec3 color
)
void setColor(
const glm::vec3 color
)
Set the current drawing color.
Parameters:
- color New drawing color "currentColor"
function updateLineMesh
void updateLineMesh(
Core::Mesh * mesh
)
void updateLineMesh(
Core::Mesh * mesh
)
function updateMesh
void updateMesh(
Core::Mesh * mesh
)
void updateMesh(
Core::Mesh * mesh
)
Public Attributes Documentation
variable plane
static std::string plane;
static std::string plane;
variable screenQuad
static std::string screenQuad;
static std::string screenQuad;
Screen quad for post processing.
variable unitCube
static std::string unitCube;
static std::string unitCube;
Equivalent to standard OpenGL ndc space.
variable unitLineCube
static std::string unitLineCube;
static std::string unitLineCube;
Equivalent to standard OpenGL ndc space.
variable vulkanNdcCube
static std::string vulkanNdcCube;
static std::string vulkanNdcCube;
variable vulkanNdcLineCube
static std::string vulkanNdcLineCube;
static std::string vulkanNdcLineCube;
variable xyzAxes
static std::string xyzAxes;
static std::string xyzAxes;
Simple three color line axes.
Updated on 2025-05-31 at 12:55:31 +0000