Panda3D
 All Classes Functions Variables Enumerations
geomContext.h
1 // Filename: geomContext.h
2 // Created by: drose (19Mar04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef GEOMCONTEXT_H
16 #define GEOMCONTEXT_H
17 
18 #include "pandabase.h"
19 
20 #include "savedContext.h"
21 #include "geom.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : GeomContext
25 // Description : This is a special class object that holds all the
26 // information returned by a particular GSG to indicate
27 // the geom's internal context identifier.
28 //
29 // Geoms typically have an immediate-mode and a
30 // retained-mode operation. When using geoms in
31 // retained-mode (in response to Geom::prepare()),
32 // the GSG will create some internal handle for the
33 // geom and store it here. The geom stores all of
34 // these handles internally.
35 //
36 // In the case of OpenGL, for example, a GeomContext
37 // corresponds to a display list identifier.
38 ////////////////////////////////////////////////////////////////////
39 class EXPCL_PANDA_GOBJ GeomContext : public SavedContext {
40 public:
41  INLINE GeomContext(Geom *geom);
42 
43 PUBLISHED:
44  INLINE Geom *get_geom() const;
45 
46 public:
47  // This cannot be a PT(Geom), because the geom and the GSG
48  // both own their GeomContexts! That would create a circular
49  // reference count.
50  Geom *_geom;
51 
52 public:
53  static TypeHandle get_class_type() {
54  return _type_handle;
55  }
56  static void init_type() {
57  SavedContext::init_type();
58  register_type(_type_handle, "GeomContext",
59  SavedContext::get_class_type());
60  }
61  virtual TypeHandle get_type() const {
62  return get_class_type();
63  }
64  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
65 
66 private:
67  static TypeHandle _type_handle;
68 };
69 
70 #include "geomContext.I"
71 
72 #endif
73 
This is a special class object that holds all the information returned by a particular GSG to indicat...
Definition: geomContext.h:39
A container for geometry primitives.
Definition: geom.h:58
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This is the base class for all GSG-specific context objects, such as TextureContext and GeomContext...
Definition: savedContext.h:29