Files
2025-12-15 23:22:33 +08:00

65 lines
2.2 KiB
C++

/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2025 by Tech Soft 3D, Inc.
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
* scope and manner of such use.
*
***********************************************************************************************************************/
#ifndef APPLICATION_H
#define APPLICATION_H
#include <string>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <glm/vec2.hpp>
#include "camera.h"
class Application
{
public:
GLFWwindow* window = nullptr;
static Camera camera;
Application() = default;
~Application();
void compute_camera(const utils::geometry::BoundingBox& box);
int launch(int width, int height, std::string title);
void clear();
bool should_close();
void display();
glm::mat4 compute_projection_matrix() const;
glm::mat4 compute_view_matrix() const;
void set_blending(bool blend);
private:
// Callbacks management
static void mouse_moved_callback(GLFWwindow* window, double position_x, double position_y);
static void mouse_pressed_callback(GLFWwindow* window, int button, int action, int mods);
static void framebuffer_size_callback(GLFWwindow* window, int w, int h);
static void scroll_callback(GLFWwindow* window, double offset_x, double offset_y);
static void key_pressed_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
static void window_size_changed_callback(GLFWwindow* window, int width, int height);
void get_ts3d_logo(char* pixels);
int initialize_glf();
int create_window(int width, int height, std::string title);
void set_callbacks();
int initialize_glad();
static int screen_width;
static int screen_height;
static bool first_mouse;
static glm::vec2 last_position;
static bool is_wireframe;
};
#endif // APPLICATION_H