#ifndef MANDELBROT_APP_H #define MANDELBROT_APP_H #include #include #include #include #include #include #include using Microsoft::WRL::ComPtr; struct ConstantBuffer { float xmin, xmax, ymin, ymax; int width, height, maxIter; float time; float padding[3]; }; struct Bookmark { double xmin, xmax, ymin, ymax; int maxIter; bool saved = false; }; class MandelbrotApp { public: MandelbrotApp(HINSTANCE hInstance); ~MandelbrotApp(); void Run(); private: void CreateMainWindow(); void InitD3D(); void CreateComputeShader(); void ResizeBuffers(int width, int height); void RenderMandelbrot(); void UpdateTitle(); void Zoom(double factor, int centerX, int centerY); void Pan(int dx, int dy); void ResetView(); void AdjustIterations(int delta); void CycleColorScheme(); void ToggleAnimation(); void SaveBookmark(); void LoadBookmark(int slot); static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); HINSTANCE hInstance_; HWND hwnd_; ComPtr device_; ComPtr context_; ComPtr swapChain_; ComPtr renderTargetView_; ComPtr computeShader_; ComPtr vertexShader_; ComPtr pixelShader_; ComPtr constantBuffer_; ComPtr outputTexture_; ComPtr outputUAV_; ComPtr outputSRV_; ComPtr samplerState_; double xmin_ = -2.5, xmax_ = 1.5; double ymin_ = -1.5, ymax_ = 1.5; int maxIter_ = 256; int colorScheme_ = 0; bool animationEnabled_ = false; float animTime_ = 0.0f; int imageWidth_ = 0; int imageHeight_ = 0; int lastMouseX_ = 0; int lastMouseY_ = 0; bool dragging_ = false; bool rightDragging_ = false; std::unordered_map keysPressed_; std::mutex viewMutex_; LARGE_INTEGER perfFreq_; LARGE_INTEGER lastFrameTime_; Bookmark bookmarks_[10]; }; #endif