mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
python task queue texture binding tweak, python task queue crash fix
This commit is contained in:
@@ -71,5 +71,6 @@ enum class TCommandType
|
||||
};
|
||||
|
||||
using material_handle = int;
|
||||
using texture_handle = int;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@ void render_task::run() {
|
||||
if( ( outputwidth != nullptr )
|
||||
&& ( outputheight != nullptr ) ) {
|
||||
|
||||
GfxRenderer.Bind_Material( m_target );
|
||||
::glBindTexture( GL_TEXTURE_2D, GfxRenderer.Texture( m_target ).id );
|
||||
// setup texture parameters
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
||||
6
PyInt.h
6
PyInt.h
@@ -29,7 +29,7 @@ class render_task {
|
||||
|
||||
public:
|
||||
// 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 )
|
||||
{}
|
||||
// methods
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
// members
|
||||
PyObject *m_renderer {nullptr};
|
||||
PyObject *m_input { nullptr };
|
||||
material_handle m_target { null_handle };
|
||||
texture_handle m_target { null_handle };
|
||||
};
|
||||
|
||||
class python_taskqueue {
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
std::string const &renderer;
|
||||
PyObject *input;
|
||||
material_handle target;
|
||||
texture_handle target;
|
||||
};
|
||||
// constructors
|
||||
python_taskqueue() = default;
|
||||
|
||||
@@ -29,6 +29,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "mtable.h"
|
||||
#include "Console.h"
|
||||
#include "application.h"
|
||||
#include "renderer.h"
|
||||
|
||||
namespace input {
|
||||
|
||||
@@ -449,9 +450,9 @@ PyObject *TTrain::GetTrainState() {
|
||||
auto const *mover = DynamicObject->MoverParameters;
|
||||
PyEval_AcquireLock();
|
||||
auto *dict = PyDict_New();
|
||||
PyEval_ReleaseLock();
|
||||
if( ( dict == nullptr )
|
||||
|| ( mover == nullptr ) ) {
|
||||
PyEval_ReleaseLock();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -581,6 +582,7 @@ PyObject *TTrain::GetTrainState() {
|
||||
PyDict_SetItemString( dict, "seconds", PyGetInt( simulation::Time.second() ) );
|
||||
PyDict_SetItemString( dict, "air_temperature", PyGetInt( Global.AirTemperature ) );
|
||||
|
||||
PyEval_ReleaseLock();
|
||||
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
|
||||
DynamicObject->asBaseDir + renderername :
|
||||
renderername ),
|
||||
material );
|
||||
GfxRenderer.Material( material ).texture1 );
|
||||
}
|
||||
// btLampkaUnknown.Init("unknown",mdKabina,false);
|
||||
} while (token != "");
|
||||
|
||||
2
Train.h
2
Train.h
@@ -670,7 +670,7 @@ private:
|
||||
// McZapkie: do syczenia
|
||||
float fPPress, fNPress;
|
||||
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:
|
||||
float fPress[20][3]; // cisnienia dla wszystkich czlonow
|
||||
|
||||
Reference in New Issue
Block a user