Panda3D

geomContext.h

00001 // Filename: geomContext.h
00002 // Created by:  drose (19Mar04)
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 #ifndef GEOMCONTEXT_H
00016 #define GEOMCONTEXT_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "savedContext.h"
00021 #include "geom.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : GeomContext
00025 // Description : This is a special class object that holds all the
00026 //               information returned by a particular GSG to indicate
00027 //               the geom's internal context identifier.
00028 //
00029 //               Geoms typically have an immediate-mode and a
00030 //               retained-mode operation.  When using geoms in
00031 //               retained-mode (in response to Geom::prepare()),
00032 //               the GSG will create some internal handle for the
00033 //               geom and store it here.  The geom stores all of
00034 //               these handles internally.
00035 //
00036 //               In the case of OpenGL, for example, a GeomContext
00037 //               corresponds to a display list identifier.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDA_GOBJ GeomContext : public SavedContext {
00040 public:
00041   INLINE GeomContext(Geom *geom);
00042 
00043 PUBLISHED:
00044   INLINE Geom *get_geom() const;
00045 
00046 public:
00047   // This cannot be a PT(Geom), because the geom and the GSG
00048   // both own their GeomContexts!  That would create a circular
00049   // reference count.
00050   Geom *_geom;
00051 
00052 public:
00053   static TypeHandle get_class_type() {
00054     return _type_handle;
00055   }
00056   static void init_type() {
00057     SavedContext::init_type();
00058     register_type(_type_handle, "GeomContext",
00059                   SavedContext::get_class_type());
00060   }
00061   virtual TypeHandle get_type() const {
00062     return get_class_type();
00063   }
00064   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00065 
00066 private:
00067   static TypeHandle _type_handle;
00068 };
00069 
00070 #include "geomContext.I"
00071 
00072 #endif
00073 
 All Classes Functions Variables Enumerations