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

@@ -413,7 +413,7 @@ namespace {
// doesn't match a recognised animation keyword — these are driven by event-
// triggered SetRotate/SetTranslate at runtime, which would silently break if
// the model were batched.
bool anim_type_unsafe_for_instancing( TAnimType a ) {
bool anim_type_unsafe_for_instancing(const TAnimType a ) {
switch( a ) {
case TAnimType::at_Rotate:
case TAnimType::at_RotateXYZ:
@@ -650,7 +650,7 @@ int TAnimModel::TerrainCount()
return pModel ? pModel->TerrainCount() : 0;
}
TSubModel * TAnimModel::TerrainSquare(int n)
TSubModel * TAnimModel::TerrainSquare(const int n)
{ // pobieranie wskaźników do pierwszego submodelu
return pModel ? pModel->TerrainSquare(n) : 0;
}

View File

@@ -42,7 +42,7 @@ TModelsManager::stringmodelcontainerindex_map TModelsManager::m_modelsmap;
// wczytanie modelu do tablicy
TModel3d *
TModelsManager::LoadModel(std::string const &Name, std::string const &virtualName, bool dynamic) {
TModelsManager::LoadModel(std::string const &Name, std::string const &virtualName, const bool dynamic) {
m_models.emplace_back();
const auto model = m_models.back().LoadModel( Name, dynamic );
@@ -57,7 +57,7 @@ TModelsManager::LoadModel(std::string const &Name, std::string const &virtualNam
}
TModel3d *
TModelsManager::GetModel(std::string const &Name, bool const Dynamic, bool const Logerrors, int uid )
TModelsManager::GetModel(std::string const &Name, bool const Dynamic, bool const Logerrors, const int uid )
{ // model może być we wpisie "node...model" albo "node...dynamic", a także być dodatkowym w dynamic
// (kabina, wnętrze, ładunek)
// dla "node...dynamic" mamy podaną ścieżkę w "\dynamic\" i musi być co najmniej 1 poziom, zwkle

View File

@@ -94,7 +94,7 @@ void TSubModel::SetDiffuseOverride(glm::vec3 const &Color, bool const Includechi
}
}
std::optional<glm::vec3> TSubModel::GetDiffuse(float Includesiblings)
std::optional<glm::vec3> TSubModel::GetDiffuse(const float Includesiblings)
{
if (eType == TP_FREESPOTLIGHT)
{
@@ -815,7 +815,7 @@ basic_vertex *TSubModel::TrianglePtr(int tex, int pos, glm::vec3 const &Ambient,
};
*/
void TSubModel::InitialRotate(bool doit)
void TSubModel::InitialRotate(const bool doit)
{ // konwersja układu współrzędnych na zgodny ze scenerią
if (iFlags & 0xC000) // jeśli jest animacja albo niejednostkowy transform
{ // niejednostkowy transform jest mnożony i wystarczy zabawy
@@ -1020,7 +1020,7 @@ uint32_t TSubModel::FlagsCheck()
return iFlags;
};
void TSubModel::SetRotate(float3 vNewRotateAxis, float fNewAngle)
void TSubModel::SetRotate(const float3 vNewRotateAxis, const float fNewAngle)
{ // obrócenie submodelu wg podanej
// osi (np. wskazówki w kabinie)
v_RotateAxis = vNewRotateAxis;
@@ -1033,7 +1033,7 @@ void TSubModel::SetRotate(float3 vNewRotateAxis, float fNewAngle)
iAnimOwner = iInstance; // zapamiętanie czyja jest animacja
}
void TSubModel::SetRotateXYZ(float3 vNewAngles)
void TSubModel::SetRotateXYZ(const float3 vNewAngles)
{ // obrócenie submodelu o
// podane kąty wokół osi
// lokalnego układu
@@ -1055,7 +1055,7 @@ void TSubModel::SetRotateXYZ(glm::vec3 vNewAngles)
iAnimOwner = iInstance; // zapamiętanie czyja jest animacja
}
void TSubModel::SetTranslate(float3 vNewTransVector)
void TSubModel::SetTranslate(const float3 vNewTransVector)
{ // przesunięcie submodelu (np. w kabinie)
v_TransVector = vNewTransVector;
b_Anim = TAnimType::at_Translate;
@@ -1073,7 +1073,7 @@ void TSubModel::SetTranslate(glm::vec3 vNewTransVector)
iAnimOwner = iInstance; // zapamiętanie czyja jest animacja
}
void TSubModel::SetRotateIK1(float3 vNewAngles)
void TSubModel::SetRotateIK1(const float3 vNewAngles)
{ // obrócenie submodelu o
// podane kąty wokół osi
// lokalnego układu
@@ -1083,13 +1083,13 @@ void TSubModel::SetRotateIK1(float3 vNewAngles)
struct ToLower
{
char operator()(char input)
char operator()(const char input)
{
return tolower(input);
}
};
TSubModel *TSubModel::GetFromName(std::string const &search, bool i)
TSubModel *TSubModel::GetFromName(std::string const &search, const bool i)
{
TSubModel *result;
// std::transform(search.begin(),search.end(),search.begin(),ToLower());
@@ -1121,14 +1121,14 @@ TSubModel *TSubModel::GetFromName(std::string const &search, bool i)
// WORD hbIndices[18]={3,0,1,5,4,2,1,0,4,1,5,3,2,3,5,2,4,0};
void TSubModel::RaAnimation(TAnimType a)
void TSubModel::RaAnimation(const TAnimType a)
{
glm::mat4 m = OpenGLMatrices.data(GL_MODELVIEW);
RaAnimation(m, a);
glLoadMatrixf(glm::value_ptr(m));
}
void TSubModel::RaAnimation(glm::mat4 &m, TAnimType a)
void TSubModel::RaAnimation(glm::mat4 &m, const TAnimType a)
{ // wykonanie animacji niezależnie od renderowania
switch (a)
{ // korekcja położenia, jeśli submodel jest animowany
@@ -1612,7 +1612,7 @@ glm::vec3 TSubModel::offset(float const Geometrytestoffsetthreshold) const
return offset;
}
bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
bool TModel3d::LoadFromFile(std::string const &FileName, const bool dynamic)
{
// wczytanie modelu z pliku
/*
@@ -1921,7 +1921,7 @@ void TSubModel::deserialize(std::istream &s)
m_rotation_init_done = true;
}
void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
void TModel3d::deserialize(std::istream &s, const size_t size, const bool dynamic)
{
Root = nullptr;
if (m_geometrybank == null_handle)
@@ -2356,7 +2356,7 @@ bool TSubModel::HasAnyVertexUserData() const
return false;
};
void TModel3d::LoadFromBinFile(std::string const &FileName, bool dynamic)
void TModel3d::LoadFromBinFile(std::string const &FileName, const bool dynamic)
{ // wczytanie modelu z pliku binarnego
WriteLog("Loading binary format 3d model data from \"" + FileName + "\"...", logtype::model);
@@ -2409,7 +2409,7 @@ TSubModel *TModel3d::AppendChildFromGeometry(const std::string &name, const std:
return sm;
}
void TModel3d::LoadFromTextFile(std::string const &FileName, bool dynamic)
void TModel3d::LoadFromTextFile(std::string const &FileName, const bool dynamic)
{ // wczytanie submodelu z pliku tekstowego
WriteLog("Loading text format 3d model data from \"" + FileName + "\"...", logtype::model);
iFlags |= 0x0200; // wczytano z pliku tekstowego (właścicielami tablic są submodle)
@@ -2518,7 +2518,7 @@ int TModel3d::TerrainCount() const
}
return i;
};
TSubModel *TModel3d::TerrainSquare(int n)
TSubModel *TModel3d::TerrainSquare(const int n)
{ // pobieranie wskaźnika do submodelu (n)
int i = 0;
TSubModel *r = Root;

View File

@@ -208,7 +208,7 @@ public:
iFlags |= 0x4000; };
void InitialRotate(bool doit);
void BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t, std::vector<std::string> *n, bool dynamic);
static void ReplacableSet(material_handle const *r, int a) {
static void ReplacableSet(material_handle const *r, const int a) {
ReplacableSkinId = r;
iAlpha = a; };
void Name_Material( std::string const &Name );

View File

@@ -375,7 +375,7 @@ opengl_texture::make_stub()
}
void
opengl_texture::make_from_memory(size_t width, size_t height, const uint8_t *raw)
opengl_texture::make_from_memory(const size_t width, const size_t height, const uint8_t *raw)
{
release();
@@ -392,7 +392,7 @@ opengl_texture::make_from_memory(size_t width, size_t height, const uint8_t *raw
is_texstub = false;
}
void opengl_texture::update_from_memory(size_t width, size_t height, const uint8_t *raw)
void opengl_texture::update_from_memory(const size_t width, const size_t height, const uint8_t *raw)
{
if (id != -1 && (width != data_width || height != data_height || GL_SRGB8_ALPHA8 != data_format || GL_RGBA != data_components))
{
@@ -878,7 +878,7 @@ opengl_texture::load_TGA() {
}
bool
opengl_texture::bind(size_t unit) {
opengl_texture::bind(const size_t unit) {
if( false == is_ready
&& false == create() ) {
@@ -906,7 +906,7 @@ opengl_texture::bind(size_t unit) {
}
void
opengl_texture::unbind(size_t unit)
opengl_texture::unbind(const size_t unit)
{
if (GLAD_GL_ARB_direct_state_access)
{
@@ -1137,7 +1137,7 @@ opengl_texture::release() {
}
void
opengl_texture::alloc_rendertarget( GLint format, GLint components, int width, int height, int l, int s, GLint wrap ) {
opengl_texture::alloc_rendertarget(const GLint format, const GLint components, const int width, const int height, const int l, const int s, const GLint wrap ) {
data_width = width;
data_height = height;
@@ -1162,7 +1162,7 @@ opengl_texture::alloc_rendertarget( GLint format, GLint components, int width, i
}
void
opengl_texture::set_components_hint( GLint hint ) {
opengl_texture::set_components_hint(const GLint hint ) {
components_hint = hint;
}
@@ -1267,7 +1267,7 @@ texture_manager::unit( GLint const Textureunit ) {
// ustalenie numeru tekstury, wczytanie jeśli jeszcze takiej nie było
texture_handle
texture_manager::create( std::string Filename, bool const Loadnow, GLint Formathint ) {
texture_manager::create( std::string Filename, bool const Loadnow, const GLint Formathint ) {
if( contains( Filename, '|' ) ) {
Filename.erase( Filename.find( '|' ) ); // po | może być nazwa kolejnej tekstury

View File

@@ -56,7 +56,7 @@ struct opengl_material : public IMaterial {
{
return shadow_rank;
}
virtual texture_handle GetTexture(int slot) const override
virtual texture_handle GetTexture(const int slot) const override
{
return textures[slot];
}

View File

@@ -17,7 +17,7 @@ struct world_vertex {
glm::vec3 normal;
glm::vec2 texture;
static world_vertex lerp(world_vertex const &a, world_vertex const &b, double factor)
static world_vertex lerp(world_vertex const &a, world_vertex const &b, const double factor)
{
return static_cast<world_vertex>(a * (1.0f - factor) + b * factor);
}