forming the skeleton

This commit is contained in:
2025-06-21 21:36:32 -04:00
parent 3bedd81d96
commit ea2e7e918c
22 changed files with 921 additions and 309 deletions

View File

@@ -1,26 +1,50 @@
#pragma once
#include "texture.h"
#include "resources.h"
#include "input.h"
static const ivec2 PREVIEW_SIZE = {1280, 720};
static const ivec2 PREVIEW_SIZE = {960, 720};
static const ivec2 PREVIEW_CENTER = {0, 0};
#define PREVIEW_ZOOM_MIN 0
#define PREVIEW_ZOOM_MIN 1
#define PREVIEW_ZOOM_MAX 400
#define PREVIEW_GRID_MIN 0
#define PREVIEW_GRID_MAX 20
#define PREVIEW_GRID_MIN 1
#define PREVIEW_GRID_MAX 50
#define PREVIEW_ZOOM_STEP 10
static const f32 PREVIEW_AXIS_VERTICES[] =
{
-1.0f, 0.0f,
1.0f, 0.0f,
0.0f, -1.0f,
0.0f, 1.0f
};
struct Preview
{
GLuint texture;
GLuint fbo;
GLuint rbo;
bool isGrid;
GLuint gridVAO;
GLuint gridVBO;
GLuint axisVAO;
GLuint axisVBO;
Input* input;
Resources* resources;
bool isGrid = false;
bool isAxis = true;
ivec2 viewport = PREVIEW_SIZE;
f32 zoom = 100;
vec2 pan = PREVIEW_CENTER;
ivec2 gridSize = {10, 10};
vec4 color = {0.69, 0.69, 0.69, 1.0f};
vec4 gridColor = {0.35, 0.35, 0.35, 1.0f};
ivec2 oldGridSize = {-1, -1};
s32 gridVertexCount = -1;
vec4 backgroundColor = {0.113, 0.184, 0.286, 1.0f};
vec4 gridColor = {1.0, 1.0, 1.0, 0.125f};
vec4 axisColor = {1.0, 1.0, 1.0, 0.5f};
};
void preview_init(Preview* self);
void preview_init(Preview* self, Resources* resources, Input* input);
void preview_draw(Preview* self);
void preview_tick(Preview* self);
void preview_free(Preview* self);