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

Render atoms as sphere meshes. More...

#include <atomRenderer.h>

Public Member Functions

 AtomRenderer (const std::vector< Atom > &atoms, uint8_t levelOfDetail=0, glm::vec3 cameraPosition=glm::vec3(0), BASE_MESH mesh=BASE_MESH::ANY, float clipCorrection=1.5f)
 Construct a new AtomRenderer from a BASE_MESH type.
 
uint32_t triangles (bool impostor=true) const
 The number of triangles drawn.
 
void setLevelOfDetail (uint8_t lod)
 Set the current level of detail.
 
uint8_t getLevelOfDetail () const
 Get the current level of detail.
 
uint8_t maxLevelOfDetail () const
 Get the maximum level of detail.
 
void updateAtoms (const std::vector< Atom > &atoms)
 Update buffers with new Atom data.
 
void draw (bool imposters=true)
 Draw the current Atoms.
 
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 setAtomScale (float s)
 Set the global atom scaling factor.
 
void setTransparencySorting (bool sort)
 Set whether transparency sorting is performed.
 
void setGlobalAlpha (float alpha)
 Set the global alpha multiplier.
 

Detailed Description

Render atoms as sphere meshes.

Remarks
See also
HierarchicalTriangularMesh.
Remarks
The level of detail can be automatically de-scaled with distance.
The level of detail can be overriden.

Constructor & Destructor Documentation

◆ AtomRenderer()

AtomRenderer::AtomRenderer ( const std::vector< Atom > &  atoms,
uint8_t  levelOfDetail = 0,
glm::vec3  cameraPosition = glm::vec3(0),
BASE_MESH  mesh = BASE_MESH::ANY,
float  clipCorrection = 1.5f 
)
inline

Construct a new AtomRenderer from a BASE_MESH type.

Remarks
BASE_MESH::ANY will sample from refinements of all BASE_MESH types. Giving a finer range of level of detail .
Choosing a specific BASE_MESH will mean the level of detail is refinements of just that mesh.
Parameters
atomsthe atoms to draw.
levelOfDetailthe level of detail.
cameraPositionthe cartesian position of the camera.
meshthe base mesh type.
See also
BASE_MESH.
Parameters
clipCorrectioncorrection factor for impostor rendering.

Member Function Documentation

◆ draw()

void AtomRenderer::draw ( bool  imposters = true)
inline

Draw the current Atoms.

Parameters
impostersdraw with impostor spheres inplace of meshes.

◆ getLevelOfDetail()

uint8_t AtomRenderer::getLevelOfDetail ( ) const
inline

Get the current level of detail.

Returns
uint8_t the current level of detail.

◆ maxLevelOfDetail()

uint8_t AtomRenderer::maxLevelOfDetail ( ) const
inline

Get the maximum level of detail.

Returns
uint8_t the maximum level of detail.

◆ setAtomScale()

void AtomRenderer::setAtomScale ( float  s)
inline

Set the global atom scaling factor.

Parameters
sthe new scaling factor.

◆ setGlobalAlpha()

void AtomRenderer::setGlobalAlpha ( float  alpha)
inline

Set the global alpha multiplier.

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

◆ setLevelOfDetail()

void AtomRenderer::setLevelOfDetail ( uint8_t  lod)
inline

Set the current level of detail.

Parameters
lodthe new level of detail.

◆ setLighting()

void AtomRenderer::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 AtomRenderer::setProjection ( glm::mat4  p)
inline

Set the Projection matrix.

Parameters
pthe projection matrix.

◆ setTransparencySorting()

void AtomRenderer::setTransparencySorting ( bool  sort)
inline

Set whether transparency sorting is performed.

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

◆ setView()

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

Set the view matrix.

Parameters
vthe view matrix.

◆ triangles()

uint32_t AtomRenderer::triangles ( bool  impostor = true) const
inline

The number of triangles drawn.

Parameters
impostersdraw with impostor spheres inplace of meshes.
Returns
uint32_t the number of triangles.

◆ updateAtoms()

void AtomRenderer::updateAtoms ( const std::vector< Atom > &  atoms)
inline

Update buffers with new Atom data.

Remarks
will upload data to the GPU.
Parameters
atomsthe new Atom data to upload.

◆ updateCamera()

void AtomRenderer::updateCamera ( const Camera camera)
inline

Update shaders from a Camera.

Parameters
camerathe camera to update from.

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