Nebula
Loading...
Searching...
No Matches
Im3d::Context Struct Reference

#include <im3d.h>

Public Member Functions

 Context ()
 
 ~Context ()
 
void begin (PrimitiveMode _mode)
 
void end ()
 
void vertex (const Vec3 &_position, float _size, Color _color)
 
void vertex (const Vec3 &_position)
 
void text (const Vec3 &_position, float _size, Color _color, TextFlags _flags, const char *_textStart, const char *_textEnd)
 
void text (const Vec3 &_position, float _size, Color _color, TextFlags _flags, const char *_text, va_list _args)
 
void reset ()
 
void merge (const Context &_src)
 
void endFrame ()
 
void draw ()
 
const DrawListgetDrawLists () const
 
U32 getDrawListCount () const
 
const TextDrawListgetTextDrawLists () const
 
U32 getTextDrawListCount () const
 
void setColor (Color _color)
 
Color getColor () const
 
void pushColor (Color _color)
 
void popColor ()
 
void setAlpha (float _alpha)
 
float getAlpha () const
 
void pushAlpha (float _alpha)
 
void popAlpha ()
 
void setSize (float _size)
 
float getSize () const
 
void pushSize (float _size)
 
void popSize ()
 
void setEnableSorting (bool _enable)
 
bool getEnableSorting () const
 
void pushEnableSorting (bool _enable)
 
void popEnableSorting ()
 
Id getLayerId () const
 
void pushLayerId (Id _layer)
 
void popLayerId ()
 
void setMatrix (const Mat4 &_mat4)
 
const Mat4getMatrix () const
 
void pushMatrix (const Mat4 &_mat4)
 
void popMatrix ()
 
void setId (Id _id)
 
Id getId () const
 
void pushId (Id _id)
 
void popId ()
 
AppDatagetAppData ()
 
bool gizmoAxisTranslation_Behavior (Id _id, const Vec3 &_origin, const Vec3 &_axis, float _snap, float _worldHeight, float _worldSize, Vec3 *_out_)
 
void gizmoAxisTranslation_Draw (Id _id, const Vec3 &_origin, const Vec3 &_axis, float _worldHeight, float _worldSize, Color _color)
 
bool gizmoPlaneTranslation_Behavior (Id _id, const Vec3 &_origin, const Vec3 &_normal, float _snap, float _worldSize, Vec3 *_out_)
 
void gizmoPlaneTranslation_Draw (Id _id, const Vec3 &_origin, const Vec3 &_normal, float _worldSize, Color _color)
 
bool gizmoAxislAngle_Behavior (Id _id, const Vec3 &_origin, const Vec3 &_axis, float _snap, float _worldRadius, float _worldSize, float *_out_)
 
void gizmoAxislAngle_Draw (Id _id, const Vec3 &_origin, const Vec3 &_axis, float _worldRadius, float _angle, Color _color, float _minAlpha)
 
bool gizmoAxisScale_Behavior (Id _id, const Vec3 &_origin, const Vec3 &_axis, float _snap, float _worldHeight, float _worldSize, float *_out_)
 
void gizmoAxisScale_Draw (Id _id, const Vec3 &_origin, const Vec3 &_axis, float _worldHeight, float _worldSize, Color _color)
 
float pixelsToWorldSize (const Vec3 &_position, float _pixels)
 
float worldSizeToPixels (const Vec3 &_position, float _pixels)
 
int estimateLevelOfDetail (const Vec3 &_position, float _worldSize, int _min=4, int _max=256)
 
bool makeHot (Id _id, float _depth, bool _intersects)
 
void makeActive (Id _id)
 
void resetId ()
 
bool isKeyDown (Key _key) const
 
bool wasKeyPressed (Key _key) const
 
bool isVisible (const VertexData *_vdata, DrawPrimitiveType _prim)
 
bool isVisible (const Vec3 &_origin, float _radius)
 
bool isVisible (const Vec3 &_min, const Vec3 &_max)
 
U32 getPrimitiveCount (DrawPrimitiveType _type) const
 
U32 getTextCount () const
 
U32 getLayerCount () const
 

Public Attributes

bool m_gizmoLocal
 
GizmoMode m_gizmoMode
 
Id m_activeId
 
Id m_hotId
 
float m_hotDepth
 
Id m_appId
 
