mirror of
https://github.com/Mudlet/Mudlet
synced 2026-08-13 18:26:27 -04:00
<!-- Keep the title short & concise so anyone non-technical can
understand it,
the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
This adds an experimental, new 3D mapper that uses shaders, more modern
openGL, and a far better code reorganization that makes it an easier
foundation to build upon.
The new 3D mapper is here side by side with the original and can be
toggled on for experimentation. There's a lot of work to be done, so I'd
rather merge it early instead of making a mega-PR.
#### Motivation for adding to Mudlet
So we have a new foundation to build upon and improve.
#### Other info (issues closed, discussion etc)
Old and new mapper can be toggled dynamically with:
```lua
-- this can be a keybinding
setConfig("experiment.3dmap.modernmapper", not getConfig("experiment.3dmap.modernmapper"))
```
Smooth movement is one experiment in the new mapper, and it can be
enabled with:
```lua
lua setConfig("experiment.rendering.smooth-camera", true)
```
As you notice an experiments system has been added so we can implement
things at once and experiment to choose the one that works best. This
system can be used in other places in Mudlet as well.
<details><summary>Details</summary>
<p>
## Experiments System
### Overview
Allows enabling/disabling experimental features via
`setConfig`/`getConfig` with validation against a predefined
whitelist.
### Usage
```lua
-- Enable experiment
setConfig("experiment.rendering.more-transparent", true)
-- Check if enabled
local enabled = getConfig("experiment.rendering.more-transparent") --
returns true/false
-- Get active experiment in group
local active = getConfig("experiment.rendering.active") -- returns
"more-transparent"
-- List all valid experiments
local experiments = getConfig("experiment.list") -- returns table of
valid keys
```
### Behavior
- Grouped experiments: Mutually exclusive (enabling one disables others in same group)
- Validation: Only predefined experiments allowed, invalid keys return errors
- Persistence: Experiment states saved/loaded with profiles
### Adding New Experiments
Edit Host::mValidExperiments in src/Host.cpp:
```cpp
const QSet<QString> Host::mValidExperiments = {
qsl("experiment.rendering.originalish"),
qsl("experiment.rendering.more-transparent"),
qsl("experiment.newfeature.option1"), // Add here
};
```
### Current Experiments
- experiment.rendering.originalish
- experiment.rendering.more-transparent
</p>
</details>
---------
Co-authored-by: Vadim Peretokin <vadi2@users.noreply.github.com>
121 lines
5 KiB
CMake
121 lines
5 KiB
CMake
###########################################################################
|
|
# Copyright (C) 2019 Florian Scheel - keneanung@gmail.com #
|
|
# #
|
|
# This program is free software; you can redistribute it and/or modify #
|
|
# it under the terms of the GNU General Public License as published by #
|
|
# the Free Software Foundation; either version 2 of the License, or #
|
|
# (at your option) any later version. #
|
|
# #
|
|
# This program is distributed in the hope that it will be useful, #
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
# GNU General Public License for more details. #
|
|
# #
|
|
# You should have received a copy of the GNU General Public License #
|
|
# along with this program; if not, write to the #
|
|
# Free Software Foundation, Inc., #
|
|
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
|
|
###########################################################################
|
|
|
|
###########################################################################
|
|
#
|
|
# Exports a macro to check, whether optional modules were disabled
|
|
# via environment variables.
|
|
#
|
|
# Usage:
|
|
# include_optional_module(
|
|
# ENVIRONMENT_VARIABLE ENVIRONMENT_VARIABLE
|
|
# OPTION_VARIABLE OPTION_VARIABLE
|
|
# READABLE_NAME "option name"
|
|
# [ SUPPORTED_SYSTEMS "List" "Of" "Systems"]
|
|
# )
|
|
###########################################################################
|
|
|
|
macro(include_optional_module)
|
|
|
|
# parse readable arguments
|
|
set(OPTIONAL_MODULE_OPTIONS "") # not used
|
|
set(OPTIONAL_MODULE_ONE_VALUE_ARGS ENVIRONMENT_VARIABLE OPTION_VARIABLE
|
|
READABLE_NAME DEFAULT)
|
|
set(OPTIONAL_MODULE_MULTI_VALUE_ARGS SUPPORTED_SYSTEMS)
|
|
cmake_parse_arguments(
|
|
OPTIONAL_MODULE "${OPTIONAL_MODULE_OPTIONS}"
|
|
"${OPTIONAL_MODULE_ONE_VALUE_ARGS}" "${OPTIONAL_MODULE_MULTI_VALUE_ARGS}"
|
|
${ARGN})
|
|
|
|
# check arguments for existence
|
|
if(NOT OPTIONAL_MODULE_ENVIRONMENT_VARIABLE)
|
|
message(
|
|
FATAL_ERROR
|
|
"Macro include_optional_module(): Required argument 'ENVIRONMENT_VARIABLE' missing."
|
|
)
|
|
endif()
|
|
if(NOT OPTIONAL_MODULE_OPTION_VARIABLE)
|
|
message(
|
|
FATAL_ERROR
|
|
"Macro include_optional_module(): Required argument 'OPTION_VARIABLE' missing."
|
|
)
|
|
endif()
|
|
if(NOT OPTIONAL_MODULE_READABLE_NAME)
|
|
message(
|
|
FATAL_ERROR
|
|
"Macro include_optional_module(): Required argument 'READABLE_NAME' missing."
|
|
)
|
|
endif()
|
|
|
|
set(OPTIONAL_MODULE_TEST $ENV{${OPTIONAL_MODULE_ENVIRONMENT_VARIABLE}})
|
|
if((NOT OPTIONAL_MODULE_SUPPORTED_SYSTEMS)
|
|
OR (CMAKE_SYSTEM_NAME IN_LIST OPTIONAL_MODULE_SUPPORTED_SYSTEMS))
|
|
if(DEFINED OPTIONAL_MODULE_TEST)
|
|
string(TOUPPER ${OPTIONAL_MODULE_TEST} OPTIONAL_MODULE_TEST)
|
|
if(OPTIONAL_MODULE_TEST STREQUAL "NO")
|
|
# The specific tested for value was seen so set the option "no don't
|
|
# include the module"
|
|
set(OPTIONAL_MODULE_OPTION_VALUE OFF)
|
|
message(
|
|
STATUS
|
|
"Excluding optional ${OPTIONAL_MODULE_READABLE_NAME} explicitly"
|
|
)
|
|
else()
|
|
# Any other value was seen so ignore it and set "yes, include the
|
|
# module"
|
|
set(OPTIONAL_MODULE_OPTION_VALUE ON)
|
|
message(
|
|
STATUS
|
|
"Including optional ${OPTIONAL_MODULE_READABLE_NAME} explicitly"
|
|
)
|
|
endif()
|
|
else()
|
|
# An environmental variable not detected, apply specified default or "yes"
|
|
if(DEFINED OPTIONAL_MODULE_DEFAULT)
|
|
string(TOUPPER ${OPTIONAL_MODULE_DEFAULT} OPTIONAL_MODULE_DEFAULT_UPPER)
|
|
if(OPTIONAL_MODULE_DEFAULT_UPPER STREQUAL "OFF" OR OPTIONAL_MODULE_DEFAULT_UPPER STREQUAL "NO")
|
|
set(OPTIONAL_MODULE_OPTION_VALUE OFF)
|
|
message(
|
|
STATUS "Excluding optional ${OPTIONAL_MODULE_READABLE_NAME} by default")
|
|
else()
|
|
set(OPTIONAL_MODULE_OPTION_VALUE ON)
|
|
message(
|
|
STATUS "Including optional ${OPTIONAL_MODULE_READABLE_NAME}")
|
|
endif()
|
|
else()
|
|
# No default specified, use platform default of "yes, include the module"
|
|
set(OPTIONAL_MODULE_OPTION_VALUE ON)
|
|
message(
|
|
STATUS "Including optional ${OPTIONAL_MODULE_READABLE_NAME}")
|
|
endif()
|
|
endif()
|
|
option(${OPTIONAL_MODULE_OPTION_VARIABLE}
|
|
"Include optional ${OPTIONAL_MODULE_READABLE_NAME}"
|
|
${OPTIONAL_MODULE_OPTION_VALUE})
|
|
else()
|
|
# Don't offer option to enable the module since it's not supported on this
|
|
# platform
|
|
set(${OPTIONAL_MODULE_OPTION_VARIABLE} OFF)
|
|
message(
|
|
STATUS
|
|
"Excluding optional ${OPTIONAL_MODULE_READABLE_NAME} as it is not supported on this platform"
|
|
)
|
|
endif()
|
|
|
|
endmacro(include_optional_module)
|