00001 // Filename: graphicsThreadingModel.I 00002 // Created by: drose (27Jan03) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: GraphicsThreadingModel::Copy Constructor 00022 // Access: Published 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE GraphicsThreadingModel:: 00026 GraphicsThreadingModel(const GraphicsThreadingModel ©) : 00027 _cull_name(copy._cull_name), 00028 _draw_name(copy._draw_name), 00029 _cull_sorting(copy._cull_sorting) 00030 { 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: GraphicsThreadingModel::Copy Assignment Operator 00035 // Access: Published 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE void GraphicsThreadingModel:: 00039 operator = (const GraphicsThreadingModel ©) { 00040 _cull_name = copy._cull_name; 00041 _draw_name = copy._draw_name; 00042 _cull_sorting = copy._cull_sorting; 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: GraphicsThreadingModel::get_cull_name 00047 // Access: Published 00048 // Description: Returns the name of the thread that will handle 00049 // culling in this model. 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE const string &GraphicsThreadingModel:: 00052 get_cull_name() const { 00053 return _cull_name; 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: GraphicsThreadingModel::get_draw_name 00058 // Access: Published 00059 // Description: Returns the name of the thread that will handle 00060 // sending the actual graphics primitives to the 00061 // graphics API in this model. 00062 //////////////////////////////////////////////////////////////////// 00063 INLINE const string &GraphicsThreadingModel:: 00064 get_draw_name() const { 00065 return _draw_name; 00066 } 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function: GraphicsThreadingModel::get_cull_sorting 00070 // Access: Published 00071 // Description: Returns true if the model involves a separate cull 00072 // pass, or false if culling happens implicitly, at the 00073 // same time as draw. 00074 //////////////////////////////////////////////////////////////////// 00075 INLINE bool GraphicsThreadingModel:: 00076 get_cull_sorting() const { 00077 return _cull_sorting; 00078 } 00079 00080 //////////////////////////////////////////////////////////////////// 00081 // Function: GraphicsThreadingModel::is_single_threaded 00082 // Access: Published 00083 // Description: Returns true if the threading model is a 00084 // single-threaded model, or false if it involves 00085 // threads. 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE bool GraphicsThreadingModel:: 00088 is_single_threaded() const { 00089 return _cull_name.empty() && _draw_name.empty(); 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: GraphicsThreadingModel::is_default 00094 // Access: Published 00095 // Description: Returns true if the threading model is the default, 00096 // cull-then-draw single-threaded model, or false 00097 // otherwise. 00098 //////////////////////////////////////////////////////////////////// 00099 INLINE bool GraphicsThreadingModel:: 00100 is_default() const { 00101 return is_single_threaded() && _cull_sorting; 00102 } 00103 00104 00105 //////////////////////////////////////////////////////////////////// 00106 // Function: GraphicsThreadingModel::output 00107 // Access: Published 00108 // Description: 00109 //////////////////////////////////////////////////////////////////// 00110 INLINE void GraphicsThreadingModel:: 00111 output(ostream &out) const { 00112 out << get_model(); 00113 } 00114 00115 INLINE ostream & 00116 operator << (ostream &out, const GraphicsThreadingModel &threading_model) { 00117 threading_model.output(out); 00118 return out; 00119 }