Compare commits

..
Author SHA1 Message Date
asarium e1cee23b82 Add bindless texturing 2018-04-03 10:18:10 +02:00
194 changed files with 1831 additions and 4929 deletions

No files matched your search

-27
View File
@@ -1,27 +0,0 @@
---
Checks: "-*,\
modernize-use-override,\
performance-*,\
-performance-type-promotion-in-math-fn,\
misc-assert-side-effect,\
misc-bool-pointer-implicit-conversion,\
misc-definitions-in-headers,\
misc-fold-init-type,\
misc-forward-declaration-namespace,\
misc-inaccurate-erase,\
misc-inefficient-algorithm,\
misc-macro-repeated-side-effects,\
misc-misplaced-const,\
misc-move-forwarding-reference,\
misc-multiple-statement-macro,\
misc-new-delete-overloads,\
misc-noexcept-move-constructor,\
"
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
CheckOptions:
- key: 'misc-assert-side-effect.AssertMacros'
value: 'assert,Assert,Assertion'
...
+8 -12
View File
@@ -3,7 +3,7 @@ sudo: required
dist: trusty
cache:
directories:
- $HOME/cmake-3.6
- $HOME/cmake
- $HOME/.ccache
addons:
apt:
@@ -86,17 +86,15 @@ matrix:
- g++-7
- *global_deps
- os: linux
env: CONFIGURATION="Debug" CC=clang-4.0 CXX=clang++-4.0 CMAKE_OPTIONS="-DENABLE_CLANG_TIDY=ON -DCLANG_TIDY_EXE=/usr/bin/clang-tidy-4.0"
env: CONFIGURATION="Debug" CC=clang-3.6 CXX=clang++-3.6
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- llvm-toolchain-precise
- sourceline: 'ppa:beineri/opt-qt571-trusty'
packages:
- *global_deps
- clang-4.0
- clang-tidy-4.0
- clang-3.6
- libc++-dev
- os: osx
env: CONFIGURATION="Debug"
@@ -122,17 +120,15 @@ matrix:
- g++-7
- *global_deps
- os: linux
env: CONFIGURATION="Release" CC=clang-4.0 CXX=clang++-4.0 CMAKE_OPTIONS="-DENABLE_CLANG_TIDY=ON -DCLANG_TIDY_EXE=/usr/bin/clang-tidy-4.0"
env: CONFIGURATION="Release" CC=clang-3.6 CXX=clang++-3.6
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- llvm-toolchain-precise
- sourceline: 'ppa:beineri/opt-qt571-trusty'
packages:
- *global_deps
- clang-4.0
- clang-tidy-4.0
- clang-3.6
- libc++-dev
- os: osx
env: CONFIGURATION="Release"
@@ -147,7 +143,7 @@ before_install:
- "./ci/travis/before_install.sh"
install:
- "./ci/travis/install.sh"
- export PATH=$HOME/cmake-3.6/bin:$PATH
- export PATH=$HOME/cmake/bin:$PATH
before_script:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then QT_ENV_SCRIPT=$(find /opt -name 'qt*-env.sh'); source $QT_ENV_SCRIPT; fi
- "./ci/travis/before_script.sh"
+2 -4
View File
@@ -142,8 +142,6 @@ if(FSO_BUILD_APPIMAGE)
include(appimage)
endif()
include(clang-tidy)
# This includes source code for some tools, either used in the build or also for something else
ADD_SUBDIRECTORY(tools)
@@ -170,7 +168,7 @@ if ("${CMAKE_VERSION}" VERSION_GREATER "3.5")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Freespace2)
endif()
IF(MSVC_USE_RUNTIME_DLL OR FSO_BUILD_QTFRED)
IF(MSVC_USE_RUNTIME_DLL)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${BINARY_DESTINATION}")
IF(FSO_BUILD_FRED2)
@@ -178,7 +176,7 @@ IF(MSVC_USE_RUNTIME_DLL OR FSO_BUILD_QTFRED)
ENDIF(FSO_BUILD_FRED2)
INCLUDE(InstallRequiredSystemLibraries)
ENDIF()
ENDIF(MSVC_USE_RUNTIME_DLL)
include(package)
-1
View File
@@ -132,7 +132,6 @@ if ($DeployBuild) {
}
cmake -DCMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER/../install" -DFSO_USE_SPEECH="ON" `
-DFSO_BUILD_QTFRED=ON -DQT5_INSTALL_ROOT="$($buildConfig.QtDir)" `
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$($buildConfig.SimdType)" `
-G "$($buildConfig.Generator)" -T "$($buildConfig.Toolset)" ..
+2 -2
View File
@@ -20,7 +20,7 @@ if [ "$TRAVIS_OS_NAME" = "linux" ]; then
export CXXFLAGS
export CFLAGS
CMAKE="cmake -G Ninja -DFSO_FATAL_WARNINGS=ON $CMAKE_OPTIONS"
CMAKE="cmake -G Ninja -DFSO_FATAL_WARNINGS=ON"
if [ "$BUILD_DEPLOYMENT" = true ]; then
for config in $BUILD_CONFIGS
do
@@ -38,6 +38,6 @@ elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
if [ "$BUILD_DEPLOYMENT" = true ]; then
cmake -G "Xcode" -DFSO_FATAL_WARNINGS=ON -DFSO_INSTALL_DEBUG_FILES=ON -DCMAKE_INSTALL_PREFIX="/tmp/release" ..
else
cmake -G "Xcode" $CMAKE_OPTIONS ..
cmake -G "Xcode" ..
fi
fi
+7 -5
View File
@@ -4,14 +4,16 @@ set -ex
FILENAME=
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ ! -d "$HOME/cmake-3.6/bin" ]; then
if [ ! -d "$HOME/cmake/bin" ]; then
# If the cache does not currently contain CMake then download and install it
mkdir -p $HOME/cmake-3.6/
FILENAME=cmake-3.4.3-Linux-x86_64
wget -O /tmp/cmake.tar.gz --no-check-certificate https://cmake.org/files/v3.6/cmake-3.6.0-Linux-x86_64.tar.gz
tar -xzf /tmp/cmake.tar.gz -C $HOME/cmake-3.6/ --strip-components=1
mkdir -p $HOME/cmake/
wget -O /tmp/cmake.tar.gz --no-check-certificate https://www.cmake.org/files/v3.4/$FILENAME.tar.gz
tar -xzf /tmp/cmake.tar.gz -C $HOME/cmake/ --strip-components=1
fi
export PATH=$HOME/cmake-3.6/bin:$PATH
export PATH=$HOME/cmake/bin:$PATH
cd $HOME
+1 -1
View File
@@ -5,7 +5,7 @@ set -e
cd build
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
ninja -k 20 all
ninja all
valgrind --leak-check=full --error-exitcode=1 --gen-suppressions=all \
--suppressions="$TRAVIS_BUILD_DIR/ci/travis/valgrind.supp" ./bin/unittests --gtest_shuffle
-37
View File
@@ -1,37 +0,0 @@
option(ENABLE_CLANG_TIDY "Enable source code checking using clang-tidy" OFF)
find_program(
CLANG_TIDY_EXE
NAMES "clang-tidy"
DOC "Path to clang-tidy executable"
)
function(enable_clang_tidy target)
# Not enabled in this configuration
endfunction()
if(NOT ENABLE_CLANG_TIDY)
return()
endif()
if(NOT EXISTS "${CLANG_TIDY_EXE}")
message(SEND_ERROR "clang-tidy: Could not find clang-tidy executable (value of variable is \"${CLANG_TIDY_EXE}\".")
return()
endif()
if(CMAKE_VERSION VERSION_LESS "3.6.0")
message(SEND_ERROR "Clang-tidy support requires CMake 3.6")
return()
endif()
message(STATUS "clang-tidy: Using \"${CLANG_TIDY_EXE}\"")
function(enable_clang_tidy target)
SET(TIDY_OPTIONS "${CLANG_TIDY_EXE}")
if(FSO_FATAL_WARNINGS)
set(TIDY_OPTIONS "${TIDY_OPTIONS};-warnings-as-errors=*")
endif()
set_target_properties(${target} PROPERTIES CXX_CLANG_TIDY "${TIDY_OPTIONS}")
endfunction()
+1 -1
View File
@@ -10,7 +10,7 @@ FUNCTION(ADD_IMPORTED_LIB NAME INCLUDES LIBS)
target_link_libraries(${NAME} INTERFACE "${LIBS}")
target_include_directories(${NAME} SYSTEM INTERFACE "${INCLUDES}")
target_include_directories(${NAME} INTERFACE "${INCLUDES}")
ENDFUNCTION(ADD_IMPORTED_LIB)
MACRO(PKG_CONFIG_LIB_RESOLVE NAME OUTVAR)
-2
View File
@@ -37,8 +37,6 @@ TARGET_LINK_LIBRARIES(code PUBLIC compiler)
target_link_libraries(code PUBLIC md5)
enable_clang_tidy(code)
IF (FSO_USE_SPEECH)
find_package(Speech REQUIRED)
target_link_libraries(code PUBLIC speech)
+11 -8
View File
@@ -13,7 +13,7 @@
#define __CFILE_H__
#include <ctime>
#include <time.h>
#include "globalincs/pstypes.h"
#include <stdexcept>
@@ -198,9 +198,9 @@ int cfwrite_compressed(void *param_buf, int param_elsize, int param_nelem, CFILE
int cfseek(CFILE *fp, int offset, int where);
// Returns current position of file.
int cftell(CFILE *fp);
// cfputc() writes a character to a file
int cftell(CFILE *fp);
// cfputc() writes a character to a file
int cfputc(int c, CFILE *cfile);
// cfputs() writes a string to a file
@@ -365,13 +365,16 @@ namespace cfile
{
}
explicit cfile_error(const std::string &excuse) : m_excuse(excuse)
cfile_error(const std::string &excuse) : m_excuse(excuse)
{
}
~cfile_error() SCP_NOEXCEPT override {}
~cfile_error() throw()
{
}
const char *what() const SCP_NOEXCEPT override {
virtual const char *what() const throw()
{
return m_excuse.c_str();
}
@@ -382,7 +385,7 @@ namespace cfile
class max_read_length : public cfile_error
{
public:
explicit max_read_length(const std::string &excuse) : cfile_error(excuse)
max_read_length(const std::string &excuse) : cfile_error(excuse)
{
}
+10 -11
View File
@@ -219,6 +219,7 @@ Flag exe_params[] =
{ "-set_cpu_affinity", "Sets processor affinity to config value", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-nograb", "Disables mouse grabbing", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nograb", },
{ "-noshadercache", "Disables the shader cache", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noshadercache", },
{ "-no_bindless_tex", "Disable bindless texturing", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_bindless_tex", },
#ifdef WIN32
{ "-fix_registry", "Use a different registry path", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
#endif
@@ -449,6 +450,7 @@ cmdline_parm no_geo_sdr_effects("-no_geo_effects", NULL, AT_NONE);
cmdline_parm set_cpu_affinity("-set_cpu_affinity", NULL, AT_NONE);
cmdline_parm nograb_arg("-nograb", NULL, AT_NONE);
cmdline_parm noshadercache_arg("-noshadercache", NULL, AT_NONE);
cmdline_parm no_bindless_tex_arg("-no_bindless_tex", NULL, AT_NONE);
#ifdef WIN32
cmdline_parm fix_registry("-fix_registry", NULL, AT_NONE);
#endif
@@ -467,6 +469,7 @@ bool Cmdline_no_geo_sdr_effects = false;
bool Cmdline_set_cpu_affinity = false;
bool Cmdline_nograb = false;
bool Cmdline_noshadercache = false;
bool Cmdline_no_bindless_textures = false;
#ifdef WIN32
bool Cmdline_alternate_registry_path = false;
#endif
@@ -1167,7 +1170,7 @@ bool cmdline_parm::has_param() {
#ifdef SCP_UNIX
// Return a vector with all filesystem names of "parent/dir" relative to parent.
// dir must not contain a slash.
static SCP_vector<SCP_string> unix_get_single_dir_names(const SCP_string& parent, const SCP_string& dir)
static SCP_vector<SCP_string> unix_get_single_dir_names(SCP_string parent, SCP_string dir)
{
SCP_vector<SCP_string> ret;
@@ -1190,7 +1193,7 @@ static SCP_vector<SCP_string> unix_get_single_dir_names(const SCP_string& parent
// Return a vector with all filesystem names of "parent/dir" relative to parent.
// Recurses to deal with slashes in dir.
static SCP_vector<SCP_string> unix_get_dir_names(const SCP_string& parent, const SCP_string& dir)
static SCP_vector<SCP_string> unix_get_dir_names(SCP_string parent, SCP_string dir)
{
size_t slash = dir.find_first_of("/\\");
@@ -1391,15 +1394,6 @@ static json_t* json_get_v1() {
json_object_set_new(openal_obj, "capture_devices", capture_array);
}
{
auto efx_support_obj = json_object();
for (auto& pair : openal_info.efx_support) {
json_object_set_new(efx_support_obj, pair.first.c_str(), json_boolean(pair.second));
}
json_object_set_new(openal_obj, "efx_support", efx_support_obj);
}
json_object_set_new(root, "openal", openal_obj);
}
@@ -1946,6 +1940,11 @@ bool SetCmdlineParams()
Cmdline_noshadercache = true;
}
if (no_bindless_tex_arg.found())
{
Cmdline_no_bindless_textures = true;
}
if (portable_mode.found())
{
Cmdline_portable_mode = true;
+1
View File
@@ -135,6 +135,7 @@ extern bool Cmdline_no_geo_sdr_effects;
extern bool Cmdline_set_cpu_affinity;
extern bool Cmdline_nograb;
extern bool Cmdline_noshadercache;
extern bool Cmdline_no_bindless_textures;
#ifdef WIN32
extern bool Cmdline_alternate_registry_path;
#endif
+3 -3
View File
@@ -25,11 +25,11 @@ class AudioDecoder: public FFMPEGStreamDecoder<AudioFrame> {
public:
explicit AudioDecoder(DecoderStatus* status);
~AudioDecoder() override;
virtual ~AudioDecoder();
void decodePacket(AVPacket* packet) override;
virtual void decodePacket(AVPacket* packet) SCP_OVERRIDE;
void finishDecoding() override;
virtual void finishDecoding() SCP_OVERRIDE;
};
}
}
+7 -7
View File
@@ -17,19 +17,19 @@ class FFMPEGDecoder: public Decoder {
public:
FFMPEGDecoder();
~FFMPEGDecoder() override;
virtual ~FFMPEGDecoder();
bool initialize(const SCP_string& fileName) override;
bool initialize(const SCP_string& fileName) SCP_OVERRIDE;
MovieProperties getProperties() override;
MovieProperties getProperties() SCP_OVERRIDE;
void startDecoding() override;
void startDecoding() SCP_OVERRIDE;
bool hasAudio() override;
bool hasAudio() SCP_OVERRIDE;
bool hasSubtitles() override;
bool hasSubtitles() SCP_OVERRIDE;
void close() override;
void close() SCP_OVERRIDE;
};
}
}
+3 -3
View File
@@ -10,11 +10,11 @@ class SubtitleDecoder: public FFMPEGStreamDecoder<SubtitleFrame> {
public:
explicit SubtitleDecoder(DecoderStatus* status);
~SubtitleDecoder() override;
virtual ~SubtitleDecoder();
void decodePacket(AVPacket* packet) override;
virtual void decodePacket(AVPacket* packet) SCP_OVERRIDE;
void finishDecoding() override;
virtual void finishDecoding() SCP_OVERRIDE;
void pushSubtitleFrame(AVPacket* subtitle, AVSubtitle* pSubtitle);
};
+2 -2
View File
@@ -22,14 +22,14 @@ class FFMPEGVideoFrame: public VideoFrame {
FFMPEGVideoFrame() : frame(nullptr) {
}
~FFMPEGVideoFrame() override {
virtual ~FFMPEGVideoFrame() {
if (frame != nullptr) {
av_freep(&frame->data[0]);
av_frame_free(&frame);
}
}
DataPointers getDataPointers() override {
virtual DataPointers getDataPointers() {
DataPointers ptrs;
ptrs.y = frame->data[0];
ptrs.u = frame->data[1];
+3 -3
View File
@@ -15,11 +15,11 @@ class VideoDecoder: public FFMPEGStreamDecoder<VideoFrame> {
public:
explicit VideoDecoder(DecoderStatus* status);
~VideoDecoder() override;
virtual ~VideoDecoder();
void decodePacket(AVPacket* packet) override;
virtual void decodePacket(AVPacket* packet) SCP_OVERRIDE;
void finishDecoding() override;
virtual void finishDecoding() SCP_OVERRIDE;
};
}
}
+2 -2
View File
@@ -48,10 +48,10 @@ class DecalDefinition {
DecalDefinition& operator=(const DecalDefinition&) = delete;
// Move constructor and operator
DecalDefinition(DecalDefinition&& other) SCP_NOEXCEPT {
DecalDefinition(DecalDefinition&& other) {
*this = std::move(other); // Use operator implementation
}
DecalDefinition& operator=(DecalDefinition&& other) SCP_NOEXCEPT {
DecalDefinition& operator=(DecalDefinition&& other) {
std::swap(_name, other._name);
std::swap(_diffuseFilename, other._diffuseFilename);
+105 -27
View File
@@ -1,4 +1,8 @@
#ifdef FEATURE_BINDLESS_TEXTURES
#extension GL_ARB_bindless_texture : require
#endif
#include "shadows.sdr"
#include "lighting.sdr"
#include "gamma.sdr"
@@ -19,6 +23,96 @@ struct model_light {
vec3 direction;
};
#ifdef FEATURE_BINDLESS_TEXTURES
layout (std140) uniform modelData {
mat4 modelViewMatrix;
mat4 modelMatrix;
mat4 viewMatrix;
mat4 projMatrix;
mat4 textureMatrix;
mat4 shadow_mv_matrix;
mat4 shadow_proj_matrix[4];
mat4 envMatrix;
vec4 color;
model_light lights[MAX_LIGHTS];
float extrudeWidth;
float fogStart;
float fogScale;
int buffer_matrix_offset;
vec4 clip_equation;
float thruster_scale;
bool use_clip_plane;
int n_lights;
float defaultGloss;
vec3 ambientFactor;
int desaturate;
vec3 diffuseFactor;
int blend_alpha;
vec3 emissionFactor;
bool overrideDiffuse;
vec3 diffuseClr;
bool overrideGlow;
vec3 glowClr;
bool overrideSpec;
vec3 specClr;
bool alphaGloss;
bool gammaSpec;
bool envGloss;
bool alpha_spec;
int effect_num;
vec4 fogColor;
vec3 base_color;
float anim_timer;
vec3 stripe_color;
float vpwidth;
float vpheight;
bool team_glow_enabled;
float znear;
float zfar;
float veryneardist;
float neardist;
float middist;
float fardist;
vec2 normalAlphaMinMax;
int sBasemapIndex;
int sGlowmapIndex;
int sSpecmapIndex;
int sNormalmapIndex;
int sAmbientmapIndex;
int sMiscmapIndex;
sampler2DArray sBasemap;
sampler2DArray sGlowmap;
sampler2DArray sSpecmap;
samplerCube sEnvmap;
sampler2DArray sNormalmap;
sampler2DArray sAmbientmap;
sampler2DArray sMiscmap;
sampler2DArray sHeightmap;
};
#else
layout (std140) uniform modelData {
mat4 modelViewMatrix;
mat4 modelMatrix;
@@ -95,6 +189,17 @@ layout (std140) uniform modelData {
int sAmbientmapIndex;
int sMiscmapIndex;
};
uniform sampler2DArray sBasemap;
uniform sampler2DArray sGlowmap;
uniform sampler2DArray sSpecmap;
uniform samplerCube sEnvmap;
uniform sampler2DArray sNormalmap;
uniform sampler2DArray sAmbientmap;
uniform sampler2DArray sMiscmap;
#endif
uniform sampler2D sFramebuffer;
uniform sampler2DArray shadow_map;
in VertexOutput {
#ifdef FLAG_ENV_MAP
@@ -120,36 +225,9 @@ in VertexOutput {
#endif
} vertIn;
#ifdef FLAG_DIFFUSE_MAP
uniform sampler2DArray sBasemap;
#endif
#ifdef FLAG_GLOW_MAP
uniform sampler2DArray sGlowmap;
#endif
#ifdef FLAG_SPEC_MAP
uniform sampler2DArray sSpecmap;
#endif
#ifdef FLAG_ENV_MAP
uniform samplerCube sEnvmap;
#endif
#ifdef FLAG_NORMAL_MAP
uniform sampler2DArray sNormalmap;
#endif
#ifdef FLAG_AMBIENT_MAP
uniform sampler2DArray sAmbientmap;
#endif
#ifdef FLAG_ANIMATED
uniform sampler2D sFramebuffer;
#endif
#ifdef FLAG_TEAMCOLOR
vec2 teamMask = vec2(0.0, 0.0);
#endif
#ifdef FLAG_MISC_MAP
uniform sampler2DArray sMiscmap;
#endif
#ifdef FLAG_SHADOWS
uniform sampler2DArray shadow_map;
#endif
out vec4 fragOut0;
out vec4 fragOut1;
+95
View File
@@ -1,5 +1,9 @@
#extension GL_ARB_gpu_shader5: enable
#ifdef FEATURE_BINDLESS_TEXTURES
#extension GL_ARB_bindless_texture : require
#endif
layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
#ifdef GL_ARB_gpu_shader5
@@ -19,6 +23,96 @@ struct model_light {
vec3 direction;
};
#ifdef FEATURE_BINDLESS_TEXTURES
layout (std140) uniform modelData {
mat4 modelViewMatrix;
mat4 modelMatrix;
mat4 viewMatrix;
mat4 projMatrix;
mat4 textureMatrix;
mat4 shadow_mv_matrix;
mat4 shadow_proj_matrix[4];
mat4 envMatrix;
vec4 color;
model_light lights[MAX_LIGHTS];
float extrudeWidth;
float fogStart;
float fogScale;
int buffer_matrix_offset;
vec4 clip_equation;
float thruster_scale;
bool use_clip_plane;
int n_lights;
float defaultGloss;
vec3 ambientFactor;
int desaturate;
vec3 diffuseFactor;
int blend_alpha;
vec3 emissionFactor;
bool overrideDiffuse;
vec3 diffuseClr;
bool overrideGlow;
vec3 glowClr;
bool overrideSpec;
vec3 specClr;
bool alphaGloss;
bool gammaSpec;
bool envGloss;
bool alpha_spec;
int effect_num;
vec4 fogColor;
vec3 base_color;
float anim_timer;
vec3 stripe_color;
float vpwidth;
float vpheight;
bool team_glow_enabled;
float znear;
float zfar;
float veryneardist;
float neardist;
float middist;
float fardist;
vec2 normalAlphaMinMax;
int sBasemapIndex;
int sGlowmapIndex;
int sSpecmapIndex;
int sNormalmapIndex;
int sAmbientmapIndex;
int sMiscmapIndex;
sampler2DArray sBasemap;
sampler2DArray sGlowmap;
sampler2DArray sSpecmap;
samplerCube sEnvmap;
sampler2DArray sNormalmap;
sampler2DArray sAmbientmap;
sampler2DArray sMiscmap;
sampler2DArray sHeightmap;
};
#else
layout (std140) uniform modelData {
mat4 modelViewMatrix;
mat4 modelMatrix;
@@ -95,6 +189,7 @@ layout (std140) uniform modelData {
int sAmbientmapIndex;
int sMiscmapIndex;
};
#endif
in VertexOutput {
#ifdef FLAG_ENV_MAP
+95 -3
View File
@@ -1,4 +1,7 @@
#extension GL_ARB_gpu_shader5: enable
#ifdef FEATURE_BINDLESS_TEXTURES
#extension GL_ARB_bindless_texture : require
#endif
#include "shadows.sdr"
@@ -22,6 +25,96 @@ struct model_light {
vec3 direction;
};
#ifdef FEATURE_BINDLESS_TEXTURES
layout (std140) uniform modelData {
mat4 modelViewMatrix;
mat4 modelMatrix;
mat4 viewMatrix;
mat4 projMatrix;
mat4 textureMatrix;
mat4 shadow_mv_matrix;
mat4 shadow_proj_matrix[4];
mat4 envMatrix;
vec4 color;
model_light lights[MAX_LIGHTS];
float extrudeWidth;
float fogStart;
float fogScale;
int buffer_matrix_offset;
vec4 clip_equation;
float thruster_scale;
bool use_clip_plane;
int n_lights;
float defaultGloss;
vec3 ambientFactor;
int desaturate;
vec3 diffuseFactor;
int blend_alpha;
vec3 emissionFactor;
bool overrideDiffuse;
vec3 diffuseClr;
bool overrideGlow;
vec3 glowClr;
bool overrideSpec;
vec3 specClr;
bool alphaGloss;
bool gammaSpec;
bool envGloss;
bool alpha_spec;
int effect_num;
vec4 fogColor;
vec3 base_color;
float anim_timer;
vec3 stripe_color;
float vpwidth;
float vpheight;
bool team_glow_enabled;
float znear;
float zfar;
float veryneardist;
float neardist;
float middist;
float fardist;
vec2 normalAlphaMinMax;
int sBasemapIndex;
int sGlowmapIndex;
int sSpecmapIndex;
int sNormalmapIndex;
int sAmbientmapIndex;
int sMiscmapIndex;
sampler2DArray sBasemap;
sampler2DArray sGlowmap;
sampler2DArray sSpecmap;
samplerCube sEnvmap;
sampler2DArray sNormalmap;
sampler2DArray sAmbientmap;
sampler2DArray sMiscmap;
sampler2DArray sHeightmap;
};
#else
layout (std140) uniform modelData {
mat4 modelViewMatrix;
mat4 modelMatrix;
@@ -98,11 +191,10 @@ layout (std140) uniform modelData {
int sAmbientmapIndex;
int sMiscmapIndex;
};
#ifdef FLAG_TRANSFORM
uniform samplerBuffer transform_tex;
#endif
uniform samplerBuffer transform_tex;
out VertexOutput {
#ifdef FLAG_ENV_MAP
vec3 envReflect;
+1 -1
View File
@@ -16,7 +16,7 @@ struct def_file
const size_t size;
};
#include "def_files/generated_def_files-generic.inc"
#include "def_files/generated_def_files-generic.h"
default_file defaults_get_file(const char *filename)
{
+1 -2
View File
@@ -4,7 +4,6 @@
*/
#include "globalincs/pstypes.h"
#include "def_files/def_files.h"
#include <iterator>
@@ -21,7 +20,7 @@ struct def_file
def_file Default_files[] =
{
#include "def_files/generated_def_files-win32.inc"
#include "def_files/generated_def_files-win32.h"
};
default_file defaults_get_file(const char *filename)
+2 -2
View File
@@ -29,7 +29,7 @@ IF(MSVC)
file(WRITE "${GENERATED_SOURCE_DIR}/code/default_files.rc" "${RES_CONTENT}")
configure_file("def_files/generated_def_files-win32.inc.in" "${GENERATED_SOURCE_DIR}/code/def_files/generated_def_files-win32.inc")
configure_file("def_files/generated_def_files-win32.h.in" "${GENERATED_SOURCE_DIR}/code/def_files/generated_def_files-win32.h")
target_sources(code INTERFACE "${GENERATED_SOURCE_DIR}/code/default_files.rc")
else()
@@ -76,7 +76,7 @@ else()
LIST(APPEND DEF_OUT_FILES ${ALL_OUTPUTS})
ENDFOREACH(file)
configure_file("def_files/generated_def_files-generic.inc.in" "${GENERATED_SOURCE_DIR}/code/def_files/generated_def_files-generic.inc")
configure_file("def_files/generated_def_files-generic.h.in" "${GENERATED_SOURCE_DIR}/code/def_files/generated_def_files-generic.h")
target_sources(code PRIVATE ${DEF_OUT_FILES})
SOURCE_GROUP("Generated Files\\Default Files" FILES ${DEF_OUT_FILES})
+3 -3
View File
@@ -19,10 +19,10 @@
#include "globalincs/toolchain.h"
#include "utils/strings.h"
#include <cstdio> // For NULL, etc
#include <cstdlib>
#include <stdio.h> // For NULL, etc
#include <stdlib.h>
#include <memory.h>
#include <cstring>
#include <string.h>
#include <algorithm>
#include <cstdint>
+2 -8
View File
@@ -61,6 +61,8 @@
#define SIZE_T_ARG "%zu"
#define PTRDIFF_T_ARG "%zd"
#define NOEXCEPT noexcept
#define likely(x) __builtin_expect((long) !!(x), 1L)
#define unlikely(x) __builtin_expect((long) !!(x), 0L)
@@ -73,11 +75,3 @@
#else
#define FALLTHROUGH
#endif
#ifndef CLANG_ANALYZER_NORETURN
#if __has_feature(attribute_analyzer_noreturn)
#define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
#else
#define CLANG_ANALYZER_NORETURN
#endif
#endif
-5
View File
@@ -58,8 +58,3 @@
* Some compilers issue a warning if a fallthrough is detected. This define can be used to suppress that warning.
*/
#define FALLTHROUGH
/**
* @brief Specifies that an analyzer should consider this function as no-return
*/
#define CLANG_ANALYZER_NORETURN
+2 -2
View File
@@ -60,6 +60,8 @@
#define SIZE_T_ARG "%zu"
#define PTRDIFF_T_ARG "%zd"
#define NOEXCEPT noexcept
#define likely(x) __builtin_expect((long) !!(x), 1L)
#define unlikely(x) __builtin_expect((long) !!(x), 0L)
@@ -70,5 +72,3 @@
#else
#define FALLTHROUGH
#endif
#define CLANG_ANALYZER_NORETURN
+2 -2
View File
@@ -55,6 +55,8 @@
#define SIZE_T_ARG "%zu"
#define PTRDIFF_T_ARG "%zd"
#define NOEXCEPT noexcept
#define likely(x) __builtin_expect((long) !!(x), 1L)
#define unlikely(x) __builtin_expect((long) !!(x), 0L)
@@ -67,5 +69,3 @@
#else
#define FALLTHROUGH
#endif
#define CLANG_ANALYZER_NORETURN
+7 -2
View File
@@ -74,11 +74,16 @@
#define PTRDIFF_T_ARG "%Iu"
#define SIZE_T_ARG "%Id"
/* The 'noexcept' keyword is not defined in versions before VS 2015. */
#if _MSC_VER < 1900
# define NOEXCEPT
#else
# define NOEXCEPT noexcept
#endif
#define likely(x)
#define unlikely(x)
#define USED_VARIABLE
#define FALLTHROUGH
#define CLANG_ANALYZER_NORETURN
+3
View File
@@ -1125,6 +1125,9 @@ bool gr_init(std::unique_ptr<os::GraphicsOperations>&& graphicsOps, int d_mode,
gpu_heap_init();
mprintf(("Checking graphics capabilities:\n"));
mprintf((" Bindless texturing: %s\n", gr_is_capable(CAPABILITY_BINDLESS_TEXTURING) ? "Enabled" : "Disabled"));
bool missing_installation = false;
if (!running_unittests && Web_cursor == nullptr) {
if (Is_standalone) {
+8 -1
View File
@@ -286,6 +286,7 @@ typedef enum gr_capability {
CAPABILITY_POINT_PARTICLES,
CAPABILITY_TIMESTAMP_QUERY,
CAPABILITY_SEPARATE_BLEND_FUNCTIONS,
CAPABILITY_BINDLESS_TEXTURING, //!< This is the ability to encode textures in uniform buffers
} gr_capability;
enum class gr_property {
@@ -757,7 +758,7 @@ typedef struct screen {
void (*gf_sphere)(material *material_def, float rad);
int (*gf_maybe_create_shader)(shader_type type, unsigned int flags);
void (*gf_recompile_all_shaders)(const std::function<void(size_t, size_t)>& progress_callback);
void (*gf_recompile_all_shaders)(std::function<void(size_t, size_t)>progress_callback);
void (*gf_clear_states)();
@@ -803,6 +804,8 @@ typedef struct screen {
void (*gf_sync_delete)(gr_sync sync);
void (*gf_set_viewport)(int x, int y, int width, int height);
uint64_t (*gf_get_texture_handle)(int bitmap_handle, int bitmap_type);
} screen;
// handy macro
@@ -1108,6 +1111,10 @@ inline void gr_sync_delete(gr_sync sync) {
(*gr_screen.gf_sync_delete)(sync);
}
inline uint64_t gr_get_texture_handle(int bitmap, int bitmap_type) {
return (*gr_screen.gf_get_texture_handle)(bitmap, bitmap_type);
}
// color functions
void gr_get_color( int *r, int *g, int b );
void gr_init_color(color *c, int r, int g, int b);
+6
View File
@@ -385,6 +385,10 @@ void gr_stub_delete_query_object(int obj)
{
}
uint64_t gr_stub_get_texture_handle(int bitmap_handle, int bitmap_type) {
return 0;
}
bool gr_stub_init()
{
if (gr_screen.res != GR_640) {
@@ -532,5 +536,7 @@ bool gr_stub_init()
gr_screen.gf_bind_uniform_buffer = [](uniform_block_type, size_t, size_t, int) {};
gr_screen.gf_get_texture_handle = gr_stub_get_texture_handle;
return true;
}
+1 -1
View File
@@ -254,7 +254,7 @@ public:
void set_batching(bool enabled);
bool is_batched() const;
uint get_shader_flags() const override;
virtual uint get_shader_flags() const override;
void set_fog(int r, int g, int b, float near, float far);
void set_fog();
+2 -2
View File
@@ -157,11 +157,11 @@ opengl::ShaderProgram::~ShaderProgram() {
}
}
opengl::ShaderProgram::ShaderProgram(ShaderProgram&& other) SCP_NOEXCEPT : _program_id(0), Uniforms(this) {
opengl::ShaderProgram::ShaderProgram(ShaderProgram&& other): _program_id(0), Uniforms(this) {
*this = std::move(other);
}
opengl::ShaderProgram& opengl::ShaderProgram::operator=(ShaderProgram&& other) SCP_NOEXCEPT {
opengl::ShaderProgram& opengl::ShaderProgram::operator=(ShaderProgram&& other) {
std::swap(_program_id, other._program_id);
std::swap(Uniforms, other.Uniforms);
+2 -2
View File
@@ -91,8 +91,8 @@ class ShaderProgram {
ShaderProgram(const ShaderProgram&) SCP_DELETED_FUNCTION;
ShaderProgram& operator=(const ShaderProgram&) SCP_DELETED_FUNCTION;
ShaderProgram(ShaderProgram&& other) SCP_NOEXCEPT;
ShaderProgram& operator=(ShaderProgram&& other) SCP_NOEXCEPT;
ShaderProgram(ShaderProgram&& other);
ShaderProgram& operator=(ShaderProgram&& other);
void use();
+4
View File
@@ -1194,6 +1194,8 @@ void opengl_setup_function_pointers()
gr_screen.gf_set_viewport = gr_opengl_set_viewport;
gr_screen.gf_get_texture_handle = gr_opengl_get_texture_handle;
// NOTE: All function pointers here should have a Cmdline_nohtl check at the top
// if they shouldn't be run in non-HTL mode, Don't keep separate entries.
// *****************************************************************************
@@ -1581,6 +1583,8 @@ bool gr_opengl_is_capable(gr_capability capability)
return GLAD_GL_ARB_timer_query != 0; // Timestamp queries are available from 3.3 onwards
case CAPABILITY_SEPARATE_BLEND_FUNCTIONS:
return GLAD_GL_ARB_draw_buffers_blend != 0; // We need an OpenGL extension for this
case CAPABILITY_BINDLESS_TEXTURING:
return GLAD_GL_ARB_bindless_texture != 0 && !Cmdline_no_bindless_textures;
}
return false;
+20 -4
View File
@@ -240,15 +240,24 @@ static opengl_shader_variant_t GL_shader_variants[] = {
static const int GL_num_shader_variants = sizeof(GL_shader_variants) / sizeof(opengl_shader_variant_t);
struct opengl_shader_feature {
const char* shader_define;
std::function<bool()> feature_test;
};
static SCP_vector<opengl_shader_feature> GL_shader_features = {
{ "FEATURE_BINDLESS_TEXTURES", []() { return gr_opengl_is_capable(CAPABILITY_BINDLESS_TEXTURING); } },
};
opengl_shader_t *Current_shader = NULL;
opengl_shader_t::opengl_shader_t() : shader(SDR_TYPE_NONE), flags(0), flags2(0)
{
}
opengl_shader_t::opengl_shader_t(opengl_shader_t&& other) SCP_NOEXCEPT {
opengl_shader_t::opengl_shader_t(opengl_shader_t&& other) {
*this = std::move(other);
}
opengl_shader_t& opengl_shader_t::operator=(opengl_shader_t&& other) SCP_NOEXCEPT {
opengl_shader_t& opengl_shader_t::operator=(opengl_shader_t&& other) {
// VS2013 doesn't support implicit move constructors so we need to explicitly declare it
shader = other.shader;
flags = other.flags;
@@ -362,6 +371,13 @@ static SCP_string opengl_shader_get_header(shader_type type_id, int flags, shade
sflags << "#define " << variant.flag_text << "\n";
}
}
// Check the global shader features
for (auto& feature : GL_shader_features) {
if (feature.feature_test()) {
sflags << "#define " << feature.shader_define << "\n";
}
}
}
return sflags.str();
@@ -522,7 +538,7 @@ static bool do_shader_caching() {
return true;
}
static bool load_cached_shader_binary(opengl::ShaderProgram* program, const SCP_string& hash) {
static bool load_cached_shader_binary(opengl::ShaderProgram* program, SCP_string hash) {
if (!do_shader_caching()) {
return false;
}
@@ -824,7 +840,7 @@ int opengl_compile_shader(shader_type sdr, uint flags)
return sdr_index;
}
void gr_opengl_recompile_all_shaders(const std::function<void(size_t, size_t)>& progress_callback)
void gr_opengl_recompile_all_shaders(std::function<void(size_t, size_t)>progress_callback)
{
for (auto sdr = GL_shader.begin(); sdr != GL_shader.end(); ++sdr)
{
+3 -3
View File
@@ -132,8 +132,8 @@ typedef struct opengl_shader_t {
opengl_shader_t();
opengl_shader_t(opengl_shader_t&& other) SCP_NOEXCEPT;
opengl_shader_t& operator=(opengl_shader_t&& other) SCP_NOEXCEPT;
opengl_shader_t(opengl_shader_t&& other);
opengl_shader_t& operator=(opengl_shader_t&& other);
opengl_shader_t(const opengl_shader_t&) = delete;
opengl_shader_t& operator=(const opengl_shader_t&) = delete;
@@ -144,7 +144,7 @@ extern SCP_vector<opengl_shader_t> GL_shader;
extern opengl_shader_t *Current_shader;
int gr_opengl_maybe_create_shader(shader_type shader_t, unsigned int flags);
void gr_opengl_recompile_all_shaders(const std::function<void(size_t, size_t)>& progress_callback = nullptr);
void gr_opengl_recompile_all_shaders(std::function<void(size_t, size_t)> progress_callback = nullptr);
void opengl_delete_shader(int sdr_handle);
void opengl_shader_set_current(opengl_shader_t *shader_obj = NULL);
void opengl_shader_set_current(int handle);
+33
View File
@@ -1903,6 +1903,39 @@ void gr_opengl_bm_generate_mip_maps(int slot)
glGenerateMipmap(ts->texture_target);
}
uint64_t gr_opengl_get_texture_handle(int bitmap, int bitmap_type) {
Assertion(gr_opengl_is_capable(CAPABILITY_BINDLESS_TEXTURING),
"Bindless texturing is not supported! Support must be checked before calling gr_get_texture_handle().");
int n = bm_get_cache_slot (bitmap, 1);
tcache_slot_opengl *t = &Textures[n];
if (t->texture_handle != 0) {
// We already have a texture handle for this texture
return t->texture_handle;
}
if (!bm_is_render_target(bitmap) && t->bitmap_handle < 0)
{
GL_state.Texture.SetActiveUnit(0);
auto ret_val = opengl_create_texture( bitmap, bitmap_type, t );
if (!ret_val) {
return 0;
}
}
// everything went ok
if (t->texture_id) {
t->texture_handle = glGetTextureHandleARB(t->texture_id);
// Always make the handles resident. Could be replaced by more sophisticated handling later
glMakeTextureHandleResidentARB(t->texture_handle);
}
return t->texture_handle;
}
//
// End of GL_EXT_framebuffer_object stuff
+4
View File
@@ -18,6 +18,7 @@
typedef struct tcache_slot_opengl {
GLuint texture_id;
GLuint64 texture_handle; // Handle for bindless texturing
GLenum texture_target;
GLenum wrap_mode;
float u_scale, v_scale;
@@ -39,6 +40,7 @@ typedef struct tcache_slot_opengl {
void reset()
{
texture_id = 0;
texture_handle = 0;
texture_target = GL_TEXTURE_2D;
wrap_mode = GL_REPEAT;
u_scale = 1.0f;
@@ -93,4 +95,6 @@ GLuint opengl_get_rtt_framebuffer();
void gr_opengl_bm_generate_mip_maps(int slot);
void gr_opengl_get_texture_scale(int bitmap_handle, float *u_scale, float *v_scale);
uint64_t gr_opengl_get_texture_handle(int bitmap, int bitmap_type);
#endif //_GROPENGLTEXTURE_H
+64 -57
View File
@@ -773,73 +773,80 @@ void opengl_tnl_set_model_material(model_material *material_info)
}
uint32_t array_index;
if ( Current_shader->flags & SDR_FLAG_MODEL_DIFFUSE_MAP ) {
Current_shader->program->Uniforms.setUniformi("sBasemap", render_pass);
if (!gr_opengl_is_capable(CAPABILITY_BINDLESS_TEXTURING)) {
// If we don't have bindless texturing support then we have to pass the texture the old-fashioned way
if ( Current_shader->flags & SDR_FLAG_MODEL_DIFFUSE_MAP ) {
Current_shader->program->Uniforms.setUniformi("sBasemap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_BASE_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
gr_opengl_tcache_set(material_info->get_texture_map(TM_BASE_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
if ( Current_shader->flags & SDR_FLAG_MODEL_GLOW_MAP ) {
Current_shader->program->Uniforms.setUniformi("sGlowmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_GLOW_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
if ( Current_shader->flags & SDR_FLAG_MODEL_SPEC_MAP ) {
Current_shader->program->Uniforms.setUniformi("sSpecmap", render_pass);
if ( material_info->get_texture_map(TM_SPEC_GLOSS_TYPE) > 0 ) {
gr_opengl_tcache_set(material_info->get_texture_map(TM_SPEC_GLOSS_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
} else {
gr_opengl_tcache_set(material_info->get_texture_map(TM_SPECULAR_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
++render_pass;
if ( Current_shader->flags & SDR_FLAG_MODEL_ENV_MAP ) {
Current_shader->program->Uniforms.setUniformi("sEnvmap", render_pass);
if ( Current_shader->flags & SDR_FLAG_MODEL_GLOW_MAP ) {
Current_shader->program->Uniforms.setUniformi("sGlowmap", render_pass);
gr_opengl_tcache_set(ENVMAP, TCACHE_TYPE_CUBEMAP, &u_scale, &v_scale, &array_index, render_pass);
Assertion(array_index == 0, "Cube map arrays are not supported yet!");
gr_opengl_tcache_set(material_info->get_texture_map(TM_GLOW_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
if ( Current_shader->flags & SDR_FLAG_MODEL_SPEC_MAP ) {
Current_shader->program->Uniforms.setUniformi("sSpecmap", render_pass);
if ( material_info->get_texture_map(TM_SPEC_GLOSS_TYPE) > 0 ) {
gr_opengl_tcache_set(material_info->get_texture_map(TM_SPEC_GLOSS_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
} else {
gr_opengl_tcache_set(material_info->get_texture_map(TM_SPECULAR_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
}
++render_pass;
if ( Current_shader->flags & SDR_FLAG_MODEL_ENV_MAP ) {
Current_shader->program->Uniforms.setUniformi("sEnvmap", render_pass);
gr_opengl_tcache_set(ENVMAP, TCACHE_TYPE_CUBEMAP, &u_scale, &v_scale, &array_index, render_pass);
Assertion(array_index == 0, "Cube map arrays are not supported yet!");
++render_pass;
}
}
if ( Current_shader->flags & SDR_FLAG_MODEL_NORMAL_MAP ) {
Current_shader->program->Uniforms.setUniformi("sNormalmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_NORMAL_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
if ( Current_shader->flags & SDR_FLAG_MODEL_HEIGHT_MAP ) {
Current_shader->program->Uniforms.setUniformi("sHeightmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_HEIGHT_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
if ( Current_shader->flags & SDR_FLAG_MODEL_AMBIENT_MAP ) {
Current_shader->program->Uniforms.setUniformi("sAmbientmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_AMBIENT_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
if ( Current_shader->flags & SDR_FLAG_MODEL_MISC_MAP ) {
Current_shader->program->Uniforms.setUniformi("sMiscmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_MISC_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
}
if ( Current_shader->flags & SDR_FLAG_MODEL_NORMAL_MAP ) {
Current_shader->program->Uniforms.setUniformi("sNormalmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_NORMAL_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
if ( Current_shader->flags & SDR_FLAG_MODEL_HEIGHT_MAP ) {
Current_shader->program->Uniforms.setUniformi("sHeightmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_HEIGHT_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
if ( Current_shader->flags & SDR_FLAG_MODEL_AMBIENT_MAP ) {
Current_shader->program->Uniforms.setUniformi("sAmbientmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_AMBIENT_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
if ( Current_shader->flags & SDR_FLAG_MODEL_MISC_MAP ) {
Current_shader->program->Uniforms.setUniformi("sMiscmap", render_pass);
gr_opengl_tcache_set(material_info->get_texture_map(TM_MISC_TYPE), TCACHE_TYPE_NORMAL, &u_scale, &v_scale, &array_index, render_pass);
++render_pass;
}
// The rest of the textures are mostly static so bindless texturing doesn't matter too much here (and it would be
// hard to expose the handles to the outside without some serious refactoring)
if ( Current_shader->flags & SDR_FLAG_MODEL_SHADOWS ) {
Current_shader->program->Uniforms.setUniformi("shadow_map", render_pass);
+2 -2
View File
@@ -35,10 +35,10 @@ class NanoVGRenderer {
Image(const Image&) = delete;
Image& operator=(const Image&) = delete;
Image(Image&& other) SCP_NOEXCEPT {
Image(Image&& other) {
*this = std::move(other);
}
Image& operator=(Image&& other) SCP_NOEXCEPT {
Image& operator=(Image&& other) {
std::swap(bitmap, other.bitmap);
std::swap(data, other.data);
std::swap(type, other.type);
+3 -3
View File
@@ -21,12 +21,12 @@ namespace font {
TrueTypeFontData() : size(0) { }
TrueTypeFontData(TrueTypeFontData &&other) SCP_NOEXCEPT {
TrueTypeFontData(TrueTypeFontData &&other) {
std::swap(data, other.data);
size = other.size;
}
TrueTypeFontData &operator=(TrueTypeFontData &&other) SCP_NOEXCEPT {
TrueTypeFontData &operator=(TrueTypeFontData &&other) {
std::swap(data, other.data);
size = other.size;
@@ -203,4 +203,4 @@ namespace font {
static FSFont *currentFont;
};
}
}
+5 -5
View File
@@ -20,7 +20,7 @@ namespace font
public:
NVGFont();
~NVGFont() override;
virtual ~NVGFont();
int getHandle() const { return m_handle; }
float getSize() const { return m_size; }
@@ -34,12 +34,12 @@ namespace font
void setTabWidth(float tabWidth);
void setSpecialCharacterFont(font* fontData);
FontType getType() const override { return NVG_FONT; };
virtual FontType getType() const SCP_OVERRIDE { return NVG_FONT; };
float getTextHeight() const override;
virtual float getTextHeight() const SCP_OVERRIDE;
void getStringSize(const char *text, size_t textLen, int resize_mode,
float *width, float *height) const override;
virtual void getStringSize(const char *text, size_t textLen, int resize_mode,
float *width, float *height) const SCP_OVERRIDE;
void computeFontMetrics() override;
+6 -6
View File
@@ -25,12 +25,12 @@ namespace font
*
* @param [in] fnt A pointer to the font data. Has to be non-null
*/
explicit VFNTFont(font *fnt);
VFNTFont(font *fnt);
/**
* @brief Destroys the allocated font pointer
*/
~VFNTFont() override;
~VFNTFont();
/**
* @brief Gets the font data struct.
@@ -44,7 +44,7 @@ namespace font
*
* @return The type.
*/
FontType getType() const override;
virtual FontType getType() const SCP_OVERRIDE;
/**
* @brief Gets the height of this font
@@ -53,7 +53,7 @@ namespace font
*
* @return The height.
*/
float getTextHeight() const override;
virtual float getTextHeight() const SCP_OVERRIDE;
/**
* @brief Gets the size of the specified string in pixels.
@@ -64,7 +64,7 @@ namespace font
* @param [out] width If non-null, the width.
* @param [out] height If non-null, the height.
*/
void
getStringSize(const char* text, size_t textLen, int resize_mode, float* width, float* height) const override;
virtual void getStringSize(const char *text, size_t textLen,
int resize_mode, float *width, float *height) const SCP_OVERRIDE;
};
}
+51 -6
View File
@@ -72,7 +72,7 @@ void convert_model_material(model_uniform_data* data_out,
}
if (shader_flags & SDR_FLAG_MODEL_LIGHT) {
int num_lights = MIN(Num_active_gr_lights, (int)graphics::MAX_UNIFORM_LIGHTS);
int num_lights = MIN(Num_active_gr_lights, (int) graphics::MAX_UNIFORM_LIGHTS);
data_out->n_lights = num_lights;
std::copy(std::begin(gr_light_uniforms), std::end(gr_light_uniforms), std::begin(data_out->lights));
@@ -187,15 +187,15 @@ void convert_model_material(model_uniform_data* data_out,
}
}
if ( shader_flags & SDR_FLAG_MODEL_NORMAL_MAP ) {
if (shader_flags & SDR_FLAG_MODEL_NORMAL_MAP) {
data_out->sNormalmapIndex = bm_get_array_index(material.get_texture_map(TM_NORMAL_TYPE));
}
if ( shader_flags & SDR_FLAG_MODEL_AMBIENT_MAP ) {
if (shader_flags & SDR_FLAG_MODEL_AMBIENT_MAP) {
data_out->sAmbientmapIndex = bm_get_array_index(material.get_texture_map(TM_AMBIENT_TYPE));
}
if ( shader_flags & SDR_FLAG_MODEL_MISC_MAP ) {
if (shader_flags & SDR_FLAG_MODEL_MISC_MAP) {
data_out->sMiscmapIndex = bm_get_array_index(material.get_texture_map(TM_MISC_TYPE));
}
@@ -240,8 +240,6 @@ void convert_model_material(model_uniform_data* data_out,
data_out->stripe_color = stripe_color;
data_out->base_color = base_color;
data_out->team_glow_enabled = bm_has_alpha_channel(material.get_texture_map(TM_MISC_TYPE)) ? 1 : 0;
}
if (shader_flags & SDR_FLAG_MODEL_THRUSTER) {
@@ -272,5 +270,52 @@ void convert_model_material(model_uniform_data* data_out,
}
}
void convert_bindless_model_material(model_uniform_data_bindless* data_out,
const model_material& material,
const matrix4& model_transform,
const vec3d& scale,
size_t transform_buffer_offset) {
// Convert the normal data with the existing function
convert_model_material(&data_out->model_data, material, model_transform, scale, transform_buffer_offset);
auto shader_flags = material.get_shader_flags();
if ( shader_flags & SDR_FLAG_MODEL_DIFFUSE_MAP ) {
data_out->sBasemap = gr_get_texture_handle(material.get_texture_map(TM_BASE_TYPE), TCACHE_TYPE_NORMAL);
}
if ( shader_flags & SDR_FLAG_MODEL_GLOW_MAP ) {
data_out->sGlowmap = gr_get_texture_handle(material.get_texture_map(TM_GLOW_TYPE), TCACHE_TYPE_NORMAL);
}
if ( shader_flags & SDR_FLAG_MODEL_SPEC_MAP ) {
if ( material.get_texture_map(TM_SPEC_GLOSS_TYPE) > 0 ) {
data_out->sSpecmap = gr_get_texture_handle(material.get_texture_map(TM_SPEC_GLOSS_TYPE), TCACHE_TYPE_NORMAL);
} else {
data_out->sSpecmap = gr_get_texture_handle(material.get_texture_map(TM_SPECULAR_TYPE), TCACHE_TYPE_NORMAL);
}
if ( shader_flags & SDR_FLAG_MODEL_ENV_MAP ) {
data_out->sEnvmap = gr_get_texture_handle(ENVMAP, TCACHE_TYPE_CUBEMAP);
}
}
if ( shader_flags & SDR_FLAG_MODEL_NORMAL_MAP ) {
data_out->sNormalmap = gr_get_texture_handle(material.get_texture_map(TM_NORMAL_TYPE), TCACHE_TYPE_NORMAL);
}
if ( shader_flags & SDR_FLAG_MODEL_HEIGHT_MAP ) {
data_out->sHeightmap = gr_get_texture_handle(material.get_texture_map(TM_HEIGHT_TYPE), TCACHE_TYPE_NORMAL);
}
if ( shader_flags & SDR_FLAG_MODEL_AMBIENT_MAP ) {
data_out->sAmbientmap = gr_get_texture_handle(material.get_texture_map(TM_AMBIENT_TYPE), TCACHE_TYPE_NORMAL);
}
if ( shader_flags & SDR_FLAG_MODEL_MISC_MAP ) {
data_out->sMiscmap = gr_get_texture_handle(material.get_texture_map(TM_MISC_TYPE), TCACHE_TYPE_NORMAL);
}
}
}
}
+6
View File
@@ -18,5 +18,11 @@ void convert_model_material(model_uniform_data* data_out,
const vec3d& scale,
size_t transform_buffer_offset);
void convert_bindless_model_material(model_uniform_data_bindless* data_out,
const model_material& material,
const matrix4& model_transform,
const vec3d& scale,
size_t transform_buffer_offset);
}
}
+2 -2
View File
@@ -57,10 +57,10 @@ bool UniformBuffer::isInUse() {
// Fence still exists and has not been signaled yet. The buffer is still in use
return true;
}
UniformBuffer::UniformBuffer(UniformBuffer&& other) SCP_NOEXCEPT : _aligner(0, 0) {
UniformBuffer::UniformBuffer(UniformBuffer&& other) : _aligner(0, 0) {
*this = std::move(other);
}
UniformBuffer& UniformBuffer::operator=(UniformBuffer&& other) SCP_NOEXCEPT {
UniformBuffer& UniformBuffer::operator=(UniformBuffer&& other) {
std::swap(_buffer_obj, other._buffer_obj);
std::swap(_aligner, other._aligner);
std::swap(_sync_obj, other._sync_obj);
+2 -2
View File
@@ -27,8 +27,8 @@ class UniformBuffer {
UniformBuffer(const UniformBuffer&) = delete;
UniformBuffer& operator=(const UniformBuffer&) = delete;
UniformBuffer(UniformBuffer&& other) SCP_NOEXCEPT;
UniformBuffer& operator=(UniformBuffer&& other) SCP_NOEXCEPT;
UniformBuffer(UniformBuffer&& other);
UniformBuffer& operator=(UniformBuffer&& other);
inline UniformAligner& aligner() {
return _aligner;
+5 -1
View File
@@ -10,7 +10,11 @@ size_t getElementSize(uniform_block_type type) {
case uniform_block_type::Lights:
return sizeof(graphics::deferred_light_data);
case uniform_block_type::ModelData:
return sizeof(graphics::model_uniform_data);
if (gr_is_capable(CAPABILITY_BINDLESS_TEXTURING)) {
return sizeof(graphics::model_uniform_data_bindless);
} else {
return sizeof(graphics::model_uniform_data);
}
case uniform_block_type::NanoVGData:
return sizeof(graphics::nanovg_draw_data);
case uniform_block_type::DecalInfo:
+16
View File
@@ -143,6 +143,22 @@ struct model_uniform_data {
int sMiscmapIndex;
};
struct model_uniform_data_bindless {
model_uniform_data model_data;
uint64_t sBasemap;
uint64_t sGlowmap;
uint64_t sSpecmap;
uint64_t sEnvmap;
uint64_t sNormalmap;
uint64_t sAmbientmap;
uint64_t sMiscmap;
uint64_t sHeightmap;
};
enum class NanoVGShaderType: int32_t {
FillGradient = 0, FillImage = 1, Simple = 2, Image = 3
};
+22 -22
View File
@@ -337,8 +337,8 @@ public:
void initBitmaps(const char *fname);
void initTextOffsets(int x, int y);
void initValueOffsets(int x, int y);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeTextWarnings: public HudGauge // HUD_TEXT_FLASH
@@ -347,8 +347,8 @@ class HudGaugeTextWarnings: public HudGauge // HUD_TEXT_FLASH
bool flash_flags;
public:
HudGaugeTextWarnings();
void render(float frametime) override;
void initialize() override;
void render(float frametime);
void initialize();
int maybeTextFlash();
};
@@ -363,8 +363,8 @@ public:
void initBitmaps(const char *fname);
void initTextOffsets(int x, int y);
void initTextValueOffsets(int x, int y);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeLag: public HudGauge
@@ -376,8 +376,8 @@ class HudGaugeLag: public HudGauge
public:
HudGaugeLag();
void initBitmaps(const char *fname);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
void startFlashLag(int duration = 1400);
bool maybeFlashLag(bool flash_fast = false);
@@ -407,14 +407,14 @@ public:
void initRedAlertTextOffsetY(int y);
void initRedAlertValueOffsetY(int y);
void render(float frametime) override;
virtual void render(float frametime);
void startFlashNotify(int duration = 1400);
bool maybeFlashNotify(bool flash_fast = false);
void renderObjective();
void renderRedAlert();
void renderSubspace();
void pageIn() override;
void initialize() override;
void pageIn();
void initialize();
};
class HudGaugeDamage: public HudGauge
@@ -467,9 +467,9 @@ public:
void initSubsysIntegValueOffsetX(int x);
void initBottomBgOffset(int offset);
void initLineHeight(int h);
void render(float frametime) override;
void pageIn() override;
void initialize() override;
void render(float frametime);
void pageIn();
void initialize();
};
class HudGaugeSupport: public HudGauge
@@ -488,8 +488,8 @@ public:
void initTextValueOffsetY(int y);
void initTextDockOffsetX(int x);
void initTextDockValueOffsetX(int x);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeMultiMsg: public HudGauge
@@ -497,8 +497,8 @@ class HudGaugeMultiMsg: public HudGauge
protected:
public:
HudGaugeMultiMsg();
bool canRender() override;
void render(float frametime) override;
bool canRender();
void render(float frametime);
};
class HudGaugeVoiceStatus: public HudGauge
@@ -506,7 +506,7 @@ class HudGaugeVoiceStatus: public HudGauge
protected:
public:
HudGaugeVoiceStatus();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugePing: public HudGauge
@@ -514,14 +514,14 @@ class HudGaugePing: public HudGauge
protected:
public:
HudGaugePing();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeSupernova: public HudGauge
{
public:
HudGaugeSupernova();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeFlightPath: public HudGauge
@@ -533,7 +533,7 @@ public:
HudGaugeFlightPath();
void initBitmap(const char *fname);
void initHalfSize(int w, int h);
void render(float frametime) override;
void render(float frametime);
};
HudGauge* hud_get_gauge(const char* name);
+1 -1
View File
@@ -45,7 +45,7 @@ public:
void initMinTargetBoxSizes(int w, int h);
void initMinSubTargetBoxSizes(int w, int h);
void initBitmaps(char *fname);
void render(float frametime) override;
void render(float frametime) SCP_OVERRIDE;
void renderObjectBrackets(object *targetp, color *clr, int w_correction, int h_correction, int flags);
void renderNavBrackets(vec3d* nav_pos, vertex* nav_point, color* clr, char* string);
void renderBoundingBrackets(int x1, int y1, int x2, int y2, int w_correction, int h_correction, float distance, int target_objnum, int flags);
+2 -2
View File
@@ -68,8 +68,8 @@ public:
void initShipNameMaxWidth(int w);
void initRightAlignNames(bool align);
int setGaugeColorEscort(int index, int team);
void render(float frametime) override;
void pageIn() override;
virtual void render(float frametime);
void pageIn();
void renderIcon(int x, int y, int index);
void renderIconDogfight(int x, int y, int index);
};
+7 -7
View File
@@ -81,30 +81,30 @@ public:
void initLetter(char _letter); // obligatory PC Load Letter joke. (Swifty)
void initBarHeight(int _ets_bar_h);
void initBitmaps(char *fname);
void blitGauge(int index);
void render(float frametime) override;
void pageIn() override;
virtual void blitGauge(int index);
virtual void render(float frametime);
void pageIn();
};
class HudGaugeEtsWeapons: public HudGaugeEts
{
public:
HudGaugeEtsWeapons();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeEtsShields: public HudGaugeEts
{
public:
HudGaugeEtsShields();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeEtsEngines: public HudGaugeEts
{
public:
HudGaugeEtsEngines();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeEtsRetail: public HudGaugeEts
@@ -114,7 +114,7 @@ protected:
int Gauge_positions[num_retail_ets_gauges];
public:
HudGaugeEtsRetail();
void render(float frametime) override;
void render(float frametime);
void initLetters(char *_letters);
void initGaugePositions(int *_gauge_positions);
};
+3 -3
View File
@@ -55,11 +55,11 @@ public:
void initTargetBoxSize(int w, int h);
void initLoopLockedAnim(bool loop);
void render(float frametime) override;
void render(float frametime);
void renderLockTriangles(int center_x, int center_y, float frametime);
void renderLockTrianglesOld(int center_x, int center_y, int radius);
void pageIn() override;
void initialize() override;
void pageIn();
void initialize();
};
#endif
+10 -10
View File
@@ -113,10 +113,10 @@ public:
void processMessageBuffer();
void addPending(const char *text, int source, int x = 0);
void scrollMessages();
void preprocess() override;
void render(float frametime) override;
void initialize() override;
void pageIn() override;
void preprocess();
void render(float frametime);
void initialize();
void pageIn();
};
class HudGaugeTalkingHead: public HudGauge // HUD_TALKING_HEAD
@@ -136,10 +136,10 @@ public:
void initHeaderOffsets(int x, int y);
void initAnimOffsets(int x, int y);
void initAnimSizes(int w, int h);
void pageIn() override;
void render(float frametime) override;
void initialize() override;
bool canRender() override;
void pageIn();
void render(float frametime);
void initialize();
bool canRender();
anim_instance* createAnim(int anim_start_frame, anim* anim_data);
};
@@ -149,8 +149,8 @@ class HudGaugeFixedMessages: public HudGauge
public:
HudGaugeFixedMessages();
void initCenterText(bool center);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
#endif
+9 -9
View File
@@ -44,9 +44,9 @@ protected:
int firepoint_scale_y;
public:
HudGaugeReticle();
void render(float frametime) override;
void render(float frametime);
void initBitmaps(char *fname);
void pageIn() override;
void pageIn();
void initFirepointDisplay(bool firepoint, int scaleX, int scaleY, int size);
void getFirepointStatus();
};
@@ -101,14 +101,14 @@ public:
void showBackground(bool show);
void initBitmaps(char *fname);
void render(float frametime) override;
void render(float frametime);
void renderThrottleSpeed(float current_speed, int y_end);
void renderThrottleLine(int y);
void renderThrottleForeground(int y_end);
void renderThrottleBackground(int y_end);
void renderMatchSpeedIcon(int x, int y);
void pageIn() override;
void pageIn();
};
class HudGaugeThreatIndicator: public HudGauge
@@ -132,9 +132,9 @@ public:
void initBitmaps(char *fname_arc, char *fname_laser, char *fname_lock);
void initLaserWarnOffsets(int x, int y);
void initLockWarnOffsets(int x, int y);
void render(float frametime) override;
void initialize() override;
void pageIn() override;
void render(float frametime);
void initialize();
void pageIn();
void renderLaserThreat();
void renderLockThreat();
};
@@ -159,8 +159,8 @@ public:
char *fname_secondary_link_1,
char *fname_secondary_link_2,
char *fname_secondary_link_3);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
void hud_init_reticle();
+5 -5
View File
@@ -57,7 +57,7 @@ protected:
public:
HudGaugeShield();
HudGaugeShield(int _gauge_object, int _gauge_config);
void render(float frametime) override;
virtual void render(float frametime);
void showShields(object *objp, int mode);
int maybeFlashShield(int target_index, int shield_offset);
void renderShieldIcon(coord2d coords[6]);
@@ -68,7 +68,7 @@ class HudGaugeShieldPlayer: public HudGaugeShield
protected:
public:
HudGaugeShieldPlayer();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeShieldTarget: public HudGaugeShield
@@ -76,7 +76,7 @@ class HudGaugeShieldTarget: public HudGaugeShield
protected:
public:
HudGaugeShieldTarget();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeShieldMini: public HudGauge
@@ -96,7 +96,7 @@ public:
int maybeFlashShield(int target_index, int shield_offset);
void showMiniShields(object *objp);
void showIntegrity(float p_target_integrity);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
#endif /* __FREESPACE_HUDSHIELDBOX_H__ */
+4 -4
View File
@@ -196,10 +196,10 @@ public:
void initPgUpOffsets(int x, int y);
void initPgDnOffsets(int x, int y);
void render(float frametime) override;
bool canRender() override;
void pageIn() override;
void initialize() override;
void render(float frametime);
bool canRender();
void pageIn();
void initialize();
void startFlashPageScroll(int duration = 1400);
bool maybeFlashPageScroll(bool flash_fast = false);
};
+31 -31
View File
@@ -198,8 +198,8 @@ public:
void initBitmaps(char *fname);
void initOnColor(int r, int g, int b, int a);
void initOffColor(int r, int g, int b, int a);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeAutoSpeed: public HudGauge
@@ -221,8 +221,8 @@ public:
void initBitmaps(char *fname);
void initOnColor(int r, int g, int b, int a);
void initOffColor(int r, int g, int b, int a);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeCmeasures: public HudGauge
@@ -237,8 +237,8 @@ public:
void initBitmaps(char *fname);
void initCountTextOffsets(int x, int y);
void initCountValueOffsets(int x, int y);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeAfterburner: public HudGauge
@@ -251,8 +251,8 @@ public:
HudGaugeAfterburner();
void initEnergyHeight(int h);
void initBitmaps(char *fname);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeWeaponEnergy: public HudGauge
@@ -282,8 +282,8 @@ public:
void initShowBallistics(bool show_ballistics);
void initAlignments(int text_align, int armed_align);
void initArmedOffsets(int x, int y, int h, bool show);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeWeapons: public HudGauge
@@ -342,8 +342,8 @@ public:
void initSecondaryHeights(int top_h, int text_h);
void initLinkIcon();
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
void maybeFlashWeapon(int index);
};
@@ -383,8 +383,8 @@ public:
void initEntryHeight(int h);
void initLinkIcon();
void render(float frametime) override;
void pageIn() override;
virtual void render(float frametime);
void pageIn();
void maybeFlashWeapon(int index);
};
@@ -400,7 +400,7 @@ public:
void initPrimaryNameOffsetX(int x);
void initPrimaryAmmoOffsetX(int x);
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeSecondaryWeapons: public HudGaugeWeaponList
@@ -419,7 +419,7 @@ public:
void initSecondaryLinkedOffsetX(int x);
void initSecondaryUnlinkedOffsetX(int x);
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeHardpoints: public HudGauge
@@ -439,7 +439,7 @@ public:
void initDrawOptions(bool primary_models, bool secondary_models);
HudGaugeHardpoints();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeWarheadCount: public HudGauge
@@ -462,8 +462,8 @@ public:
void initMaxSymbols(int count);
void initMaxColumns(int count);
void initTextAlign(int align);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
};
class HudGaugeOrientationTee: public HudGauge
@@ -473,9 +473,9 @@ protected:
public:
HudGaugeOrientationTee();
void initRadius(int length);
void render(float frametime) override;
void render(float frametime);
void renderOrientation(object *from_objp, object *to_objp, matrix *from_orientp);
void pageIn() override;
void pageIn();
};
class HudGaugeReticleTriangle: public HudGauge
@@ -490,7 +490,7 @@ public:
void initRadius(int length);
void initTriBase(float length);
void initTriHeight(float h);
void render(float frametime) override;
virtual void render(float frametime);
void renderTriangle(vec3d *hostile_pos, int aspect_flag, int show_interior, int split_tri);
void renderTriangleMissileTail(float ang, float xpos, float ypos, float cur_dist, int draw_solid, int draw_inside);
};
@@ -500,7 +500,7 @@ class HudGaugeHostileTriangle: public HudGaugeReticleTriangle
protected:
public:
HudGaugeHostileTriangle();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeTargetTriangle: public HudGaugeReticleTriangle
@@ -508,7 +508,7 @@ class HudGaugeTargetTriangle: public HudGaugeReticleTriangle
protected:
public:
HudGaugeTargetTriangle();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeMissileTriangles: public HudGaugeReticleTriangle
@@ -516,7 +516,7 @@ class HudGaugeMissileTriangles: public HudGaugeReticleTriangle
protected:
public:
HudGaugeMissileTriangles();
void render(float frametime) override;
void render(float frametime);
};
class HudGaugeOffscreen: public HudGauge
@@ -532,10 +532,10 @@ public:
void initMaxFrontSeperation(float length);
void initTriBase(float length);
void initTriHeight(float length);
void render(float frametime) override;
void render(float frametime);
void calculatePosition(vertex* target_point, vec3d *tpos, vec2d *outcoords, int *dir, float *half_triangle_sep);
void renderOffscreenIndicator(vec2d *coords, int dir, float distance, float half_triangle_sep, bool draw_solid = true);
void pageIn() override;
void pageIn();
};
class HudGaugeLeadIndicator: public HudGauge
@@ -547,12 +547,12 @@ public:
HudGaugeLeadIndicator();
void initHalfSize(float w, float h);
void initBitmaps(char *fname);
void render(float frametime) override;
void render(float frametime);
void renderIndicator(int frame_offset, object *targetp, vec3d *lead_target_pos);
void renderLeadCurrentTarget();
void renderLeadQuick(vec3d *target_pos, object *targetp);
int pickFrame(float prange, float srange, float dist_to_target);
void pageIn() override;
void pageIn();
};
class HudGaugeLeadSight: public HudGauge
@@ -563,9 +563,9 @@ protected:
public:
HudGaugeLeadSight();
void initBitmaps(char *fname);
void render(float frametime) override;
void render(float frametime);
void renderSight(int indicator_frame, vec3d *target_pos, vec3d *lead_target_pos);
void pageIn() override;
void pageIn();
};
#endif
+6 -6
View File
@@ -107,9 +107,9 @@ public:
void initDisabledStatusOffsets(int x, int y, bool activate);
void initDesaturate(bool desaturate);
void initialize() override;
void pageIn() override;
void render(float frametime) override;
void initialize();
void pageIn();
void render(float frametime);
void renderTargetShip(object *target_objp);
void renderTargetWeapon(object *target_objp);
void renderTargetDebris(object *target_objp);
@@ -149,13 +149,13 @@ public:
void initOrderOffsets(int x, int y);
void initOrderMaxWidth(int width);
void updateFrame();
void render(float frametime) override;
void initialize() override;
void render(float frametime);
void initialize();
void initDockFlashTimer();
void startFlashDock(int duration=TBOX_FLASH_DURATION);
int maybeFlashDock(int flash_fast=0);
void endFlashDock();
void pageIn() override;
void pageIn();
};
void hud_targetbox_init();
+3 -3
View File
@@ -74,9 +74,9 @@ public:
void initWingmate5Offsets(int x, int y);
void initWingmate6Offsets(int x, int y);
void initGrowMode(int mode);
void pageIn() override;
void initialize() override;
void render(float frametime) override;
void pageIn();
void initialize();
void render(float frametime);
void renderBackground(int num_wings_to_draw);
void renderDots(int wing_index, int screen_index, int num_wings_to_draw);
void initFlash();
+2 -2
View File
@@ -66,12 +66,12 @@ namespace io
namespace mouse
{
Cursor::Cursor(Cursor&& other) SCP_NOEXCEPT
Cursor::Cursor(Cursor&& other)
{
*this = std::move(other);
}
Cursor& Cursor::operator=(Cursor&& other) SCP_NOEXCEPT
Cursor& Cursor::operator=(Cursor&& other)
{
std::swap(this->mAnimationFrames, other.mAnimationFrames);
+2 -2
View File
@@ -43,14 +43,14 @@ namespace io
*
* Transfers SDL resources to this newly constructed object
*/
Cursor(Cursor&& other) SCP_NOEXCEPT;
Cursor(Cursor&& other);
/**
* @brief Move operator
*
* Transfers SDL resources to this object
*/
Cursor& operator=(Cursor&& other) SCP_NOEXCEPT;
Cursor& operator=(Cursor&& other);
/**
* @brief Cursor destructor
+2 -2
View File
@@ -326,7 +326,7 @@ namespace joystick
fillValues();
}
Joystick::Joystick(Joystick &&other) SCP_NOEXCEPT :
Joystick::Joystick(Joystick &&other) :
_joystick(nullptr)
{
*this = std::move(other);
@@ -341,7 +341,7 @@ namespace joystick
}
}
Joystick &Joystick::operator=(Joystick &&other) SCP_NOEXCEPT
Joystick &Joystick::operator=(Joystick &&other)
{
std::swap(_device_id, other._device_id);
std::swap(_joystick, other._joystick);
+2 -2
View File
@@ -67,7 +67,7 @@ namespace io
*
* @param other A rvalue reference
*/
Joystick(Joystick &&other) SCP_NOEXCEPT;
Joystick(Joystick &&other);
/**
* @brief Frees the owned SDL handle
@@ -79,7 +79,7 @@ namespace io
*
* @param other A rvalue reference to the other object
*/
Joystick &operator=(Joystick &&other) SCP_NOEXCEPT;
Joystick &operator=(Joystick &&other);
/**
* @brief Determines if this joystick is still connected to the computer
+2 -2
View File
@@ -58,7 +58,7 @@ CJumpNode::CJumpNode(vec3d *position) : m_radius(0.0f), m_modelnum(-1), m_objnum
m_objnum = obj_create(OBJ_JUMP_NODE, -1, -1, NULL, &m_pos, m_radius, default_flags);
}
CJumpNode::CJumpNode(CJumpNode&& other) SCP_NOEXCEPT
CJumpNode::CJumpNode(CJumpNode&& other)
: m_radius(other.m_radius), m_modelnum(other.m_modelnum), m_objnum(other.m_objnum), m_flags(other.m_flags)
{
other.m_radius = 0.0f;
@@ -72,7 +72,7 @@ CJumpNode::CJumpNode(CJumpNode&& other) SCP_NOEXCEPT
strcpy_s(m_name, other.m_name);
}
CJumpNode& CJumpNode::operator=(CJumpNode&& other) SCP_NOEXCEPT
CJumpNode& CJumpNode::operator=(CJumpNode&& other)
{
if (this != &other)
{
+2 -2
View File
@@ -47,9 +47,9 @@ public:
//Constructors
CJumpNode();
CJumpNode(vec3d *position);
CJumpNode(CJumpNode&& other) SCP_NOEXCEPT;
CJumpNode(CJumpNode&& other);
CJumpNode& operator=(CJumpNode&&) SCP_NOEXCEPT;
CJumpNode& operator=(CJumpNode&&);
//Destructor
~CJumpNode();
+5 -5
View File
@@ -1611,16 +1611,16 @@ SCP_string get_directory_or_vp(char* path)
found = result.find(".vp");
}
auto directory_name_pos = result.rfind(DIR_SEPARATOR_CHAR, found - strlen(DIR_SEPARATOR_STR) - 1);
auto directory_name_pos = result.rfind(DIR_SEPARATOR_STR, found - strlen(DIR_SEPARATOR_STR) - 1);
result = result.substr(directory_name_pos, found - directory_name_pos);
found = result.find(DIR_SEPARATOR_CHAR);
found = result.find(DIR_SEPARATOR_STR);
//Strip directory separators
while (found != std::string::npos)
{
result.erase(found, strlen(DIR_SEPARATOR_STR));
found = result.find(DIR_SEPARATOR_CHAR);
found = result.find(DIR_SEPARATOR_STR);
}
return result;
@@ -1834,7 +1834,7 @@ void labviewer_make_background_window(Button* caller)
SCP_map<SCP_string, SCP_vector<SCP_string>> directories;
char fullpath[MAX_PATH_LEN];
for (const auto& filename : missions)
for (auto filename : missions)
{
cf_find_file_location((filename + ".fs2").c_str(), CF_TYPE_MISSIONS, sizeof(fullpath) - 1, fullpath, NULL, NULL);
auto location = get_directory_or_vp(fullpath);
@@ -1854,7 +1854,7 @@ void labviewer_make_background_window(Button* caller)
auto directoryItem = Mission_directories[i];
directoryItem = missiontree->AddItem(NULL, directory.first);
for (const auto& Lab_mission : directory.second)
for (auto Lab_mission : directory.second)
{
missiontree->AddItem(directoryItem, Lab_mission, 0, true, labviewer_change_background);
}
+39 -39
View File
@@ -282,7 +282,7 @@ public:
//CONSTRUCTION/DESTRUCTION
//Derive your class's constructer from the GUIObject one
GUIObject(const SCP_string &in_Name="", int x_coord = 0, int y_coord = 0, int x_width = -1, int y_height = -1, int in_style = 0);
~GUIObject() override;
~GUIObject();
void Delete();
//CHILD FUNCTIONS
@@ -315,7 +315,7 @@ private:
SCP_vector<GUIObject*> DeletionCache;
public:
GUIScreen(const SCP_string &in_Name="");
~GUIScreen() override;
~GUIScreen();
ObjectClassInfoEntry *GetObjectClassInfo(GUIObject *cgp);
@@ -427,13 +427,13 @@ class Window : public GUIObject
shader WindowShade;
protected:
void DoDraw(float frametime) override;
void DoMove(int dx, int dy) override;
int DoRefreshSize() override;
int DoMouseOver(float frametime) override;
int DoMouseDown(float frametime) override;
int DoMouseUp(float frametime) override;
int DoMouseOut(float frametime) override;
void DoDraw(float frametime);
void DoMove(int dx, int dy);
int DoRefreshSize();
int DoMouseOver(float frametime);
int DoMouseDown(float frametime);
int DoMouseUp(float frametime);
int DoMouseOut(float frametime);
bool HasChildren(){return NOT_EMPTY(&Children);}
public:
@@ -462,11 +462,11 @@ class Button : public GUIObject
bool IsDown; //Does it look pressed?
protected:
void DoDraw(float frametime) override;
int DoRefreshSize() override;
int DoMouseDown(float frametime) override;
int DoMouseUp(float frametime) override;
int DoMouseOut(float frametime) override;
void DoDraw(float frametime);
int DoRefreshSize();
int DoMouseDown(float frametime);
int DoMouseUp(float frametime);
int DoMouseOut(float frametime);
public:
Button(const SCP_string &in_caption, int x_coord, int y_coord, void (*in_function)(Button *caller) = NULL, int x_width = -1, int y_height = -1, int in_style = 0);
@@ -511,7 +511,7 @@ public:
void ClearAllItems();
TreeItem();
~TreeItem() override;
~TreeItem();
};
class Tree : public GUIObject
@@ -528,12 +528,12 @@ class Tree : public GUIObject
void CalcItemsSize(TreeItem *items, int *DrawData);
void DrawItems(TreeItem *items);
protected:
void DoDraw(float frametime) override;
void DoMove(int dx, int dy) override;
int DoRefreshSize() override;
int DoMouseOver(float frametime) override;
int DoMouseDown(float frametime) override;
int DoMouseUp(float frametime) override;
void DoDraw(float frametime);
void DoMove(int dx, int dy);
int DoRefreshSize();
int DoMouseOver(float frametime);
int DoMouseDown(float frametime);
int DoMouseUp(float frametime);
public:
Tree(const SCP_string &in_name, int x_coord, int y_coord, void* in_associateditem = NULL, int x_width = -1, int y_width = -1, int in_style = 0);
@@ -590,10 +590,10 @@ class Text : public GUIObject
union{int SaveMin;float flSaveMin;uint uSaveMin;};
protected:
void DoDraw(float frametime) override;
int DoRefreshSize() override;
int DoMouseDown(float frametime) override;
int DoKeyPress(float frametime) override;
void DoDraw(float frametime);
int DoRefreshSize();
int DoMouseDown(float frametime);
int DoKeyPress(float frametime);
public:
Text(const SCP_string &in_name, const SCP_string &in_content, int x_coord, int y_coord, int x_width = -1, int y_width = -1, int in_style = 0);
@@ -636,13 +636,13 @@ class Checkbox : public GUIObject
int HighlightStatus;
protected:
void DoDraw(float frametime) override;
void DoMove(int dx, int dy) override;
int DoRefreshSize() override;
int DoMouseOver(float frametime) override;
int DoMouseDown(float frametime) override;
int DoMouseUp(float frametime) override;
int DoMouseOut(float frametime) override;
void DoDraw(float frametime);
void DoMove(int dx, int dy);
int DoRefreshSize();
int DoMouseOver(float frametime);
int DoMouseDown(float frametime);
int DoMouseUp(float frametime);
int DoMouseOut(float frametime);
public:
Checkbox(const SCP_string &in_label, int x_coord, int y_coord, void (*in_function)(Checkbox *caller) = NULL, int x_width = -1, int y_height = DEFAULT_BUTTON_HEIGHT, int in_style = 0);
@@ -719,8 +719,8 @@ class ImageAnim : public GUIObject
int PlayType;
int ImageFlags;
protected:
void DoDraw(float frametime) override;
int DoRefreshSize() override;
void DoDraw(float frametime);
int DoRefreshSize();
public:
ImageAnim(const SCP_string &in_name, const SCP_string &in_imagename, int x_coord, int y_coord, int x_width = -1, int y_width = -1, int in_style = 0);
@@ -754,11 +754,11 @@ class Slider : public GUIObject
float GetSliderPos(int x);
void UpdateSlider(int x);
protected:
void DoDraw(float frametime) override;
void DoMove(int dx, int dy) override;
int DoRefreshSize() override;
int DoMouseDown(float frametime) override;
int DoMouseUp(float frametime) override;
void DoDraw(float frametime);
void DoMove(int dx, int dy);
int DoRefreshSize();
int DoMouseDown(float frametime);
int DoMouseUp(float frametime);
public:
Slider(const SCP_string &in_label, float min, float max, int x_coord, int y_coord, void(*in_function)(Slider *caller) = NULL, int x_width = -1, int y_height = DEFAULT_BUTTON_HEIGHT, int in_style = 0);
+2 -2
View File
@@ -13,8 +13,8 @@ void initialize();
class FFmpegException: public std::runtime_error {
public:
explicit FFmpegException(const std::string& msg) : std::runtime_error(msg) {}
~FFmpegException() SCP_NOEXCEPT override {}
FFmpegException(const std::string& msg) : std::runtime_error(msg) {}
~FFmpegException() throw() {}
};
}
-1
View File
@@ -67,7 +67,6 @@ FFmpegContext::~FFmpegContext() {
av_free(m_ctx->pb->buffer);
}
av_free(m_ctx->pb);
m_ctx->pb = nullptr;
}
avformat_close_input(&m_ctx);
-2
View File
@@ -18,8 +18,6 @@
#include "globalincs/pstypes.h"
#include <cfloat>
extern float frand();
extern int rand_chance(float frametime, float chance = 1.0f);
float frand_range(float min, float max);
+6 -6
View File
@@ -49,9 +49,9 @@ public:
void initTextStartOffsets(int x, int y);
void initTextHeight(int h);
void initMaxLineWidth(int w);
void render(float frametime) override;
void pageIn() override;
bool canRender() override;
void render(float frametime);
void pageIn();
bool canRender();
};
class HudGaugeTrainingMessages: public HudGauge
@@ -59,9 +59,9 @@ class HudGaugeTrainingMessages: public HudGauge
protected:
public:
HudGaugeTrainingMessages();
void render(float frametime) override;
void pageIn() override;
bool canRender() override;
void render(float frametime);
void pageIn();
bool canRender();
};
#endif /* __MISSIONTRAINING_H__ */
+19 -7
View File
@@ -543,7 +543,7 @@ void model_draw_list::render_buffer(queued_buffer_draw &render_elements)
gr_bind_uniform_buffer(uniform_block_type::ModelData,
render_elements.uniform_buffer_offset,
sizeof(graphics::model_uniform_data),
render_elements.uniform_data_size,
_dataBuffer->bufferHandle());
gr_render_model(&render_elements.render_material, render_elements.vert_src, render_elements.buffer, render_elements.texi);
@@ -797,6 +797,7 @@ void model_draw_list::build_uniform_buffer() {
TRACE_SCOPE(tracing::BuildModelUniforms);
_dataBuffer = gr_get_uniform_buffer(uniform_block_type::ModelData);
auto bindless_textures = gr_is_capable(CAPABILITY_BINDLESS_TEXTURING);
for (auto render_index : Render_keys) {
auto& queued_draw = Render_elements[render_index];
@@ -810,12 +811,23 @@ void model_draw_list::build_uniform_buffer() {
Scene_light_handler.resetLightState();
}
auto element = _dataBuffer->aligner().addTypedElement<graphics::model_uniform_data>();
graphics::uniforms::convert_model_material(element,
queued_draw.render_material,
queued_draw.transform,
queued_draw.scale,
queued_draw.transform_buffer_offset);
if (bindless_textures) {
auto element = _dataBuffer->aligner().addTypedElement<graphics::model_uniform_data_bindless>();
graphics::uniforms::convert_bindless_model_material(element,
queued_draw.render_material,
queued_draw.transform,
queued_draw.scale,
queued_draw.transform_buffer_offset);
queued_draw.uniform_data_size = sizeof(graphics::model_uniform_data_bindless);
} else {
auto element = _dataBuffer->aligner().addTypedElement<graphics::model_uniform_data>();
graphics::uniforms::convert_model_material(element,
queued_draw.render_material,
queued_draw.transform,
queued_draw.scale,
queued_draw.transform_buffer_offset);
queued_draw.uniform_data_size = sizeof(graphics::model_uniform_data);
}
queued_draw.uniform_buffer_offset = _dataBuffer->aligner().getCurrentOffset();
}
+1
View File
@@ -183,6 +183,7 @@ struct queued_buffer_draw
{
size_t transform_buffer_offset = 0;
size_t uniform_buffer_offset = 0;
size_t uniform_data_size = 0;
model_material render_material;
+7 -6
View File
@@ -228,7 +228,8 @@ public:
passwd.assign(newPasswd);
}
void execute() override {
virtual void execute()
{
if (hasName) {
strcpy_s(Netgame.name, name.c_str());
strcpy_s(Multi_options_g.std_pname, name.c_str());
@@ -257,7 +258,7 @@ public:
: mPlayerId(playerId) {
}
void execute() override {
virtual void execute() {
size_t foundPlayerIndex = MAX_PLAYERS;
for (size_t idx = 0; idx < MAX_PLAYERS; idx++) {
if (MULTI_CONNECTED(Net_players[idx])) {
@@ -277,14 +278,14 @@ private:
class ShutdownServerCommand: public WebapiCommand {
public:
void execute() override {
virtual void execute() {
gameseq_post_event(GS_EVENT_QUIT_GAME);
}
};
class UpdateMissionsCommand: public WebapiCommand {
public:
void execute() override {
virtual void execute() {
if (MULTI_IS_TRACKER_GAME) {
// delete mvalid.cfg if it exists
cf_delete(MULTI_VALID_MISSION_FILE, CF_TYPE_DATA);
@@ -297,14 +298,14 @@ public:
class ResetGameCommand: public WebapiCommand {
public:
void execute() override {
virtual void execute() {
multi_quit_game(PROMPT_NONE);
}
};
class ResetFs2NetCommand: public WebapiCommand {
public:
void execute() override {
virtual void execute() {
fs2netd_reset_connection();
}
};
+1 -1
View File
@@ -232,7 +232,7 @@ void obj_render(object* obj);
void obj_queue_render(object* obj, model_draw_list* scene);
//Sorts and renders all the ojbects
void obj_render_all(const std::function<void(object*)>& render_function, bool* render_viewer_last );
void obj_render_all(std::function<void(object*)> render_function, bool* render_viewer_last );
//move all objects for the current frame
void obj_move_all(float frametime); // moves all objects
+1 -1
View File
@@ -169,7 +169,7 @@ inline bool obj_render_is_model(object *obj)
}
// Sorts all the objects by Z and renders them
void obj_render_all(const std::function<void(object*)>& render_function, bool *draw_viewer_last )
void obj_render_all(std::function<void(object*)> render_function, bool *draw_viewer_last )
{
object *objp;
int i;
+4 -6
View File
@@ -51,9 +51,8 @@ namespace os
* @param linenum The source code line number where this function was called
* @param format An optional message to display in addition to the specified text
*/
void AssertMessage(const char* text, const char* filename, int linenum, SCP_FORMAT_STRING
const char* format = nullptr, ...)
SCP_FORMAT_STRING_ARGS(4, 5) CLANG_ANALYZER_NORETURN;
void AssertMessage(const char* text, const char* filename, int linenum,
SCP_FORMAT_STRING const char* format = nullptr, ...) SCP_FORMAT_STRING_ARGS(4, 5);
/**
* @brief Shows a lua error.
@@ -73,8 +72,7 @@ namespace os
* @param line The source code line number where this function was called
* @param format The error message to display (a format string)
*/
void Error(const char* filename, int line, SCP_FORMAT_STRING const char* format, ...)
SCP_FORMAT_STRING_ARGS(3, 4) CLANG_ANALYZER_NORETURN;
void Error(const char* filename, int line, SCP_FORMAT_STRING const char* format, ...) SCP_FORMAT_STRING_ARGS(3, 4);
/**
* @brief Shows an error dialog.
@@ -82,7 +80,7 @@ namespace os
*
* @param text The text to display
*/
void Error(const char* text) CLANG_ANALYZER_NORETURN;;
void Error(const char* text);
/**
* @brief Shows a warning dialog.
+2 -2
View File
@@ -351,8 +351,8 @@ namespace parse
class ParseException : public std::runtime_error
{
public:
explicit ParseException(const std::string& msg) : std::runtime_error(msg) {}
~ParseException() SCP_NOEXCEPT override {}
ParseException(const std::string& msg) : std::runtime_error(msg) {}
~ParseException() throw() {}
};
}
+1 -1
View File
@@ -123,7 +123,7 @@ void SourceOrigin::moveToObject(object* objp, vec3d* offset) {
m_offset = *offset;
}
void SourceOrigin::moveToParticle(const WeakParticlePtr& weakParticlePtr) {
void SourceOrigin::moveToParticle(WeakParticlePtr weakParticlePtr) {
m_originType = SourceOriginType::PARTICLE;
m_origin.m_particle = weakParticlePtr;
}
+1 -1
View File
@@ -121,7 +121,7 @@ class SourceOrigin {
* @brief Moves the source to the specified particle
* @param weakParticlePtr The hosting particle
*/
void moveToParticle(const WeakParticlePtr& weakParticlePtr);
void moveToParticle(WeakParticlePtr weakParticlePtr);
friend class ParticleSource;
};
+3 -4
View File
@@ -12,14 +12,13 @@ namespace particle
m_sources.push_back(source);
}
ParticleSourceWrapper::ParticleSourceWrapper(ParticleSourceWrapper&& other) SCP_NOEXCEPT
ParticleSourceWrapper::ParticleSourceWrapper(ParticleSourceWrapper&& other)
{
*this = std::move(other);
}
ParticleSourceWrapper::~ParticleSourceWrapper()
{
// Prevent empty wrapper from causing issues
if (!m_sources.empty())
{
@@ -28,7 +27,7 @@ namespace particle
}
}
ParticleSourceWrapper& ParticleSourceWrapper::operator=(ParticleSourceWrapper&& other) SCP_NOEXCEPT
ParticleSourceWrapper& ParticleSourceWrapper::operator=(ParticleSourceWrapper&& other)
{
std::swap(other.m_sources, m_sources);
return *this;
@@ -60,7 +59,7 @@ namespace particle
}
}
void ParticleSourceWrapper::moveToParticle(const WeakParticlePtr& ptr)
void ParticleSourceWrapper::moveToParticle(WeakParticlePtr ptr)
{
for (auto& source : m_sources)
{
+3 -3
View File
@@ -40,15 +40,15 @@ namespace particle
~ParticleSourceWrapper();
ParticleSourceWrapper(ParticleSourceWrapper&& other) SCP_NOEXCEPT;
ParticleSourceWrapper(ParticleSourceWrapper&& other);
ParticleSourceWrapper& operator=(ParticleSourceWrapper&& other) SCP_NOEXCEPT;
ParticleSourceWrapper& operator=(ParticleSourceWrapper&& other);
void finish();
void setCreationTimestamp(int timestamp);
void moveToParticle(const WeakParticlePtr& ptr);
void moveToParticle(WeakParticlePtr ptr);
void moveToObject(object* obj, vec3d* localPos);
+3 -3
View File
@@ -23,11 +23,11 @@ class BeamPiercingEffect: public ParticleEffect {
public:
BeamPiercingEffect() : ParticleEffect("") {}
bool processSource(const ParticleSource* source) override;
virtual bool processSource(const ParticleSource* source) override;
void parseValues(bool nocreate) override;
virtual void parseValues(bool nocreate) override;
void pageIn() override;
virtual void pageIn() override;
void setValues(int bitmapIndex, float radius, float velocity, float back_velocity, float variance);
};
+4 -4
View File
@@ -19,13 +19,13 @@ class CompositeEffect: public ParticleEffect {
public:
explicit CompositeEffect(const SCP_string& name);
bool processSource(const ParticleSource* source) override;
virtual bool processSource(const ParticleSource* source) override;
void parseValues(bool nocreate) override;
virtual void parseValues(bool nocreate) override;
void pageIn() override;
virtual void pageIn() override;
EffectType getType() const override { return EffectType::Composite; }
virtual EffectType getType() const override { return EffectType::Composite; }
const SCP_vector<ParticleEffectPtr>& getEffects() const { return m_childEffects; }
+4 -4
View File
@@ -84,7 +84,7 @@ class GenericShapeEffect : public ParticleEffect {
explicit GenericShapeEffect(const SCP_string& name) : ParticleEffect(name) {
}
bool processSource(const ParticleSource* source) override {
virtual bool processSource(const ParticleSource* source) override {
if (!m_timing.continueProcessing(source)) {
return false;
}
@@ -127,7 +127,7 @@ class GenericShapeEffect : public ParticleEffect {
return true;
}
void parseValues(bool nocreate) override {
virtual void parseValues(bool nocreate) override {
m_particleProperties.parse(nocreate);
m_shape.parse(nocreate);
@@ -172,9 +172,9 @@ class GenericShapeEffect : public ParticleEffect {
m_timing.applyToSource(&source);
}
EffectType getType() const override { return m_shape.getType(); }
virtual EffectType getType() const override { return m_shape.getType(); }
void pageIn() override {
virtual void pageIn() override {
m_particleProperties.pageIn();
}
@@ -19,11 +19,11 @@ class ParticleEmitterEffect: public ParticleEffect {
public:
ParticleEmitterEffect();
bool processSource(const ParticleSource* source) override;
virtual bool processSource(const ParticleSource* source) override;
void parseValues(bool nocreate) override;
virtual void parseValues(bool nocreate) override;
void pageIn() override;
virtual void pageIn() override;
void setValues(const particle_emitter& emitter, int bitmap, float range);
};
+5 -5
View File
@@ -22,15 +22,15 @@ class SingleParticleEffect: public ParticleEffect {
public:
explicit SingleParticleEffect(const SCP_string& name);
bool processSource(const ParticleSource* source) override;
virtual bool processSource(const ParticleSource* source) SCP_OVERRIDE;
void parseValues(bool nocreate) override;
virtual void parseValues(bool nocreate) SCP_OVERRIDE;
void pageIn() override;
virtual void pageIn() SCP_OVERRIDE;
void initializeSource(ParticleSource& source) override;
virtual void initializeSource(ParticleSource& source) SCP_OVERRIDE;
EffectType getType() const override { return EffectType::Single; }
virtual EffectType getType() const SCP_OVERRIDE { return EffectType::Single; }
util::ParticleProperties& getProperties() { return m_particleProperties; }
+2 -2
View File
@@ -41,12 +41,12 @@ class BinaryFileHandler: public FileHandler {
void endSectionWrite() override;
void startArrayWrite(const char* name, size_t size, bool short_length) override;
void startArrayWrite(const char* name, size_t size, bool short_length = false) override;
void endArrayWrite() override;
void flush() override;
virtual void flush() override;
};
}
+1 -1
View File
@@ -210,7 +210,7 @@ void pilotfile::update_stats_backout(scoring_struct *stats, bool training)
}
if (j >= 0) {
p_stats->medals_earned[j].val = std::max(0,p_stats->medals_earned[j].val--);
p_stats->medals_earned[j].val = MAX(0,p_stats->medals_earned[j].val--);
} else {
Assertion(true, "Medal '%s' not found, should have been added by pilotfile::update_stats.", Medals[stats->m_medal_earned].name);
}
+3 -3
View File
@@ -92,9 +92,9 @@ private:
class ApngException : public std::runtime_error
{
public:
explicit ApngException(const std::string& msg) : std::runtime_error(msg) {}
~ApngException() SCP_NOEXCEPT override {}
public:
ApngException(const std::string& msg) : std::runtime_error(msg) {}
~ApngException() throw() {}
};
}
+2 -2
View File
@@ -59,8 +59,8 @@ public:
void drawContactCircle( int x, int y, int rad );
void drawContactImage( int x, int y, int rad, int idx, int clr_idx, int size );
void drawCrosshairs(int x, int y);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
void plotBlip(blip *b, int *x, int *y);
void plotObject( object *objp );
};
+4 -4
View File
@@ -86,12 +86,12 @@ public:
void drawOutlinesHtl();
void setupViewHtl();
int calcAlpha(vec3d* pt);
void render(float frametime) override;
void pageIn() override;
void render(float frametime);
void pageIn();
void plotBlip(blip* b, vec3d *pos, float *alpha);
void onFrame(float frametime) override;
void initialize() override;
virtual void onFrame(float frametime);
virtual void initialize();
// Sound specific functions
void doLoopSnd();
Loaded 100 of 194 files, more files were not shown because too many files have changed in this diff. Show more