mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 22:09:19 +02:00
Merge branch 'tmj-dev' into milek-dev
This commit is contained in:
@@ -71,7 +71,7 @@ void TButton::Load( cParser &Parser, TDynamicObject const *Owner, TModel3d *pMod
|
|||||||
if( ( pModelOn == nullptr )
|
if( ( pModelOn == nullptr )
|
||||||
&& ( pModelOff == nullptr ) ) {
|
&& ( pModelOff == nullptr ) ) {
|
||||||
// if we failed to locate even one state submodel, cry
|
// if we failed to locate even one state submodel, cry
|
||||||
ErrorLog( "Bad model: failed to locate sub-model \"" + submodelname + "\" in 3d model \"" + pModel1->NameGet() + "\"", logtype::model );
|
ErrorLog( "Bad model: failed to locate sub-model \"" + submodelname + "\" in 3d model \"" + ( pModel1 != nullptr ? pModel1->NameGet() : pModel2 != nullptr ? pModel2->NameGet() : "NULL" ) + "\"", logtype::model );
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass submodel location to defined sounds
|
// pass submodel location to defined sounds
|
||||||
|
|||||||
47
PyInt.cpp
47
PyInt.cpp
@@ -40,24 +40,28 @@ void render_task::run() {
|
|||||||
// anisotropic filtering
|
// anisotropic filtering
|
||||||
::glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, Global.AnisotropicFiltering );
|
::glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, Global.AnisotropicFiltering );
|
||||||
}
|
}
|
||||||
::glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, -1.0 );
|
|
||||||
// build texture
|
// build texture
|
||||||
::glTexImage2D(
|
::glTexImage2D(
|
||||||
GL_TEXTURE_2D, 0,
|
GL_TEXTURE_2D, 0,
|
||||||
GL_RGB8,
|
GL_RGB8,
|
||||||
PyInt_AsLong( outputwidth ), PyInt_AsLong( outputheight ), 0,
|
PyInt_AsLong( outputwidth ), PyInt_AsLong( outputheight ), 0,
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, reinterpret_cast<GLubyte const *>( PyString_AsString( output ) ) );
|
GL_RGB, GL_UNSIGNED_BYTE, reinterpret_cast<GLubyte const *>( PyString_AsString( output ) ) );
|
||||||
|
::glFlush();
|
||||||
glFlush();
|
|
||||||
}
|
}
|
||||||
Py_DECREF( outputheight );
|
if( outputheight != nullptr ) { Py_DECREF( outputheight ); }
|
||||||
Py_DECREF( outputwidth );
|
if( outputwidth != nullptr ) { Py_DECREF( outputwidth ); }
|
||||||
Py_DECREF( output );
|
Py_DECREF( output );
|
||||||
}
|
}
|
||||||
// clean up after yourself
|
// clean up after yourself
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void render_task::cancel() {
|
||||||
|
|
||||||
|
Py_DECREF( m_input );
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
// initializes the module. returns true on success
|
// initializes the module. returns true on success
|
||||||
auto python_taskqueue::init() -> bool {
|
auto python_taskqueue::init() -> bool {
|
||||||
|
|
||||||
@@ -142,7 +146,7 @@ void python_taskqueue::exit() {
|
|||||||
// get rid of the leftover tasks
|
// get rid of the leftover tasks
|
||||||
// with the workers dead we don't have to worry about concurrent access anymore
|
// with the workers dead we don't have to worry about concurrent access anymore
|
||||||
for( auto *task : m_tasks.data ) {
|
for( auto *task : m_tasks.data ) {
|
||||||
delete task;
|
task->cancel();
|
||||||
}
|
}
|
||||||
// take a bow
|
// take a bow
|
||||||
PyEval_AcquireLock();
|
PyEval_AcquireLock();
|
||||||
@@ -159,22 +163,29 @@ auto python_taskqueue::insert( task_request const &Task ) -> bool {
|
|||||||
|
|
||||||
auto *renderer { fetch_renderer( Task.renderer ) };
|
auto *renderer { fetch_renderer( Task.renderer ) };
|
||||||
if( renderer == nullptr ) { return false; }
|
if( renderer == nullptr ) { return false; }
|
||||||
// acquire a lock on the task queue and add a new task
|
|
||||||
|
auto *newtask { new render_task( renderer, Task.input, Task.target ) };
|
||||||
|
bool newtaskinserted { false };
|
||||||
|
// acquire a lock on the task queue and add the new task
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock( m_tasks.mutex );
|
std::lock_guard<std::mutex> lock( m_tasks.mutex );
|
||||||
|
// check the task list for a pending request with the same target
|
||||||
// if task for this target already exists, don't add another
|
for( auto &task : m_tasks.data ) {
|
||||||
for (render_task *task : m_tasks.data)
|
if( task->target() == Task.target ) {
|
||||||
if (task->get_target() == Task.target)
|
// replace pending task in the slot with the more recent one
|
||||||
{
|
|
||||||
PyEval_AcquireLock();
|
PyEval_AcquireLock();
|
||||||
Py_DECREF(Task.input);
|
{
|
||||||
PyEval_ReleaseLock();
|
task->cancel();
|
||||||
|
}
|
||||||
return false;
|
PyEval_ReleaseLock();
|
||||||
|
task = newtask;
|
||||||
|
newtaskinserted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( false == newtaskinserted ) {
|
||||||
|
m_tasks.data.emplace_back( newtask );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_tasks.data.emplace_back( new render_task( renderer, Task.input, Task.target ) );
|
|
||||||
}
|
}
|
||||||
// potentially wake a worker to handle the new task
|
// potentially wake a worker to handle the new task
|
||||||
m_condition.notify_one();
|
m_condition.notify_one();
|
||||||
|
|||||||
3
PyInt.h
3
PyInt.h
@@ -44,7 +44,8 @@ public:
|
|||||||
{}
|
{}
|
||||||
// methods
|
// methods
|
||||||
void run();
|
void run();
|
||||||
const texture_handle get_target() const { return m_target; }
|
void cancel();
|
||||||
|
auto target() const -> texture_handle { return m_target; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// members
|
// members
|
||||||
|
|||||||
@@ -1730,7 +1730,7 @@ int TTrack::CrossSegment(int from, int into)
|
|||||||
|
|
||||||
void TTrack::RaAnimListAdd(TTrack *t)
|
void TTrack::RaAnimListAdd(TTrack *t)
|
||||||
{ // dodanie toru do listy animacyjnej
|
{ // dodanie toru do listy animacyjnej
|
||||||
if (SwitchExtension)
|
if ((t != nullptr) && (SwitchExtension != nullptr))
|
||||||
{
|
{
|
||||||
if (t == this)
|
if (t == this)
|
||||||
return; // siebie nie dodajemy drugi raz do listy
|
return; // siebie nie dodajemy drugi raz do listy
|
||||||
|
|||||||
@@ -2193,13 +2193,10 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Dynamic->mdModel )
|
if( Dynamic->mdModel )
|
||||||
Render( Dynamic->mdModel, Dynamic->Material(), squaredistance );
|
Render( Dynamic->mdModel, Dynamic->Material(), squaredistance );
|
||||||
|
|
||||||
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
||||||
Render( Dynamic->mdLoad, Dynamic->Material(), squaredistance, { 0.f, Dynamic->LoadOffset, 0.f }, {} );
|
Render( Dynamic->mdLoad, Dynamic->Material(), squaredistance, { 0.f, Dynamic->LoadOffset, 0.f }, {} );
|
||||||
|
|
||||||
// post-render cleanup
|
// post-render cleanup
|
||||||
m_renderspecular = false;
|
m_renderspecular = false;
|
||||||
if( Dynamic->fShade > 0.0f ) {
|
if( Dynamic->fShade > 0.0f ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user