Maya 1.0
SphereTracingWidget Class Reference

SDF rendering widget based on sphere-tracing. More...

#include <realtime.h>

Public Member Functions

 SphereTracingWidget (QWidget *parent=nullptr)
 Default constructor.
 
 ~SphereTracingWidget ()
 Destructor. Release shader program.
 
virtual void paintGL ()
 Renders the scene.
 
virtual void ReloadShaders ()
 Reload the shaders of the widget. Useful for realtime editing and fine tuning of the rendering.
 
void AddSDF (const QString &, const QString &)
 Add a new sdf in the scene.
 
void DeleteSDF (const QString &)
 Delete a sdf in the scene from its name.
 
bool HasSDF (const QString &) const
 Check if a sdf exists in the widget.
 
void ClearAll ()
 Destroys all sdf objects in the scene.
 
void UpdateSDF (const QString &, const FrameScaled &)
 Updates the transform of a sdf given its name.
 
void EnableSDF (const QString &)
 Enable a sdf given its name.
 
void DisableSDF (const QString &)
 Disable a sdf given its name. The sdf will not be rendered until it's enabled again.
 
void setShading (int)
 Set the shading to use.
 
void setSampleFieldNormal (const Vector &)
 Set the normal of the plane showing the sdf field.
 
void setSampleFieldPoint (const Vector &)
 Set the offset of the plane showing the sdf field.
 
void setSampleFieldParam (float freq, float size, bool disk, bool cost, bool showInPhotobox)
 Set the frequence of the sdf field.
 
void setMaxCost (int)
 Set the maximum cost to show on the cost shader.
 
void setKG (float)
 Set the geometric interpolation coeficient.
 
void setKN (float)
 Set the normal interpolation coeficient.
 
void setAA (int)
 Set the anti-aliasing level.
 
void setUseBEIS (float)
 Set the useBEIS variable.
 
void setUseLoD (float)
 Set the useBEIS variable.
 
void setVerticalLoD (bool)
 Set the verticalLoD variable.
 
void setAutoScaleCost (bool)
 Set the autoScaleCost variable.
 
void setEvaluationPoints (std::vector< Vector >, std::vector< float >)
 Set all the evaluations points.
 
void setNbSteps (int)
 Set the number of step of the sphere tracing.
 

Protected Member Functions

void RenderSDF ()
 Render all the sdf.
 
void RenderPoints ()
 Render all the evaluation points.
 

Protected Attributes

int aa = 0
 Anti aliasing size.
 
PointGL evaluationsPoints
 3D points where we count the number of reccursive call done when evaluating the tree.
 

Detailed Description

SDF rendering widget based on sphere-tracing.

Author
Hubert-Brierre Pierre

Member Function Documentation

◆ AddSDF()

void SphereTracingWidget::AddSDF ( const QString & name,
const QString & sdf_code_glsl )

Add a new sdf in the scene.

Parameters
sdf_code_glslnew sdf glsl code
framesdf frame, identity by default.

◆ DeleteSDF()

void SphereTracingWidget::DeleteSDF ( const QString & name)

Delete a sdf in the scene from its name.

Parameters
sdfmesh sdf

◆ DisableSDF()

void SphereTracingWidget::DisableSDF ( const QString & name)

Disable a sdf given its name. The sdf will not be rendered until it's enabled again.

Parameters
namesdf name

◆ EnableSDF()

void SphereTracingWidget::EnableSDF ( const QString & name)

Enable a sdf given its name.

Parameters
namesdf name

◆ HasSDF()

bool SphereTracingWidget::HasSDF ( const QString & name) const

Check if a sdf exists in the widget.

Parameters
namesdf name

◆ RenderPoints()

void SphereTracingWidget::RenderPoints ( )
protected

Render all the evaluation points.

Author
Hubert-Brierre Pierre

References evaluationsPoints, Matrix4Float::LookAt(), Matrix4Float::Orthographic(), Matrix4Float::Perspective(), and Math::RadianToDegree().

Referenced by paintGL().

◆ RenderSDF()

void SphereTracingWidget::RenderSDF ( )
protected

Render all the sdf.

Author
Hubert-Brierre Pierre

References aa, Matrix4Float::Inverse(), Matrix4Float::LookAt(), Matrix4Float::Orthographic(), Matrix4Float::Perspective(), and Math::RadianToDegree().

Referenced by paintGL().

◆ setAA()

void SphereTracingWidget::setAA ( int a)

Set the anti-aliasing level.

Parameters
aLevel.
Author
Hubert-Brierre Pierre

References aa.

◆ setAutoScaleCost()

void SphereTracingWidget::setAutoScaleCost ( bool autoScaleCost)

Set the autoScaleCost variable.

Author
Hubert-Brierre Pierre

◆ setEvaluationPoints()

void SphereTracingWidget::setEvaluationPoints ( std::vector< Vector > points,
std::vector< float > nbRecCalls )

Set all the evaluations points.

Author
Hubert-Brierre Pierre

References evaluationsPoints.

◆ setKG()

void SphereTracingWidget::setKG ( float kg)

Set the geometric interpolation coeficient.

Author
Hubert-Brierre Pierre

◆ setKN()

void SphereTracingWidget::setKN ( float kn)

Set the normal interpolation coeficient.

Author
Hubert-Brierre Pierre

◆ setMaxCost()

void SphereTracingWidget::setMaxCost ( int maxCost)

Set the maximum cost to show on the cost shader.

Author
Hubert-Brierre Pierre

◆ setNbSteps()

void SphereTracingWidget::setNbSteps ( int newNbSteps)

Set the number of step of the sphere tracing.

Author
Hubert-Brierre Pierre

◆ setSampleFieldNormal()

void SphereTracingWidget::setSampleFieldNormal ( const Vector & sampleFieldNormal)

Set the normal of the plane showing the sdf field.

Author
Hubert-Brierre Pierre

◆ setSampleFieldParam()

void SphereTracingWidget::setSampleFieldParam ( float freq,
float size,
bool disk,
bool cost,
bool showInPhotobox )

Set the frequence of the sdf field.

Author
Hubert-Brierre Pierre

◆ setSampleFieldPoint()

void SphereTracingWidget::setSampleFieldPoint ( const Vector & sampleFieldPoint)

Set the offset of the plane showing the sdf field.

Author
Hubert-Brierre Pierre

◆ setShading()

void SphereTracingWidget::setShading ( int newShading)

Set the shading to use.

Author
Hubert-Brierre Pierre

◆ setUseBEIS()

void SphereTracingWidget::setUseBEIS ( float useBEIS)

Set the useBEIS variable.

Author
Hubert-Brierre Pierre

◆ setUseLoD()

void SphereTracingWidget::setUseLoD ( float useLoD)

Set the useBEIS variable.

Author
Hubert-Brierre Pierre

◆ setVerticalLoD()

void SphereTracingWidget::setVerticalLoD ( bool verticalLoD)

Set the verticalLoD variable.

Author
Hubert-Brierre Pierre

◆ UpdateSDF()

void SphereTracingWidget::UpdateSDF ( const QString & name,
const FrameScaled & frame )

Updates the transform of a sdf given its name.

Parameters
namesdf name
framenew frame