mirror of
https://github.com/ENSL/NS.git
synced 2024-11-22 12:41:33 +00:00
merge in postprocessing
This commit is contained in:
commit
dcb4de963d
43 changed files with 65457 additions and 230 deletions
|
@ -2,7 +2,7 @@
|
||||||
brightness "1"
|
brightness "1"
|
||||||
gamma "2.5"
|
gamma "2.5"
|
||||||
lightgamma "2.5"
|
lightgamma "2.5"
|
||||||
gl_use_shaders "1" // Use temporary gamma ramp replacement that utilizes HL25 shaders. It only adjusts to the average gamma value of ns maps instead of per-map.
|
cl_shader "1"
|
||||||
|
|
||||||
// Bobbing
|
// Bobbing
|
||||||
cl_bob "0.01"
|
cl_bob "0.01"
|
||||||
|
@ -34,4 +34,3 @@ echo "- Original HUD and crosshairs"
|
||||||
echo "- Original weapon and view bob"
|
echo "- Original weapon and view bob"
|
||||||
echo "- Original mix volumes for ambient sound and music"
|
echo "- Original mix volumes for ambient sound and music"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Note: 25th aniversary Half-Life and sv_allow_shaders 1 are required for the graphics to display properly at the moment."
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Lighting - temporary until new gamma ramp shader.
|
// Lighting - temporary until new gamma ramp shader.
|
||||||
brightness "1"
|
brightness "0"
|
||||||
gamma "2.5"
|
gamma "2.5"
|
||||||
lightgamma "2.25"
|
lightgamma "1.81"
|
||||||
gl_use_shaders "1"
|
cl_shader "1"
|
||||||
|
|
||||||
// Bobbing
|
// Bobbing
|
||||||
cl_bob "0.006"
|
cl_bob "0.006"
|
||||||
|
@ -34,4 +34,3 @@ echo "- Minimal marine HUD and new crosshair system"
|
||||||
echo "- Reduced weapon bobbing and no view bobbing"
|
echo "- Reduced weapon bobbing and no view bobbing"
|
||||||
echo "- Reduced ambient sound and music volumes"
|
echo "- Reduced ambient sound and music volumes"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Note: 25th aniversary Half-Life and sv_allow_shaders 1 are required for the graphics to display properly at the moment."
|
|
|
@ -2,7 +2,7 @@
|
||||||
brightness "2"
|
brightness "2"
|
||||||
gamma "3"
|
gamma "3"
|
||||||
lightgamma "2"
|
lightgamma "2"
|
||||||
gl_use_shaders "0"
|
cl_shader "0"
|
||||||
|
|
||||||
// No bobbing
|
// No bobbing
|
||||||
cl_bob "0"
|
cl_bob "0"
|
||||||
|
|
15
main/shaders/fs.shaders
Normal file
15
main/shaders/fs.shaders
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#version 330 core
|
||||||
|
|
||||||
|
in vec2 texCoord;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
uniform sampler2D textureSampler;
|
||||||
|
uniform float colorMultiplier; // Uniform float to multiply color by
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// Sample the texture
|
||||||
|
vec4 texColor = texture(textureSampler, texCoord);
|
||||||
|
|
||||||
|
// Multiply the color by the uniform float
|
||||||
|
fragColor = texColor * colorMultiplier;
|
||||||
|
}
|
10
main/shaders/vs.shaders
Normal file
10
main/shaders/vs.shaders
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#version 330 core
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 vertexPosition;
|
||||||
|
out vec2 texCoord;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// Pass the vertex position to the fragment shader
|
||||||
|
texCoord = (vertexPosition + 1.0) * 0.5; // Convert vertex position to texture coordinates
|
||||||
|
gl_Position = vec4(vertexPosition, 0.0, 1.0);
|
||||||
|
}
|
|
@ -69,6 +69,8 @@ TeamFortressViewport *gViewPort = NULL;
|
||||||
HINTERFACEMODULE g_hTrackerModule = NULL;
|
HINTERFACEMODULE g_hTrackerModule = NULL;
|
||||||
//ITrackerUser *g_pTrackerUser = NULL;
|
//ITrackerUser *g_pTrackerUser = NULL;
|
||||||
|
|
||||||
|
CPostProcessShader g_PostProcessShader;
|
||||||
|
|
||||||
void InitInput (void);
|
void InitInput (void);
|
||||||
void EV_HookEvents( void );
|
void EV_HookEvents( void );
|
||||||
void IN_Commands( void );
|
void IN_Commands( void );
|
||||||
|
@ -216,6 +218,8 @@ void CL_DLLEXPORT HUD_Init( void )
|
||||||
InitInput();
|
InitInput();
|
||||||
gHUD.Init();
|
gHUD.Init();
|
||||||
Scheme_Init();
|
Scheme_Init();
|
||||||
|
g_PostProcessShader.Init();
|
||||||
|
//gEngfuncs.Con_Printf("waterrenderer init %d", success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -261,6 +265,8 @@ HUD_Redraw
|
||||||
|
|
||||||
int CL_DLLEXPORT HUD_Redraw( float time, int intermission )
|
int CL_DLLEXPORT HUD_Redraw( float time, int intermission )
|
||||||
{
|
{
|
||||||
|
g_PostProcessShader.DrawShader();
|
||||||
|
|
||||||
// RecClHudRedraw(time, intermission);
|
// RecClHudRedraw(time, intermission);
|
||||||
|
|
||||||
gHUD.Redraw( time, intermission );
|
gHUD.Redraw( time, intermission );
|
||||||
|
|
|
@ -158,8 +158,8 @@
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\glew;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;GLEW_STATIC</PreprocessorDefinitions>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
|
@ -281,6 +281,22 @@
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\includes\glew\GL\glew.c">
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\util\ShaderUtil.cpp">
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="ammo.cpp">
|
<ClCompile Include="ammo.cpp">
|
||||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
|
||||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
|
||||||
|
@ -564,6 +580,14 @@
|
||||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="shader.cpp">
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
|
||||||
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="status_icons.cpp">
|
<ClCompile Include="status_icons.cpp">
|
||||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
|
||||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
|
||||||
|
@ -1615,7 +1639,6 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\util\Balance.cpp" />
|
<ClCompile Include="..\util\Balance.cpp" />
|
||||||
<ClCompile Include="..\util\Checksum.cpp" />
|
<ClCompile Include="..\util\Checksum.cpp" />
|
||||||
<ClCompile Include="..\util\GammaTable.cpp" />
|
|
||||||
<ClCompile Include="..\util\LinuxSupport.cpp" />
|
<ClCompile Include="..\util\LinuxSupport.cpp" />
|
||||||
<ClCompile Include="..\util\Mat3.cpp" />
|
<ClCompile Include="..\util\Mat3.cpp" />
|
||||||
<ClCompile Include="..\util\MathUtil.cpp" />
|
<ClCompile Include="..\util\MathUtil.cpp" />
|
||||||
|
@ -1627,6 +1650,10 @@
|
||||||
<ClCompile Include="..\textrep\TRFactory.cpp" />
|
<ClCompile Include="..\textrep\TRFactory.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\includes\glew\GL\eglew.h" />
|
||||||
|
<ClInclude Include="..\includes\glew\GL\glew.h" />
|
||||||
|
<ClInclude Include="..\includes\glew\GL\glxew.h" />
|
||||||
|
<ClInclude Include="..\includes\glew\GL\wglew.h" />
|
||||||
<ClInclude Include="..\mod\AvHAlienAbilities.h" />
|
<ClInclude Include="..\mod\AvHAlienAbilities.h" />
|
||||||
<ClInclude Include="..\mod\AvHAlienWeaponConstants.h" />
|
<ClInclude Include="..\mod\AvHAlienWeaponConstants.h" />
|
||||||
<ClInclude Include="..\mod\AvHAlienWeapons.h" />
|
<ClInclude Include="..\mod\AvHAlienWeapons.h" />
|
||||||
|
@ -1634,6 +1661,7 @@
|
||||||
<ClInclude Include="..\mod\AvHMarineWeapon.h" />
|
<ClInclude Include="..\mod\AvHMarineWeapon.h" />
|
||||||
<ClInclude Include="..\mod\AvHMarineWeaponConstants.h" />
|
<ClInclude Include="..\mod\AvHMarineWeaponConstants.h" />
|
||||||
<ClInclude Include="..\mod\AvHMarineWeapons.h" />
|
<ClInclude Include="..\mod\AvHMarineWeapons.h" />
|
||||||
|
<ClInclude Include="..\util\ShaderUtil.h" />
|
||||||
<ClInclude Include="ammo.h" />
|
<ClInclude Include="ammo.h" />
|
||||||
<ClInclude Include="ammohistory.h" />
|
<ClInclude Include="ammohistory.h" />
|
||||||
<ClInclude Include="..\game_shared\bitvec.h" />
|
<ClInclude Include="..\game_shared\bitvec.h" />
|
||||||
|
@ -1763,7 +1791,6 @@
|
||||||
<ClInclude Include="..\util\Balance.h" />
|
<ClInclude Include="..\util\Balance.h" />
|
||||||
<ClInclude Include="..\util\Checksum.h" />
|
<ClInclude Include="..\util\Checksum.h" />
|
||||||
<ClInclude Include="..\util\CString.h" />
|
<ClInclude Include="..\util\CString.h" />
|
||||||
<ClInclude Include="..\util\GammaTable.h" />
|
|
||||||
<ClInclude Include="..\util\LinuxSupport.h" />
|
<ClInclude Include="..\util\LinuxSupport.h" />
|
||||||
<ClInclude Include="..\util\Mat3.h" />
|
<ClInclude Include="..\util\Mat3.h" />
|
||||||
<ClInclude Include="..\util\MathUtil.h" />
|
<ClInclude Include="..\util\MathUtil.h" />
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
<Filter Include="textrep">
|
<Filter Include="textrep">
|
||||||
<UniqueIdentifier>{ad5bbb2c-1092-4ba3-ab5b-fdfa0a33f1f5}</UniqueIdentifier>
|
<UniqueIdentifier>{ad5bbb2c-1092-4ba3-ab5b-fdfa0a33f1f5}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Source Files\glew">
|
||||||
|
<UniqueIdentifier>{57cad65d-80b8-4d06-abb5-8ff8dc1d60cc}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="ammo.cpp">
|
<ClCompile Include="ammo.cpp">
|
||||||
|
@ -552,9 +555,6 @@
|
||||||
<ClCompile Include="..\util\Checksum.cpp">
|
<ClCompile Include="..\util\Checksum.cpp">
|
||||||
<Filter>util</Filter>
|
<Filter>util</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\util\GammaTable.cpp">
|
|
||||||
<Filter>util</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\util\LinuxSupport.cpp">
|
<ClCompile Include="..\util\LinuxSupport.cpp">
|
||||||
<Filter>util</Filter>
|
<Filter>util</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -600,6 +600,15 @@
|
||||||
<ClCompile Include="hudgl.cpp">
|
<ClCompile Include="hudgl.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="shader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\util\ShaderUtil.cpp">
|
||||||
|
<Filter>util</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\includes\glew\GL\glew.c">
|
||||||
|
<Filter>Source Files\glew</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\mod\AvHAlienAbilities.h">
|
<ClInclude Include="..\mod\AvHAlienAbilities.h">
|
||||||
|
@ -1004,9 +1013,6 @@
|
||||||
<ClInclude Include="..\util\CString.h">
|
<ClInclude Include="..\util\CString.h">
|
||||||
<Filter>util</Filter>
|
<Filter>util</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\util\GammaTable.h">
|
|
||||||
<Filter>util</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\util\LinuxSupport.h">
|
<ClInclude Include="..\util\LinuxSupport.h">
|
||||||
<Filter>util</Filter>
|
<Filter>util</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1052,6 +1058,21 @@
|
||||||
<ClInclude Include="hudgl.h">
|
<ClInclude Include="hudgl.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\util\ShaderUtil.h">
|
||||||
|
<Filter>util</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\includes\glew\GL\glxew.h">
|
||||||
|
<Filter>Source Files\glew</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\includes\glew\GL\wglew.h">
|
||||||
|
<Filter>Source Files\glew</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\includes\glew\GL\eglew.h">
|
||||||
|
<Filter>Source Files\glew</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\includes\glew\GL\glew.h">
|
||||||
|
<Filter>Source Files\glew</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Library Include="..\lib\public\game_controls.lib" />
|
<Library Include="..\lib\public\game_controls.lib" />
|
||||||
|
|
|
@ -30,6 +30,7 @@ class TeamFortressViewport;
|
||||||
class AvHHud;
|
class AvHHud;
|
||||||
#include "AvHHud.h"
|
#include "AvHHud.h"
|
||||||
extern AvHHud gHUD;
|
extern AvHHud gHUD;
|
||||||
|
extern CPostProcessShader g_PostProcessShader;
|
||||||
|
|
||||||
#include "wrect.h"
|
#include "wrect.h"
|
||||||
#include "cl_dll.h"
|
#include "cl_dll.h"
|
||||||
|
|
|
@ -561,7 +561,7 @@ void CHudSpectator::DrawOverviewMap()
|
||||||
gEngfuncs.pTriAPI->CullFace(TRI_NONE);
|
gEngfuncs.pTriAPI->CullFace(TRI_NONE);
|
||||||
|
|
||||||
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)(gEngfuncs.GetSpritePointer(m_hsprWhite)), 0);
|
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)(gEngfuncs.GetSpritePointer(m_hsprWhite)), 0);
|
||||||
float gammaScale = 1.0f / gHUD.GetGammaSlope();
|
float gammaScale = 1.0f/* / gHUD.GetGammaSlope()*/;
|
||||||
|
|
||||||
// Draw the background.
|
// Draw the background.
|
||||||
|
|
||||||
|
|
214
main/source/cl_dll/shader.cpp
Normal file
214
main/source/cl_dll/shader.cpp
Normal file
|
@ -0,0 +1,214 @@
|
||||||
|
#include "hud.h"
|
||||||
|
#include "cl_util.h"
|
||||||
|
|
||||||
|
//#include "PlatformHeaders.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "windows.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <GL/glew.h>
|
||||||
|
//#include <gl/GL.h>
|
||||||
|
#include "util/ShaderUtil.h"
|
||||||
|
|
||||||
|
cvar_t* cl_postprocess = NULL;
|
||||||
|
cvar_t* cl_intensity = NULL;
|
||||||
|
|
||||||
|
GLuint screenTexture;
|
||||||
|
GLenum glew;
|
||||||
|
ShaderUtil shaderUtil;
|
||||||
|
|
||||||
|
void CPostProcessShader::Init()
|
||||||
|
{
|
||||||
|
//glActiveTexture(GL_TEXTURE0);
|
||||||
|
//glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTextAtInit);
|
||||||
|
|
||||||
|
// Create the screen texture
|
||||||
|
glGenTextures(1, &screenTexture);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, screenTexture);
|
||||||
|
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, ScreenWidth(), ScreenHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
|
||||||
|
cl_postprocess = CVAR_CREATE("cl_postprocess", "1", FCVAR_ARCHIVE);
|
||||||
|
cl_intensity = CVAR_CREATE("cl_intensity", "1", FCVAR_ARCHIVE);
|
||||||
|
|
||||||
|
// Store shaders in dll so swapping in different ones is harder.
|
||||||
|
const std::string vertShader =
|
||||||
|
"#version 330 core\n"
|
||||||
|
|
||||||
|
"layout(location = 0) in vec2 vertexPosition;\n"
|
||||||
|
"out vec2 texCoord;\n"
|
||||||
|
|
||||||
|
"void main() {\n"
|
||||||
|
// Convert vertex position to texture coordinates
|
||||||
|
"texCoord = (vertexPosition + 1.0) * 0.5;\n"
|
||||||
|
"gl_Position = vec4(vertexPosition, 0.0, 1.0);\n"
|
||||||
|
"}\n"
|
||||||
|
;
|
||||||
|
|
||||||
|
const std::string fragShader =
|
||||||
|
"#version 330 core\n"
|
||||||
|
|
||||||
|
"in vec2 texCoord;\n"
|
||||||
|
"out vec4 fragColor;\n"
|
||||||
|
|
||||||
|
"uniform sampler2D textureSampler;\n"
|
||||||
|
"uniform float colorMultiplier;\n"
|
||||||
|
|
||||||
|
"void main() {\n"
|
||||||
|
// Sample the texture
|
||||||
|
"vec4 texColor = texture(textureSampler, texCoord);\n"
|
||||||
|
// Multiply the color
|
||||||
|
"fragColor = vec4(texColor.rgb * colorMultiplier, 1.0f);\n"
|
||||||
|
"}\n"
|
||||||
|
;
|
||||||
|
|
||||||
|
glew = glewInit();
|
||||||
|
|
||||||
|
if (GLEW_OK != glew)
|
||||||
|
{
|
||||||
|
/* Problem: glewInit failed, something is seriously wrong. */
|
||||||
|
// fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
|
||||||
|
gEngfuncs.Con_DPrintf("[GLEW] Error: %s\n", glewGetErrorString(glew));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gEngfuncs.Con_DPrintf("[GLEW] Initialize success!\n");
|
||||||
|
//shaderUtil.LoadFromFile(std::string(gEngfuncs.pfnGetGameDirectory() + (std::string) "/shaders/vs.shaders"), std::string(gEngfuncs.pfnGetGameDirectory() + (std::string) "/shaders/fs.shaders"));
|
||||||
|
shaderUtil.LoadFromString(vertShader, fragShader);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPostProcessShader::ClearFrameBuffer()
|
||||||
|
{
|
||||||
|
if (cl_postprocess->value <= 0 || cl_intensity->value <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
|
//GLfloat clearColors[] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||||
|
//GLint drawFboId;
|
||||||
|
//GLint readFboId;
|
||||||
|
//GLint FboId;
|
||||||
|
//glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFboId);
|
||||||
|
//glBindFramebuffer(GL_FRAMEBUFFER, drawFboId);
|
||||||
|
//glClearBufferfv(GL_COLOR, 0, clearColors);
|
||||||
|
|
||||||
|
//glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFboId);
|
||||||
|
//glBindFramebuffer(GL_FRAMEBUFFER, readFboId);
|
||||||
|
//glClearBufferfv(GL_COLOR, 0, clearColors);
|
||||||
|
|
||||||
|
//glGetIntegerv(GL_FRAMEBUFFER_BINDING, &FboId);
|
||||||
|
//glBindFramebuffer(GL_FRAMEBUFFER, FboId);
|
||||||
|
//glClearBufferfv(GL_COLOR, 0, clearColors);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPostProcessShader::DrawShader()
|
||||||
|
{
|
||||||
|
if (cl_postprocess->value <= 0 || cl_intensity->value <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// TO DO: Check NPOT texture support and shader support for older systems. HL might already check NPOT for FBO mode.
|
||||||
|
|
||||||
|
const int error1 = glGetError();
|
||||||
|
if (error1 != 0)
|
||||||
|
gEngfuncs.Con_DPrintf("before shader error %d\n", error1);
|
||||||
|
|
||||||
|
glPushAttrib(GL_TEXTURE_BIT);
|
||||||
|
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
||||||
|
|
||||||
|
//// Might need some of these if things break.
|
||||||
|
//glViewport(0, 0, ScreenWidth(), ScreenHeight());
|
||||||
|
//glActiveTexture(GL_TEXTURE0);
|
||||||
|
//glEnable(GL_TEXTURE_RECTANGE_NV);
|
||||||
|
//glColor3f(1, 1, 1);
|
||||||
|
//glDisable(GL_DEPTH_TEST);
|
||||||
|
//glMatrixMode(GL_MODELVIEW);
|
||||||
|
//glPushMatrix();
|
||||||
|
//glLoadIdentity();
|
||||||
|
//glMatrixMode(GL_PROJECTION);
|
||||||
|
//glPushMatrix();
|
||||||
|
//glLoadIdentity();
|
||||||
|
//glOrtho(0, 1, 1, 0, 0.1, 100);
|
||||||
|
//glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||||
|
|
||||||
|
//glEnable(GL_TEXTURE_2D);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, screenTexture);
|
||||||
|
|
||||||
|
//// Solokiller's code to copy from MSAA/scaling framebuffer
|
||||||
|
//glFinish(); // Significant performance hit with this and it seems to work without it.
|
||||||
|
GLint drawFboId;
|
||||||
|
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFboId);
|
||||||
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, drawFboId);
|
||||||
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
|
glBlitFramebuffer(0, 0, ScreenWidth(), ScreenHeight(), 0, 0, ScreenWidth(), ScreenHeight(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
|
|
||||||
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, drawFboId);
|
||||||
|
|
||||||
|
glReadBuffer(GL_BACK);
|
||||||
|
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, ScreenWidth(), ScreenHeight(), 0);
|
||||||
|
|
||||||
|
const int error2 = glGetError();
|
||||||
|
if (error2 != 0)
|
||||||
|
gEngfuncs.Con_DPrintf("framebuffer copy error %d\n", error2);
|
||||||
|
|
||||||
|
|
||||||
|
float colorMultiplier = 1.0f;
|
||||||
|
const float scalarCvar = min(2.0f, max( 0.0f, cl_intensity->value));
|
||||||
|
//const float colorMultiplier = max( 1.0f, max(scalarCvar, 1.0f + (gHUD.GetGammaSlope() - 1.0f) * scalarCvar));
|
||||||
|
|
||||||
|
// Scale the map's gamma value.
|
||||||
|
if (gHUD.GetGammaSlope() > 1.0f)
|
||||||
|
{
|
||||||
|
colorMultiplier = 1.0f + (gHUD.GetGammaSlope() - 1.0f) * scalarCvar;
|
||||||
|
}
|
||||||
|
// If the map has no gamma value, override it with the cvar's value.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
colorMultiplier = min(1.0f, scalarCvar);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use shader.
|
||||||
|
glUseProgram(shaderUtil.GetProgramID());
|
||||||
|
//glUniform1f(glGetUniformLocation(shaderUtil.GetProgramID(), "textureMap"), 0);
|
||||||
|
glUniform1f(glGetUniformLocation(shaderUtil.GetProgramID(), "colorMultiplier"), colorMultiplier);
|
||||||
|
|
||||||
|
// Draw the quad.
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex3f(-1, 1, -1);
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(-1, -1, -1);
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex3f(1, -1, -1);
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(1, 1, -1);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// Restore state.
|
||||||
|
glUseProgram(0);
|
||||||
|
//glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
//glBindVertexArray(0);
|
||||||
|
glPopAttrib();
|
||||||
|
glPopClientAttrib();
|
||||||
|
|
||||||
|
//glMatrixMode(GL_PROJECTION);
|
||||||
|
//glPopMatrix();
|
||||||
|
//glMatrixMode(GL_MODELVIEW);
|
||||||
|
//glPopMatrix();
|
||||||
|
//glDisable(GL_TEXTURE_RECTANGE_NV); // Don't disable texture_2d or ui bugs out.
|
||||||
|
//glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
const int error3 = glGetError();
|
||||||
|
if (error3 != 0)
|
||||||
|
gEngfuncs.Con_DPrintf("shader error %d\n", error3);
|
||||||
|
}
|
|
@ -212,8 +212,11 @@ void ScorePanel::HitTestPanel::internalMousePressed(MouseCode code)
|
||||||
|
|
||||||
vgui::Color BuildColor( int R, int G, int B, float gamma )
|
vgui::Color BuildColor( int R, int G, int B, float gamma )
|
||||||
{
|
{
|
||||||
ASSERT( gamma != 0 );
|
// 2024 - remove old gamma ramp compensation
|
||||||
return vgui::Color( R/gamma, G/gamma, B/gamma, 0 );
|
//ASSERT( gamma != 0 );
|
||||||
|
//return vgui::Color( R/gamma, G/gamma, B/gamma, 0 );
|
||||||
|
|
||||||
|
return vgui::Color(R, G, B, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -148,13 +148,13 @@ void SpectatorPanel::Initialize()
|
||||||
CSchemeManager * pSchemes = gViewPort->GetSchemeManager();
|
CSchemeManager * pSchemes = gViewPort->GetSchemeManager();
|
||||||
|
|
||||||
|
|
||||||
int colorR = 128 / gHUD.GetGammaSlope();
|
int colorR = 128/* / gHUD.GetGammaSlope()*/;
|
||||||
int colorG = 128 / gHUD.GetGammaSlope();
|
int colorG = 128/* / gHUD.GetGammaSlope()*/;
|
||||||
int colorB = 128 / gHUD.GetGammaSlope();
|
int colorB = 128/* / gHUD.GetGammaSlope()*/;
|
||||||
|
|
||||||
int armedColorR = 255 / gHUD.GetGammaSlope();
|
int armedColorR = 255/* / gHUD.GetGammaSlope()*/;
|
||||||
int armedColorG = 255 / gHUD.GetGammaSlope();
|
int armedColorG = 255/* / gHUD.GetGammaSlope()*/;
|
||||||
int armedColorB = 255 / gHUD.GetGammaSlope();
|
int armedColorB = 255/* / gHUD.GetGammaSlope()*/;
|
||||||
|
|
||||||
|
|
||||||
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle( /*"Team Info Text"*/ "PieMenuScheme" );
|
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle( /*"Team Info Text"*/ "PieMenuScheme" );
|
||||||
|
|
|
@ -157,15 +157,15 @@ public:
|
||||||
case PLAYERCLASS_DEAD_MARINE:
|
case PLAYERCLASS_DEAD_MARINE:
|
||||||
case PLAYERCLASS_DEAD_ALIEN:
|
case PLAYERCLASS_DEAD_ALIEN:
|
||||||
case PLAYERCLASS_REINFORCING:
|
case PLAYERCLASS_REINFORCING:
|
||||||
r = 255 / gHUD.GetGammaSlope();
|
r = 255/* / gHUD.GetGammaSlope()*/;
|
||||||
g = 0 / gHUD.GetGammaSlope();
|
g = 0/* / gHUD.GetGammaSlope()*/;
|
||||||
b = 0 / gHUD.GetGammaSlope();
|
b = 0/* / gHUD.GetGammaSlope()*/;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
r = kTeamColors[theTeamNumber][0] / gHUD.GetGammaSlope();
|
r = kTeamColors[theTeamNumber][0]/* / gHUD.GetGammaSlope()*/;
|
||||||
g = kTeamColors[theTeamNumber][1] / gHUD.GetGammaSlope();
|
g = kTeamColors[theTeamNumber][1]/* / gHUD.GetGammaSlope()*/;
|
||||||
b = kTeamColors[theTeamNumber][2] / gHUD.GetGammaSlope();
|
b = kTeamColors[theTeamNumber][2]/* / gHUD.GetGammaSlope()*/;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2218,6 +2218,8 @@ void CL_DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
|
||||||
{
|
{
|
||||||
// RecClCalcRefdef(pparams);
|
// RecClCalcRefdef(pparams);
|
||||||
|
|
||||||
|
g_PostProcessShader.ClearFrameBuffer();
|
||||||
|
|
||||||
// intermission / finale rendering
|
// intermission / finale rendering
|
||||||
if ( pparams->intermission )
|
if ( pparams->intermission )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1357,7 +1357,6 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\util\Balance.cpp" />
|
<ClCompile Include="..\util\Balance.cpp" />
|
||||||
<ClCompile Include="..\util\Checksum.cpp" />
|
<ClCompile Include="..\util\Checksum.cpp" />
|
||||||
<ClCompile Include="..\util\GammaTable.cpp" />
|
|
||||||
<ClCompile Include="..\util\LinuxSupport.cpp" />
|
<ClCompile Include="..\util\LinuxSupport.cpp" />
|
||||||
<ClCompile Include="..\util\Mat3.cpp" />
|
<ClCompile Include="..\util\Mat3.cpp" />
|
||||||
<ClCompile Include="..\util\MathUtil.cpp" />
|
<ClCompile Include="..\util\MathUtil.cpp" />
|
||||||
|
@ -1485,7 +1484,6 @@
|
||||||
<ClInclude Include="..\util\Balance.h" />
|
<ClInclude Include="..\util\Balance.h" />
|
||||||
<ClInclude Include="..\util\Checksum.h" />
|
<ClInclude Include="..\util\Checksum.h" />
|
||||||
<ClInclude Include="..\util\CString.h" />
|
<ClInclude Include="..\util\CString.h" />
|
||||||
<ClInclude Include="..\util\GammaTable.h" />
|
|
||||||
<ClInclude Include="..\util\LinuxSupport.h" />
|
<ClInclude Include="..\util\LinuxSupport.h" />
|
||||||
<ClInclude Include="..\util\Mat3.h" />
|
<ClInclude Include="..\util\Mat3.h" />
|
||||||
<ClInclude Include="..\util\MathUtil.h" />
|
<ClInclude Include="..\util\MathUtil.h" />
|
||||||
|
|
|
@ -473,9 +473,6 @@
|
||||||
<ClCompile Include="..\util\Checksum.cpp">
|
<ClCompile Include="..\util\Checksum.cpp">
|
||||||
<Filter>util</Filter>
|
<Filter>util</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\util\GammaTable.cpp">
|
|
||||||
<Filter>util</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\util\LinuxSupport.cpp">
|
<ClCompile Include="..\util\LinuxSupport.cpp">
|
||||||
<Filter>util</Filter>
|
<Filter>util</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -856,9 +853,6 @@
|
||||||
<ClInclude Include="..\util\CString.h">
|
<ClInclude Include="..\util\CString.h">
|
||||||
<Filter>util</Filter>
|
<Filter>util</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\util\GammaTable.h">
|
|
||||||
<Filter>util</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\util\LinuxSupport.h">
|
<ClInclude Include="..\util\LinuxSupport.h">
|
||||||
<Filter>util</Filter>
|
<Filter>util</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
3051
main/source/includes/glew/GL/eglew.h
Normal file
3051
main/source/includes/glew/GL/eglew.h
Normal file
File diff suppressed because it is too large
Load diff
31949
main/source/includes/glew/GL/glew.c
Normal file
31949
main/source/includes/glew/GL/glew.c
Normal file
File diff suppressed because it is too large
Load diff
26427
main/source/includes/glew/GL/glew.h
Normal file
26427
main/source/includes/glew/GL/glew.h
Normal file
File diff suppressed because it is too large
Load diff
1831
main/source/includes/glew/GL/glxew.h
Normal file
1831
main/source/includes/glew/GL/glxew.h
Normal file
File diff suppressed because it is too large
Load diff
1468
main/source/includes/glew/GL/wglew.h
Normal file
1468
main/source/includes/glew/GL/wglew.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -26,9 +26,9 @@ GAME_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/game_shared
|
||||||
PM_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/pm_shared
|
PM_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/pm_shared
|
||||||
HL1_SERVER_OBJ_DIR=$(HL1_OBJ_DIR)/server
|
HL1_SERVER_OBJ_DIR=$(HL1_OBJ_DIR)/server
|
||||||
|
|
||||||
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -I/usr/include/malloc -D_snwprintf=swprintf -DAVH_CLIENT -DUSE_OLDAUTH -DAVH_NO_NEXUS -DNDEBUG -DASSERT=assert -Dsprintf_s=snprintf -DDISABLE_VEC_FUNCS -DDISABLE_VEC_ORIGIN
|
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -I/usr/include/malloc -D_snwprintf=swprintf -DAVH_CLIENT -DUSE_OLDAUTH -DAVH_NO_NEXUS -DNDEBUG -DASSERT=assert -Dsprintf_s=snprintf -DDISABLE_VEC_FUNCS -DDISABLE_VEC_ORIGIN -DGLEW_STATIC -DGLEW_NO_GLU
|
||||||
|
|
||||||
INCLUDEDIRS= -I$(HL_SRC_DIR) -I$(NS_MOD_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PUBLIC_SRC_DIR) -I$(PM_SHARED_SRC_DIR) -I../engine -I$(GAME_SHARED_SRC_DIR) -I../external/ -I../particles -I../includes/fmodapi375linux/api/inc -I$(HL_SERVER_SRC_DIR) -I$(HL_SRC_DIR)/cl_dll -I$(VGUI_INCLUDE_DIR) -I$(UI_INCLUDE_DIR) -I$(UTIL_SRC_DIR) -I../ -I../includes/fmodapi375linux/api -I../includes/lpng1251
|
INCLUDEDIRS= -I$(HL_SRC_DIR) -I$(NS_MOD_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PUBLIC_SRC_DIR) -I$(PM_SHARED_SRC_DIR) -I../engine -I$(GAME_SHARED_SRC_DIR) -I../external/ -I../particles -I../includes/fmodapi375linux/api/inc -I$(HL_SERVER_SRC_DIR) -I$(HL_SRC_DIR)/cl_dll -I$(VGUI_INCLUDE_DIR) -I$(UI_INCLUDE_DIR) -I$(UTIL_SRC_DIR) -I../ -I../includes/fmodapi375linux/api -I../includes/lpng1251 -I../includes/glew
|
||||||
|
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -framework Carbon -framework OpenGL vgui.dylib -L. -lSDL2-2.0.0 -L. libparticleMP.a
|
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -framework Carbon -framework OpenGL vgui.dylib -L. -lSDL2-2.0.0 -L. libparticleMP.a
|
||||||
|
@ -86,6 +86,7 @@ HL1_OBJS = \
|
||||||
$(HL1_OBJ_DIR)/view.o \
|
$(HL1_OBJ_DIR)/view.o \
|
||||||
$(HL1_OBJ_DIR)/message.o \
|
$(HL1_OBJ_DIR)/message.o \
|
||||||
$(HL1_OBJ_DIR)/parsemsg.o \
|
$(HL1_OBJ_DIR)/parsemsg.o \
|
||||||
|
$(HL1_OBJ_DIR)/shader.o \
|
||||||
$(HL1_OBJ_DIR)/saytext.o \
|
$(HL1_OBJ_DIR)/saytext.o \
|
||||||
$(HL1_OBJ_DIR)/status_icons.o \
|
$(HL1_OBJ_DIR)/status_icons.o \
|
||||||
$(HL1_OBJ_DIR)/statusbar.o \
|
$(HL1_OBJ_DIR)/statusbar.o \
|
||||||
|
@ -246,11 +247,12 @@ UI_OBJS = \
|
||||||
UTIL_OBJS = \
|
UTIL_OBJS = \
|
||||||
$(UTIL_OBJ_DIR)/Balance.o \
|
$(UTIL_OBJ_DIR)/Balance.o \
|
||||||
$(UTIL_OBJ_DIR)/Checksum.o \
|
$(UTIL_OBJ_DIR)/Checksum.o \
|
||||||
$(UTIL_OBJ_DIR)/GammaTable.o \
|
#$(UTIL_OBJ_DIR)/GammaTable.o \
|
||||||
$(UTIL_OBJ_DIR)/LinuxSupport.o \
|
$(UTIL_OBJ_DIR)/LinuxSupport.o \
|
||||||
$(UTIL_OBJ_DIR)/Mat3.o \
|
$(UTIL_OBJ_DIR)/Mat3.o \
|
||||||
$(UTIL_OBJ_DIR)/MathUtil.o \
|
$(UTIL_OBJ_DIR)/MathUtil.o \
|
||||||
$(UTIL_OBJ_DIR)/Quat.o \
|
$(UTIL_OBJ_DIR)/Quat.o \
|
||||||
|
$(UTIL_OBJ_DIR)/ShaderUtil.o \
|
||||||
$(UTIL_OBJ_DIR)/Stacktrace.o \
|
$(UTIL_OBJ_DIR)/Stacktrace.o \
|
||||||
$(UTIL_OBJ_DIR)/STLUtil.o \
|
$(UTIL_OBJ_DIR)/STLUtil.o \
|
||||||
$(UTIL_OBJ_DIR)/Tokenizer.o \
|
$(UTIL_OBJ_DIR)/Tokenizer.o \
|
||||||
|
|
|
@ -203,7 +203,7 @@ GAME_SHARED_OBJS = \
|
||||||
UTIL_OBJS = \
|
UTIL_OBJS = \
|
||||||
$(UTIL_OBJ_DIR)/Balance.o \
|
$(UTIL_OBJ_DIR)/Balance.o \
|
||||||
$(UTIL_OBJ_DIR)/Checksum.o \
|
$(UTIL_OBJ_DIR)/Checksum.o \
|
||||||
$(UTIL_OBJ_DIR)/GammaTable.o \
|
#$(UTIL_OBJ_DIR)/GammaTable.o \
|
||||||
$(UTIL_OBJ_DIR)/LinuxSupport.o \
|
$(UTIL_OBJ_DIR)/LinuxSupport.o \
|
||||||
$(UTIL_OBJ_DIR)/Mat3.o \
|
$(UTIL_OBJ_DIR)/Mat3.o \
|
||||||
$(UTIL_OBJ_DIR)/MathUtil.o \
|
$(UTIL_OBJ_DIR)/MathUtil.o \
|
||||||
|
|
|
@ -227,10 +227,9 @@ extern void __CmdFunc_Close(void);
|
||||||
extern int CL_ButtonBits(int);
|
extern int CL_ButtonBits(int);
|
||||||
extern int g_iVisibleMouse;
|
extern int g_iVisibleMouse;
|
||||||
|
|
||||||
//@2014 make this work for linux
|
//// 2024 - replaced windows gamma table with shader
|
||||||
|
//GammaTable AvHHud::sPregameGammaTable;
|
||||||
GammaTable AvHHud::sPregameGammaTable;
|
//GammaTable AvHHud::sGameGammaTable;
|
||||||
GammaTable AvHHud::sGameGammaTable;
|
|
||||||
|
|
||||||
|
|
||||||
bool AvHHud::sShowMap = false;
|
bool AvHHud::sShowMap = false;
|
||||||
|
@ -312,7 +311,7 @@ void NumericalInfoEffect::SetPosition(float inPosition[3])
|
||||||
void AvHHud::OnActivateSteamUI()
|
void AvHHud::OnActivateSteamUI()
|
||||||
{
|
{
|
||||||
// Set the normal gamma so the Steam UI looks correct.
|
// Set the normal gamma so the Steam UI looks correct.
|
||||||
/*
|
/*
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
sPregameGammaTable.InitializeToVideoState();
|
sPregameGammaTable.InitializeToVideoState();
|
||||||
#endif*/
|
#endif*/
|
||||||
|
@ -323,7 +322,7 @@ void AvHHud::OnDeactivateSteamUI()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Set the special NS gamma. //@2014 no more gamma
|
// Set the special NS gamma. //@2014 no more gamma
|
||||||
/*
|
/*
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetGamma(mDesiredGammaSlope);
|
SetGamma(mDesiredGammaSlope);
|
||||||
#endif */
|
#endif */
|
||||||
|
@ -695,7 +694,7 @@ AvHHud::~AvHHud(void)
|
||||||
//this->ResetGamma();
|
//this->ResetGamma();
|
||||||
//delete [] sOriginalGammaTable;
|
//delete [] sOriginalGammaTable;
|
||||||
//delete [] sGammaTable;
|
//delete [] sGammaTable;
|
||||||
AvHHud::ResetGammaAtExit();
|
//AvHHud::ResetGammaAtExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DummyFunction()
|
void DummyFunction()
|
||||||
|
@ -1787,7 +1786,10 @@ AvHMessageID AvHHud::HotKeyHit(char inChar)
|
||||||
//@2014 make this work for linux
|
//@2014 make this work for linux
|
||||||
float AvHHud::GetGammaSlope() const
|
float AvHHud::GetGammaSlope() const
|
||||||
{
|
{
|
||||||
return sGameGammaTable.GetGammaSlope();
|
//gEngfuncs.Con_DPrintf("Map gamma set to %f\n", this->mShaderGamma);
|
||||||
|
return this->mShaderGamma;
|
||||||
|
|
||||||
|
//return sGameGammaTable.GetGammaSlope();
|
||||||
}
|
}
|
||||||
string AvHHud::GetMapName(bool inLocalOnly) const
|
string AvHHud::GetMapName(bool inLocalOnly) const
|
||||||
{
|
{
|
||||||
|
@ -1848,57 +1850,65 @@ int AvHHud::GetMaxAlienResources() const
|
||||||
|
|
||||||
bool AvHHud::SetGamma(float inSlope)
|
bool AvHHud::SetGamma(float inSlope)
|
||||||
{
|
{
|
||||||
bool theSuccess = false;
|
bool theSuccess = true;
|
||||||
|
|
||||||
// Disable gamma stuff in debug for sanity
|
this->mShaderGamma = inSlope;
|
||||||
// #ifndef DEBUG
|
|
||||||
|
|
||||||
//@2014
|
//sGameGammaTable.ProcessSlope(inSlope);
|
||||||
/*
|
|
||||||
#ifdef _WIN32
|
|
||||||
HDC theDC = GetDC(NULL); // this is a windows func call
|
|
||||||
if(theDC != 0)
|
|
||||||
{
|
|
||||||
const float kGammaIncrement = 0.05f;
|
|
||||||
float theGammaToTry = inSlope + kGammaIncrement;
|
|
||||||
while(!theSuccess && (theGammaToTry > 1.0f))
|
|
||||||
{
|
|
||||||
theGammaToTry -= kGammaIncrement;
|
|
||||||
|
|
||||||
sGameGammaTable.ProcessSlope(theGammaToTry);
|
// 2024 - Replaced windows gamma ramp with shader
|
||||||
// : fakes a successful gamma ramp change if cl_gammaramp is set to 0
|
//
|
||||||
if((CVAR_GET_FLOAT(kvGammaRamp) == 0) || sGameGammaTable.InitializeToVideoState())
|
// bool theSuccess = false;
|
||||||
{
|
//
|
||||||
// Tell UI components so they can change shading to look the same
|
// // Disable gamma stuff in debug for sanity
|
||||||
this->GetManager().NotifyGammaChange(theGammaToTry);
|
//// #ifndef DEBUG
|
||||||
|
//
|
||||||
// aww yeah
|
////@2014
|
||||||
theSuccess = true;
|
//
|
||||||
}
|
//#ifdef _WIN32
|
||||||
}
|
// HDC theDC = GetDC(NULL); // this is a windows func call
|
||||||
|
// if(theDC != 0)
|
||||||
char theMessage[256];
|
// {
|
||||||
if(theSuccess)
|
// const float kGammaIncrement = 0.05f;
|
||||||
{
|
// float theGammaToTry = inSlope + kGammaIncrement;
|
||||||
sprintf(theMessage, "Gamma set to %f.", theGammaToTry);
|
// while(!theSuccess && (theGammaToTry > 1.0f))
|
||||||
}
|
// {
|
||||||
else
|
// theGammaToTry -= kGammaIncrement;
|
||||||
{
|
//
|
||||||
sprintf(theMessage, "Display doesn't support downloadable gamma ramps.");
|
// sGameGammaTable.ProcessSlope(theGammaToTry);
|
||||||
}
|
// // : fakes a successful gamma ramp change if cl_gammaramp is set to 0
|
||||||
|
// if((CVAR_GET_FLOAT(kvGammaRamp) == 0) || sGameGammaTable.InitializeToVideoState())
|
||||||
if(!theSuccess || (gEngfuncs.GetMaxClients() == 1))
|
// {
|
||||||
{
|
// // Tell UI components so they can change shading to look the same
|
||||||
CenterPrint(theMessage);
|
// this->GetManager().NotifyGammaChange(theGammaToTry);
|
||||||
}
|
//
|
||||||
|
// // aww yeah
|
||||||
if(!ReleaseDC(NULL, theDC))
|
// theSuccess = true;
|
||||||
{
|
// }
|
||||||
// emit error about leak
|
// }
|
||||||
}
|
//
|
||||||
}
|
// char theMessage[256];
|
||||||
|
// if(theSuccess)
|
||||||
#endif */
|
// {
|
||||||
|
// sprintf(theMessage, "Gamma set to %f.", theGammaToTry);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// sprintf(theMessage, "Display doesn't support downloadable gamma ramps.");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(!theSuccess || (gEngfuncs.GetMaxClients() == 1))
|
||||||
|
// {
|
||||||
|
// CenterPrint(theMessage);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(!ReleaseDC(NULL, theDC))
|
||||||
|
// {
|
||||||
|
// // emit error about leak
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//#endif
|
||||||
return theSuccess;
|
return theSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1944,25 +1954,25 @@ int AvHHud::Redraw( float flTime, int intermission )
|
||||||
return theRC;
|
return theRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvHHud::ResetGammaAtExit()
|
//void AvHHud::ResetGammaAtExit()
|
||||||
{
|
//{
|
||||||
/*#ifdef _WIN32
|
//#ifdef _WIN32
|
||||||
sPregameGammaTable.InitializeToVideoState();
|
//sPregameGammaTable.InitializeToVideoState();
|
||||||
#endif*/
|
//#endif
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
int AvHHud::ResetGammaAtExitForOnExit()
|
//int AvHHud::ResetGammaAtExitForOnExit()
|
||||||
{
|
//{
|
||||||
/*#ifdef _WIN32
|
//#ifdef _WIN32
|
||||||
sPregameGammaTable.InitializeToVideoState();
|
// sPregameGammaTable.InitializeToVideoState();
|
||||||
#endif*/
|
//#endif
|
||||||
return TRUE;
|
// return TRUE;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void AvHHud::ResetGammaAtExit(int inSig)
|
//void AvHHud::ResetGammaAtExit(int inSig)
|
||||||
{
|
//{
|
||||||
AvHHud::ResetGammaAtExit();
|
// AvHHud::ResetGammaAtExit();
|
||||||
}
|
//}
|
||||||
|
|
||||||
void AvHHud::ResetTopDownUI()
|
void AvHHud::ResetTopDownUI()
|
||||||
{
|
{
|
||||||
|
@ -2591,6 +2601,7 @@ void AvHHud::ResetGame(bool inMapChanged)
|
||||||
|
|
||||||
this->mHiveInfoList.clear();
|
this->mHiveInfoList.clear();
|
||||||
|
|
||||||
|
this->mShaderGamma = kDefaultMapGamma;
|
||||||
this->mDesiredGammaSlope = kDefaultMapGamma;
|
this->mDesiredGammaSlope = kDefaultMapGamma;
|
||||||
this->mRecordingLastFrame = false;
|
this->mRecordingLastFrame = false;
|
||||||
this->mTimeOfLastHelpText = -1;
|
this->mTimeOfLastHelpText = -1;
|
||||||
|
@ -3791,6 +3802,7 @@ void AvHHud::Init(void)
|
||||||
signal(SIGBREAK, AvHHud::ResetGammaAtExit);
|
signal(SIGBREAK, AvHHud::ResetGammaAtExit);
|
||||||
signal(SIGABRT, AvHHud::ResetGammaAtExit);
|
signal(SIGABRT, AvHHud::ResetGammaAtExit);
|
||||||
#endif */
|
#endif */
|
||||||
|
this->mShaderGamma = 1.0f;
|
||||||
//memset(this->mAlienUILifeforms, 0, sizeof(HSPRITE)*kNumAlienLifeforms);
|
//memset(this->mAlienUILifeforms, 0, sizeof(HSPRITE)*kNumAlienLifeforms);
|
||||||
this->mAlienUIUpgrades = 0;
|
this->mAlienUIUpgrades = 0;
|
||||||
this->mAlienUIUpgradeCategories = 0;
|
this->mAlienUIUpgradeCategories = 0;
|
||||||
|
@ -4917,13 +4929,13 @@ void AvHHud::InitExploitPrevention() {
|
||||||
ForceCvar("r_detailtextures", r_detailtextures, 0.0f);
|
ForceCvar("r_detailtextures", r_detailtextures, 0.0f);
|
||||||
ForceCvar("gl_max_size", gl_max_size, 512.0f);
|
ForceCvar("gl_max_size", gl_max_size, 512.0f);
|
||||||
|
|
||||||
RemoveAlias("lightgamma");
|
//RemoveAlias("lightgamma");
|
||||||
if(lightgamma && lightgamma->value < 2.0) {
|
//if(lightgamma && lightgamma->value < 2.0) {
|
||||||
ForceCvar("lightgamma", lightgamma, 2.0f);
|
// ForceCvar("lightgamma", lightgamma, 2.0f);
|
||||||
}
|
//}
|
||||||
if(lightgamma && lightgamma->value > 5.0) {
|
//if(lightgamma && lightgamma->value > 5.0) {
|
||||||
ForceCvar("lightgamma", lightgamma, 5.0f);
|
// ForceCvar("lightgamma", lightgamma, 5.0f);
|
||||||
}
|
//}
|
||||||
RemoveAlias("texgamma");
|
RemoveAlias("texgamma");
|
||||||
if(texgamma && texgamma->value < 1.0) {
|
if(texgamma && texgamma->value < 1.0) {
|
||||||
ForceCvar("texgamma", texgamma, 1.0f);
|
ForceCvar("texgamma", texgamma, 1.0f);
|
||||||
|
@ -4949,8 +4961,8 @@ void AvHHud::UpdateExploitPrevention()
|
||||||
ForceCvar("r_detailtextures", r_detailtextures, 0.0f);
|
ForceCvar("r_detailtextures", r_detailtextures, 0.0f);
|
||||||
ForceCvar("gl_max_size", gl_max_size, 512.0f);
|
ForceCvar("gl_max_size", gl_max_size, 512.0f);
|
||||||
|
|
||||||
if(lightgamma && lightgamma->value < 2.0) {
|
if(lightgamma && lightgamma->value < 1.81f) {
|
||||||
ForceCvar("lightgamma", lightgamma, 2.0f);
|
ForceCvar("lightgamma", lightgamma, 1.81f);
|
||||||
}
|
}
|
||||||
if(lightgamma && lightgamma->value > 5.0) {
|
if(lightgamma && lightgamma->value > 5.0) {
|
||||||
ForceCvar("lightgamma", lightgamma, 5.0f);
|
ForceCvar("lightgamma", lightgamma, 5.0f);
|
||||||
|
@ -7405,7 +7417,7 @@ LONG WINAPI ExceptionFilter(EXCEPTION_POINTERS* pExp)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AvHHud::ResetGammaAtExit();
|
//AvHHud::ResetGammaAtExit();
|
||||||
|
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
|
|
||||||
|
@ -7425,7 +7437,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
|
||||||
}
|
}
|
||||||
else if (fdwReason == DLL_PROCESS_DETACH)
|
else if (fdwReason == DLL_PROCESS_DETACH)
|
||||||
{
|
{
|
||||||
AvHHud::ResetGammaAtExit();
|
//AvHHud::ResetGammaAtExit();
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
#include "AvHVisibleBlipList.h"
|
#include "AvHVisibleBlipList.h"
|
||||||
#include "AvHMapExtents.h"
|
#include "AvHMapExtents.h"
|
||||||
#include "AvHSpecials.h"
|
#include "AvHSpecials.h"
|
||||||
#include "GammaTable.h"
|
//#include "GammaTable.h"
|
||||||
#include "AvHBaseInfoLocation.h"
|
#include "AvHBaseInfoLocation.h"
|
||||||
#include "AvHTooltip.h"
|
#include "AvHTooltip.h"
|
||||||
#include "AvHTechSlotManager.h"
|
#include "AvHTechSlotManager.h"
|
||||||
|
@ -430,9 +430,9 @@ public:
|
||||||
// This function should be used instead of the global SetCrosshair.
|
// This function should be used instead of the global SetCrosshair.
|
||||||
void SetCurrentCrosshair(AVHHSPRITE hspr, wrect_t rc, int r, int g, int b);
|
void SetCurrentCrosshair(AVHHSPRITE hspr, wrect_t rc, int r, int g, int b);
|
||||||
|
|
||||||
static void ResetGammaAtExit();
|
//static void ResetGammaAtExit();
|
||||||
static int ResetGammaAtExitForOnExit();
|
//static int ResetGammaAtExitForOnExit();
|
||||||
static void ResetGammaAtExit(int inSig);
|
//static void ResetGammaAtExit(int inSig);
|
||||||
|
|
||||||
void SetViewport(const int inViewport[4]);
|
void SetViewport(const int inViewport[4]);
|
||||||
void GetViewport(int outViewport[4]) const;
|
void GetViewport(int outViewport[4]) const;
|
||||||
|
@ -679,9 +679,9 @@ private:
|
||||||
int mFramesSinceEnteredTopdownMode;
|
int mFramesSinceEnteredTopdownMode;
|
||||||
int mNumLocalSelectEvents;
|
int mNumLocalSelectEvents;
|
||||||
AvHMapMode mMapMode;
|
AvHMapMode mMapMode;
|
||||||
//@2014 make this work for linux
|
//// 2024 - Replaced gamma ramp with shader.
|
||||||
static GammaTable sPregameGammaTable;
|
//static GammaTable sPregameGammaTable;
|
||||||
static GammaTable sGameGammaTable;
|
//static GammaTable sGameGammaTable;
|
||||||
|
|
||||||
|
|
||||||
float mDesiredGammaSlope;
|
float mDesiredGammaSlope;
|
||||||
|
@ -882,6 +882,16 @@ private:
|
||||||
bool mReInitHUD;
|
bool mReInitHUD;
|
||||||
float mLastHudStyle;
|
float mLastHudStyle;
|
||||||
|
|
||||||
|
float mShaderGamma;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class CPostProcessShader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Init();
|
||||||
|
void ClearFrameBuffer();
|
||||||
|
void DrawShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -511,8 +511,8 @@ void DrawScaledHUDSprite(AVHHSPRITE inSpriteHandle, int inMode, int inRowsInSpri
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compensate for gamma
|
// Compensate for gamma
|
||||||
float theGammaSlope = gHUD.GetGammaSlope();
|
//float theGammaSlope = gHUD.GetGammaSlope();
|
||||||
float theColorComponent = 1.0f/theGammaSlope;
|
float theColorComponent = 1.0f/* / theGammaSlope*/;
|
||||||
gEngfuncs.pTriAPI->Color4f(theColorComponent, theColorComponent, theColorComponent, 1.0f);
|
gEngfuncs.pTriAPI->Color4f(theColorComponent, theColorComponent, theColorComponent, 1.0f);
|
||||||
|
|
||||||
Vector thePoint;
|
Vector thePoint;
|
||||||
|
@ -627,9 +627,9 @@ void DrawSpriteOnGroundAtPoint(vec3_t inOrigin, int inRadius, AVHHSPRITE inSprit
|
||||||
// Draw one quad
|
// Draw one quad
|
||||||
vec3_t thePoint = inOrigin;
|
vec3_t thePoint = inOrigin;
|
||||||
|
|
||||||
float theGammaSlope = gHUD.GetGammaSlope();
|
//float theGammaSlope = gHUD.GetGammaSlope();
|
||||||
ASSERT(theGammaSlope > 0.0f);
|
//ASSERT(theGammaSlope > 0.0f);
|
||||||
float theColorComponent = 1.0f/theGammaSlope;
|
float theColorComponent = 1.0f/* / theGammaSlope*/;
|
||||||
|
|
||||||
gEngfuncs.pTriAPI->Color4f(theColorComponent, theColorComponent, theColorComponent, inAlpha);
|
gEngfuncs.pTriAPI->Color4f(theColorComponent, theColorComponent, theColorComponent, inAlpha);
|
||||||
gEngfuncs.pTriAPI->Brightness(1.6f);
|
gEngfuncs.pTriAPI->Brightness(1.6f);
|
||||||
|
@ -1707,8 +1707,8 @@ void AvHHud::DrawMouseCursor(int inBaseX, int inBaseY)
|
||||||
|
|
||||||
if (theCursorSprite > 0)
|
if (theCursorSprite > 0)
|
||||||
{
|
{
|
||||||
float theGammaSlope = this->GetGammaSlope();
|
//float theGammaSlope = this->GetGammaSlope();
|
||||||
ASSERT(theGammaSlope > 0.0f);
|
//ASSERT(theGammaSlope > 0.0f);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int theColorComponent = 255/theGammaSlope;
|
int theColorComponent = 255/theGammaSlope;
|
||||||
|
@ -2025,15 +2025,15 @@ void AvHHud::GetPrimaryHudColor(int& outR, int& outG, int& outB, bool inIgnoreUp
|
||||||
UnpackRGB(outR, outG, outB, RGB_YELLOWISH);
|
UnpackRGB(outR, outG, outB, RGB_YELLOWISH);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
// 2024 - Remove old gamma ramp correction.
|
||||||
if (gammaCorrect)
|
//if (gammaCorrect)
|
||||||
{
|
//{
|
||||||
// Take into account current gamma?
|
// // Take into account current gamma?
|
||||||
float theGammaSlope = this->GetGammaSlope();
|
// float theGammaSlope = this->GetGammaSlope();
|
||||||
outR /= theGammaSlope;
|
// outR /= theGammaSlope;
|
||||||
outG /= theGammaSlope;
|
// outG /= theGammaSlope;
|
||||||
outB /= theGammaSlope;
|
// outB /= theGammaSlope;
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2638,10 +2638,10 @@ void AvHHud::DrawHUDNumber(int inX, int inY, int inFlags, int inNumber)
|
||||||
int theR, theG, theB;
|
int theR, theG, theB;
|
||||||
this->GetPrimaryHudColor(theR, theG, theB, false, false);
|
this->GetPrimaryHudColor(theR, theG, theB, false, false);
|
||||||
|
|
||||||
int theGammaSlope = this->GetGammaSlope();
|
//int theGammaSlope = this->GetGammaSlope();
|
||||||
theR /= theGammaSlope;
|
//theR /= theGammaSlope;
|
||||||
theG /= theGammaSlope;
|
//theG /= theGammaSlope;
|
||||||
theB /= theGammaSlope;
|
//theB /= theGammaSlope;
|
||||||
|
|
||||||
this->DrawHudNumber(inX, inY, inFlags, inNumber, theR, theG, theB);
|
this->DrawHudNumber(inX, inY, inFlags, inNumber, theR, theG, theB);
|
||||||
}
|
}
|
||||||
|
@ -2740,7 +2740,7 @@ void AvHHud::Render()
|
||||||
int theWidth;
|
int theWidth;
|
||||||
int theHeight;
|
int theHeight;
|
||||||
|
|
||||||
float gammaScale = 1.0f / GetGammaSlope();
|
float gammaScale = 1.0f/* / GetGammaSlope()*/;
|
||||||
|
|
||||||
gEngfuncs.pfnDrawSetTextColor(0, gammaScale, 0);
|
gEngfuncs.pfnDrawSetTextColor(0, gammaScale, 0);
|
||||||
gEngfuncs.pfnDrawConsoleStringLen(theMessage, &theWidth, &theHeight);
|
gEngfuncs.pfnDrawConsoleStringLen(theMessage, &theWidth, &theHeight);
|
||||||
|
@ -2876,11 +2876,11 @@ void AvHHud::RenderShowSpeed()
|
||||||
|
|
||||||
float theGroundSpeed = sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]);
|
float theGroundSpeed = sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]);
|
||||||
maxGroundSpeed = max(theGroundSpeed, maxGroundSpeed);
|
maxGroundSpeed = max(theGroundSpeed, maxGroundSpeed);
|
||||||
sprintf(buffer, "Ground speed = %d (%d)", (int)theGroundSpeed, maxGroundSpeed);
|
//sprintf(buffer, "Ground speed = %d (%d)", (int)theGroundSpeed, maxGroundSpeed);
|
||||||
mFont.DrawString(10, 12 + mFont.GetStringHeight(), buffer, theR, theG, theB);
|
//mFont.DrawString(10, 12 + mFont.GetStringHeight(), buffer, theR, theG, theB);
|
||||||
|
|
||||||
//sprintf(buffer, "vangle0= %f vangle1= %f vangle2= %f)", pmove->angles[0], pmove->angles[1], pmove->angles[2]);
|
sprintf(buffer, "vangle0= %f vangle1= %f vangle2= %f)", pmove->angles[0], pmove->angles[1], pmove->angles[2]);
|
||||||
//mFont.DrawString(10, 12 + mFont.GetStringHeight() * 2, buffer, theR, theG, theB);
|
mFont.DrawString(10, 12 + mFont.GetStringHeight() * 2, buffer, theR, theG, theB);
|
||||||
speedMeasured = true;
|
speedMeasured = true;
|
||||||
}
|
}
|
||||||
else if (speedMeasured == true) {
|
else if (speedMeasured == true) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ void AvHOverviewControl::paint()
|
||||||
|
|
||||||
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)(gEngfuncs.GetSpritePointer(m_hsprWhite)), 0);
|
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)(gEngfuncs.GetSpritePointer(m_hsprWhite)), 0);
|
||||||
|
|
||||||
float gammaScale = 1.0f / gHUD.GetGammaSlope();
|
float gammaScale = 1.0f/* / gHUD.GetGammaSlope()*/;
|
||||||
|
|
||||||
// Draw the background.
|
// Draw the background.
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ void AvHSpriteDraw(AVHHSPRITE spriteHandle, int frame, float x1, float y1, float
|
||||||
|
|
||||||
// Compensate for the overbrightening effect.
|
// Compensate for the overbrightening effect.
|
||||||
|
|
||||||
float gammaScale = 1.0f / gHUD.GetGammaSlope();
|
float gammaScale = 1.0f/* / gHUD.GetGammaSlope()*/;
|
||||||
gEngfuncs.pTriAPI->Color4f(gammaScale * gColor[0], gammaScale * gColor[1], gammaScale * gColor[2], gColor[3]);
|
gEngfuncs.pTriAPI->Color4f(gammaScale * gColor[0], gammaScale * gColor[1], gammaScale * gColor[2], gColor[3]);
|
||||||
|
|
||||||
// Output the vertices.
|
// Output the vertices.
|
||||||
|
|
|
@ -93,10 +93,10 @@ void FadingImageLabel::DoPaint()
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
this->getBgColor(r, g, b, a);
|
this->getBgColor(r, g, b, a);
|
||||||
|
|
||||||
float theGammaSlope = gHUD.GetGammaSlope();
|
//float theGammaSlope = gHUD.GetGammaSlope();
|
||||||
r = r/theGammaSlope;
|
//r = r/theGammaSlope;
|
||||||
g = g/theGammaSlope;
|
//g = g/theGammaSlope;
|
||||||
b = b/theGammaSlope;
|
//b = b/theGammaSlope;
|
||||||
|
|
||||||
// Don't take gamma slope into account for alpha
|
// Don't take gamma slope into account for alpha
|
||||||
a = 255 - a;
|
a = 255 - a;
|
||||||
|
|
|
@ -25,17 +25,17 @@ MarqueeComponent::MarqueeComponent()
|
||||||
{
|
{
|
||||||
this->mX0 = this->mY0 = 0;
|
this->mX0 = this->mY0 = 0;
|
||||||
this->mX1 = this->mY1 = 0;
|
this->mX1 = this->mY1 = 0;
|
||||||
this->mGammaSlope = 1.0f;
|
//this->mGammaSlope = 1.0f;
|
||||||
|
|
||||||
// Default color scheme
|
// Default color scheme
|
||||||
this->setFgColor(0, 255, 0, 0);
|
this->setFgColor(0, 255, 0, 0);
|
||||||
this->setBgColor(0, 255, 0, 230);
|
this->setBgColor(0, 255, 0, 230);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarqueeComponent::NotifyGammaChange(float inGammaSlope)
|
//void MarqueeComponent::NotifyGammaChange(float inGammaSlope)
|
||||||
{
|
//{
|
||||||
this->mGammaSlope = inGammaSlope;
|
// this->mGammaSlope = inGammaSlope;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MarqueeComponent::paint()
|
void MarqueeComponent::paint()
|
||||||
{
|
{
|
||||||
|
@ -49,8 +49,8 @@ void MarqueeComponent::paint()
|
||||||
int theWidth, theHeight;
|
int theWidth, theHeight;
|
||||||
this->getSize(theWidth, theHeight);
|
this->getSize(theWidth, theHeight);
|
||||||
|
|
||||||
//vguiSimpleBox(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a/this->mGammaSlope);
|
//vguiSimpleBox(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a);
|
||||||
vguiSimpleBox(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a);
|
vguiSimpleBox(0, 0, theWidth, theHeight, r, g, b, a);
|
||||||
|
|
||||||
// Top
|
// Top
|
||||||
// vguiSimpleLine(0, 0, theWidth, 0, r, g, b, a);
|
// vguiSimpleLine(0, 0, theWidth, 0, r, g, b, a);
|
||||||
|
@ -76,8 +76,8 @@ void MarqueeComponent::paintBackground()
|
||||||
int theWidth, theHeight;
|
int theWidth, theHeight;
|
||||||
this->getSize(theWidth, theHeight);
|
this->getSize(theWidth, theHeight);
|
||||||
|
|
||||||
//FillRGBA(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a/this->mGammaSlope);
|
//FillRGBA(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a);
|
||||||
FillRGBA(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a);
|
FillRGBA(0, 0, theWidth, theHeight, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarqueeComponent::ResetDimensions()
|
void MarqueeComponent::ResetDimensions()
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
#define MARQUEECOMPONENT_H
|
#define MARQUEECOMPONENT_H
|
||||||
|
|
||||||
#include "VGUI_Panel.h"
|
#include "VGUI_Panel.h"
|
||||||
#include "GammaAwareComponent.h"
|
//#include "GammaAwareComponent.h"
|
||||||
|
|
||||||
class MarqueeComponent : public vgui::Panel, public GammaAwareComponent
|
class MarqueeComponent : public vgui::Panel//, public GammaAwareComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MarqueeComponent();
|
MarqueeComponent();
|
||||||
virtual void NotifyGammaChange(float inGammaSlope);
|
//virtual void NotifyGammaChange(float inGammaSlope);
|
||||||
void SetStartPos(int inX, int inY);
|
void SetStartPos(int inX, int inY);
|
||||||
void SetEndPos(int inX, int inY);
|
void SetEndPos(int inX, int inY);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ private:
|
||||||
int mX0, mY0;
|
int mX0, mY0;
|
||||||
int mX1, mY1;
|
int mX1, mY1;
|
||||||
|
|
||||||
float mGammaSlope;
|
//float mGammaSlope;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -130,11 +130,11 @@ void PieMenu::ResetToDefaults()
|
||||||
this->mNodeList->ResetToDefaults();
|
this->mNodeList->ResetToDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PieMenu::NotifyGammaChange(float inGammaSlope)
|
//void PieMenu::NotifyGammaChange(float inGammaSlope)
|
||||||
{
|
//{
|
||||||
// TODO: Adjust font color?
|
// // TODO: Adjust font color?
|
||||||
this->mNodeList->GetRoot()->SetColorBias(1.0f/inGammaSlope);
|
// this->mNodeList->GetRoot()->SetColorBias(1.0f/inGammaSlope);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void PieMenu::SetConnectorName(const string& inConnectorName)
|
void PieMenu::SetConnectorName(const string& inConnectorName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
#include "cl_dll/chud.h"
|
#include "cl_dll/chud.h"
|
||||||
#include "ui/FadingImageLabel.h"
|
#include "ui/FadingImageLabel.h"
|
||||||
#include "ui/PieNode.h"
|
#include "ui/PieNode.h"
|
||||||
#include "ui/GammaAwareComponent.h"
|
//#include "ui/GammaAwareComponent.h"
|
||||||
#include "ui/ReloadableComponent.h"
|
#include "ui/ReloadableComponent.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using vgui::Font;
|
using vgui::Font;
|
||||||
|
|
||||||
class PieMenu : public vgui::Panel, public ReloadableComponent, public GammaAwareComponent
|
class PieMenu : public vgui::Panel, public ReloadableComponent//, public GammaAwareComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PieMenu(const string& inRootName, int x, int y, int wide, int tall);
|
PieMenu(const string& inRootName, int x, int y, int wide, int tall);
|
||||||
|
@ -59,7 +59,7 @@ public:
|
||||||
// is how it determines which item was selected.
|
// is how it determines which item was selected.
|
||||||
virtual void mouseReleased(MouseCode code, Panel* panel);
|
virtual void mouseReleased(MouseCode code, Panel* panel);
|
||||||
|
|
||||||
virtual void NotifyGammaChange(float inGammaSlope);
|
//virtual void NotifyGammaChange(float inGammaSlope);
|
||||||
|
|
||||||
void RecomputeVisibleSize(void);
|
void RecomputeVisibleSize(void);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define PIENODE_H
|
#define PIENODE_H
|
||||||
|
|
||||||
#include "ui/FadingImageLabel.h"
|
#include "ui/FadingImageLabel.h"
|
||||||
#include "ui/GammaAwareComponent.h"
|
//#include "ui/GammaAwareComponent.h"
|
||||||
#include "mod/AvHSharedTypes.h"
|
#include "mod/AvHSharedTypes.h"
|
||||||
#include "string"
|
#include "string"
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
|
@ -115,8 +115,10 @@ vgui::Color gammaAdjustColor( vgui::Color& color, const float gamma_slope )
|
||||||
{
|
{
|
||||||
int components[4];
|
int components[4];
|
||||||
color.getColor( components[0], components[1], components[2], components[3] );
|
color.getColor( components[0], components[1], components[2], components[3] );
|
||||||
ASSERT( gamma_slope != 0 );
|
////2024 - replace gamma ramp with shader
|
||||||
vgui::Color returnVal = vgui::Color( components[0]/gamma_slope, components[1]/gamma_slope, components[2]/gamma_slope, 0 );
|
//ASSERT( gamma_slope != 0 );
|
||||||
|
//vgui::Color returnVal = vgui::Color( components[0]/gamma_slope, components[1]/gamma_slope, components[2]/gamma_slope, 0 );
|
||||||
|
vgui::Color returnVal = vgui::Color(components[0], components[1], components[2], 0);
|
||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ SpritePanel::SpritePanel(const string& inBaseSpriteName, const string& inRenderM
|
||||||
|
|
||||||
this->mRenderMode = inRenderMode;
|
this->mRenderMode = inRenderMode;
|
||||||
this->mSpriteHandle = 0;
|
this->mSpriteHandle = 0;
|
||||||
this->mGammaSlope = 1.0f;
|
//this->mGammaSlope = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SpritePanel::GetNumSpritesAcross()
|
int SpritePanel::GetNumSpritesAcross()
|
||||||
|
@ -48,10 +48,10 @@ int SpritePanel::GetNumSpritesDown()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpritePanel::NotifyGammaChange(float inGammaSlope)
|
//void SpritePanel::NotifyGammaChange(float inGammaSlope)
|
||||||
{
|
//{
|
||||||
this->mGammaSlope = inGammaSlope;
|
// this->mGammaSlope = inGammaSlope;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void SpritePanel::paint()
|
void SpritePanel::paint()
|
||||||
{
|
{
|
||||||
|
@ -118,8 +118,9 @@ void SpritePanel::paint()
|
||||||
{
|
{
|
||||||
if(theCurrentFrame < theNumFrames)
|
if(theCurrentFrame < theNumFrames)
|
||||||
{
|
{
|
||||||
int theGammaAwareColorComponent = (int)(255.0f/this->mGammaSlope);
|
//int theGammaAwareColorComponent = (int)(255.0f/this->mGammaSlope);
|
||||||
SPR_Set(this->mSpriteHandle, theGammaAwareColorComponent, theGammaAwareColorComponent, theGammaAwareColorComponent);
|
//SPR_Set(this->mSpriteHandle, theGammaAwareColorComponent, theGammaAwareColorComponent, theGammaAwareColorComponent);
|
||||||
|
SPR_Set(this->mSpriteHandle, 255, 255, 255);
|
||||||
int theFinalX = theX*theSpriteWidth;
|
int theFinalX = theX*theSpriteWidth;
|
||||||
int theFinalY = theY*theSpriteHeight + theAlignBottomOffset;
|
int theFinalY = theY*theSpriteHeight + theAlignBottomOffset;
|
||||||
//if(!theAlignmentIsTop)
|
//if(!theAlignmentIsTop)
|
||||||
|
|
|
@ -2,18 +2,18 @@
|
||||||
#define SPRITEPANEL_H
|
#define SPRITEPANEL_H
|
||||||
|
|
||||||
#include "VGUI_Panel.h"
|
#include "VGUI_Panel.h"
|
||||||
#include "ui/GammaAwareComponent.h"
|
//#include "ui/GammaAwareComponent.h"
|
||||||
#include "ui/ReloadableComponent.h"
|
#include "ui/ReloadableComponent.h"
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
|
|
||||||
typedef int AVHHSPRITE;
|
typedef int AVHHSPRITE;
|
||||||
|
|
||||||
class SpritePanel : public vgui::Panel, public ReloadableComponent, public GammaAwareComponent
|
class SpritePanel : public vgui::Panel, public ReloadableComponent//, public GammaAwareComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SpritePanel(const string& inBaseSpriteName, const string& inRenderMode);
|
SpritePanel(const string& inBaseSpriteName, const string& inRenderMode);
|
||||||
|
|
||||||
virtual void NotifyGammaChange(float inGammaSlope);
|
//virtual void NotifyGammaChange(float inGammaSlope);
|
||||||
|
|
||||||
virtual void SetVAlignment(const string& inAlignment);
|
virtual void SetVAlignment(const string& inAlignment);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ private:
|
||||||
string mRenderMode;
|
string mRenderMode;
|
||||||
string mVAlignment;
|
string mVAlignment;
|
||||||
AVHHSPRITE mSpriteHandle;
|
AVHHSPRITE mSpriteHandle;
|
||||||
float mGammaSlope;
|
//float mGammaSlope;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "VGUI_TextPanel.h"
|
#include "VGUI_TextPanel.h"
|
||||||
#include "VGUI_Label.h"
|
#include "VGUI_Label.h"
|
||||||
#include "cl_dll/vgui_TeamFortressViewport.h"
|
#include "cl_dll/vgui_TeamFortressViewport.h"
|
||||||
#include "ui/GammaAwareComponent.h"
|
//#include "ui/GammaAwareComponent.h"
|
||||||
#include "ui/ReloadableComponent.h"
|
#include "ui/ReloadableComponent.h"
|
||||||
|
|
||||||
//using vgui::Label;
|
//using vgui::Label;
|
||||||
|
@ -41,7 +41,7 @@ UIManager::UIManager(UIFactory* inFactory)
|
||||||
this->mBlankCursor = NULL;
|
this->mBlankCursor = NULL;
|
||||||
|
|
||||||
this->mFactory = inFactory;
|
this->mFactory = inFactory;
|
||||||
this->mGammaSlope = 1.0f;
|
//this->mGammaSlope = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
UIManager::~UIManager(void)
|
UIManager::~UIManager(void)
|
||||||
|
@ -221,12 +221,12 @@ bool UIManager::Initialize(const TRDescriptionList& inDesc, CSchemeManager* inSc
|
||||||
this->TranslateComponent(theCurrentComponent->GetComponentPointer(), true);
|
this->TranslateComponent(theCurrentComponent->GetComponentPointer(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If gamma aware, tell it immediately
|
//// If gamma aware, tell it immediately
|
||||||
GammaAwareComponent* theGammaAwareComponent = dynamic_cast<GammaAwareComponent*>(theCurrentComponent->GetComponentPointer());
|
//GammaAwareComponent* theGammaAwareComponent = dynamic_cast<GammaAwareComponent*>(theCurrentComponent->GetComponentPointer());
|
||||||
if(theGammaAwareComponent)
|
//if(theGammaAwareComponent)
|
||||||
{
|
//{
|
||||||
theGammaAwareComponent->NotifyGammaChange(this->mGammaSlope);
|
// theGammaAwareComponent->NotifyGammaChange(this->mGammaSlope);
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Save it. It is now part of the world.
|
// Save it. It is now part of the world.
|
||||||
this->mComponentList.push_back(theCurrentComponent);
|
this->mComponentList.push_back(theCurrentComponent);
|
||||||
|
@ -250,20 +250,20 @@ bool UIManager::InMouseMode(void) const
|
||||||
return (g_iVisibleMouse ? true : false);
|
return (g_iVisibleMouse ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIManager::NotifyGammaChange(float inGammaSlope)
|
//void UIManager::NotifyGammaChange(float inGammaSlope)
|
||||||
{
|
//{
|
||||||
UIComponentListType::iterator theCompIter;
|
// UIComponentListType::iterator theCompIter;
|
||||||
for(theCompIter = this->mComponentList.begin(); theCompIter != this->mComponentList.end(); theCompIter++)
|
// for(theCompIter = this->mComponentList.begin(); theCompIter != this->mComponentList.end(); theCompIter++)
|
||||||
{
|
// {
|
||||||
GammaAwareComponent* theGammaAwareComponent = dynamic_cast<GammaAwareComponent*>((*theCompIter)->GetComponentPointer());
|
// GammaAwareComponent* theGammaAwareComponent = dynamic_cast<GammaAwareComponent*>((*theCompIter)->GetComponentPointer());
|
||||||
if(theGammaAwareComponent)
|
// if(theGammaAwareComponent)
|
||||||
{
|
// {
|
||||||
theGammaAwareComponent->NotifyGammaChange(inGammaSlope);
|
// theGammaAwareComponent->NotifyGammaChange(inGammaSlope);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
this->mGammaSlope = inGammaSlope;
|
// this->mGammaSlope = inGammaSlope;
|
||||||
}
|
//}
|
||||||
|
|
||||||
bool UIManager::Save(const string& outFilename, const string& outHeader)
|
bool UIManager::Save(const string& outFilename, const string& outHeader)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
|
|
||||||
bool InMouseMode(void) const;
|
bool InMouseMode(void) const;
|
||||||
|
|
||||||
void NotifyGammaChange(float inGammaSlope);
|
//void NotifyGammaChange(float inGammaSlope);
|
||||||
|
|
||||||
// Saves the current UI layout back out the file that it was read in from. This is only meaningful after
|
// Saves the current UI layout back out the file that it was read in from. This is only meaningful after
|
||||||
// the layout has been edited by the player. Returns false if the file couldn't be opened, if a write fails.
|
// the layout has been edited by the player. Returns false if the file couldn't be opened, if a write fails.
|
||||||
|
@ -145,7 +145,7 @@ private:
|
||||||
Cursor* mBlankCursor;
|
Cursor* mBlankCursor;
|
||||||
|
|
||||||
UIFactory* mFactory;
|
UIFactory* mFactory;
|
||||||
float mGammaSlope;
|
//float mGammaSlope;
|
||||||
|
|
||||||
// List of text representations associated with UIComponents.
|
// List of text representations associated with UIComponents.
|
||||||
// These are all currently loaded in the game.
|
// These are all currently loaded in the game.
|
||||||
|
|
|
@ -31,7 +31,7 @@ void UIDrawVariableBarSpriteHoles(AVHHSPRITE inSprite, int inX, int inY, float i
|
||||||
int theSpriteWidth = SPR_Width(inSprite, kFullFrame);
|
int theSpriteWidth = SPR_Width(inSprite, kFullFrame);
|
||||||
int theSpriteHeight = SPR_Height(inSprite, kFullFrame);
|
int theSpriteHeight = SPR_Height(inSprite, kFullFrame);
|
||||||
|
|
||||||
int theColorComponent = 255/inGammaSlope;
|
int theColorComponent = 255/*/inGammaSlope*/;
|
||||||
|
|
||||||
// Draw empty sprite
|
// Draw empty sprite
|
||||||
SPR_Set(inSprite, theColorComponent, theColorComponent, theColorComponent);
|
SPR_Set(inSprite, theColorComponent, theColorComponent, theColorComponent);
|
||||||
|
|
152
main/source/util/ShaderUtil.cpp
Normal file
152
main/source/util/ShaderUtil.cpp
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
//// Bacontsu's Shader utilities - adapted for reading directly from strings.
|
||||||
|
|
||||||
|
#include "hud.h"
|
||||||
|
#include "ShaderUtil.h"
|
||||||
|
//#include "windows.h"
|
||||||
|
#include <GL/glew.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#define access _access_s
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool FileExists(const std::string& Filename)
|
||||||
|
{
|
||||||
|
return access(Filename.c_str(), 0) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//unsigned int ShaderUtil::GetCompiledShader(unsigned int shader_type, const std::string& shader_source, const std::string& path)
|
||||||
|
//{
|
||||||
|
// unsigned int shader_id = glCreateShader(shader_type);
|
||||||
|
//
|
||||||
|
// const char* c_source = shader_source.c_str();
|
||||||
|
// glShaderSource(shader_id, 1, &c_source, nullptr);
|
||||||
|
// glCompileShader(shader_id);
|
||||||
|
//
|
||||||
|
// GLint result;
|
||||||
|
// glGetShaderiv(shader_id, GL_COMPILE_STATUS, &result);
|
||||||
|
//
|
||||||
|
// if (result == GL_FALSE)
|
||||||
|
// {
|
||||||
|
// int length;
|
||||||
|
// glGetShaderiv(shader_id, GL_INFO_LOG_LENGTH, &length);
|
||||||
|
//
|
||||||
|
// GLchar* strInfoLog = new GLchar[length + 1];
|
||||||
|
// glGetShaderInfoLog(shader_id, length, &length, strInfoLog);
|
||||||
|
//
|
||||||
|
// //fprintf(stderr, "Compilation error in shader: %s\n", strInfoLog);
|
||||||
|
// gEngfuncs.Con_Printf("[GLEW] Compilation error in shader: %s\n[GLEW] ERROR: %s\n", path.c_str(), strInfoLog);
|
||||||
|
//
|
||||||
|
// delete[] strInfoLog;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// gEngfuncs.Con_Printf("[GLEW] Compiling %s shader success!\n", path.c_str());
|
||||||
|
//
|
||||||
|
// return shader_id;
|
||||||
|
//}
|
||||||
|
|
||||||
|
unsigned int ShaderUtil::GetCompiledShader(unsigned int shader_type, const std::string& shader_source)
|
||||||
|
{
|
||||||
|
unsigned int shader_id = glCreateShader(shader_type);
|
||||||
|
|
||||||
|
const char* c_source = shader_source.c_str();
|
||||||
|
glShaderSource(shader_id, 1, &c_source, nullptr);
|
||||||
|
glCompileShader(shader_id);
|
||||||
|
|
||||||
|
GLint result;
|
||||||
|
glGetShaderiv(shader_id, GL_COMPILE_STATUS, &result);
|
||||||
|
|
||||||
|
if (result == GL_FALSE)
|
||||||
|
{
|
||||||
|
int length;
|
||||||
|
glGetShaderiv(shader_id, GL_INFO_LOG_LENGTH, &length);
|
||||||
|
|
||||||
|
GLchar* strInfoLog = new GLchar[length + 1];
|
||||||
|
glGetShaderInfoLog(shader_id, length, &length, strInfoLog);
|
||||||
|
|
||||||
|
//fprintf(stderr, "Compilation error in shader: %s\n", strInfoLog);
|
||||||
|
gEngfuncs.Con_Printf("[GLEW] Compilation error in shader: %d\n[GLEW] ERROR: %s\n", shader_type, strInfoLog);
|
||||||
|
|
||||||
|
delete[] strInfoLog;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gEngfuncs.Con_Printf("[GLEW] Compiling %d shader success!\n", shader_type);
|
||||||
|
|
||||||
|
return shader_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool ShaderUtil::LoadFromFile(const std::string& vertexShaderFile, const std::string& fragmentShaderFile)
|
||||||
|
//{
|
||||||
|
// std::ifstream is_vs(vertexShaderFile);
|
||||||
|
// const std::string f_vs((std::istreambuf_iterator<char>(is_vs)), std::istreambuf_iterator<char>());
|
||||||
|
//
|
||||||
|
// std::ifstream is_fs(fragmentShaderFile);
|
||||||
|
// const std::string f_fs((std::istreambuf_iterator<char>(is_fs)), std::istreambuf_iterator<char>());
|
||||||
|
//
|
||||||
|
// bool failToLoad = false;
|
||||||
|
// if (!FileExists(vertexShaderFile))
|
||||||
|
// {
|
||||||
|
// gEngfuncs.Con_Printf("[GLEW] Cannot find %s shader!\n", vertexShaderFile.c_str());
|
||||||
|
// failToLoad = true;
|
||||||
|
// }
|
||||||
|
// if (!FileExists(fragmentShaderFile))
|
||||||
|
// {
|
||||||
|
// gEngfuncs.Con_Printf("[GLEW] Cannot find %s shader!\n", fragmentShaderFile.c_str());
|
||||||
|
// failToLoad = true;
|
||||||
|
// }
|
||||||
|
// if (failToLoad)
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// mProgramId = glCreateProgram();
|
||||||
|
//
|
||||||
|
// unsigned int vs = GetCompiledShader(GL_VERTEX_SHADER, f_vs, vertexShaderFile);
|
||||||
|
// unsigned int fs = GetCompiledShader(GL_FRAGMENT_SHADER, f_fs, fragmentShaderFile);
|
||||||
|
//
|
||||||
|
// glAttachShader(mProgramId, vs);
|
||||||
|
// glAttachShader(mProgramId, fs);
|
||||||
|
//
|
||||||
|
// glLinkProgram(mProgramId);
|
||||||
|
// glValidateProgram(mProgramId);
|
||||||
|
//
|
||||||
|
// glDeleteShader(vs);
|
||||||
|
// glDeleteShader(fs);
|
||||||
|
//
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
bool ShaderUtil::LoadFromString(const std::string& vertexShader, const std::string& fragmentShader)
|
||||||
|
{
|
||||||
|
mProgramId = glCreateProgram();
|
||||||
|
|
||||||
|
unsigned int vs = GetCompiledShader(GL_VERTEX_SHADER, vertexShader);
|
||||||
|
unsigned int fs = GetCompiledShader(GL_FRAGMENT_SHADER, fragmentShader);
|
||||||
|
|
||||||
|
glAttachShader(mProgramId, vs);
|
||||||
|
glAttachShader(mProgramId, fs);
|
||||||
|
|
||||||
|
glLinkProgram(mProgramId);
|
||||||
|
glValidateProgram(mProgramId);
|
||||||
|
|
||||||
|
glDeleteShader(vs);
|
||||||
|
glDeleteShader(fs);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShaderUtil::Use()
|
||||||
|
{
|
||||||
|
glUseProgram(mProgramId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShaderUtil::Delete()
|
||||||
|
{
|
||||||
|
glDeleteProgram(mProgramId);
|
||||||
|
}
|
||||||
|
|
33
main/source/util/ShaderUtil.h
Normal file
33
main/source/util/ShaderUtil.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// Utitlity class to load, compile and attach a vertex- and fragment shader to a program
|
||||||
|
class ShaderUtil
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int mProgramId;
|
||||||
|
|
||||||
|
//unsigned int GetCompiledShader(unsigned int shader_type, const std::string& shader_source, const std::string& path);
|
||||||
|
unsigned int GetCompiledShader(unsigned int shader_type, const std::string& shader_source);
|
||||||
|
|
||||||
|
public:
|
||||||
|
ShaderUtil() {}
|
||||||
|
~ShaderUtil() {}
|
||||||
|
|
||||||
|
// Load a vertex and a fragment shader from file
|
||||||
|
//bool LoadFromFile(const std::string& vertexShaderFile, const std::string& fragmentShaderFile);
|
||||||
|
bool LoadFromString(const std::string& vertexShader, const std::string& fragmentShader);
|
||||||
|
|
||||||
|
// Use the program
|
||||||
|
void Use();
|
||||||
|
|
||||||
|
// Delete the program
|
||||||
|
void Delete();
|
||||||
|
|
||||||
|
// Give the programID
|
||||||
|
unsigned int GetProgramID() { return mProgramId; }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue