00001 // Filename: geomDrawCallbackData.cxx 00002 // Created by: drose (13Mar09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "geomDrawCallbackData.h" 00016 00017 TypeHandle GeomDrawCallbackData::_type_handle; 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function: GeomDrawCallbackData::output 00021 // Access: Published, Virtual 00022 // Description: 00023 //////////////////////////////////////////////////////////////////// 00024 void GeomDrawCallbackData:: 00025 output(ostream &out) const { 00026 out << get_type() << "(" << (void *)_obj << ", " << (void *)_gsg 00027 << ", " << _force << ")"; 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: GeomDrawCallbackData::upcall 00032 // Access: Published, Virtual 00033 // Description: You should make this call during the callback if you 00034 // want to continue the normal rendering function that 00035 // would have been done in the absence of a callback. 00036 // 00037 // Specifically, this method will add the Geoms in this 00038 // node to the list of renderable objects for drawing. 00039 // If this callback was made on a CallbackNode, it 00040 // doesn't actually do anything, since only a GeomNode 00041 // holds geoms. 00042 //////////////////////////////////////////////////////////////////// 00043 void GeomDrawCallbackData:: 00044 upcall() { 00045 // Go ahead and draw the object, if we have one. 00046 if (_obj->_geom != (Geom *)NULL) { 00047 if (_lost_state) { 00048 // Tell the GSG to forget its state. 00049 _gsg->clear_state_and_transform(); 00050 } 00051 00052 _obj->_geom->draw(_gsg, _obj->_munger, _obj->_munged_data, _force, 00053 Thread::get_current_thread()); 00054 } 00055 }