NAP
Public Member Functions | Public Attributes | List of all members
PlaneMesh Class Reference

#include <planemesh.h>

Public Member Functions

 PlaneMesh (Core &core)
 
virtual bool init (utility::ErrorState &errorState) override
 
bool setup (utility::ErrorState &error)
 
virtual MeshInstancegetMeshInstance () override
 
virtual const MeshInstancegetMeshInstance () const override
 
const math::RectgetRect ()
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

glm::vec2 mSize = { 1.0, 1.0 }
 Property: 'Size' the size of the plane in units. More...
 
glm::vec2 mPosition = { 0.0,0.0 }
 Property: 'Position' where the plane is positioned in object space. More...
 
RGBAColorFloat mColor = { 1.0f, 1.0f, 1.0f, 1.0f }
 Property: 'Color' color of the plane. More...
 
uint mRows = 1
 Property: 'Rows' number of rows. More...
 
uint mColumns = 1
 Property: 'Columns' number of columns. More...
 
EMemoryUsage mUsage = EMemoryUsage::Static
 Property: 'Usage' If the plane is uploaded once or frequently updated. More...
 
ECullMode mCullMode = ECullMode::None
 Property: 'CullMode' Plane cull mode, defaults to no culling. More...
 
EPolygonMode mPolygonMode = EPolygonMode::Fill
 Property: 'PolygonMode' Polygon rasterization mode (fill, line, points) More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Predefined rectangular mesh with a specific size centered at the origin on the xy axis. When there is no size given the mesh is a uniform 1m2. The UV coordinates are always 0-1. By default the plane has 1 row and 1 column.

Inheritance diagram for PlaneMesh:
[legend]
Collaboration diagram for PlaneMesh:
[legend]

Constructor & Destructor Documentation

◆ PlaneMesh()

PlaneMesh ( Core core)

Member Function Documentation

◆ getMeshInstance() [1/2]

virtual const MeshInstance& getMeshInstance ( ) const
overridevirtual
Returns
the mesh used for rendering

Implements IMesh.

◆ getMeshInstance() [2/2]

virtual MeshInstance& getMeshInstance ( )
overridevirtual
Returns
the mesh used for rendering

Implements IMesh.

◆ getRect()

const math::Rect& getRect ( )
Returns
the plane as a rectangle

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Sets up, initializes and uploads the plane to the GPU based on the provided parameters.

Parameters
errorStatecontains the error message if the mesh could not be created.
Returns
if the mesh was successfully created and initialized.

Reimplemented from Object.

◆ setup()

bool setup ( utility::ErrorState error)

Creates and prepares the mesh instance but doesn't initialize it. Call this when you want to prepare a grid without creating the GPU representation. You have to manually call init() on the mesh instance afterwards.

Parameters
errorcontains the error code if setup fails
Returns
if setup succeeded

Member Data Documentation

◆ mColor

RGBAColorFloat mColor = { 1.0f, 1.0f, 1.0f, 1.0f }

Property: 'Color' color of the plane.

◆ mColumns

uint mColumns = 1

Property: 'Columns' number of columns.

◆ mCullMode

Property: 'CullMode' Plane cull mode, defaults to no culling.

◆ mPolygonMode

Property: 'PolygonMode' Polygon rasterization mode (fill, line, points)

◆ mPosition

glm::vec2 mPosition = { 0.0,0.0 }

Property: 'Position' where the plane is positioned in object space.

◆ mRows

uint mRows = 1

Property: 'Rows' number of rows.

◆ mSize

glm::vec2 mSize = { 1.0, 1.0 }

Property: 'Size' the size of the plane in units.

◆ mUsage

Property: 'Usage' If the plane is uploaded once or frequently updated.