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

merge manul

This commit is contained in:
WLs50
2025-03-09 15:36:11 +01:00
parent a687f551a2
commit a5f6397eca
1211 changed files with 483542 additions and 58643 deletions

View File

@@ -420,7 +420,7 @@ std::pair<int, int> TSubModel::Load( cParser &parser, bool dynamic )
if (m_material > 0)
{
const opengl_material &mat = GfxRenderer->Material(m_material);
const IMaterial *mat = GfxRenderer->Material(m_material);
/*
// if material does have opacity set, replace submodel opacity with it
if (mat.opacity)
@@ -433,8 +433,8 @@ std::pair<int, int> TSubModel::Load( cParser &parser, bool dynamic )
}
*/
// and same thing with selfillum
if (mat.selfillum)
fLight = *mat.selfillum;
if (mat->GetSelfillum())
fLight = *mat->GetSelfillum();
}
// visibility range
@@ -806,11 +806,10 @@ void TSubModel::InitialRotate(bool doit)
(*mat)(3)[0] = (*mat)(3)[1] = (*mat)(3)[2] = 0.0;
if( eType != TP_STARS ) {
// gwiazdki mają kolory zamiast normalnych, to ich wtedy nie ruszamy
for( auto &vertex : Vertices ) {
vertex.normal = (
glm::length( vertex.normal ) > 0.0f ?
glm::normalize( ( *mat ) * vertex.normal ) :
glm::vec3() );
for (auto &vertex : Vertices)
{
vertex.normal = (*mat) * vertex.normal;
vertex.tangent.xyz = (*mat) * vertex.tangent.xyz;
}
}
}
@@ -823,19 +822,17 @@ void TSubModel::InitialRotate(bool doit)
if (doit)
{ // jeśli jest jednostkowy transform, to przeliczamy
// wierzchołki, a mnożenie podajemy dalej
float swapcopy;
for( auto &vertex : Vertices ) {
vertex.position.x = -vertex.position.x; // zmiana znaku X
swapcopy = vertex.position.y; // zamiana Y i Z
vertex.position.y = vertex.position.z;
vertex.position.z = swapcopy;
for (auto &vertex : Vertices)
{
glm::mat4 vertexTransform{{-1.f, 0.f, 0.f, 0.f}, {0.f, 0.f, 1.f, 0.f}, {0.f, 1.f, 0.f, 0.f}, {0.f, 0.f, 0.f, 1.f}};
vertex.position = vertexTransform * glm::vec4(vertex.position, 1.f);
// wektory normalne również trzeba przekształcić, bo się źle oświetlają
if( eType != TP_STARS ) {
// gwiazdki mają kolory zamiast normalnych, to // ich wtedy nie ruszamy
vertex.normal.x = -vertex.normal.x; // zmiana znaku X
swapcopy = vertex.normal.y; // zamiana Y i Z
vertex.normal.y = vertex.normal.z;
vertex.normal.z = swapcopy;
if (eType != TP_STARS)
{
glm::mat3 normalTransform{{-1.f, 0.f, 0.f}, {0.f, 0.f, 1.f}, {0.f, 1.f, 0.f}};
// gwiazdki mają kolory zamiast normalnych, to // ich wtedy nie ruszamy
vertex.normal = normalTransform * vertex.normal;
vertex.tangent.xyz = normalTransform * vertex.tangent.xyz;
}
}
if (Child)
@@ -2043,8 +2040,8 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
// if we don't have phase flags set for some reason, try to fix it
if (!(iFlags & 0x30) && m_material != null_handle)
{
const opengl_material &mat = GfxRenderer->Material(m_material);
float opacity = mat.get_or_guess_opacity();
const IMaterial *mat = GfxRenderer->Material(m_material);
float opacity = mat->get_or_guess_opacity();
// set phase flag based on material opacity
if (opacity == 0.0f)
@@ -2055,7 +2052,7 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
if ( m_material != null_handle )
{
opengl_material const &mat = GfxRenderer->Material(m_material);
IMaterial const *mat = GfxRenderer->Material(m_material);
/*
// if material does have opacity set, replace submodel opacity with it
if (mat.opacity)
@@ -2068,8 +2065,8 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
}
*/
// replace submodel selfillum with material one
if( mat.selfillum ) {
fLight = mat.selfillum.value();
if( mat->GetSelfillum() ) {
fLight = mat->GetSelfillum().value();
}
}
}