Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::xgl Namespace Reference

Namespaces

namespace  Ui
 

Classes

class  Axes
 Class to render axis lines in OpenGL. All axis have the same color. Length is both positive and negative direction. More...
 
class  Color
 Color class used in vertex arrays and has layout of 4 x GLfloat. More...
 
class  Cone
 Class to render a cone in OpenGL. Height of the cone is along the Z-axis where the tip is at (0, 0, 0). More...
 
class  Cube
 Class to render a cube with 6 different colored faces and normals for reflection. Center of the cube is in (0,0,0). More...
 
class  Cylinder
 Class to render a cylinder in OpenGL. Has a single color. Height of the cone is along the Z-axis where the tip is at (0, 0, 0). More...
 
class  DemoRenderer
 
class  DemoScene
 
class  Disk
 Class to render a circle in OpenGL. More...
 
class  Dynamic
 Dynamic object . More...
 
class  Helper
 Keeps track of color. More...
 
class  Line
 Class to render a line in OpenGL. More...
 
class  Matrix
 A 4x4 matrix class used in arrays and has layout of 16x GLfloat. More...
 
class  NipscanRenderer
 
class  NipscanScene
 
class  Normals
 Class to render Normals from another vertex array. More...
 
class  Rectangle
 Class to render a rectangle in OpenGL. Height of the cone is along the Z-axis where the tip is at (0, 0, 0). More...
 
class  SceneInterface
 Base class for the interface. More...
 
class  SceneServer
 Server for color palettes used in images for coloring on basis of index. More...
 
class  SceneServerPropertyPage
 
class  ScopedCulling
 Easy to use class to enable culling temporarily. More...
 
class  ScopedMatrix
 Pushes and pops a matrix for the scope it is in. More...
 
class  ShaderProgram
 Shader program having a default vertex and fragment shader. More...
 
class  Sphere
 Class to render a sphere in OpenGL. Center of the sphere is in (0,0,0). Has a single color. More...
 
class  Tube
 Class to render a cylinder in OpenGL. Height of the cone is along the Z-axis where the tip is at (0, 0, 0). More...
 
class  TVertexArray
 OpenGL base class and wrapper template for vertex arrays. Automates most of the things needed for primitive objects. More...
 
class  VertexArray
 OpenGL base class and wrapper for vertex arrays. More...
 
class  VertexArrayBase
 Base class for Vertex array derived classes. More...
 

Typedefs

typedef std::array< GLfloat, 16 > matrix4x4f
 Type which correspond with a GLSL type and used to implement Vertex structures.
 
typedef std::array< GLfloat, 2 > vector2f
 Type which correspond with a GLSL type and used to implement Vertex structures.
 
typedef std::array< GLfloat, 3 > vector3f
 Type which correspond with a GLSL type and used to implement Vertex structures.
 
typedef std::array< GLfloat, 4 > vector4f
 Type which correspond with a GLSL type and used to implement Vertex structures.
 
typedef std::array< GLdouble, 16 > matrix4x4d
 Type which correspond with a GLSL type and used to implement Vertex structures.
 
typedef std::array< GLdouble, 3 > vector3d
 Type which correspond with a GLSL type and used to implement Vertex structures.
 
typedef std::array< GLdouble, 4 > vector4d
 Type which correspond with a GLSL type and used to implement Vertex structures.
 
typedef QFlags< ECullingFlagCullingState
 Type to contain bitmapped culling settings.
 

Enumerations

enum  ECullingFlag : int {
  cfIgnore = -1 , cfDisabled = 0 , cfEnabled = 1 << 0 , cfCCW = 0 ,
  cfCW = 1 << 1 , cfBackside = 0 , cfFrontside = 1 << 2
}
 Type to determine the culling settings where CCW en Backside are the defaults. More...
 

Functions

QDebug operator<< (QDebug dbg, const Color &color)
 
_XGL_FUNC void setCullingState (QOpenGLFunctions *funcs, CullingState state, CullingState current={cfIgnore})
 
