From 32584f0a68fd1043321d8d9dfe5863cc35c1c83f Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 9 Nov 2021 15:46:14 +0100 Subject: [PATCH 1/4] pgraph: Fix prepare_scene() not properly invoking the shader generator --- panda/src/pgraph/geomNode.cxx | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/panda/src/pgraph/geomNode.cxx b/panda/src/pgraph/geomNode.cxx index eb1148b126..a485851448 100644 --- a/panda/src/pgraph/geomNode.cxx +++ b/panda/src/pgraph/geomNode.cxx @@ -396,6 +396,24 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, geom_state = state_munger->munge_state(geom_state); } + // As well as the shaders. + const ShaderAttrib *sa; + if (geom_state->get_attrib(sa)) { + Shader *shader = (Shader *)sa->get_shader(); + if (shader != nullptr) { + prepared_objects->enqueue_shader(shader); + } + else if (sa->auto_shader()) { + gsg->ensure_generated_shader(geom_state); + } + else if (munger->is_of_type(StateMunger::get_class_type())) { + // Premunge the state for the fixed-function pipeline. + StateMunger *state_munger = (StateMunger *)munger.p(); + geom_state = state_munger->munge_state(geom_state); + } + // TODO: prepare the shader inputs. + } + // And now prepare each of the textures. const TextureAttrib *ta; if (geom_state->get_attrib(ta)) { @@ -408,16 +426,6 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, } } } - - // As well as the shaders. - const ShaderAttrib *sa; - if (geom_state->get_attrib(sa)) { - Shader *shader = (Shader *)sa->get_shader(); - if (shader != nullptr) { - prepared_objects->enqueue_shader(shader); - } - // TODO: prepare the shader inputs. - } } PandaNode::r_prepare_scene(gsg, node_state, transformer, current_thread); From ab6d3b2e15d9671a7f7748470a5ad39b22f71535 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 16 Nov 2021 15:04:46 +0100 Subject: [PATCH 2/4] gobj: Show better error if calling tex.write() with unknown extension --- panda/src/gobj/texture.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index d6c30296d9..940944daef 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -30,6 +30,7 @@ #include "pnmImage.h" #include "pnmReader.h" #include "pfmFile.h" +#include "pnmFileTypeRegistry.h" #include "virtualFileSystem.h" #include "datagramInputFile.h" #include "datagramOutputFile.h" @@ -5176,11 +5177,19 @@ do_write_one(CData *cdata, const Filename &fullpath, int z, int n) { success = pfm.write(fullpath); } else { // Writing a normal, integer texture. + PNMFileType *type = + PNMFileTypeRegistry::get_global_ptr()->get_type_from_extension(fullpath); + if (type == nullptr) { + gobj_cat.error() + << "Texture::write() - couldn't determine type from extension: " << fullpath << endl; + return false; + } + PNMImage pnmimage; if (!do_store_one(cdata, pnmimage, z, n)) { return false; } - success = pnmimage.write(fullpath); + success = pnmimage.write(fullpath, type); } if (!success) { From b6e521715403a5aa02eb3c070d9c39339cba533a Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 16 Nov 2021 15:09:44 +0100 Subject: [PATCH 3/4] ai: Add name property to AICharacter class Closes #1205 --- contrib/src/ai/aiCharacter.cxx | 4 ++++ contrib/src/ai/aiCharacter.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/contrib/src/ai/aiCharacter.cxx b/contrib/src/ai/aiCharacter.cxx index 58485081c3..8f46bd8ee1 100644 --- a/contrib/src/ai/aiCharacter.cxx +++ b/contrib/src/ai/aiCharacter.cxx @@ -117,6 +117,10 @@ NodePath AICharacter::get_char_render() { return _window_render; } +std::string AICharacter::get_name() { + return _name; +} + void AICharacter::set_pf_guide(bool pf_guide) { _pf_guide = pf_guide; } diff --git a/contrib/src/ai/aiCharacter.h b/contrib/src/ai/aiCharacter.h index 81b3a01210..5ea5e590ec 100644 --- a/contrib/src/ai/aiCharacter.h +++ b/contrib/src/ai/aiCharacter.h @@ -46,6 +46,8 @@ class EXPCL_PANDAAI AICharacter : public ReferenceCount { void set_char_render(NodePath render); NodePath get_char_render(); + std::string get_name(); + PUBLISHED: double get_mass(); void set_mass(double m); @@ -65,6 +67,8 @@ PUBLISHED: explicit AICharacter(std::string model_name, NodePath model_np, double mass, double movt_force, double max_force); ~AICharacter(); + + MAKE_PROPERTY(name, get_name); }; #endif From 0f7a575ac059d643e52298521dcbae0765e9384c Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 16 Nov 2021 15:15:27 +0100 Subject: [PATCH 4/4] bullet: Add bullet-split-impulse config variable Fixes #1201 Co-authored-by: K9Kraken --- panda/src/bullet/bulletWorld.cxx | 2 +- panda/src/bullet/config_bullet.cxx | 5 +++++ panda/src/bullet/config_bullet.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/panda/src/bullet/bulletWorld.cxx b/panda/src/bullet/bulletWorld.cxx index 5590f6aee6..b14a4c7e18 100644 --- a/panda/src/bullet/bulletWorld.cxx +++ b/panda/src/bullet/bulletWorld.cxx @@ -125,7 +125,7 @@ BulletWorld() { // Some prefered settings _world->getDispatchInfo().m_enableSPU = true; // default: true _world->getDispatchInfo().m_useContinuous = true; // default: true - _world->getSolverInfo().m_splitImpulse = false; // default: false + _world->getSolverInfo().m_splitImpulse = bullet_split_impulse; _world->getSolverInfo().m_numIterations = bullet_solver_iterations; } diff --git a/panda/src/bullet/config_bullet.cxx b/panda/src/bullet/config_bullet.cxx index e4627c931e..caee5fb2c6 100644 --- a/panda/src/bullet/config_bullet.cxx +++ b/panda/src/bullet/config_bullet.cxx @@ -100,6 +100,11 @@ PRC_DESC("Specifies if events should be send when new contacts are " "contact events might create more load on the event queue " "then you might want! Default value is FALSE.")); +ConfigVariableBool bullet_split_impulse +("bullet-split-impulse", false, +PRC_DESC("Penetrating recovery won't add momentum. " + "btContactSolverInfo::m_splitImpulse. Default value is false.")); + ConfigVariableInt bullet_solver_iterations ("bullet-solver-iterations", 10, PRC_DESC("Specifies the number of iterations for the Bullet contact " diff --git a/panda/src/bullet/config_bullet.h b/panda/src/bullet/config_bullet.h index 7b8a52e122..8ba8b6b7a8 100644 --- a/panda/src/bullet/config_bullet.h +++ b/panda/src/bullet/config_bullet.h @@ -33,6 +33,7 @@ extern ConfigVariableEnum bullet_broadphase_al extern ConfigVariableEnum bullet_filter_algorithm; extern ConfigVariableDouble bullet_sap_extents; extern ConfigVariableBool bullet_enable_contact_events; +extern ConfigVariableBool bullet_split_impulse; extern ConfigVariableInt bullet_solver_iterations; extern ConfigVariableBool bullet_additional_damping; extern ConfigVariableDouble bullet_additional_damping_linear_factor;