From 14690717a2f23009ad41b443ffbfc227bcd02add Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 28 Apr 2006 00:50:53 +0000 Subject: [PATCH] allow changes --- panda/src/display/graphicsThreadingModel.I | 44 ++++++++++++++++++++ panda/src/display/graphicsThreadingModel.cxx | 42 ++++++++++++------- panda/src/display/graphicsThreadingModel.h | 8 ++++ 3 files changed, 79 insertions(+), 15 deletions(-) diff --git a/panda/src/display/graphicsThreadingModel.I b/panda/src/display/graphicsThreadingModel.I index dd89837218..0873ab642f 100644 --- a/panda/src/display/graphicsThreadingModel.I +++ b/panda/src/display/graphicsThreadingModel.I @@ -57,6 +57,20 @@ get_cull_name() const { return _cull_name; } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsThreadingModel::set_cull_name +// Access: Published +// Description: Changes the name of the thread that will handle +// culling in this model. This won't change any windows +// that were already created with this model; this only +// has an effect on newly-opened windows. +//////////////////////////////////////////////////////////////////// +INLINE void GraphicsThreadingModel:: +set_cull_name(const string &cull_name) { + _cull_name = cull_name; + update_stages(); +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsThreadingModel::get_cull_stage // Access: Published @@ -82,6 +96,20 @@ get_draw_name() const { return _draw_name; } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsThreadingModel::set_draw_name +// Access: Published +// Description: Changes the name of the thread that will handle +// drawing in this model. This won't change any windows +// that were already created with this model; this only +// has an effect on newly-opened windows. +//////////////////////////////////////////////////////////////////// +INLINE void GraphicsThreadingModel:: +set_draw_name(const string &draw_name) { + _draw_name = draw_name; + update_stages(); +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsThreadingModel::get_draw_stage // Access: Published @@ -106,6 +134,22 @@ get_draw_stage() const { INLINE bool GraphicsThreadingModel:: get_cull_sorting() const { return _cull_sorting; + +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsThreadingModel::set_cull_sorting +// Access: Published +// Description: Changes the flag that indicates whether the threading +// model involves a separate cull pass. This won't +// change any windows that were already created with +// this model; this only has an effect on newly-opened +// windows. +//////////////////////////////////////////////////////////////////// +INLINE void GraphicsThreadingModel:: +set_cull_sorting(bool cull_sorting) { + _cull_sorting = cull_sorting; + update_stages(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/graphicsThreadingModel.cxx b/panda/src/display/graphicsThreadingModel.cxx index 4081c41790..2f92b4b685 100644 --- a/panda/src/display/graphicsThreadingModel.cxx +++ b/panda/src/display/graphicsThreadingModel.cxx @@ -64,6 +64,33 @@ GraphicsThreadingModel(const string &model) { _cull_name = model.substr(start, slash - start); _draw_name = model.substr(slash + 1); } + + update_stages(); +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsThreadingModel::get_model +// Access: Published +// Description: Returns the string that describes the threading +// model. See the constructor. +//////////////////////////////////////////////////////////////////// +string GraphicsThreadingModel:: +get_model() const { + if (get_cull_sorting()) { + return get_cull_name() + "/" + get_draw_name(); + } else { + return string("-") + get_cull_name(); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsThreadingModel::update_stages +// Access: Private +// Description: Called internally to recompute _cull_stage and +// _draw_stage after either name has been changed. +//////////////////////////////////////////////////////////////////// +void GraphicsThreadingModel:: +update_stages() { if (_cull_name.empty()) { _cull_stage = 0; } else { @@ -80,18 +107,3 @@ GraphicsThreadingModel(const string &model) { } } - -//////////////////////////////////////////////////////////////////// -// Function: GraphicsThreadingModel::get_model -// Access: Published -// Description: Returns the string that describes the threading -// model. See the constructor. -//////////////////////////////////////////////////////////////////// -string GraphicsThreadingModel:: -get_model() const { - if (get_cull_sorting()) { - return get_cull_name() + "/" + get_draw_name(); - } else { - return string("-") + get_cull_name(); - } -} diff --git a/panda/src/display/graphicsThreadingModel.h b/panda/src/display/graphicsThreadingModel.h index 825aa7d6ff..2f8b505f3e 100644 --- a/panda/src/display/graphicsThreadingModel.h +++ b/panda/src/display/graphicsThreadingModel.h @@ -34,15 +34,23 @@ PUBLISHED: string get_model() const; INLINE const string &get_cull_name() const; + INLINE void set_cull_name(const string &cull_name); INLINE int get_cull_stage() const; + INLINE const string &get_draw_name() const; + INLINE void set_draw_name(const string &cull_name); INLINE int get_draw_stage() const; + INLINE bool get_cull_sorting() const; + INLINE void set_cull_sorting(bool cull_sorting); INLINE bool is_single_threaded() const; INLINE bool is_default() const; INLINE void output(ostream &out) const; +private: + void update_stages(); + private: string _cull_name; int _cull_stage;