Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
utils.h File Reference
#include "math/Types.h"
#include <QImage>
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <xgl/Types.h>
#include <xgl/global.h>
#include <xgl/utils.hpp>
Include dependency graph for xgl/utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  sf
 
namespace  sf::xgl
 

Functions

_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.
 
_XGL_FUNC matrix4x4f sf::xgl::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 > 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.
 
template<typename T >
constexpr GLenum sf::xgl::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 > sf::xgl::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 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.
 
_XGL_FUNC QImage sf::xgl::getTransparentImage (const QImage &src_image, int alpha)
 Turms the given image into a transparent one.
 
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.
 
_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.