Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LangmuirView::PointCloud Class Reference

A class to represent a point cloud. More...

#include <pointcloud.h>

Public Types

enum  Mode { Points = 1, Squares = 2, Cubes = 3 }
 The rendering mode for the cloud. More...
 

Public Slots

virtual void makeConnections ()
 make signal/slot connections More...
 
void setMaxPoints (unsigned int value)
 change the maximum number of points allowed More...
 
void setMaxRender (unsigned int value)
 change the maximum number of points to render More...
 
void setPointSize (float value)
 set the point size More...
 
void setColor (QColor color)
 set the color More...
 
void setMode (Mode mode)
 set the mode More...
 
void updateVBO ()
 update the GPU memory using CPU vertices More...
 
static QString modeToQString (Mode mode)
 convert Mode to string More...
 
static Mode QStringToMode (QString string)
 convert string to Mode enum More...
 
- Public Slots inherited from LangmuirView::SceneObject
void toggleVisible ()
 toggle visibility More...
 
void setVisible (bool draw=true)
 set the visibility More...
 
virtual void makeConnections ()
 make signal/slot connections More...
 

Signals

void maxPointsChanged (unsigned int value)
 signal that the maximum number of points has changed More...
 
void maxRenderChanged (unsigned int value)
 signal that the maximum number of points rendered has changed More...
 
void pointSizeChanged (float value)
 signal that the point size has changed More...
 
void colorChanged (QColor color)
 signal that the color of has changed More...
 
void modeChanged (PointCloud::Mode mode)
 signal that the render mode has changed More...
 
void modeChanged (QString mode)
 signal that the render mode has changed More...
 
- Signals inherited from LangmuirView::SceneObject
void visibleChanged (bool drawn)
 signal that the visibility has changed More...
 

Public Member Functions

 PointCloud (LangmuirViewer &viewer, QObject *parent=0)
 create the PointCloud More...
 
 ~PointCloud ()
 destroy the PointCloud More...
 
const QColor & getColor () const
 get color More...
 
float getPointSize () const
 get x length More...
 
Mode getMode () const
 get render mode More...
 
QVector< float > & vertices ()
 get the list of vertices (CPU memory) More...
 
unsigned int getMaxPoints ()
 get the maximum number of points that can be rendered More...
 
unsigned int getMaxRender ()
 get the number of points currently being rendered More...
 
- Public Member Functions inherited from LangmuirView::SceneObject
 SceneObject (LangmuirViewer &viewer, QObject *parent=0)
 create the SceneObject More...
 
bool isVisible ()
 true if object is drawn More...
 
void render ()
 calls OpenGL drawing commands. More...
 

Protected Member Functions

virtual void init ()
 initialize object More...
 
virtual void draw ()
 perform OpenGL drawing operations More...
 
void initShaders ()
 load the shaders More...
 
void drawFallback ()
 render function More...
 
void drawPoints ()
 render function More...
 
void drawSquares ()
 render function More...
 
void drawCubes ()
 render function More...
 
- Protected Member Functions inherited from LangmuirView::SceneObject
virtual void preDraw ()
 perform OpenGL drawing operations before draw() More...
 
virtual void postDraw ()
 perform OpenGL drawing operations after draw() More...
 

Protected Attributes

QOpenGLShaderProgram m_shader1
 OpenGL shading pipeline for points. More...
 
QOpenGLShaderProgram m_shader2
 OpenGL shading pipeline for squares. More...
 
QOpenGLShaderProgram m_shader3
 OpenGL shading pipeline for cubes. More...
 
QOpenGLBuffer * m_verticesVBO
 vertices buffer (GPU) More...
 
QVector< float > m_vertices
 vertices buffer (CPU) More...
 
