allow changes

This commit is contained in:
David Rose
2006-04-28 00:50:53 +00:00
parent c08358b05d
commit 14690717a2
3 changed files with 79 additions and 15 deletions

View File

@@ -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();
}
////////////////////////////////////////////////////////////////////

View File

@@ -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();
}
}

View File

@@ -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;