Panda3D
|
00001 // Filename: tinyGraphicsBuffer.h 00002 // Created by: drose (08Aug08) 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 TINYGRAPHICSBUFFER_H 00016 #define TINYGRAPHICSBUFFER_H 00017 00018 #include "pandabase.h" 00019 #include "graphicsBuffer.h" 00020 #include "tinyGraphicsStateGuardian.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : TinyGraphicsBuffer 00024 // Description : An offscreen graphics buffer. 00025 //////////////////////////////////////////////////////////////////// 00026 class EXPCL_TINYDISPLAY TinyGraphicsBuffer : public GraphicsBuffer { 00027 public: 00028 TinyGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, 00029 const string &name, 00030 const FrameBufferProperties &fb_prop, 00031 const WindowProperties &win_prop, 00032 int flags, 00033 GraphicsStateGuardian *gsg, 00034 GraphicsOutput *host); 00035 virtual ~TinyGraphicsBuffer(); 00036 00037 virtual bool begin_frame(FrameMode mode, Thread *current_thread); 00038 virtual void end_frame(FrameMode mode, Thread *current_thread); 00039 00040 INLINE ZBuffer *get_frame_buffer(); 00041 00042 protected: 00043 virtual void close_buffer(); 00044 virtual bool open_buffer(); 00045 00046 private: 00047 void create_frame_buffer(); 00048 00049 private: 00050 ZBuffer *_frame_buffer; 00051 00052 public: 00053 static TypeHandle get_class_type() { 00054 return _type_handle; 00055 } 00056 static void init_type() { 00057 GraphicsBuffer::init_type(); 00058 register_type(_type_handle, "TinyGraphicsBuffer", 00059 GraphicsBuffer::get_class_type()); 00060 } 00061 virtual TypeHandle get_type() const { 00062 return get_class_type(); 00063 } 00064 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00065 00066 private: 00067 static TypeHandle _type_handle; 00068 }; 00069 00070 #include "tinyGraphicsBuffer.I" 00071 00072 #endif 00073