_XGL_FUNC QMatrix4x4 getPerspectiveMatrix (float fov_y, float aspect, float near_z, float far_z)
 createPerspectiveMatrix Generates a perspective projection matrix using QMatrix4x4. This function calculates the perspective projection matrix, which is used to transform 3D coordinates into 2D clip space. This transformation is essential for rendering 3D scenes correctly on a 2D screen. The matrix is designed to simulate the effect of perspective, where objects appear smaller the farther away they are.
 
_XGL_FUNC matrix4x4f getPerspectiveMatrixF (GLfloat fovY, GLfloat aspect, GLfloat nearZ, GLfloat farZ)
 Gets the perspective matrix similar to GLU gluPerspective() function.
 
_XGL_FUNC std::pair< GLsizei, std::string_view > getTypeInfo (GLenum type)
 Gets the C++ type and GLSL type as a string and the size in bytes of the given type enumerate.
 
template<typename T >
constexpr GLenum getTypeEnum ()
 Converts the template type into a OpenGL type value like GL_INT, GL_FLOAT, Double.
 
template<size_t N = 3, typename T = GLfloat>
std::array< T, N > array (const QVector3D vect, T value=1)
 Template function to gets a 'std::array' from a Vector3D. This function is to pass a 3D vector where 4 or more values are required in an OpenGL function.
 
_XGL_FUNC QMatrix4x4 getRotationMatrix (const QVector3D &v1, const QVector3D &v2)
 Gets a 4x4 matrix from to vectors. When the 'v1' vector is mapped using the matrix the 'v2' vector is retrieved.
 
_XGL_FUNC QImage getTransparentImage (const QImage &src_image, int alpha)
 Turms the given image into a transparent one.
 
template<typename VertexType , typename FieldType >
void setVertexAttribPointer (QOpenGLShaderProgram *sp, GLuint attr_loc, size_t offset)
 Makes a call to glVertexAttribPointer() and to glEnableVertexAttribArray() in a smart way.
 
_XGL_FUNC bool checkDrawMode (GLenum mode, size_t vertice_count, const std::string &src)
 Checks is the needed vertices are sufficient and in range.
 

Typedef Documentation

◆ CullingState

Type to contain bitmapped culling settings.

◆ matrix4x4d

typedef std::array<GLdouble, 16> sf::xgl::matrix4x4d

Type which correspond with a GLSL type and used to implement Vertex structures.

◆ matrix4x4f

typedef std::array<GLfloat, 16> sf::xgl::matrix4x4f

Type which correspond with a GLSL type and used to implement Vertex structures.

◆ vector2f

typedef std::array<GLfloat, 2> sf::xgl::vector2f

Type which correspond with a GLSL type and used to implement Vertex structures.

◆ vector3d

typedef std::array<GLdouble, 3> sf::xgl::vector3d

Type which correspond with a GLSL type and used to implement Vertex structures.

◆ vector3f

typedef std::array<GLfloat, 3> sf::xgl::vector3f

Type which correspond with a GLSL type and used to implement Vertex structures.

◆ vector4d

typedef std::array<GLdouble, 4> sf::xgl::vector4d

Type which correspond with a GLSL type and used to implement Vertex structures.

◆ vector4f

typedef std::array<GLfloat, 4> sf::xgl::vector4f

Type which correspond with a GLSL type and used to implement Vertex structures.

Enumeration Type Documentation

◆ ECullingFlag

Type to determine the culling settings where CCW en Backside are the defaults.

Enumerator
cfIgnore 

Ignore this state when comparing.

cfDisabled 

Disables culling (is default).

cfEnabled 

Enables culling.

cfCCW 

Vertices counter clock wise are considered backside (is default).

cfCW 

Vertices clock wise are considered front.

cfBackside 

Backside is culled. (is default)

cfFrontside 

Frontside is culled.

Function Documentation

◆ array()

template<size_t N = 3, typename T = GLfloat>
std::array< T, N > sf::xgl::array ( const QVector3D  vect,
value = 1 
)

Template function to gets a 'std::array' from a Vector3D. This function is to pass a 3D vector where 4 or more values are required in an OpenGL function.

Template Parameters
TType of the array which default to a 'float'.
NSize of the returned array.
Parameters
vect3D vector supplying upto the 3 first entries in the array.
valueValue when the size N is larger than 3
Returns
T