Id m_appActiveId
 
Id m_appHotId
 
Vec3 m_gizmoStateVec3
 
Mat3 m_gizmoStateMat3
 
float m_gizmoStateFloat
 
float m_gizmoHeightPixels
 
float m_gizmoSizePixels
 

Private Types

typedef Vector< VertexDataVertexList
 
typedef Vector< TextDataTextList
 

Private Member Functions

void sort ()
 
int findLayerIndex (Id _id) const
 
VertexListgetCurrentVertexList ()
 
TextListgetCurrentTextList ()
 

Private Attributes

Vector< Colorm_colorStack
 
Vector< float > m_alphaStack
 
Vector< float > m_sizeStack
 
Vector< bool > m_enableSortingStack
 
Vector< Mat4m_matrixStack
 
Vector< Idm_idStack
 
Vector< Idm_layerIdStack
 
Vector< VertexList * > m_vertexData [2]
 
int m_vertexDataIndex
 
Vector< Idm_layerIdMap
 
int m_layerIndex
 
Vector< DrawListm_drawLists
 
bool m_sortCalled
 
bool m_endFrameCalled
 
Vector< TextList * > m_textData
 
Vector< char > m_textBuffer
 
Vector< TextDrawListm_textDrawLists
 
PrimitiveMode m_primMode
 
DrawPrimitiveType m_primType
 
U32 m_firstVertThisPrim
 
U32 m_vertCountThisPrim
 
Vec3 m_minVertThisPrim
 
Vec3 m_maxVertThisPrim
 
AppData m_appData
 
bool m_keyDownCurr [Key_Count]
 
bool m_keyDownPrev [Key_Count]
 
Vec4 m_cullFrustum [FrustumPlane_Count]
 
int m_cullFrustumCount
 

Member Typedef Documentation

◆ TextList

◆ VertexList

Constructor & Destructor Documentation

◆ Context()

Context::Context ( )

◆ ~Context()

Context::~Context ( )

Member Function Documentation

◆ begin()

void Context::begin ( PrimitiveMode _mode)

◆ draw()

void Context::draw ( )

◆ end()

void Context::end ( )

◆ endFrame()

void Context::endFrame ( )

◆ estimateLevelOfDetail()

int Context::estimateLevelOfDetail ( const Vec3 & _position,
float _worldSize,
int _min = 4,
int _max = 256 )

◆ findLayerIndex()

int Context::findLayerIndex ( Id _id) const
private

◆ getAlpha()

float Im3d::Context::getAlpha ( ) const
inline

◆ getAppData()

AppData & Im3d::Context::getAppData ( )
inline

◆ getColor()

Color Im3d::Context::getColor ( ) const
inline

◆ getCurrentTextList()

Context::TextList * Context::getCurrentTextList ( )
private

◆ getCurrentVertexList()

Context::VertexList * Context::getCurrentVertexList ( )
private

◆ getDrawListCount()

U32 Im3d::Context::getDrawListCount ( ) const
inline

◆ getDrawLists()

const DrawList * Im3d::Context::getDrawLists ( ) const
inline

◆ getEnableSorting()

bool Im3d::Context::getEnableSorting ( ) const
inline

◆ getId()

Id Im3d::Context::getId ( ) const
inline

◆ getLayerCount()

U32 Im3d::Context::getLayerCount ( ) const
inline

◆ getLayerId()

Id Im3d::Context::getLayerId ( ) const
inline

◆ getMatrix()

const Mat4 & Im3d::Context::getMatrix ( ) const
inline

◆ getPrimitiveCount()

U32 Context::getPrimitiveCount ( DrawPrimitiveType _type) const

◆ getSize()

float Im3d::Context::getSize ( ) const
inline

◆ getTextCount()

U32 Context::getTextCount ( ) const

◆ getTextDrawListCount()

U32 Im3d::Context::getTextDrawListCount ( ) const
inline

◆ getTextDrawLists()

const TextDrawList * Im3d::Context::getTextDrawLists ( ) const
inline

◆ gizmoAxislAngle_Behavior()

bool Context::gizmoAxislAngle_Behavior ( Id _id,
const Vec3 & _origin,
const Vec3 & _axis,
float _snap,
float _worldRadius,
float _worldSize,
float * _out_ )

◆ gizmoAxislAngle_Draw()