unsigned int m_maxPoints
 maximum number of points allowed (# vertices / 3) More...
 
unsigned int m_maxRender
 maximum number of points rendered (less than or equal to max points) More...
 
float m_pointSize
 the size of points More...
 
QColor m_color
 color of points More...
 
Mode m_mode
 rendering mode More...
 
bool m_shader1OK
 shader1 ok to use More...
 
bool m_shader2OK
 shader2 ok to use More...
 
bool m_shader3OK
 shader3 ok to use More...
 
- Protected Attributes inherited from LangmuirView::SceneObject
LangmuirViewerm_viewer
 reference to OpenGL widget More...
 
bool visible_
 visibility More...
 

Detailed Description

A class to represent a point cloud.

Member Enumeration Documentation

The rendering mode for the cloud.

Enumerator
Points 
Squares 

render points as OpenGL points

Cubes 

render points as squares

Constructor & Destructor Documentation

LangmuirView::PointCloud::PointCloud ( LangmuirViewer viewer,
QObject *  parent = 0 
)
explicit

create the PointCloud

Parameters
viewerthe viewer
parentQObject this belongs to
LangmuirView::PointCloud::~PointCloud ( )

destroy the PointCloud

Member Function Documentation

void LangmuirView::PointCloud::colorChanged ( QColor  color)
signal

signal that the color of has changed

Parameters
colorvalue of color
virtual void LangmuirView::PointCloud::draw ( )
protectedvirtual

perform OpenGL drawing operations

Reimplemented from LangmuirView::SceneObject.

void LangmuirView::PointCloud::drawCubes ( )
protected

render function

void LangmuirView::PointCloud::drawFallback ( )
protected

render function

void LangmuirView::PointCloud::drawPoints ( )
protected

render function

void LangmuirView::PointCloud::drawSquares ( )
protected

render function

const QColor& LangmuirView::PointCloud::getColor ( ) const

get color

unsigned int LangmuirView::PointCloud::getMaxPoints ( )

get the maximum number of points that can be rendered

unsigned int LangmuirView::PointCloud::getMaxRender ( )

get the number of points currently being rendered

Warning
max points >= max rendered
Mode LangmuirView::PointCloud::getMode ( ) const

get render mode

float LangmuirView::PointCloud::getPointSize ( ) const

get x length

virtual void LangmuirView::PointCloud::init ( )
protectedvirtual

initialize object

Reimplemented from LangmuirView::SceneObject.

void LangmuirView::PointCloud::initShaders ( )
protected

load the shaders

virtual void LangmuirView::PointCloud::makeConnections ( )
virtualslot

make signal/slot connections

void LangmuirView::PointCloud::maxPointsChanged ( unsigned int  value)
signal

signal that the maximum number of points has changed

Parameters
valuevalue of max
void LangmuirView::PointCloud::maxRenderChanged ( unsigned int  value)
signal

signal that the maximum number of points rendered has changed

Parameters
valuevalue of max
void LangmuirView::PointCloud::modeChanged ( PointCloud::Mode  mode)
signal

signal that the render mode has changed

Parameters
modevalue of rendering mode
void LangmuirView::PointCloud::modeChanged ( QString  mode)
signal

signal that the render mode has changed

Parameters
modevalue of rendering mode
static QString LangmuirView::PointCloud::modeToQString ( Mode  mode)
staticslot

convert Mode to string

Parameters
modemode enum
void LangmuirView::PointCloud::pointSizeChanged ( float  value)
signal

signal that the point size has changed

Parameters
valuevalue of point size
static Mode LangmuirView::PointCloud::QStringToMode ( QString  string)
staticslot

convert string to Mode enum

Parameters
stringmode string
void LangmuirView::PointCloud::setColor ( QColor  color)
slot

set the color

Parameters
colorcolor to set
void LangmuirView::PointCloud::setMaxPoints ( unsigned int  value)
slot

change the maximum number of points allowed

Parameters
valuemax points to set

This deletes the GPU memory and creates a new buffer. Do not do it often.

void LangmuirView::PointCloud::setMaxRender ( unsigned int  value)
slot

change the maximum number of points to render

Parameters
valuemax points to render

Make sure this is less than the max points allowed.

void LangmuirView::PointCloud::setMode ( Mode  mode)
slot

set the mode

Parameters
modemode to set
void LangmuirView::PointCloud::setPointSize ( float  value)
slot

set the point size

Parameters
valuepoint size to set
void LangmuirView::PointCloud::updateVBO ( )
slot

update the GPU memory using CPU vertices

First alter the CPU vertices, set the max render, then update the VBO.

QVector<float>& LangmuirView::PointCloud::vertices ( )

get the list of vertices (CPU memory)

Warning
please do not resize this vector

Member Data Documentation

QColor LangmuirView::PointCloud::m_color
protected

color of points

unsigned int LangmuirView::PointCloud::m_maxPoints
protected

maximum number of points allowed (# vertices / 3)

unsigned int LangmuirView::PointCloud::m_maxRender
protected

maximum number of points rendered (less than or equal to max points)

Mode LangmuirView::PointCloud::m_mode
protected

rendering mode

float LangmuirView::PointCloud::m_pointSize
protected

the size of points

QOpenGLShaderProgram LangmuirView::PointCloud::m_shader1
protected

OpenGL shading pipeline for points.

bool LangmuirView::PointCloud::m_shader1OK
protected

shader1 ok to use

QOpenGLShaderProgram LangmuirView::PointCloud::m_shader2
protected

OpenGL shading pipeline for squares.

bool LangmuirView::PointCloud::m_shader2OK
protected

shader2 ok to use

QOpenGLShaderProgram LangmuirView::PointCloud::m_shader3
protected

OpenGL shading pipeline for cubes.

bool LangmuirView::PointCloud::m_shader3OK
protected

shader3 ok to use

QVector<float> LangmuirView::PointCloud::m_vertices
protected

vertices buffer (CPU)

QOpenGLBuffer* LangmuirView::PointCloud::m_verticesVBO
protected

vertices buffer (GPU)


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