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

python task queue texture binding tweak, python task queue crash fix

This commit is contained in:
tmj-fstate
2018-10-12 22:07:42 +02:00
parent 7cf06246a6
commit 68f82be451
5 changed files with 10 additions and 7 deletions

View File

@@ -71,5 +71,6 @@ enum class TCommandType
}; };
using material_handle = int; using material_handle = int;
using texture_handle = int;
#endif #endif

View File

@@ -27,7 +27,7 @@ void render_task::run() {
if( ( outputwidth != nullptr ) if( ( outputwidth != nullptr )
&& ( outputheight != nullptr ) ) { && ( outputheight != nullptr ) ) {
GfxRenderer.Bind_Material( m_target ); ::glBindTexture( GL_TEXTURE_2D, GfxRenderer.Texture( m_target ).id );
// setup texture parameters // setup texture parameters
::glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE ); ::glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE );
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); ::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

View File

@@ -29,7 +29,7 @@ class render_task {
public: public:
// constructors // constructors
render_task( PyObject *Renderer, PyObject *Input, material_handle Target ) : render_task( PyObject *Renderer, PyObject *Input, texture_handle Target ) :
m_renderer( Renderer ), m_input( Input ), m_target( Target ) m_renderer( Renderer ), m_input( Input ), m_target( Target )
{} {}
// methods // methods
@@ -39,7 +39,7 @@ private:
// members // members
PyObject *m_renderer {nullptr}; PyObject *m_renderer {nullptr};
PyObject *m_input { nullptr }; PyObject *m_input { nullptr };
material_handle m_target { null_handle }; texture_handle m_target { null_handle };
}; };
class python_taskqueue { class python_taskqueue {
@@ -50,7 +50,7 @@ public:
std::string const &renderer; std::string const &renderer;
PyObject *input; PyObject *input;
material_handle target; texture_handle target;
}; };
// constructors // constructors
python_taskqueue() = default; python_taskqueue() = default;

View File

@@ -29,6 +29,7 @@ http://mozilla.org/MPL/2.0/.
#include "mtable.h" #include "mtable.h"
#include "Console.h" #include "Console.h"
#include "application.h" #include "application.h"
#include "renderer.h"
namespace input { namespace input {
@@ -449,9 +450,9 @@ PyObject *TTrain::GetTrainState() {
auto const *mover = DynamicObject->MoverParameters; auto const *mover = DynamicObject->MoverParameters;
PyEval_AcquireLock(); PyEval_AcquireLock();
auto *dict = PyDict_New(); auto *dict = PyDict_New();
PyEval_ReleaseLock();
if( ( dict == nullptr ) if( ( dict == nullptr )
|| ( mover == nullptr ) ) { || ( mover == nullptr ) ) {
PyEval_ReleaseLock();
return nullptr; return nullptr;
} }
@@ -581,6 +582,7 @@ PyObject *TTrain::GetTrainState() {
PyDict_SetItemString( dict, "seconds", PyGetInt( simulation::Time.second() ) ); PyDict_SetItemString( dict, "seconds", PyGetInt( simulation::Time.second() ) );
PyDict_SetItemString( dict, "air_temperature", PyGetInt( Global.AirTemperature ) ); PyDict_SetItemString( dict, "air_temperature", PyGetInt( Global.AirTemperature ) );
PyEval_ReleaseLock();
return dict; return dict;
} }
@@ -6792,7 +6794,7 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
( substr_path(renderername).empty() ? // supply vehicle folder as path if none is provided ( substr_path(renderername).empty() ? // supply vehicle folder as path if none is provided
DynamicObject->asBaseDir + renderername : DynamicObject->asBaseDir + renderername :
renderername ), renderername ),
material ); GfxRenderer.Material( material ).texture1 );
} }
// btLampkaUnknown.Init("unknown",mdKabina,false); // btLampkaUnknown.Init("unknown",mdKabina,false);
} while (token != ""); } while (token != "");

View File

@@ -670,7 +670,7 @@ private:
// McZapkie: do syczenia // McZapkie: do syczenia
float fPPress, fNPress; float fPPress, fNPress;
int iRadioChannel { 1 }; // numer aktualnego kana?u radiowego int iRadioChannel { 1 }; // numer aktualnego kana?u radiowego
std::vector<std::pair<std::string, material_handle>> m_screens; std::vector<std::pair<std::string, texture_handle>> m_screens;
public: public:
float fPress[20][3]; // cisnienia dla wszystkich czlonow float fPress[20][3]; // cisnienia dla wszystkich czlonow