void Context::gizmoAxislAngle_Draw ( Id _id,
const Vec3 & _origin,
const Vec3 & _axis,
float _worldRadius,
float _angle,
Color _color,
float _minAlpha )

◆ gizmoAxisScale_Behavior()

bool Context::gizmoAxisScale_Behavior ( Id _id,
const Vec3 & _origin,
const Vec3 & _axis,
float _snap,
float _worldHeight,
float _worldSize,
float * _out_ )

◆ gizmoAxisScale_Draw()

void Context::gizmoAxisScale_Draw ( Id _id,
const Vec3 & _origin,
const Vec3 & _axis,
float _worldHeight,
float _worldSize,
Color _color )

◆ gizmoAxisTranslation_Behavior()

bool Context::gizmoAxisTranslation_Behavior ( Id _id,
const Vec3 & _origin,
const Vec3 & _axis,
float _snap,
float _worldHeight,
float _worldSize,
Vec3 * _out_ )

◆ gizmoAxisTranslation_Draw()

void Context::gizmoAxisTranslation_Draw ( Id _id,
const Vec3 & _origin,
const Vec3 & _axis,
float _worldHeight,
float _worldSize,
Color _color )

◆ gizmoPlaneTranslation_Behavior()

bool Context::gizmoPlaneTranslation_Behavior ( Id _id,
const Vec3 & _origin,
const Vec3 & _normal,
float _snap,
float _worldSize,
Vec3 * _out_ )

◆ gizmoPlaneTranslation_Draw()

void Context::gizmoPlaneTranslation_Draw ( Id _id,
const Vec3 & _origin,
const Vec3 & _normal,
float _worldSize,
Color _color )

◆ isKeyDown()

bool Im3d::Context::isKeyDown ( Key _key) const
inline

◆ isVisible() [1/3]

bool Context::isVisible ( const Vec3 & _min,
const Vec3 & _max )

◆ isVisible() [2/3]

bool Context::isVisible ( const Vec3 & _origin,
float _radius )

◆ isVisible() [3/3]

bool Context::isVisible ( const VertexData * _vdata,
DrawPrimitiveType _prim )

◆ makeActive()

void Context::makeActive ( Id _id)

◆ makeHot()

bool Context::makeHot ( Id _id,
float _depth,
bool _intersects )

◆ merge()

void Context::merge ( const Context & _src)

◆ pixelsToWorldSize()

float Context::pixelsToWorldSize ( const Vec3 & _position,
float _pixels )

◆ popAlpha()

void Im3d::Context::popAlpha ( )
inline

◆ popColor()

void Im3d::Context::popColor ( )
inline

◆ popEnableSorting()

void Context::popEnableSorting ( )

◆ popId()

void Im3d::Context::popId ( )
inline

◆ popLayerId()

void Context::popLayerId ( )

◆ popMatrix()

void Im3d::Context::popMatrix ( )
inline

◆ popSize()

void Im3d::Context::popSize ( )
inline

◆ pushAlpha()

void Im3d::Context::pushAlpha ( float _alpha)
inline

◆ pushColor()

void Im3d::Context::pushColor ( Color _color)
inline

◆ pushEnableSorting()

void Context::pushEnableSorting ( bool _enable)

◆ pushId()

void Im3d::Context::pushId ( Id _id)
inline

◆ pushLayerId()

void Context::pushLayerId ( Id _layer)

◆ pushMatrix()

void Im3d::Context::pushMatrix ( const Mat4 & _mat4)
inline

◆ pushSize()

void Im3d::Context::pushSize ( float _size)
inline

◆ reset()

void Context::reset ( )

◆ resetId()

void Context::resetId ( )

◆ setAlpha()

void Im3d::Context::setAlpha ( float _alpha)
inline

◆ setColor()

void Im3d::Context::setColor ( Color _color)
inline

◆ setEnableSorting()

void Context::setEnableSorting ( bool _enable)

◆ setId()

void Im3d::Context::setId ( Id _id)
inline

◆ setMatrix()

void Im3d::Context::setMatrix ( const Mat4 & _mat4)
inline

◆ setSize()

void Im3d::Context::setSize ( float _size)
inline

◆ sort()

void Context::sort ( )
private

◆ text() [1/2]

void Context::text ( const Vec3 & _position,
float _size,
Color _color,
TextFlags _flags,
const char * _text,
va_list _args )

