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

revert, try to maintain compatiblity with weirdness for now...

This commit is contained in:
milek7
2022-03-07 21:02:14 +01:00
parent 063db3d382
commit d2b93f0cbb
3 changed files with 14 additions and 4 deletions

View File

@@ -209,18 +209,18 @@ material_data::assign( std::string const &Replacableskin ) {
// BUGS! it's not entierly designed whether opacity is property of material or submodel, // BUGS! it's not entierly designed whether opacity is property of material or submodel,
// and code does confusing things with this in various places // and code does confusing things with this in various places
textures_alpha = ( textures_alpha = (
GfxRenderer->Material( replacable_skins[ 1 ] ).get_or_guess_opacity() == 0.0f ? GfxRenderer->Material( replacable_skins[ 1 ] ).is_translucent() ?
0x31310031 : // tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych 0x31310031 : // tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
0x30300030 ); // wszystkie tekstury nieprzezroczyste - nie renderować w cyklu przezroczystych 0x30300030 ); // wszystkie tekstury nieprzezroczyste - nie renderować w cyklu przezroczystych
if( GfxRenderer->Material( replacable_skins[ 2 ] ).get_or_guess_opacity() == 0.0f ) { if( GfxRenderer->Material( replacable_skins[ 2 ] ).is_translucent() ) {
// tekstura -2 z kanałem alfa - nie renderować w cyklu nieprzezroczystych // tekstura -2 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
textures_alpha |= 0x02020002; textures_alpha |= 0x02020002;
} }
if( GfxRenderer->Material( replacable_skins[ 3 ] ).get_or_guess_opacity() == 0.0f ) { if( GfxRenderer->Material( replacable_skins[ 3 ] ).is_translucent() ) {
// tekstura -3 z kanałem alfa - nie renderować w cyklu nieprzezroczystych // tekstura -3 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
textures_alpha |= 0x04040004; textures_alpha |= 0x04040004;
} }
if( GfxRenderer->Material( replacable_skins[ 4 ] ).get_or_guess_opacity() == 0.0f ) { if( GfxRenderer->Material( replacable_skins[ 4 ] ).is_translucent() ) {
// tekstura -4 z kanałem alfa - nie renderować w cyklu nieprzezroczystych // tekstura -4 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
textures_alpha |= 0x08080008; textures_alpha |= 0x08080008;
} }

View File

@@ -446,6 +446,15 @@ float opengl_material::get_or_guess_opacity() const {
return 0.5f; return 0.5f;
} }
bool
opengl_material::is_translucent() const {
return (
textures[ 0 ] != null_handle ?
GfxRenderer->Texture( textures[ 0 ] ).has_alpha :
false );
}
// create material object from data stored in specified file. // create material object from data stored in specified file.
// NOTE: the deferred load parameter is passed to textures defined by material, the material itself is always loaded immediately // NOTE: the deferred load parameter is passed to textures defined by material, the material itself is always loaded immediately
material_handle material_handle

View File

@@ -41,6 +41,7 @@ struct opengl_material {
void finalize(bool Loadnow); void finalize(bool Loadnow);
bool update(); bool update();
float get_or_guess_opacity() const; float get_or_guess_opacity() const;
bool is_translucent() const;
// members // members
static struct path_data { static struct path_data {
std::unordered_map<std::string, int> index_map; std::unordered_map<std::string, int> index_map;