Panda3D

graphicsPipeSelection.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 graphicsPipeSelection.h
10 * @author drose
11 * @date 2002-08-15
12 */
13
14 #ifndef GRAPHICSPIPESELECTION_H
15 #define GRAPHICSPIPESELECTION_H
16
17 #include "pandabase.h"
18
19 #include "graphicsPipe.h"
20 #include "pointerTo.h"
21 #include "typeHandle.h"
22 #include "lightMutex.h"
23 #include "vector_string.h"
24
25 class HardwareChannel;
26 class GraphicsWindow;
27
28 /**
29 * This maintains a list of GraphicsPipes by type that are available for
30 * creation. Normally there is one default interactive GraphicsPipe, and
31 * possibly other types available as well.
32 */
33 class EXPCL_PANDA_DISPLAY GraphicsPipeSelection {
34 protected:
35 GraphicsPipeSelection();
36 ~GraphicsPipeSelection();
37
38 PUBLISHED:
39 int get_num_pipe_types() const;
40 TypeHandle get_pipe_type(int n) const;
41 MAKE_SEQ(get_pipe_types, get_num_pipe_types, get_pipe_type);
42 MAKE_SEQ_PROPERTY(pipe_types, get_num_pipe_types, get_pipe_type);
43 void print_pipe_types() const;
44
45 PT(GraphicsPipe) make_pipe(const std::string &type_name,
46 const std::string &module_name = std::string());
47 PT(GraphicsPipe) make_pipe(TypeHandle type);
48 PT(GraphicsPipe) make_module_pipe(const std::string &module_name);
49 PT(GraphicsPipe) make_default_pipe();
50
51 INLINE int get_num_aux_modules() const;
52 void load_aux_modules();
53
54 INLINE static GraphicsPipeSelection *get_global_ptr();
55
56 public:
57 typedef PT(GraphicsPipe) PipeConstructorFunc();
58 bool add_pipe_type(TypeHandle type, PipeConstructorFunc *func);
59
60 private:
61 INLINE void load_default_module() const;
62 void do_load_default_module();
63 TypeHandle load_named_module(const std::string &name);
64
65 class LoadedModule {
66 public:
67 std::string _module_name;
68 void *_module_handle;
69 TypeHandle _default_pipe_type;
70 };
71 typedef pmap<std::string, LoadedModule> LoadedModules;
72 LoadedModules _loaded_modules;
73 LightMutex _loaded_modules_lock;
74
75 class PipeType {
76 public:
77 INLINE PipeType(TypeHandle type, PipeConstructorFunc *constructor);
78 TypeHandle _type;
79 PipeConstructorFunc *_constructor;
80 };
81 typedef pvector<PipeType> PipeTypes;
82 PipeTypes _pipe_types;
83 LightMutex _lock;
84
85 typedef vector_string DisplayModules;
86 DisplayModules _display_modules;
87 std::string _default_display_module;
88 std::string _default_pipe_name;
89 bool _default_module_loaded;
90
91 static GraphicsPipeSelection *_global_ptr;
92 };
93
94 #include "graphicsPipeSelection.I"
95
96 #endif
GraphicsPipeSelection
This maintains a list of GraphicsPipes by type that are available for creation.
Definition: graphicsPipeSelection.h:33
GraphicsPipe
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:52
GraphicsWindow
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
Definition: graphicsWindow.h:40
LightMutex
This is a standard, non-reentrant mutex, similar to the Mutex class.
Definition: lightMutex.h:41
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
pmap< std::string, LoadedModule >
pvector< PipeType >
graphicsPipeSelection.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
graphicsPipe.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lightMutex.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
typeHandle.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
vector_string.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.