Panda3D
|
00001 // Filename: graphicsBuffer.h 00002 // Created by: drose (06Feb04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef GRAPHICSBUFFER_H 00016 #define GRAPHICSBUFFER_H 00017 00018 #include "pandabase.h" 00019 00020 #include "graphicsOutput.h" 00021 #include "texture.h" 00022 #include "pointerTo.h" 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : GraphicsBuffer 00026 // Description : An offscreen buffer for rendering into. This is 00027 // similar in function to a GraphicsWindow, except that 00028 // the output is not visible to the user. 00029 //////////////////////////////////////////////////////////////////// 00030 class EXPCL_PANDA_DISPLAY GraphicsBuffer : public GraphicsOutput { 00031 protected: 00032 GraphicsBuffer(GraphicsEngine *engine, 00033 GraphicsPipe *pipe, 00034 const string &name, 00035 const FrameBufferProperties &fb_prop, 00036 const WindowProperties &win_prop, 00037 int flags, 00038 GraphicsStateGuardian *gsg, 00039 GraphicsOutput *host); 00040 00041 PUBLISHED: 00042 virtual ~GraphicsBuffer(); 00043 void set_size(int x, int y); 00044 00045 public: 00046 virtual void request_open(); 00047 virtual void request_close(); 00048 00049 // It is an error to call any of the following methods from any 00050 // thread other than the window thread. These methods are normally 00051 // called by the GraphicsEngine. 00052 virtual void set_close_now(); 00053 virtual void process_events(); 00054 00055 protected: 00056 virtual void close_buffer(); 00057 virtual bool open_buffer(); 00058 00059 protected: 00060 enum OpenRequest { 00061 OR_none, 00062 OR_open, 00063 OR_close, 00064 }; 00065 OpenRequest _open_request; 00066 00067 public: 00068 static TypeHandle get_class_type() { 00069 return _type_handle; 00070 } 00071 static void init_type() { 00072 GraphicsOutput::init_type(); 00073 register_type(_type_handle, "GraphicsBuffer", 00074 GraphicsOutput::get_class_type()); 00075 } 00076 virtual TypeHandle get_type() const { 00077 return get_class_type(); 00078 } 00079 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00080 00081 private: 00082 static TypeHandle _type_handle; 00083 }; 00084 00085 #include "graphicsBuffer.I" 00086 00087 #endif