00001 // Filename: geomNodeContext.h 00002 // Created by: drose (11Jun01) 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 #ifndef GEOMNODECONTEXT_H 00020 #define GEOMNODECONTEXT_H 00021 00022 #include <pandabase.h> 00023 00024 #include "savedContext.h" 00025 00026 class GeomNode; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : GeomNodeContext 00030 // Description : This is a special class object, similar to a 00031 // TextureContext, that holds all the information 00032 // returned by a particular GSG to cache the rendering 00033 // information associated with one or more GeomNodes. 00034 // This is similar to, but different from, a Geom 00035 // context, which is associated with the containing Geom 00036 // class; a GSG might prefer to associate data with 00037 // either the Geom or the GeomNode or both. 00038 // 00039 // This allows the GSG to precompute some information 00040 // necessary for drawing the Geoms as quickly as 00041 // possible and reuse that information across multiple 00042 // frames. Typically, only static Geoms 00043 // (e.g. nonindexed) will be assigned GeomContexts. 00044 //////////////////////////////////////////////////////////////////// 00045 class EXPCL_PANDA GeomNodeContext : public SavedContext { 00046 public: 00047 INLINE GeomNodeContext(GeomNode *node); 00048 00049 // This cannot be a PT(GeomNode), because the geomNode and the GSG 00050 // both own their GeomNodeContexts! That would create a circular 00051 // reference count. 00052 GeomNode *_node; 00053 00054 public: 00055 static TypeHandle get_class_type() { 00056 return _type_handle; 00057 } 00058 static void init_type() { 00059 SavedContext::init_type(); 00060 register_type(_type_handle, "GeomNodeContext", 00061 SavedContext::get_class_type()); 00062 } 00063 virtual TypeHandle get_type() const { 00064 return get_class_type(); 00065 } 00066 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00067 00068 private: 00069 static TypeHandle _type_handle; 00070 }; 00071 00072 #include "geomNodeContext.I" 00073 00074 #endif 00075