Nebula
Loading...
Searching...
No Matches
CoreGraphics::RenderShape Class Reference

#include <rendershape.h>

Detailed Description

Describes a shape which is rendered through the ShapeRenderer singleton.

Shape rendering may be relatively inefficient and should only be used for debug visualizations. Please note that vertex and index data will be copied into a memory stream, so that it is safe to release or alter the original data once the shape object has been created. You have to be aware of the performance and memory-footprint implications though. Shape objects can be copied, but they will share the internal vertex/index data copy.

Classes

struct  RenderShapeVertex
 

Public Types

enum  Type {
  Box , Sphere , Cylinder , Torus ,
  Cone , Arrow , Primitives , IndexedPrimitives ,
  RenderMesh , NumShapeTypes , InvalidShapeType
}
 shape types More...
 
enum  RenderFlag { CheckDepth = 0 , AlwaysOnTop , Wireframe , NumDepthFlags }
 

Public Member Functions

 RenderShape ()
 default constructor
 
 RenderShape (Type shapeType, RenderFlag depthFlag, const Math::mat4 &modelTransform, const Math::vec4 &color)
 shortcut constructor for simple shapes
 
bool IsValid () const
 return true if object has been setup
 
void SetupSimpleShape (Type shapeType, RenderFlag depthFlag, const Math::vec4 &color, const Math::mat4 &modelTransform=Math::mat4::identity, float lineThickness=1.0f)
 setup simple shape
 
void SetupPrimitives (const RenderShape::RenderShapeVertex *vertices, SizeT numVertices, PrimitiveTopology::Code topology, RenderFlag depthFlag, const Math::mat4 transform=Math::mat4::identity, float lineThickness=1.0f)
 Setup primitives draw.
 
void SetupPrimitives (const Util::Array< RenderShape::RenderShapeVertex > vertices, PrimitiveTopology::Code topology, RenderFlag depthFlag, const Math::mat4 transform=Math::mat4::identity, float lineThickness=1.0f)
 Setup primitives draw.
 
void SetupIndexPrimitives (const RenderShape::RenderShapeVertex *vertices, SizeT numVertices, const void *indices, SizeT numIndices, IndexType::Code indexType, PrimitiveTopology::Code topology, RenderFlag depthFlag, const Math::mat4 transform=Math::mat4::identity, float lineThickness=1.0f)
 Setup indexed primitives draw.
 
void SetupIndexPrimitives (const Util::Array< RenderShape::RenderShapeVertex > vertices, const Util::Array< uint16 > indices, PrimitiveTopology::Code topology, RenderFlag depthFlag, const Math::mat4 transform=Math::mat4::identity, float lineThickness=1.0f)
 Setup indexed primitives draw.
 
void SetupIndexPrimitives (const Util::Array< RenderShape::RenderShapeVertex > vertices, const Util::Array< uint32 > indices, PrimitiveTopology::Code topology, RenderFlag depthFlag, const Math::mat4 transform=Math::mat4::identity, float lineThickness=1.0f)
 Setup indexed primitives draw.
 
void SetupMesh (const MeshId mesh, const IndexT groupIndex, const Math::vec4 &color, RenderFlag depthFlag, const Math::mat4 &modelTransform=Math::mat4::identity, float lineThickness=1.0f)
 setup mesh
 
Type GetShapeType () const
 get shape type
 
RenderFlag GetDepthFlag () const
 get depth flag
 
const Math::mat4GetModelTransform () const
 get model transform
 
PrimitiveTopology::Code GetTopology () const
 get primitive topology
 
SizeT GetNumVertices () const
 get number of vertices
 
SizeT GetNumIndices () const
 get number of indices
 
const void * GetVertexData () const
 get pointer to vertex data (returns 0 if none exist)
 
const void * GetIndexData () const
 get index data (returns 0 if none exists)
 
IndexType::Code GetIndexType () const
 get the index type (16 or 32 bit)
 
