#ifndef FLUTTER_PLUGIN_POLYVOX_FILAMENT_PLUGIN_H_ #define FLUTTER_PLUGIN_POLYVOX_FILAMENT_PLUGIN_H_ #include #include #include #include #include #include #include #include #include #include "GL/GL.h" #include "GL/GLu.h" #include "EGL/egl.h" #include "EGL/eglext.h" #include "EGL/eglplatform.h" #include "GLES2/gl2.h" #include "GLES2/gl2ext.h" #include "PolyvoxFilamentApi.h" #include "PlatformAngle.h" namespace polyvox_filament { class PolyvoxFilamentPlugin : public flutter::Plugin { public: static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar); PolyvoxFilamentPlugin(flutter::TextureRegistrar *textureRegistrar, flutter::PluginRegistrarWindows *registrar); virtual ~PolyvoxFilamentPlugin(); // Disallow copy and assign. PolyvoxFilamentPlugin(const PolyvoxFilamentPlugin &) = delete; PolyvoxFilamentPlugin &operator=(const PolyvoxFilamentPlugin &) = delete; // Called when a method is called on this plugin's channel from Dart. void HandleMethodCall( const flutter::MethodCall &method_call, std::unique_ptr> result); flutter::PluginRegistrarWindows *_pluginRegistrar; flutter::TextureRegistrar *_textureRegistrar; std::map _resources; std::unique_ptr _texture = nullptr; std::unique_ptr _pixelBuffer = nullptr; std::unique_ptr _pixelData = nullptr; std::unique_ptr _textureDescriptor = nullptr; int64_t _flutterTextureId; GLuint _glTextureId = 0; // D3D // Device ID3D11Device* _D3D11Device = nullptr; ID3D11DeviceContext* _D3D11DeviceContext = nullptr; // Texture objects/shared handles Microsoft::WRL::ComPtr _externalD3DTexture2D; Microsoft::WRL::ComPtr _internalD3DTexture2D; HANDLE _externalD3DTextureHandle = nullptr; HANDLE _internalD3DTextureHandle = nullptr; filament::backend::PlatformANGLE* _platform = nullptr; void CreateTexture( const flutter::MethodCall &methodCall, std::unique_ptr> result); void RenderCallback(); ResourceBuffer loadResource(const char *path); void freeResource(ResourceBuffer rbuf); }; } // namespace polyvox_filament #endif // FLUTTER_PLUGIN_POLYVOX_FILAMENT_PLUGIN_H_