00001 // Filename: drawable.cxx 00002 // Created by: drose (15Jan99) 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 "drawable.h" 00020 00021 TypeHandle dDrawable::_type_handle; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: Drawable::Constructor 00025 // Access: Public 00026 // Description: 00027 //////////////////////////////////////////////////////////////////// 00028 dDrawable:: 00029 dDrawable() : WritableConfigurable() { 00030 #ifdef DO_MEMORY_USAGE 00031 MemoryUsage::update_type(this, this); 00032 #endif 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: Drawable::Destructor 00037 // Access: Public, Virtual 00038 // Description: 00039 //////////////////////////////////////////////////////////////////// 00040 dDrawable:: 00041 ~dDrawable() { 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: Drawable::draw 00046 // Access: Public, Virtual 00047 // Description: Actually draws the Drawable with the indicated GSG. 00048 // At this level, this doesn't do very much. 00049 //////////////////////////////////////////////////////////////////// 00050 void dDrawable:: 00051 draw(GraphicsStateGuardianBase *) { 00052 if (is_dirty()) { 00053 config(); 00054 } 00055 } 00056 00057 //////////////////////////////////////////////////////////////////// 00058 // Function: Drawable::draw 00059 // Access: Public, Virtual 00060 // Description: Returns true if the Drawable has any dynamic 00061 // properties that are expected to change from one frame 00062 // to the next, or false if the Drawable is largely 00063 // static. 00064 //////////////////////////////////////////////////////////////////// 00065 bool dDrawable:: 00066 is_dynamic() const { 00067 return false; 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: Drawable::propagate_stale_bound 00072 // Access: Protected, Virtual 00073 // Description: Called by BoundedObject::mark_bound_stale(), this 00074 // should make sure that all bounding volumes that 00075 // depend on this one are marked stale also. 00076 //////////////////////////////////////////////////////////////////// 00077 void dDrawable:: 00078 propagate_stale_bound() { 00079 // Unforunately, we don't have a pointer to the GeomNode that 00080 // includes us, so we can't propagate the bounding volume change 00081 // upwards. Need to address this. 00082 } 00083 00084 //////////////////////////////////////////////////////////////////// 00085 // Function: dDrawable::write_datagram 00086 // Access: Public 00087 // Description: Function to write the important information in 00088 // the particular object to a Datagram 00089 //////////////////////////////////////////////////////////////////// 00090 void dDrawable:: 00091 write_datagram(BamWriter *manager, Datagram &me) 00092 { 00093 //dDrawable contains nothing, but it has to define write_datagram 00094 }