mirror of
https://github.com/leozide/leocad.git
synced 2026-10-26 22:10:32 +00:00
Texture decoding and generated atlases previously used a custom packed-pixel container alongside QImage, duplicating storage and image-processing code. Use QImage throughout texture preparation and upload, remove Image and its pixel-format enum, and store font and string masks in Alpha8 atlases. Preserve power-of-two dimensions with smooth scaling and keep the existing OpenGL formats, shaders, and CPU mipmap filtering. Handle padded scanlines, restore the caller's unpack alignment on every upload return, and centralize binding cleanup so failed uploads do not leave stale texture caches. Validation: full application build and diff checks passed. OpenGL readback checks covered RGB/RGBA/alpha data, padded and custom strides, generated and supplied mipmaps, unpack-state restoration, and failure cleanup. All nine grid mip levels matched the previous generator. Visual rendering was checked by the user.
202 lines
6.1 KiB
C++
202 lines
6.1 KiB
C++
#pragma once
|
|
|
|
#define LC_IMAGE_TRANSPARENT 0x2000
|
|
|
|
enum class lcShadingMode;
|
|
enum class lcSelectionRenderMode;
|
|
enum class lcAxisIconLocation;
|
|
enum class lcViewSphereLocation;
|
|
enum class lcColorTheme;
|
|
enum class lcStudStyle;
|
|
enum class lcPartFilterType;
|
|
enum class lcPOVRayRenderQuality;
|
|
|
|
enum LC_PROFILE_KEY
|
|
{
|
|
// Settings.
|
|
LC_PROFILE_FIXED_AXES,
|
|
LC_PROFILE_LINE_WIDTH,
|
|
LC_PROFILE_ALLOW_LOD,
|
|
LC_PROFILE_LOD_DISTANCE,
|
|
LC_PROFILE_FADE_STEPS,
|
|
LC_PROFILE_FADE_STEPS_COLOR,
|
|
LC_PROFILE_HIGHLIGHT_NEW_PARTS,
|
|
LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR,
|
|
LC_PROFILE_SHADING_MODE,
|
|
LC_PROFILE_SELECTION_RENDER_MODE,
|
|
LC_PROFILE_BACKGROUND_GRADIENT,
|
|
LC_PROFILE_BACKGROUND_COLOR,
|
|
LC_PROFILE_GRADIENT_COLOR_TOP,
|
|
LC_PROFILE_GRADIENT_COLOR_BOTTOM,
|
|
LC_PROFILE_DRAW_AXES,
|
|
LC_PROFILE_DRAW_AXES_LOCATION,
|
|
LC_PROFILE_TEXT_COLOR,
|
|
LC_PROFILE_TEXT_HALO_COLOR,
|
|
LC_PROFILE_MARQUEE_BORDER_COLOR,
|
|
LC_PROFILE_MARQUEE_FILL_COLOR,
|
|
LC_PROFILE_OVERLAY_COLOR,
|
|
LC_PROFILE_ACTIVE_VIEW_COLOR,
|
|
LC_PROFILE_INACTIVE_VIEW_COLOR,
|
|
LC_PROFILE_DRAW_EDGE_LINES,
|
|
LC_PROFILE_DRAW_CONDITIONAL_LINES,
|
|
LC_PROFILE_GRID_STUDS,
|
|
LC_PROFILE_GRID_STUD_COLOR,
|
|
LC_PROFILE_GRID_LINES,
|
|
LC_PROFILE_GRID_LINE_SPACING,
|
|
LC_PROFILE_GRID_LINE_COLOR,
|
|
LC_PROFILE_GRID_ORIGIN,
|
|
LC_PROFILE_ANTIALIASING_SAMPLES,
|
|
LC_PROFILE_VIEW_SPHERE_ENABLED,
|
|
LC_PROFILE_VIEW_SPHERE_LOCATION,
|
|
LC_PROFILE_VIEW_SPHERE_SIZE,
|
|
LC_PROFILE_VIEW_SPHERE_COLOR,
|
|
LC_PROFILE_VIEW_SPHERE_TEXT_COLOR,
|
|
LC_PROFILE_VIEW_SPHERE_HIGHLIGHT_COLOR,
|
|
LC_PROFILE_OBJECT_SELECTED_COLOR,
|
|
LC_PROFILE_OBJECT_FOCUSED_COLOR,
|
|
LC_PROFILE_CAMERA_COLOR,
|
|
LC_PROFILE_LIGHT_COLOR,
|
|
LC_PROFILE_CONTROL_POINT_COLOR,
|
|
LC_PROFILE_CONTROL_POINT_FOCUSED_COLOR,
|
|
|
|
LC_PROFILE_LANGUAGE,
|
|
LC_PROFILE_COLOR_THEME,
|
|
LC_PROFILE_CHECK_UPDATES,
|
|
LC_PROFILE_PROJECTS_PATH,
|
|
LC_PROFILE_PARTS_LIBRARY,
|
|
LC_PROFILE_PART_PALETTES,
|
|
LC_PROFILE_MINIFIG_SETTINGS,
|
|
LC_PROFILE_COLOR_CONFIG,
|
|
LC_PROFILE_KEYBOARD_SHORTCUTS,
|
|
LC_PROFILE_MOUSE_SHORTCUTS,
|
|
LC_PROFILE_CATEGORIES,
|
|
LC_PROFILE_RECENT_FILE1,
|
|
LC_PROFILE_RECENT_FILE2,
|
|
LC_PROFILE_RECENT_FILE3,
|
|
LC_PROFILE_RECENT_FILE4,
|
|
LC_PROFILE_AUTOLOAD_MOSTRECENT,
|
|
LC_PROFILE_RESTORE_TAB_LAYOUT,
|
|
LC_PROFILE_AUTOSAVE_INTERVAL,
|
|
LC_PROFILE_MOUSE_SENSITIVITY,
|
|
LC_PROFILE_IMAGE_WIDTH,
|
|
LC_PROFILE_IMAGE_HEIGHT,
|
|
LC_PROFILE_IMAGE_EXTENSION,
|
|
LC_PROFILE_PARTS_LIST_ICONS,
|
|
LC_PROFILE_PARTS_LIST_NAMES,
|
|
LC_PROFILE_PARTS_LIST_COLOR,
|
|
LC_PROFILE_PARTS_LIST_COLOR_LOCKED,
|
|
LC_PROFILE_PARTS_LIST_DECORATED,
|
|
LC_PROFILE_PARTS_LIST_ALIASES,
|
|
LC_PROFILE_PARTS_LIST_LISTMODE,
|
|
LC_PROFILE_PARTS_POPUP_ICONS,
|
|
LC_PROFILE_PARTS_POPUP_NAMES,
|
|
LC_PROFILE_PARTS_POPUP_DECORATED,
|
|
LC_PROFILE_PARTS_POPUP_ALIASES,
|
|
LC_PROFILE_PARTS_POPUP_LISTMODE,
|
|
LC_PROFILE_PARTS_LIST_PART_FILTER,
|
|
LC_PROFILE_PARTS_LIST_CASE_SENSITIVE_FILTER,
|
|
LC_PROFILE_PARTS_LIST_FILE_NAME_FILTER,
|
|
LC_PROFILE_PARTS_LIST_PART_DESCRIPTION_FILTER,
|
|
LC_PROFILE_STUD_STYLE,
|
|
|
|
// Defaults for new projects.
|
|
LC_PROFILE_DEFAULT_AUTHOR_NAME,
|
|
LC_PROFILE_DEFAULT_AMBIENT_COLOR,
|
|
|
|
// Exporters.
|
|
LC_PROFILE_HTML_OPTIONS,
|
|
LC_PROFILE_HTML_IMAGE_OPTIONS,
|
|
LC_PROFILE_HTML_IMAGE_WIDTH,
|
|
LC_PROFILE_HTML_IMAGE_HEIGHT,
|
|
LC_PROFILE_POVRAY_PATH,
|
|
LC_PROFILE_POVRAY_LGEO_PATH,
|
|
LC_PROFILE_RENDER_WIDTH,
|
|
LC_PROFILE_RENDER_HEIGHT,
|
|
LC_PROFILE_RENDER_QUALITY,
|
|
LC_PROFILE_BLENDER_PATH,
|
|
LC_PROFILE_BLENDER_LDRAW_CONFIG_PATH,
|
|
LC_PROFILE_BLENDER_VERSION,
|
|
LC_PROFILE_BLENDER_ADDON_VERSION,
|
|
LC_PROFILE_BLENDER_ADDON_VERSION_CHECK,
|
|
LC_PROFILE_BLENDER_IMPORT_MODULE,
|
|
|
|
LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED,
|
|
LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE,
|
|
LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION,
|
|
LC_PROFILE_PREVIEW_DRAW_AXES,
|
|
|
|
LC_PROFILE_STUD_CYLINDER_COLOR_ENABLED,
|
|
LC_PROFILE_STUD_CYLINDER_COLOR,
|
|
LC_PROFILE_PART_EDGE_COLOR_ENABLED,
|
|
LC_PROFILE_PART_EDGE_COLOR,
|
|
LC_PROFILE_BLACK_EDGE_COLOR_ENABLED,
|
|
LC_PROFILE_BLACK_EDGE_COLOR,
|
|
LC_PROFILE_DARK_EDGE_COLOR_ENABLED,
|
|
LC_PROFILE_DARK_EDGE_COLOR,
|
|
LC_PROFILE_PART_EDGE_CONTRAST,
|
|
LC_PROFILE_PART_COLOR_VALUE_LD_INDEX,
|
|
LC_PROFILE_AUTOMATE_EDGE_COLOR,
|
|
|
|
LC_NUM_PROFILE_KEYS
|
|
};
|
|
|
|
class lcProfileEntry
|
|
{
|
|
public:
|
|
lcProfileEntry(const char* Section, const char* Key, int DefaultValue);
|
|
lcProfileEntry(const char* Section, const char* Key, uint DefaultValue);
|
|
lcProfileEntry(const char* Section, const char* Key, float DefaultValue);
|
|
lcProfileEntry(const char* Section, const char* Key, const char* DefaultValue);
|
|
lcProfileEntry(const char* Section, const char* Key, const QStringList& StringList);
|
|
lcProfileEntry(const char* Section, const char* Key);
|
|
|
|
QString mSection;
|
|
QString mKey;
|
|
|
|
std::variant<int, uint, float, QString, QStringList, QByteArray> mDefault;
|
|
};
|
|
|
|
void lcProfileInit();
|
|
void lcRemoveProfileKey(LC_PROFILE_KEY Key);
|
|
|
|
int lcGetProfileInt(LC_PROFILE_KEY Key);
|
|
uint lcGetProfileUInt(LC_PROFILE_KEY Key);
|
|
float lcGetProfileFloat(LC_PROFILE_KEY Key);
|
|
QString lcGetProfileString(LC_PROFILE_KEY Key);
|
|
QStringList lcGetProfileStringList(LC_PROFILE_KEY Key);
|
|
QByteArray lcGetProfileBuffer(LC_PROFILE_KEY Key);
|
|
|
|
void lcSetProfileInt(LC_PROFILE_KEY Key, int Value);
|
|
void lcSetProfileUInt(LC_PROFILE_KEY Key, uint Value);
|
|
void lcSetProfileFloat(LC_PROFILE_KEY Key, float Value);
|
|
void lcSetProfileString(LC_PROFILE_KEY Key, const QString& Value);
|
|
void lcSetProfileStringList(LC_PROFILE_KEY Key, const QStringList& Value);
|
|
void lcSetProfileBuffer(LC_PROFILE_KEY Key, const QByteArray& Buffer);
|
|
|
|
lcShadingMode lcGetProfileShadingMode();
|
|
void lcSetProfileShadingMode(lcShadingMode Value);
|
|
|
|
lcSelectionRenderMode lcGetProfileSelectionRenderMode();
|
|
void lcSetProfileSelectionRenderMode(lcSelectionRenderMode Value);
|
|
|
|
lcAxisIconLocation lcGetProfileAxisIconLocation();
|
|
void lcSetProfileAxisIconLocation(lcAxisIconLocation Value);
|
|
|
|
lcViewSphereLocation lcGetProfileViewSphereLocation();
|
|
void lcSetProfileViewSphereLocation(lcViewSphereLocation Value);
|
|
|
|
lcColorTheme lcGetProfileColorTheme();
|
|
void lcSetProfileColorTheme(lcColorTheme Value);
|
|
|
|
lcStudStyle lcGetProfileStudStyle();
|
|
void lcSetProfileStudStyle(lcStudStyle Value);
|
|
|
|
lcPartFilterType lcGetProfilePartFilterType();
|
|
void lcSetProfilePartFilterType(lcPartFilterType Value);
|
|
|
|
lcPOVRayRenderQuality lcGetProfileRenderQuality();
|
|
void lcSetProfileRenderQuality(lcPOVRayRenderQuality Value);
|
|
|
|
lcViewSphereLocation lcGetProfilePreviewViewSphereLocation();
|
|
void lcSetProfilePreviewViewSphereLocation(lcViewSphereLocation Value);
|