16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 11:19:19 +02:00

reformat: parameters can be made const

This commit is contained in:
jerrrrycho
2026-07-04 07:08:14 +02:00
parent 6fd1d6715b
commit 220689a5e3
121 changed files with 1380 additions and 1352 deletions

View File

@@ -204,7 +204,7 @@ void calculate_tangents(vertex_array &vertices, index_array const &indices, int
}
}
void calculate_indices( index_array &Indices, vertex_array &Vertices, userdata_array &Userdata, float tolerancescale ) {
void calculate_indices( index_array &Indices, vertex_array &Vertices, userdata_array &Userdata, const float tolerancescale ) {
Indices.resize( Vertices.size() );
std::iota( std::begin( Indices ), std::end( Indices ), 0 );

View File

@@ -75,7 +75,7 @@ struct geometry_handle {
geometry_handle() :
bank( 0 ), chunk( 0 )
{}
geometry_handle( std::uint32_t Bank, std::uint32_t Chunk ) :
geometry_handle(const std::uint32_t Bank, const std::uint32_t Chunk ) :
bank( Bank ), chunk( Chunk )
{}
// methods
@@ -145,14 +145,14 @@ protected:
index_array indices; // index data
userdata_array userdata;
// NOTE: constructor doesn't copy provided geometry data, but moves it
geometry_chunk( vertex_array &Vertices, userdata_array& Userdata, unsigned int Type ) :
geometry_chunk( vertex_array &Vertices, userdata_array& Userdata, const unsigned int Type ) :
type( Type )
{
vertices.swap( Vertices );
userdata.swap( Userdata );
}
// NOTE: constructor doesn't copy provided geometry data, but moves it
geometry_chunk( index_array &Indices, vertex_array &Vertices, userdata_array& Userdata, unsigned int Type ) :
geometry_chunk( index_array &Indices, vertex_array &Vertices, userdata_array& Userdata, const unsigned int Type ) :
type( Type )
{
vertices.swap( Vertices );

View File

@@ -106,7 +106,7 @@ void opengl33_vaogeometrybank::setup_buffer()
}
void
opengl33_vaogeometrybank::setup_attrib(size_t offset)
opengl33_vaogeometrybank::setup_attrib(const size_t offset)
{
m_vao->setup_attrib( *m_vertexbuffer, 0, 3, GL_FLOAT, sizeof( basic_vertex ), offsetof(basic_vertex, position) + offset * sizeof( basic_vertex ) );
// NOTE: normal and color streams share the data
@@ -115,7 +115,7 @@ opengl33_vaogeometrybank::setup_attrib(size_t offset)
m_vao->setup_attrib( *m_vertexbuffer, 3, 4, GL_FLOAT, sizeof( basic_vertex ), offsetof(basic_vertex, tangent) + offset * sizeof( basic_vertex ) );
}
void opengl33_vaogeometrybank::setup_userdata(size_t offset) {
void opengl33_vaogeometrybank::setup_userdata(const size_t offset) {
const size_t offset_evaluated = m_vertex_count * sizeof(basic_vertex) + offset * sizeof( vertex_userdata );
m_vao->setup_attrib( *m_vertexbuffer, 4, 4, GL_FLOAT, sizeof( vertex_userdata ), offsetof(vertex_userdata, data) + offset_evaluated );}

View File

@@ -29,7 +29,7 @@ int constexpr EU07_PICKBUFFERSIZE{ 1024 }; // size of (square) textures bound wi
int constexpr EU07_REFLECTIONFIDELITYOFFSET { 250 }; // artificial increase of range for reflection pass detail reduction
void GLAPIENTRY
ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam ) {
ErrorCallback( GLenum source, const GLenum type, const GLuint id, const GLenum severity, GLsizei length, const GLchar* message, const void* userParam ) {
/*
auto const typestring {
type == GL_DEBUG_TYPE_ERROR ? "error" :
@@ -1461,7 +1461,7 @@ glm::mat4 opengl33_renderer::perspective_projection(const viewport_proj_config &
return glm::translate(R * M, -c.pe);
}
glm::mat4 opengl33_renderer::perspective_projection_raw(float fovy, float aspect, float znear, float zfar)
glm::mat4 opengl33_renderer::perspective_projection_raw(const float fovy, const float aspect, const float znear, const float zfar)
{
if (GLAD_GL_ARB_clip_control || GLAD_GL_EXT_clip_control)
{
@@ -1487,7 +1487,7 @@ glm::mat4 opengl33_renderer::perspective_projection_raw(float fovy, float aspect
glm::perspective(fovy, aspect, znear, zfar);
}
glm::mat4 opengl33_renderer::ortho_projection(float l, float r, float b, float t, float znear, float zfar)
glm::mat4 opengl33_renderer::ortho_projection(const float l, const float r, const float b, const float t, const float znear, const float zfar)
{
const glm::mat4 proj = glm::ortho(l, r, b, t, znear, zfar);
if (GLAD_GL_ARB_clip_control || GLAD_GL_EXT_clip_control)
@@ -1511,7 +1511,7 @@ glm::mat4 opengl33_renderer::ortho_projection(float l, float r, float b, float t
proj;
}
glm::mat4 opengl33_renderer::ortho_frustumtest_projection(float l, float r, float b, float t, float znear, float zfar)
glm::mat4 opengl33_renderer::ortho_frustumtest_projection(const float l, const float r, const float b, const float t, const float znear, const float zfar)
{
// for frustum calculation, use standard opengl matrix
return glm::ortho(l, r, b, t, znear, zfar);
@@ -2337,7 +2337,7 @@ opengl_material const & opengl33_renderer::Material( TSubModel const * Submodel
return m_materials.material( material );
}
texture_handle opengl33_renderer::Fetch_Texture(std::string const &Filename, bool const Loadnow, GLint format_hint)
texture_handle opengl33_renderer::Fetch_Texture(std::string const &Filename, bool const Loadnow, const GLint format_hint)
{
return m_textures.create(Filename, Loadnow, format_hint);
}
@@ -2800,7 +2800,7 @@ void opengl33_renderer::Render(cell_sequence::iterator First, cell_sequence::ite
m_frame_instance_buckets.clear();
}
void opengl33_renderer::Draw_Geometry(std::vector<gfx::geometrybank_handle>::iterator begin, std::vector<gfx::geometrybank_handle>::iterator end)
void opengl33_renderer::Draw_Geometry(const std::vector<gfx::geometrybank_handle>::iterator begin, const std::vector<gfx::geometrybank_handle>::iterator end)
{
m_geometry.draw(begin, end);
}
@@ -2825,7 +2825,7 @@ void opengl33_renderer::draw(const gfx::geometry_handle &handle)
}
}
void opengl33_renderer::draw(std::vector<gfx::geometrybank_handle>::iterator it, std::vector<gfx::geometrybank_handle>::iterator end)
void opengl33_renderer::draw(const std::vector<gfx::geometrybank_handle>::iterator it, const std::vector<gfx::geometrybank_handle>::iterator end)
{
model_ubs.set_modelview(OpenGLMatrices.data(GL_MODELVIEW));
model_ubo->update(model_ubs);
@@ -3850,7 +3850,7 @@ void opengl33_renderer::Render(TTrack *Track)
}
// experimental, does track rendering in two passes, to take advantage of reduced texture switching
void opengl33_renderer::Render(scene::basic_cell::path_sequence::const_iterator First, scene::basic_cell::path_sequence::const_iterator Last)
void opengl33_renderer::Render(const scene::basic_cell::path_sequence::const_iterator First, const scene::basic_cell::path_sequence::const_iterator Last)
{
// setup
@@ -4826,7 +4826,7 @@ void opengl33_renderer::Render_Alpha(TSubModel *Submodel)
Render_Alpha(Submodel->Next);
};
bool opengl33_renderer::Debug_Ui_State(std::optional<bool> param)
bool opengl33_renderer::Debug_Ui_State(const std::optional<bool> param)
{
if (param) {
debug_ui_active = *param;
@@ -4920,7 +4920,7 @@ void opengl33_renderer::Update_Pick_Node()
}
}
void opengl33_renderer::Pick_Control_Callback(std::function<void(TSubModel const *, glm::vec2 pos)> callback)
void opengl33_renderer::Pick_Control_Callback(const std::function<void(TSubModel const *, glm::vec2 pos)> callback)
{
if (!Global.render_cab) {
callback(nullptr, glm::vec2());
@@ -4929,7 +4929,7 @@ void opengl33_renderer::Pick_Control_Callback(std::function<void(TSubModel const
m_control_pick_requests.push_back(callback);
}
void opengl33_renderer::Pick_Node_Callback(std::function<void(scene::basic_node *)> callback)
void opengl33_renderer::Pick_Node_Callback(const std::function<void(scene::basic_node *)> callback)
{
m_node_pick_requests.push_back(callback);
}

View File

@@ -224,7 +224,7 @@ opengl_vbogeometrybank::delete_buffer() {
}
void
opengl_vbogeometrybank::bind_streams( stream_units const &Units, unsigned int const Streams, size_t offset ) {
opengl_vbogeometrybank::bind_streams( stream_units const &Units, unsigned int const Streams, const size_t offset ) {
if( Streams & position ) {
::glVertexPointer( 3, GL_FLOAT, sizeof( basic_vertex ), reinterpret_cast<void const *>( offsetof(gfx::basic_vertex, position) + sizeof( basic_vertex ) * offset ) );

View File

@@ -3093,7 +3093,7 @@ opengl_renderer::Render( TTrack *Track ) {
// experimental, does track rendering in two passes, to take advantage of reduced texture switching
void
opengl_renderer::Render( scene::basic_cell::path_sequence::const_iterator First, scene::basic_cell::path_sequence::const_iterator Last ) {
opengl_renderer::Render(const scene::basic_cell::path_sequence::const_iterator First, const scene::basic_cell::path_sequence::const_iterator Last ) {
::glColor3fv( glm::value_ptr( colors::white ) );
// setup

View File

@@ -13,7 +13,7 @@ http://mozilla.org/MPL/2.0/.
std::unique_ptr<gfx_renderer> GfxRenderer;
bool gfx_renderer_factory::register_backend(const std::string &backend, create_method func)
bool gfx_renderer_factory::register_backend(const std::string &backend, const create_method func)
{
backends[backend] = func;
return true;

View File

@@ -4,7 +4,7 @@
#include "utilities/Logs.h"
#include <png.h>
void screenshot_manager::screenshot_save_thread( char *img, int w, int h )
void screenshot_manager::screenshot_save_thread( char *img, const int w, const int h )
{
png_image png;
memset(&png, 0, sizeof(png_image));