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