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