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

build 170626. individual self-illumination levels for interior sections, automatic merging of suitable terrain geometry during load from text files, unused resource release by geometry bank manager, support for ui backgrounds with width:height ratio other than 4:3, comment parsing optimization, minor bug fixes

This commit is contained in:
tmj-fstate
2017-06-26 16:57:25 +02:00
parent 34a899239f
commit 5d7b3fb036
18 changed files with 608 additions and 339 deletions

View File

@@ -164,12 +164,22 @@ void
ui_layer::render_background() {
if( m_background == 0 ) return;
// NOTE: we limit/expect the background to come with 4:3 ratio.
// TODO, TBD: if we expose texture width or ratio from texture object, this limitation could be lifted
GfxRenderer.Bind( m_background );
quad( float4( 0.0f, 0.0f, 1024.0f, 768.0f ), float4( 1.0f, 1.0f, 1.0f, 1.0f ) );
auto const height { 768.0f };
auto const &texture = GfxRenderer.Texture( m_background );
float const width = (
texture.width() == texture.height() ?
1024.0f : // legacy mode, square texture displayed as 4:3 image
texture.width() / ( texture.height() / 768.0f ) );
quad(
float4(
( 1024.0f * 0.5f ) - ( width * 0.5f ),
( 768.0f * 0.5f ) - ( height * 0.5f ),
( 1024.0f * 0.5f ) - ( width * 0.5f ) + width,
( 768.0f * 0.5f ) - ( height * 0.5f ) + height ),
float4( 1.0f, 1.0f, 1.0f, 1.0f ) );
}
void
@@ -200,7 +210,11 @@ ui_layer::quad( float4 const &Coordinates, float4 const &Color ) {
Global::iWindowHeight / 768.0 :
Global::iWindowHeight / 768.0 * screenratio / ( 4.0f / 3.0f ) );
float const height = 768.0f * heightratio;
/*
float const heightratio = Global::iWindowHeight / 768.0f;
float const height = 768.0f * heightratio;
float const width = Global::iWindowWidth * heightratio;
*/
glColor4fv(&Color.x);
glBegin( GL_TRIANGLE_STRIP );