const Math::vec4GetColor () const
 get shape color
 
const VertexLayoutId GetVertexLayout () const
 get vertex layout, returns NULL if none exist
 
const MeshId GetMesh () const
 get mesh
 
const IndexTGetPrimitiveGroupIndex () const
 get primitive group
 
const float GetLineThickness () const
 Get line thickness.
 

Private Attributes

Type shapeType
 
RenderFlag depthFlag
 
Math::mat4 modelTransform
 
PrimitiveTopology::Code topology
 
SizeT numIndices
 
SizeT numVertices
 
SizeT vertexDataOffset
 
IndexType::Code indexType
 
Math::vec4 color
 
float lineThickness
 
IndexT groupIndex
 
MeshId mesh
 
VertexLayoutId vertexLayout
 
Ptr< IO::MemoryStreamdataStream
 

Member Enumeration Documentation

◆ RenderFlag

Enumerator
CheckDepth 
AlwaysOnTop 
Wireframe 
NumDepthFlags 

◆ Type

shape types

Enumerator
Box 
Sphere 
Cylinder 
Torus 
Cone 
Arrow 
Primitives 
IndexedPrimitives 
RenderMesh 
NumShapeTypes 
InvalidShapeType 

Constructor & Destructor Documentation

◆ RenderShape() [1/2]

CoreGraphics::RenderShape::RenderShape ( )

default constructor

◆ RenderShape() [2/2]

CoreGraphics::RenderShape::RenderShape ( Type shapeType,
RenderFlag depthFlag,
const Math::mat4 & modelTransform,
const Math::vec4 & color )

shortcut constructor for simple shapes

Member Function Documentation

◆ GetColor()

const Math::vec4 & CoreGraphics::RenderShape::GetColor ( ) const
inline

get shape color

◆ GetDepthFlag()

RenderShape::RenderFlag CoreGraphics::RenderShape::GetDepthFlag ( ) const
inline

get depth flag

◆ GetIndexData()

const void * CoreGraphics::RenderShape::GetIndexData ( ) const
inline

get index data (returns 0 if none exists)

◆ GetIndexType()

IndexType::Code CoreGraphics::RenderShape::GetIndexType ( ) const
inline

get the index type (16 or 32 bit)

◆ GetLineThickness()

const float CoreGraphics::RenderShape::GetLineThickness ( ) const
inline

Get line thickness.

◆ GetMesh()

const MeshId CoreGraphics::RenderShape::GetMesh ( ) const
inline

get mesh

◆ GetModelTransform()

const Math::mat4 & CoreGraphics::RenderShape::GetModelTransform ( ) const
inline

get model transform

◆ GetNumIndices()

SizeT CoreGraphics::RenderShape::GetNumIndices ( ) const
inline

get number of indices

◆ GetNumVertices()

SizeT CoreGraphics::RenderShape::GetNumVertices ( ) const
inline

get number of vertices

◆ GetPrimitiveGroupIndex()

const IndexT & CoreGraphics::RenderShape::GetPrimitiveGroupIndex ( ) const
inline

get primitive group

◆ GetShapeType()

RenderShape::Type CoreGraphics::RenderShape::GetShapeType ( ) const
inline

get shape type

◆ GetTopology()

PrimitiveTopology::Code CoreGraphics::RenderShape::GetTopology ( ) const
inline

get primitive topology

◆ GetVertexData()

const void * CoreGraphics::RenderShape::GetVertexData ( ) const
inline

get pointer to vertex data (returns 0 if none exist)

◆ GetVertexLayout()

const VertexLayoutId CoreGraphics::RenderShape::GetVertexLayout ( ) const
inline

get vertex layout, returns NULL if none exist

◆ IsValid()

bool CoreGraphics::RenderShape::IsValid ( ) const
inline

return true if object has been setup

◆ SetupIndexPrimitives() [1/3]