◆ checkDrawMode()

_XGL_FUNC bool sf::xgl::checkDrawMode ( GLenum  mode,
size_t  vertice_count,
const std::string &  src 
)

Checks is the needed vertices are sufficient and in range.

◆ getPerspectiveMatrix()

_XGL_FUNC QMatrix4x4 sf::xgl::getPerspectiveMatrix ( float  fov_y,
float  aspect,
float  near_z,
float  far_z 
)

createPerspectiveMatrix Generates a perspective projection matrix using QMatrix4x4. This function calculates the perspective projection matrix, which is used to transform 3D coordinates into 2D clip space. This transformation is essential for rendering 3D scenes correctly on a 2D screen. The matrix is designed to simulate the effect of perspective, where objects appear smaller the farther away they are.

Parameters
fov_yField of view angle in the y direction, in radians.
This determines the vertical extent of the viewing volume.
Typical values are around 45 to 60 degrees (converted to radians).
aspectThe aspect ratio of the viewport (width / height).
This determines the horizontal extent of the viewing volume and ensures that objects are not stretched or compressed.
near_zThe distance to the near clipping plane.
Objects closer to the camera than this plane are clipped (not rendered). Must be positive.
far_zThe distance to the far clipping plane.
Objects farther from the camera than this plane are clipped. Must be positive and greater than near_z.
Returns
A QMatrix4x4 object representing the perspective projection matrix.
The matrix is in column-major order, which is how OpenGL expects matrices.

◆ getPerspectiveMatrixF()

_XGL_FUNC matrix4x4f sf::xgl::getPerspectiveMatrixF ( GLfloat  fovY,
GLfloat  aspect,
GLfloat  nearZ,
GLfloat  farZ 
)

Gets the perspective matrix similar to GLU gluPerspective() function.

◆ getRotationMatrix()

_XGL_FUNC QMatrix4x4 sf::xgl::getRotationMatrix ( const QVector3D &  v1,
const QVector3D &  v2 
)

Gets a 4x4 matrix from to vectors. When the 'v1' vector is mapped using the matrix the 'v2' vector is retrieved.

Parameters
v1Initial vector
v2Final vector.
Returns
Matrix which makes the rotation happen.

◆ getTransparentImage()

_XGL_FUNC QImage sf::xgl::getTransparentImage ( const QImage &  src_image,
int  alpha 
)

Turms the given image into a transparent one.

Parameters
src_imageImage to create the transparent image from.
alphaAlpha value for each pixel.

◆ getTypeEnum()

template<typename T >
constexpr GLenum sf::xgl::getTypeEnum ( )
constexpr

Converts the template type into a OpenGL type value like GL_INT, GL_FLOAT, Double.

Template Parameters
TType to convert to the OpenGL GLenum value for types.
Returns
Enumerate OpenGL value.

◆ getTypeInfo()

_XGL_FUNC std::pair< GLsizei, std::string_view > sf::xgl::getTypeInfo ( GLenum  type)

Gets the C++ type and GLSL type as a string and the size in bytes of the given type enumerate.

Note
GLSL = OpenGL Shader Language
Parameters
typeValues like GL_FLOAT_VEC3, GL_UNSIGNED_INT, GL_BOOL et cetera.

◆ operator<<()

QDebug sf::xgl::operator<< ( QDebug  dbg,
const Color color 
)

◆ setCullingState()

_XGL_FUNC void sf::xgl::setCullingState ( QOpenGLFunctions *  funcs,
CullingState  state,
CullingState  current = {cfIgnore} 
)

Set the culling settings according the passed state.

◆ setVertexAttribPointer()

template<typename VertexType , typename FieldType >
void sf::xgl::setVertexAttribPointer ( QOpenGLShaderProgram *  sp,
GLuint  attr_loc,
size_t  offset 
)

Makes a call to glVertexAttribPointer() and to glEnableVertexAttribArray() in a smart way.

Template Parameters
VertexTypeThe vertex structure.
FieldTypeStructure field which is a std::array<> having a 'value_type'.
Parameters
spThe applicable shader-program.
attr_locAttribute layout location of the shader application.
offsetOffset of the field containing the