◆ text() [2/2]

void Context::text ( const Vec3 & _position,
float _size,
Color _color,
TextFlags _flags,
const char * _textStart,
const char * _textEnd )

◆ vertex() [1/2]

void Im3d::Context::vertex ( const Vec3 & _position)
inline

◆ vertex() [2/2]

void Context::vertex ( const Vec3 & _position,
float _size,
Color _color )

◆ wasKeyPressed()

bool Im3d::Context::wasKeyPressed ( Key _key) const
inline

◆ worldSizeToPixels()

float Context::worldSizeToPixels ( const Vec3 & _position,
float _pixels )

Member Data Documentation

◆ m_activeId

Id Im3d::Context::m_activeId

◆ m_alphaStack

Vector<float> Im3d::Context::m_alphaStack
private

◆ m_appActiveId

Id Im3d::Context::m_appActiveId

◆ m_appData

AppData Im3d::Context::m_appData
private

◆ m_appHotId

Id Im3d::Context::m_appHotId

◆ m_appId

Id Im3d::Context::m_appId

◆ m_colorStack

Vector<Color> Im3d::Context::m_colorStack
private

◆ m_cullFrustum

Vec4 Im3d::Context::m_cullFrustum[FrustumPlane_Count]
private

◆ m_cullFrustumCount

int Im3d::Context::m_cullFrustumCount
private

◆ m_drawLists

Vector<DrawList> Im3d::Context::m_drawLists
private

◆ m_enableSortingStack

Vector<bool> Im3d::Context::m_enableSortingStack
private

◆ m_endFrameCalled

bool Im3d::Context::m_endFrameCalled
private

◆ m_firstVertThisPrim

U32 Im3d::Context::m_firstVertThisPrim
private

◆ m_gizmoHeightPixels

float Im3d::Context::m_gizmoHeightPixels

◆ m_gizmoLocal

bool Im3d::Context::m_gizmoLocal

◆ m_gizmoMode

GizmoMode Im3d::Context::m_gizmoMode

◆ m_gizmoSizePixels

float Im3d::Context::m_gizmoSizePixels

◆ m_gizmoStateFloat

float Im3d::Context::m_gizmoStateFloat

◆ m_gizmoStateMat3

Mat3 Im3d::Context::m_gizmoStateMat3

◆ m_gizmoStateVec3

Vec3 Im3d::Context::m_gizmoStateVec3

◆ m_hotDepth

float Im3d::Context::m_hotDepth

◆ m_hotId

Id Im3d::Context::m_hotId

◆ m_idStack

Vector<Id> Im3d::Context::m_idStack
private

◆ m_keyDownCurr

bool Im3d::Context::m_keyDownCurr[Key_Count]
private

◆ m_keyDownPrev

bool Im3d::Context::m_keyDownPrev[Key_Count]
private

◆ m_layerIdMap

Vector<Id> Im3d::Context::m_layerIdMap
private

◆ m_layerIdStack

Vector<Id> Im3d::Context::m_layerIdStack
private

◆ m_layerIndex

int Im3d::Context::m_layerIndex
private

◆ m_matrixStack

Vector<Mat4> Im3d::Context::m_matrixStack
private

◆ m_maxVertThisPrim

Vec3 Im3d::Context::m_maxVertThisPrim
private

◆ m_minVertThisPrim

Vec3 Im3d::Context::m_minVertThisPrim
private

◆ m_primMode

PrimitiveMode Im3d::Context::m_primMode
private

◆ m_primType

DrawPrimitiveType Im3d::Context::m_primType
private

◆ m_sizeStack

Vector<float> Im3d::Context::m_sizeStack
private

◆ m_sortCalled

bool Im3d::Context::m_sortCalled
private

◆ m_textBuffer

Vector<char> Im3d::Context::m_textBuffer
private

◆ m_textData

Vector<TextList*> Im3d::Context::m_textData
private

◆ m_textDrawLists

Vector<TextDrawList> Im3d::Context::m_textDrawLists
private

◆ m_vertCountThisPrim

U32 Im3d::Context::m_vertCountThisPrim
private

◆ m_vertexData

Vector<VertexList*> Im3d::Context::m_vertexData[2]
private

◆ m_vertexDataIndex

int Im3d::Context::m_vertexDataIndex
private

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