00001 // Filename: frameBufferProperties.cxx 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 #include "frameBufferProperties.h" 00020 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Function: FrameBufferProperties::Constructor 00024 // Access: Published 00025 // Description: 00026 //////////////////////////////////////////////////////////////////// 00027 FrameBufferProperties:: 00028 FrameBufferProperties() { 00029 clear(); 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: FrameBufferProperties::Copy Assignment Operator 00034 // Access: Published 00035 // Description: 00036 //////////////////////////////////////////////////////////////////// 00037 void FrameBufferProperties:: 00038 operator = (const FrameBufferProperties ©) { 00039 _specified = copy._specified; 00040 _flags = copy._flags; 00041 _frame_buffer_mode = copy._frame_buffer_mode; 00042 _depth_bits = copy._depth_bits; 00043 _color_bits = copy._color_bits; 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: FrameBufferProperties::operator == 00048 // Access: Published 00049 // Description: 00050 //////////////////////////////////////////////////////////////////// 00051 bool FrameBufferProperties:: 00052 operator == (const FrameBufferProperties &other) const { 00053 return (_specified == other._specified && 00054 _flags == other._flags && 00055 _frame_buffer_mode == other._frame_buffer_mode && 00056 _depth_bits == other._depth_bits && 00057 _color_bits == other._color_bits); 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: FrameBufferProperties::clear 00062 // Access: Published 00063 // Description: Unsets all properties that have been specified so 00064 // far, and resets the FrameBufferProperties structure to its 00065 // initial empty state. 00066 //////////////////////////////////////////////////////////////////// 00067 void FrameBufferProperties:: 00068 clear() { 00069 _specified = 0; 00070 _flags = 0; 00071 _frame_buffer_mode = 0; 00072 _depth_bits = 0; 00073 _color_bits = 0; 00074 } 00075 00076 //////////////////////////////////////////////////////////////////// 00077 // Function: FrameBufferProperties::add_properties 00078 // Access: Published 00079 // Description: Sets any properties that are explicitly specified in 00080 // other on this object. Leaves other properties 00081 // unchanged. 00082 //////////////////////////////////////////////////////////////////// 00083 void FrameBufferProperties:: 00084 add_properties(const FrameBufferProperties &other) { 00085 if (other.has_frame_buffer_mode()) { 00086 set_frame_buffer_mode(other.get_frame_buffer_mode()); 00087 } 00088 if (other.has_depth_bits()) { 00089 set_depth_bits(other.get_depth_bits()); 00090 } 00091 if (other.has_color_bits()) { 00092 set_color_bits(other.get_color_bits()); 00093 } 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function: FrameBufferProperties::output 00098 // Access: Published 00099 // Description: Sets any properties that are explicitly specified in 00100 // other on this object. Leaves other properties 00101 // unchanged. 00102 //////////////////////////////////////////////////////////////////// 00103 void FrameBufferProperties:: 00104 output(ostream &out) const { 00105 if (has_frame_buffer_mode()) { 00106 out << "frameBuffer_mode="; 00107 int frameBuffer_mode = get_frame_buffer_mode(); 00108 if ((frameBuffer_mode & FM_index) != 0) { 00109 out << "FM_index"; 00110 } else { 00111 out << "FM_rgb"; 00112 } 00113 00114 if ((frameBuffer_mode & FM_triple_buffer) != 0) { 00115 out << "|FM_triple_buffer"; 00116 } else if ((frameBuffer_mode & FM_double_buffer) != 0) { 00117 out << "|FM_double_buffer"; 00118 } else { 00119 out << "|FM_single_buffer"; 00120 } 00121 00122 if ((frameBuffer_mode & FM_accum) != 0) { 00123 out << "|FM_accum"; 00124 } 00125 if ((frameBuffer_mode & FM_alpha) != 0) { 00126 out << "|FM_alpha"; 00127 } 00128 if ((frameBuffer_mode & FM_depth) != 0) { 00129 out << "|FM_depth"; 00130 } 00131 if ((frameBuffer_mode & FM_stencil) != 0) { 00132 out << "|FM_stencil"; 00133 } 00134 if ((frameBuffer_mode & FM_multisample) != 0) { 00135 out << "|FM_multisample"; 00136 } 00137 if ((frameBuffer_mode & FM_stereo) != 0) { 00138 out << "|FM_stereo"; 00139 } 00140 if ((frameBuffer_mode & FM_luminance) != 0) { 00141 out << "|FM_luminance"; 00142 } 00143 out << " "; 00144 } 00145 if (has_depth_bits()) { 00146 out << "depth_bits=" << get_depth_bits() << " "; 00147 } 00148 if (has_color_bits()) { 00149 out << "color_bits=" << get_color_bits() << " "; 00150 } 00151 }