SimpleFastOpenAtomicVisualiser
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BondRenderer Class Reference

Render Bonds as ray-traced cylinders. More...

#include <bondRenderer.h>

Public Member Functions

 BondRenderer (const std::map< uint64_t, std::set< uint64_t > > &bonds, const std::vector< Atom > &atoms, uint64_t maxBonds, uint64_t bondPad=1024, float clipCorrection=5.0f)
 Construct a new BondRenderer from set bonds and atoms.
 
 ~BondRenderer ()
 
void setClipCorrection (float correction)
 Set the clip correction.
 
void setView (glm::mat4 v)
 Set the view matrix.
 
void setProjection (glm::mat4 p)
 Set the Projection matrix.
 
void setLighting (glm::vec3 position, glm::vec3 colour={1.0f, 1.0f, 1.0f}, float ambient=0.1f)
 Set the lighting of the scene.
 
void updateCamera (const Camera &camera)
 Update shaders from a Camera.
 
void setTransparencySorting (bool sort)
 Set whether transparency sorting is performed.
 
void setBondScale (float scale)
 Set the uniform radii of bonds.
 
uint64_t triangles () const
 The number of triangles drawn.
 
void update (const std::map< uint64_t, std::set< uint64_t > > &bonds, const std::vector< Atom > &atoms)
 Update the bonds rendered on the GPU.
 
void draw (uint64_t count)
 Draw the bonds.
 
void draw ()
 Draw all the bonds.
 
void setGlobalAlpha (float alpha)
 Set the global alpha multiplier.
 

Detailed Description

Render Bonds as ray-traced cylinders.

Constructor & Destructor Documentation

◆ BondRenderer()

BondRenderer::BondRenderer ( const std::map< uint64_t, std::set< uint64_t > > &  bonds,
const std::vector< Atom > &  atoms,
uint64_t  maxBonds,
uint64_t  bondPad = 1024,
float  clipCorrection = 5.0f 
)
inline

Construct a new BondRenderer from set bonds and atoms.

Parameters
bondsthe current Bonds between atoms.
atomsthe Atoms with bonds Bonds.
maxBondsa hint to the maximum number of Bonds.
bondPadnumber of bonds to increase maximum by on overflow.
clipCorrectioncorrection factor for impostor rendering. Default to 1024.

◆ ~BondRenderer()

BondRenderer::~BondRenderer ( )
inline

Member Function Documentation

◆ draw() [1/2]

void BondRenderer::draw ( )
inline

Draw all the bonds.

◆ draw() [2/2]

void BondRenderer::draw ( uint64_t  count)
inline

Draw the bonds.

Parameters
countoverride number of bonds.

◆ setBondScale()

void BondRenderer::setBondScale ( float  scale)
inline

Set the uniform radii of bonds.

Parameters
scalethe scale (radii) of bonds.

◆ setClipCorrection()

void BondRenderer::setClipCorrection ( float  correction)
inline

Set the clip correction.

Remarks
The clip correction is a fudge factor for the ray tracing. It is the size of the square picture plane through which rays are traced. Due to projective geometry a value of 1.0f leaves part of a sphere/cylinder off plane. Larger values may be needed for thinner/longer cylinders.
Parameters
correctionoverdraw amount.

◆ setGlobalAlpha()

void BondRenderer::setGlobalAlpha ( float  alpha)
inline

Set the global alpha multiplier.

Parameters
alphathe new alpha multiplier.
Remarks
alpha is clamped to [0, 1].

◆ setLighting()

void BondRenderer::setLighting ( glm::vec3  position,
glm::vec3  colour = {1.0f, 1.0f, 1.0f},
float  ambient = 0.1f 
)
inline

Set the lighting of the scene.

Parameters
positionthe camera/light position.
colourthe light colour.
ambientthe ambient light strength.

◆ setProjection()

void BondRenderer::setProjection ( glm::mat4  p)
inline

Set the Projection matrix.

Parameters
pthe projection matrix.

◆ setTransparencySorting()

void BondRenderer::setTransparencySorting ( bool  sort)
inline

Set whether transparency sorting is performed.

Parameters
sortIf true atoms will be sorted by distance to the camera.

◆ setView()

void BondRenderer::setView ( glm::mat4  v)
inline

Set the view matrix.

Parameters
vthe view matrix.

◆ triangles()

uint64_t BondRenderer::triangles ( ) const
inline

The number of triangles drawn.

Returns
uint64_t the number of triangles.

◆ update()

void BondRenderer::update ( const std::map< uint64_t, std::set< uint64_t > > &  bonds,
const std::vector< Atom > &  atoms 
)
inline

Update the bonds rendered on the GPU.

Remarks
If the number of bonds exceeds the storage space a reallocation will occur (with padding).
Parameters
bondsthe new bonds.
atomsthe new atoms.

◆ updateCamera()

void BondRenderer::updateCamera ( const Camera camera)
inline

Update shaders from a Camera.

Parameters
camerathe camera to update from.
Remarks
If transparencySortingEnabled a sort and upload will occur.

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