00001 // Filename: graphicsChannel.h 00002 // Created by: mike (09Jan97) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 #ifndef GRAPHICSCHANNEL_H 00019 #define GRAPHICSCHANNEL_H 00020 00021 #include "pandabase.h" 00022 #include "graphicsLayer.h" 00023 #include "typedReferenceCount.h" 00024 #include "pointerTo.h" 00025 #include "pmutex.h" 00026 #include "pvector.h" 00027 00028 class GraphicsChannel; 00029 class GraphicsPipe; 00030 class GraphicsWindow; 00031 class CullHandler; 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Class : GraphicsChannel 00035 // Description : This represents a single hardware output. Typically 00036 // there is exactly one channel per window, but some 00037 // implementations (e.g. SGI) support potentially 00038 // several different video channel ports connected to 00039 // different parts within a window. 00040 //////////////////////////////////////////////////////////////////// 00041 class EXPCL_PANDA GraphicsChannel : public TypedReferenceCount { 00042 protected: 00043 GraphicsChannel(); 00044 00045 public: 00046 GraphicsChannel(GraphicsWindow *window); 00047 00048 private: 00049 GraphicsChannel(const GraphicsChannel ©); 00050 void operator = (const GraphicsChannel ©); 00051 00052 PUBLISHED: 00053 virtual ~GraphicsChannel(); 00054 GraphicsLayer *make_layer(int index = -1); 00055 int get_num_layers() const; 00056 GraphicsLayer *get_layer(int index) const; 00057 void move_layer(int from_index, int to_index); 00058 void remove_layer(int index); 00059 00060 GraphicsWindow *get_window() const; 00061 GraphicsPipe *get_pipe() const; 00062 00063 void set_active(bool active); 00064 INLINE bool is_active() const; 00065 00066 public: 00067 virtual void window_resized(int x_size, int y_size); 00068 00069 private: 00070 void win_display_regions_changed(); 00071 00072 protected: 00073 Mutex _lock; 00074 GraphicsWindow *_window; 00075 bool _is_active; 00076 00077 typedef pvector< PT(GraphicsLayer) > GraphicsLayers; 00078 GraphicsLayers _layers; 00079 00080 public: 00081 static TypeHandle get_class_type() { 00082 return _type_handle; 00083 } 00084 static void init_type() { 00085 TypedReferenceCount::init_type(); 00086 register_type(_type_handle, "GraphicsChannel", 00087 TypedReferenceCount::get_class_type()); 00088 } 00089 virtual TypeHandle get_type() const { 00090 return get_class_type(); 00091 } 00092 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00093 00094 private: 00095 static TypeHandle _type_handle; 00096 00097 friend class GraphicsWindow; 00098 friend class GraphicsLayer; 00099 }; 00100 00101 #include "graphicsChannel.I" 00102 00103 #endif /* GRAPHICSCHANNEL_H */