Katana Plug-in APIs 0.1

ExampleViewport.h

00001 // Copyright (c) 2016 The Foundry Visionmongers Ltd. All Rights Reserved.
00002 
00003 #ifndef EXAMPLEVIEWPORT_H_
00004 #define EXAMPLEVIEWPORT_H_
00005 
00006 #include <FnViewer/plugin/FnViewport.h>
00007 #include <FnViewer/plugin/FnViewportLayer.h>
00008 #include <FnViewer/plugin/FnEventWrapper.h>
00009 #include <FnAttribute/FnAttribute.h>
00010 #include <FnAttribute/FnGroupBuilder.h>
00011 #include "GL/glew.h"
00012 #include "ExampleViewerDelegate.h"
00013 
00014 #include <map>
00015 #include <string>
00016 
00017 using Foundry::Katana::ViewerAPI::FnEventWrapper;
00018 using Foundry::Katana::ViewerAPI::OptionIdGenerator;
00019 using Foundry::Katana::ViewerAPI::ViewerDelegate;
00020 
00028 class ExampleViewport : public Foundry::Katana::ViewerAPI::Viewport
00029 {
00030 public:
00031     ExampleViewport();
00032     ~ExampleViewport();
00033 
00035     static Foundry::Katana::ViewerAPI::Viewport* create();
00036 
00038     void setup();
00039 
00041     void cleanup();
00042 
00047     bool event(const FnEventWrapper& event);
00048 
00053     void draw();
00054 
00056     void resize(unsigned int width, unsigned int height);
00057 
00059     void setOption(OptionIdGenerator::value_type optionId,
00060         FnAttribute::Attribute attr);
00061 
00063     FnAttribute::Attribute getOption(
00064         OptionIdGenerator::value_type optionId);
00065 
00067     static void flush();
00068 
00070     void freeze();
00071 
00073     void thaw();
00074 
00075 protected:
00077     void createDefaultCameras();
00078 
00079 private:
00081     ExampleViewerDelegate* _getViewerDelegate();
00082 
00084     std::string _getEventDescription(const FnEventWrapper& event) const;
00085 
00087     void setupFramebuffer();
00089     void resizeFramebuffer();
00092     void resolveFramebuffer();
00094     void cleanupFramebuffer();
00095 
00096 private:
00097     typedef std::map<OptionIdGenerator::value_type,
00098         FnAttribute::Attribute> AttrMap;
00100     AttrMap m_options;
00102     float _backgroundColor[3];
00103 
00104     GLuint m_framebuffer;
00105     GLuint m_colorRenderBuffer;
00106     GLuint m_depthRenderBuffer;
00107     unsigned int m_multisampleCount;
00108 };
00109 
00110 #endif  // EXAMPLEVIEWPORT_H_
 All Classes Functions Variables Typedefs Enumerations Enumerator