void CoreGraphics::RenderShape::SetupIndexPrimitives ( const RenderShape::RenderShapeVertex * vertices,
SizeT numVertices,
const void * indices,
SizeT numIndices,
IndexType::Code indexType,
PrimitiveTopology::Code topology,
RenderFlag depthFlag,
const Math::mat4 transform = Math::mat4::identity,
float lineThickness = 1.0f )

Setup indexed primitives draw.

◆ SetupIndexPrimitives() [2/3]

void CoreGraphics::RenderShape::SetupIndexPrimitives ( const Util::Array< RenderShape::RenderShapeVertex > vertices,
const Util::Array< uint16 > indices,
PrimitiveTopology::Code topology,
RenderFlag depthFlag,
const Math::mat4 transform = Math::mat4::identity,
float lineThickness = 1.0f )

Setup indexed primitives draw.

◆ SetupIndexPrimitives() [3/3]

void CoreGraphics::RenderShape::SetupIndexPrimitives ( const Util::Array< RenderShape::RenderShapeVertex > vertices,
const Util::Array< uint32 > indices,
PrimitiveTopology::Code topology,
RenderFlag depthFlag,
const Math::mat4 transform = Math::mat4::identity,
float lineThickness = 1.0f )

Setup indexed primitives draw.

◆ SetupMesh()

void CoreGraphics::RenderShape::SetupMesh ( const MeshId mesh,
const IndexT groupIndex,
const Math::vec4 & color,
RenderFlag depthFlag,
const Math::mat4 & modelTransform = Math::mat4::identity,
float lineThickness = 1.0f )

setup mesh

◆ SetupPrimitives() [1/2]

void CoreGraphics::RenderShape::SetupPrimitives ( const RenderShape::RenderShapeVertex * vertices,
SizeT numVertices,
PrimitiveTopology::Code topology,
RenderFlag depthFlag,
const Math::mat4 transform = Math::mat4::identity,
float lineThickness = 1.0f )

Setup primitives draw.

◆ SetupPrimitives() [2/2]

void CoreGraphics::RenderShape::SetupPrimitives ( const Util::Array< RenderShape::RenderShapeVertex > vertices,
PrimitiveTopology::Code topology,
RenderFlag depthFlag,
const Math::mat4 transform = Math::mat4::identity,
float lineThickness = 1.0f )

Setup primitives draw.

◆ SetupSimpleShape()

void CoreGraphics::RenderShape::SetupSimpleShape ( Type shapeType,
RenderFlag depthFlag,
const Math::vec4 & color,
const Math::mat4 & modelTransform = Math::mat4::identity,
float lineThickness = 1.0f )

setup simple shape

Member Data Documentation

◆ color

Math::vec4 CoreGraphics::RenderShape::color
private

◆ dataStream

Ptr<IO::MemoryStream> CoreGraphics::RenderShape::dataStream
private

◆ depthFlag

RenderFlag CoreGraphics::RenderShape::depthFlag
private

◆ groupIndex

IndexT CoreGraphics::RenderShape::groupIndex
private

◆ indexType

IndexType::Code CoreGraphics::RenderShape::indexType
private

◆ lineThickness

float CoreGraphics::RenderShape::lineThickness
private

◆ mesh

MeshId CoreGraphics::RenderShape::mesh
private

◆ modelTransform

Math::mat4 CoreGraphics::RenderShape::modelTransform
private

◆ numIndices

SizeT CoreGraphics::RenderShape::numIndices
private

◆ numVertices

SizeT CoreGraphics::RenderShape::numVertices
private

◆ shapeType

Type CoreGraphics::RenderShape::shapeType
private

◆ topology

PrimitiveTopology::Code CoreGraphics::RenderShape::topology
private

◆ vertexDataOffset

SizeT CoreGraphics::RenderShape::vertexDataOffset
private

◆ vertexLayout

VertexLayoutId CoreGraphics::RenderShape::vertexLayout
private

The documentation for this class was generated from the following files: