ComputerGraphik TU WIEN
Public Member Functions | Private Attributes | List of all members
BubbleCursor Class Reference

This class is rendering multiple circles (called bubbles in the paper) that are randomly placed on the screen space, the radius of the circle is as big as the distance to the nearest tank. More...

#include <bubbleCursor.hpp>

Inheritance diagram for BubbleCursor:
SceneObject

Public Member Functions

 BubbleCursor (Scene *scene, Texture *texture)
 
virtual ~BubbleCursor ()
 
void draw ()
 
void setShader (Shader *shader)
 
void update (double deltaT)
 
void updateDistanceState (unsigned int _distance)
 
void generateRandomPopulation ()
 
void keyCallback (GLFWwindow *window, int key, int scancode, int action, int mode)
 
bool drawingEnabled ()
 
unsigned int getDistance ()
 
- Public Member Functions inherited from SceneObject
 SceneObject (std::shared_ptr< SceneObject > &effectParent, const glm::mat4 &modelMatrix=glm::mat4(1))
 
 SceneObject (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1))
 
virtual ~SceneObject ()
 
ModelgetModel () const
 
ShadergetShader () const
 
glm::mat4 getModelMatrix () const
 
glm::mat4 getGlobalModelMatrix () const
 
std::string getName () const
 
std::shared_ptr< SceneObjectgetParent () const
 
void setAnimationTime (double time)
 
bool setAnimation (const Animation &anim)
 
bool delChild (size_t idx)
 
bool getChild (size_t idx, std::shared_ptr< SceneObject > &child) const
 
bool addChild (std::shared_ptr< SceneObject > &child)
 
bool remEffect (const std::string &name)
 
SceneObjectgetEffect (const std::string &name) const
 
bool addEffect (const std::string &name, std::unique_ptr< SceneObject > &effect)
 
bool doNotRender ()
 
bool getIsVolSun ()
 
virtual void reset ()
 
virtual void draw () const
 
virtual bool animate (double time)
 

Private Attributes

glm::vec2 latestPos
 
int distance
 
GLFWwindow * window
 
GLuint vboPositions
 
Texturetexture
 
std::vector< glm::vec2 > population
 
bool enableDrawing
 

Additional Inherited Members

- Public Types inherited from SceneObject
typedef std::vector< std::pair< double, glm::mat4 > > Animation
 
- Protected Attributes inherited from SceneObject
GLuint vao
 
Scenescene
 
Modelmodel
 
Shadershader
 
glm::mat4 modelMatrix
 
std::string name
 
std::weak_ptr< SceneObjectparent
 
std::vector< std::shared_ptr< SceneObject > > childs
 
std::map< std::string, std::unique_ptr< SceneObject > > effectChilds
 
size_t animIDX
 
Animation animation
 
bool norender
 
bool isVolSun
 

Detailed Description

This class is rendering multiple circles (called bubbles in the paper) that are randomly placed on the screen space, the radius of the circle is as big as the distance to the nearest tank.

The class BubbleCursor implements the rendering of circles (=bubbles in the paper) that are randomly placed on the screen with the radius as big as the distance to the nearest object.

In the method generateRandomPopulation() 50 points are generated at random that are distributed across the screen space. These 2d points are generated using two Gaussian distributions centered at windowWidth/2 and windowHeight/2 (middle of the screen), with a sigma value of windowWidth/5 and windowHeight/5. The objects used were:

std::default_random_engine generator(time(NULL));
std::normal_distribution<double> distributionY(height / 2.0f, height / 5.0f);
std::normal_distribution<double> distributionX(width / 2.0f, width / 5.0f);

for further details see the function generateRandomPopulation().

In the draw() function the positions of those points are then forwarded to the pickObject method in the class SelectorQuadTree where the distance to the closest object (for each point separately) is computed. A point sprite renderer is then used to draw a transparent circle onto the screen. The radius of the circle is scaled to conicide with the distance to the nearest object (in pixels).

The user can enable/disable the display of these bubbles with the key B, everytime the display of the bubbles is disabled and enabled another random population is created. Rendering all bubbles consumes a huge amount of CPU load since for each of the 50 points the quadtree needs to be queried.

The result looks like:

bubble1scaled.png
bubble cursor
bubble2scaled.png
bubble cursor
Author
Felix Koenig

Constructor & Destructor Documentation

BubbleCursor::BubbleCursor ( Scene scene,
Texture texture 
)
BubbleCursor::~BubbleCursor ( )
virtual

Member Function Documentation

void BubbleCursor::draw ( )
bool BubbleCursor::drawingEnabled ( )
void BubbleCursor::generateRandomPopulation ( )
unsigned int BubbleCursor::getDistance ( )
inline
void BubbleCursor::keyCallback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mode 
)
void BubbleCursor::setShader ( Shader shader)
virtual

Reimplemented from SceneObject.

void BubbleCursor::update ( double  deltaT)
virtual

Reimplemented from SceneObject.

void BubbleCursor::updateDistanceState ( unsigned int  _distance)

Member Data Documentation

int BubbleCursor::distance
private
bool BubbleCursor::enableDrawing
private
glm::vec2 BubbleCursor::latestPos
private
std::vector<glm::vec2> BubbleCursor::population
private
Texture* BubbleCursor::texture
private
GLuint BubbleCursor::vboPositions
private
GLFWwindow* BubbleCursor::window
private

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