mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 17:39:46 +00:00
A review of the branch turned up a number of defects, gaps and leftovers; this commit addresses all of them. Defects: - the shadow uniform array held seven entries while eight locations were written, so the last one landed outside the object; - CursorShape::LAST stayed in the middle of the enum after the new corner shapes were appended, which made the GLFW cursor table read out of bounds; the extra shapes are now mapped onto the ones GLFW knows, and the table is only filled for those; - GlStateGuard asked glIsEnabled for an attribute pname, so it always got GL_INVALID_ENUM and never restored the vertex attribute arrays; - the early returns in wayland_window_initialize left the global window and input pointers dangling when falling back to GLFW; - the icon textures were listed nowhere, so none of them ever loaded; - a shader failure disabled the shadow after the surface had already been sized for it, and VOXEL_DECORATIONS outlived the switch cleanup. Behavior: - the keyboard now releases every pressed key when it loses focus, and a repeat rate of zero means no repeat; - the fourth UTF-8 lead byte is decoded with the right mask, control characters no longer reach text fields, and a vanished clipboard offer clears the cached text; - compositor side decorations disable ours again instead of leaving two titles, the window destructor releases the rest of the state, and the content inset is computed before the GUI acts so the HUD and the container never disagree for a frame; the HUD clamps it; - the window controls fall back to minimize, maximize and close, and the icons are drawn from textures only. Cleanups: one monotonic timer instead of three, one vertex shader shared by both renderers with a link check, one button layout parser, the inset rule moved into Screen, the scissor stack moved into the base Window (about 110 duplicated lines), named shadow and evdev constants, trimmed includes, a README note about the Wayland dependencies, and the long lines introduced by this branch wrapped.
109 lines
2.7 KiB
C++
109 lines
2.7 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <optional>
|
|
|
|
#include "util/EnumMetadata.hpp"
|
|
|
|
enum class DrawPrimitive {
|
|
point = 0,
|
|
line,
|
|
triangle,
|
|
};
|
|
|
|
enum class BlendMode {
|
|
/// @brief Normal blending mode.
|
|
normal,
|
|
/// @brief Additive blending mode.
|
|
addition,
|
|
/// @brief Subtractive blending mode.
|
|
inversion
|
|
};
|
|
|
|
/// @brief Standard GLFW 3.4 cursor shapes (same order and count as in GLFW).
|
|
/// It also works in GLFW 3.3 (unsupported shapes will be replaced with the arrow).
|
|
enum class CursorShape {
|
|
/// @brief Regular arrow
|
|
ARROW,
|
|
/// @brief Text input I-beam
|
|
TEXT,
|
|
/// @brief Crosshair
|
|
CROSSHAIR,
|
|
/// @brief Pointing hand
|
|
POINTER,
|
|
/// @brief Horizontal resize arrow
|
|
EW_RESIZE,
|
|
/// @brief Vertical resize arrow
|
|
NS_RESIZE,
|
|
|
|
// GLFW 3.4+ cursor shapes
|
|
|
|
/// @brief Diagonal resize arrow (top-left to bottom-right)
|
|
NWSE_RESIZE,
|
|
/// @brief Diagonal resize arrow (top-right to bottom-left)
|
|
NESW_RESIZE,
|
|
/// @brief All-direction resize arrow
|
|
ALL_RESIZE,
|
|
/// @brief Operation not allowed
|
|
NOT_ALLOWED,
|
|
/// @brief Corner resize arrows
|
|
N_RESIZE,
|
|
S_RESIZE,
|
|
E_RESIZE,
|
|
W_RESIZE,
|
|
NE_RESIZE,
|
|
NW_RESIZE,
|
|
SE_RESIZE,
|
|
SW_RESIZE,
|
|
|
|
LAST=SW_RESIZE
|
|
};
|
|
|
|
namespace advanced_pipeline {
|
|
inline constexpr int TARGET_COLOR = 0;
|
|
inline constexpr int TARGET_SKYBOX = 1;
|
|
inline constexpr int TARGET_POSITIONS = 2;
|
|
inline constexpr int TARGET_NORMALS = 3;
|
|
inline constexpr int TARGET_EMISSION = 4;
|
|
inline constexpr int TARGET_SSAO = 5;
|
|
inline constexpr int TARGET_SHADOWS0 = 6;
|
|
inline constexpr int TARGET_SHADOWS1 = 7;
|
|
|
|
inline constexpr int TARGETS_COUNT = 8;
|
|
}
|
|
|
|
VC_ENUM_METADATA(CursorShape)
|
|
{"arrow", CursorShape::ARROW},
|
|
{"text", CursorShape::TEXT},
|
|
{"crosshair", CursorShape::CROSSHAIR},
|
|
{"pointer", CursorShape::POINTER},
|
|
{"ew-resize", CursorShape::EW_RESIZE},
|
|
{"ns-resize", CursorShape::NS_RESIZE},
|
|
{"nwse-resize", CursorShape::NWSE_RESIZE},
|
|
{"nesw-resize", CursorShape::NESW_RESIZE},
|
|
{"all-resize", CursorShape::ALL_RESIZE},
|
|
{"not-allowed", CursorShape::NOT_ALLOWED},
|
|
{"n-resize", CursorShape::N_RESIZE},
|
|
{"s-resize", CursorShape::S_RESIZE},
|
|
{"e-resize", CursorShape::E_RESIZE},
|
|
{"w-resize", CursorShape::W_RESIZE},
|
|
{"ne-resize", CursorShape::NE_RESIZE},
|
|
{"nw-resize", CursorShape::NW_RESIZE},
|
|
{"se-resize", CursorShape::SE_RESIZE},
|
|
{"sw-resize", CursorShape::SW_RESIZE},
|
|
VC_ENUM_END
|
|
|
|
class Flushable {
|
|
public:
|
|
virtual ~Flushable() = default;
|
|
|
|
virtual void flush() = 0;
|
|
};
|
|
|
|
class Bindable {
|
|
public:
|
|
virtual ~Bindable() = default;
|
|
|
|
virtual void bind() const = 0;
|
|
virtual void unbind() const = 0;
|
|
};
|