mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- backend update from GZDoom
This commit is contained in:
parent
4c6abe1bb9
commit
d7225c1965
35 changed files with 217 additions and 98 deletions
|
@ -329,6 +329,50 @@ DEFINE_ACTION_FUNCTION(_Screen, GetClipRect)
|
||||||
return MIN(numret, 4);
|
return MIN(numret, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void CalcFullscreenScale(F2DDrawer* drawer, double srcwidth, double srcheight, int autoaspect, DoubleRect &rect)
|
||||||
|
{
|
||||||
|
auto GetWidth = [=]() { return drawer->GetWidth(); };
|
||||||
|
auto GetHeight = [=]() {return drawer->GetHeight(); };
|
||||||
|
|
||||||
|
double aspect;
|
||||||
|
if (srcheight == 200) aspect = srcwidth / 240.;
|
||||||
|
else if (srcheight == 400) aspect = srcwidth / 480;
|
||||||
|
else aspect = srcwidth / srcheight;
|
||||||
|
rect.left = rect.top = 0;
|
||||||
|
auto screenratio = ActiveRatio(GetWidth(), GetHeight());
|
||||||
|
if (autoaspect == 3)
|
||||||
|
{
|
||||||
|
if (screenratio >= aspect || aspect < 1.4) autoaspect = 1; // screen is wider than the image -> pillarbox it. 4:3 images must also be pillarboxed if the screen is taller than the image
|
||||||
|
else if (screenratio > 1.32) autoaspect = 2; // on anything 4:3 and wider crop the sides of the image.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// special case: Crop image to 4:3 and then letterbox this. This avoids too much cropping on narrow windows.
|
||||||
|
double width4_3 = srcheight * (4. / 3.);
|
||||||
|
rect.width = (double)GetWidth() * srcwidth / width4_3;
|
||||||
|
rect.height = GetHeight() * screenratio * (3. / 4.); // use 4:3 for the image
|
||||||
|
rect.top = (GetHeight() - rect.height) / 2;
|
||||||
|
rect.left = -(srcwidth - width4_3) / 2;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((screenratio > aspect) ^ (autoaspect == 2))
|
||||||
|
{
|
||||||
|
// pillarboxed or vertically cropped (i.e. scale to height)
|
||||||
|
rect.height = GetHeight();
|
||||||
|
rect.width = GetWidth() * aspect / screenratio;
|
||||||
|
rect.left = (GetWidth() - rect.width) / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// letterboxed or horizontally cropped (i.e. scale to width)
|
||||||
|
rect.width = GetWidth();
|
||||||
|
rect.height = GetHeight() * screenratio / aspect;
|
||||||
|
rect.top = (GetHeight() - rect.height) / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Draw parameter parsing
|
// Draw parameter parsing
|
||||||
|
@ -384,49 +428,30 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, do
|
||||||
parms->destheight = parms->texheight * CleanYfac_1;
|
parms->destheight = parms->texheight * CleanYfac_1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DTA_Base:
|
||||||
|
if (parms->fsscalemode != -1)
|
||||||
|
{
|
||||||
|
// First calculate the destination rect for an image of the given size and then reposition this object in it.
|
||||||
|
DoubleRect rect;
|
||||||
|
CalcFullscreenScale(drawer, parms->virtWidth, parms->virtHeight, parms->fsscalemode, rect);
|
||||||
|
parms->x = rect.left + parms->x * rect.width / parms->virtWidth;
|
||||||
|
parms->y = rect.top + parms->y * rect.height / parms->virtHeight;
|
||||||
|
parms->destwidth = parms->destwidth * rect.width / parms->virtWidth;
|
||||||
|
parms->destheight = parms->destheight * rect.height / parms->virtHeight;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case DTA_Fullscreen:
|
case DTA_Fullscreen:
|
||||||
case DTA_FullscreenEx:
|
case DTA_FullscreenEx:
|
||||||
{
|
{
|
||||||
double aspect;
|
DoubleRect rect;
|
||||||
double srcwidth = img->GetDisplayWidth();
|
CalcFullscreenScale(drawer, img->GetDisplayWidth(), img->GetDisplayHeight(), parms->fsscalemode, rect);
|
||||||
double srcheight = img->GetDisplayHeight();
|
|
||||||
int autoaspect = parms->fsscalemode;
|
|
||||||
if (srcheight == 200) aspect = srcwidth / 240.;
|
|
||||||
else if (srcheight == 400) aspect = srcwidth / 480;
|
|
||||||
else aspect = srcwidth / srcheight;
|
|
||||||
parms->x = parms->y = 0;
|
|
||||||
parms->keepratio = true;
|
parms->keepratio = true;
|
||||||
auto screenratio = ActiveRatio(GetWidth(), GetHeight());
|
parms->x = rect.left;
|
||||||
if (autoaspect == 3)
|
parms->y = rect.top;
|
||||||
{
|
parms->destwidth = rect.width;
|
||||||
if (screenratio >= aspect || aspect < 1.4) autoaspect = 1; // screen is wider than the image -> pillarbox it. 4:3 images must also be pillarboxes if the screen is taller than the image
|
parms->destheight = rect.height;
|
||||||
else if (screenratio > 1.32) autoaspect = 2; // on anything 4:3 and wider crop the sides of the image.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// special case: Crop image to 4:3 and then letterbox this. This avoids too much cropping on narrow windows.
|
|
||||||
double width4_3 = srcheight * (4. / 3.);
|
|
||||||
parms->destwidth = (double)GetWidth() * srcwidth / width4_3;
|
|
||||||
parms->destheight = GetHeight() * screenratio * (3. / 4.); // use 4:3 for the image
|
|
||||||
parms->y = (GetHeight() - parms->destheight) / 2;
|
|
||||||
parms->x = -(srcwidth - width4_3) / 2;
|
|
||||||
return false; // Do not call VirtualToRealCoords for this!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((screenratio > aspect) ^ (autoaspect == 2))
|
|
||||||
{
|
|
||||||
// pillarboxed or vertically cropped (i.e. scale to height)
|
|
||||||
parms->destheight = GetHeight();
|
|
||||||
parms->destwidth =GetWidth() * aspect / screenratio;
|
|
||||||
parms->x = (GetWidth() - parms->destwidth) / 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// letterboxed or horizontally cropped (i.e. scale to width)
|
|
||||||
parms->destwidth = GetWidth();
|
|
||||||
parms->destheight = GetHeight() * screenratio / aspect;
|
|
||||||
parms->y = (GetHeight() - parms->destheight) / 2;
|
|
||||||
}
|
|
||||||
return false; // Do not call VirtualToRealCoords for this!
|
return false; // Do not call VirtualToRealCoords for this!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,6 +623,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
||||||
parms->burn = false;
|
parms->burn = false;
|
||||||
parms->monospace = EMonospacing::Off;
|
parms->monospace = EMonospacing::Off;
|
||||||
parms->spacing = 0;
|
parms->spacing = 0;
|
||||||
|
parms->fsscalemode = -1;
|
||||||
|
|
||||||
// Parse the tag list for attributes. (For floating point attributes,
|
// Parse the tag list for attributes. (For floating point attributes,
|
||||||
// consider that the C ABI dictates that all floats be promoted to
|
// consider that the C ABI dictates that all floats be promoted to
|
||||||
|
@ -718,6 +744,14 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
||||||
parms->virtHeight = ListGetDouble(tags);
|
parms->virtHeight = ListGetDouble(tags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DTA_FullscreenScale:
|
||||||
|
intval = ListGetInt(tags);
|
||||||
|
if (intval >= 0 && intval <= 3)
|
||||||
|
{
|
||||||
|
parms->fsscalemode = (uint8_t)intval;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case DTA_Fullscreen:
|
case DTA_Fullscreen:
|
||||||
|
|
||||||
boolval = ListGetInt(tags);
|
boolval = ListGetInt(tags);
|
||||||
|
|
|
@ -88,6 +88,8 @@ enum
|
||||||
DTA_Monospace, // Fonts only: Use a fixed distance between characters.
|
DTA_Monospace, // Fonts only: Use a fixed distance between characters.
|
||||||
|
|
||||||
DTA_FullscreenEx,
|
DTA_FullscreenEx,
|
||||||
|
DTA_FullscreenScale,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EMonospacing : int
|
enum EMonospacing : int
|
||||||
|
@ -152,7 +154,7 @@ struct DrawParms
|
||||||
bool fortext;
|
bool fortext;
|
||||||
bool virtBottom;
|
bool virtBottom;
|
||||||
bool burn;
|
bool burn;
|
||||||
uint8_t fsscalemode;
|
int8_t fsscalemode;
|
||||||
double srcx, srcy;
|
double srcx, srcy;
|
||||||
double srcwidth, srcheight;
|
double srcwidth, srcheight;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1420,7 +1420,10 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
|
||||||
|
|
||||||
if(!reuse_chan || reuse_chan->StartTime == 0)
|
if(!reuse_chan || reuse_chan->StartTime == 0)
|
||||||
{
|
{
|
||||||
float st = (chanflags & SNDF_LOOP) ? fmod(startTime, (float)GetMSLength(sfx) / 1000.f) : clamp<float>(startTime, 0.f, (float)GetMSLength(sfx) / 1000.f);
|
float sfxlength = (float)GetMSLength(sfx) / 1000.f;
|
||||||
|
float st = (chanflags & SNDF_LOOP)
|
||||||
|
? (sfxlength > 0 ? fmod(startTime, sfxlength) : 0)
|
||||||
|
: clamp<float>(startTime, 0.f, sfxlength);
|
||||||
alSourcef(source, AL_SEC_OFFSET, st);
|
alSourcef(source, AL_SEC_OFFSET, st);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -547,9 +547,10 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
||||||
if (chanflags & (CHANF_UI|CHANF_NOPAUSE)) startflags |= SNDF_NOPAUSE;
|
if (chanflags & (CHANF_UI|CHANF_NOPAUSE)) startflags |= SNDF_NOPAUSE;
|
||||||
if (chanflags & CHANF_UI) startflags |= SNDF_NOREVERB;
|
if (chanflags & CHANF_UI) startflags |= SNDF_NOREVERB;
|
||||||
|
|
||||||
|
float sfxlength = (float)GSnd->GetMSLength(sfx->data) / 1000.f;
|
||||||
startTime = (startflags & SNDF_LOOP)
|
startTime = (startflags & SNDF_LOOP)
|
||||||
? fmod(startTime, (float)GSnd->GetMSLength(sfx->data) / 1000.f)
|
? (sfxlength > 0 ? fmod(startTime, sfxlength) : 0)
|
||||||
: clamp<float>(startTime, 0.f, (float)GSnd->GetMSLength(sfx->data) / 1000.f);
|
: clamp<float>(startTime, 0.f, sfxlength);
|
||||||
|
|
||||||
if (attenuation > 0 && type != SOURCE_None)
|
if (attenuation > 0 && type != SOURCE_None)
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,7 +171,7 @@ public:
|
||||||
|
|
||||||
static void ListVars (const char *filter, bool plain);
|
static void ListVars (const char *filter, bool plain);
|
||||||
|
|
||||||
const char *GetDescription() const { return Description; };
|
const FString &GetDescription() const { return Description; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoSet (UCVarValue value, ECVarType type) = 0;
|
virtual void DoSet (UCVarValue value, ECVarType type) = 0;
|
||||||
|
|
|
@ -300,6 +300,7 @@ void C_DoCommand (const char *cmd, int keynum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Get the variable's value
|
{ // Get the variable's value
|
||||||
|
if (var->GetDescription().Len()) Printf("%s\n", var->GetDescription().GetChars());
|
||||||
Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString());
|
Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,12 +360,13 @@ void FResourceFile::PostProcessArchive(void *lumps, size_t lumpsize, LumpFilterI
|
||||||
int lastpos = -1;
|
int lastpos = -1;
|
||||||
FString file;
|
FString file;
|
||||||
FString LumpFilter = filter->dotFilter;
|
FString LumpFilter = filter->dotFilter;
|
||||||
while ((len = LumpFilter.IndexOf('.', lastpos + 1)) > 0)
|
while ((len = LumpFilter.IndexOf('.', lastpos+1)) > 0)
|
||||||
{
|
{
|
||||||
max -= FilterLumps(LumpFilter.Left(len), lumps, lumpsize, max);
|
max -= FilterLumps(LumpFilter.Left(len), lumps, lumpsize, max);
|
||||||
lastpos = len;
|
lastpos = len;
|
||||||
}
|
}
|
||||||
max -= FilterLumps(LumpFilter, lumps, lumpsize, max);
|
max -= FilterLumps(LumpFilter, lumps, lumpsize, max);
|
||||||
|
|
||||||
JunkLeftoverFilters(lumps, lumpsize, max);
|
JunkLeftoverFilters(lumps, lumpsize, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#ifndef PR_SET_PTRACER
|
#ifndef PR_SET_PTRACER
|
||||||
#define PR_SET_PTRACER 0x59616d61
|
#define PR_SET_PTRACER 0x59616d61
|
||||||
#endif
|
#endif
|
||||||
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined(__OpenBSD__)
|
#elif defined (__APPLE__) || defined (BSD)
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -300,8 +300,10 @@ static SDLInputJoystickManager *JoystickManager;
|
||||||
|
|
||||||
void I_StartupJoysticks()
|
void I_StartupJoysticks()
|
||||||
{
|
{
|
||||||
|
#ifndef NO_SDL_JOYSTICK
|
||||||
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)
|
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)
|
||||||
JoystickManager = new SDLInputJoystickManager();
|
JoystickManager = new SDLInputJoystickManager();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void I_ShutdownInput()
|
void I_ShutdownInput()
|
||||||
{
|
{
|
||||||
|
@ -316,7 +318,8 @@ void I_GetJoysticks(TArray<IJoystickConfig *> &sticks)
|
||||||
{
|
{
|
||||||
sticks.Clear();
|
sticks.Clear();
|
||||||
|
|
||||||
JoystickManager->GetDevices(sticks);
|
if (JoystickManager)
|
||||||
|
JoystickManager->GetDevices(sticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_GetAxes(float axes[NUM_JOYAXIS])
|
void I_GetAxes(float axes[NUM_JOYAXIS])
|
||||||
|
@ -325,7 +328,7 @@ void I_GetAxes(float axes[NUM_JOYAXIS])
|
||||||
{
|
{
|
||||||
axes[i] = 0;
|
axes[i] = 0;
|
||||||
}
|
}
|
||||||
if (use_joystick)
|
if (use_joystick && JoystickManager)
|
||||||
{
|
{
|
||||||
JoystickManager->AddAxes(axes);
|
JoystickManager->AddAxes(axes);
|
||||||
}
|
}
|
||||||
|
@ -333,7 +336,7 @@ void I_GetAxes(float axes[NUM_JOYAXIS])
|
||||||
|
|
||||||
void I_ProcessJoysticks()
|
void I_ProcessJoysticks()
|
||||||
{
|
{
|
||||||
if (use_joystick)
|
if (use_joystick && JoystickManager)
|
||||||
JoystickManager->ProcessInput();
|
JoystickManager->ProcessInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,8 @@ void I_SetIWADInfo()
|
||||||
void Mac_I_FatalError(const char* errortext);
|
void Mac_I_FatalError(const char* errortext);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __unix__
|
||||||
void Linux_I_FatalError(const char* errortext)
|
void Unix_I_FatalError(const char* errortext)
|
||||||
{
|
{
|
||||||
// Close window or exit fullscreen and release mouse capture
|
// Close window or exit fullscreen and release mouse capture
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
@ -116,8 +116,8 @@ void I_ShowFatalError(const char *message)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
Mac_I_FatalError(message);
|
Mac_I_FatalError(message);
|
||||||
#elif defined __linux__
|
#elif defined __unix__
|
||||||
Linux_I_FatalError(message);
|
Unix_I_FatalError(message);
|
||||||
#else
|
#else
|
||||||
// ???
|
// ???
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -516,9 +516,9 @@ void OpenGLFrameBuffer::Draw2D()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLFrameBuffer::PostProcessScene(bool swscene, int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D)
|
void OpenGLFrameBuffer::PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D)
|
||||||
{
|
{
|
||||||
GLRenderer->PostProcessScene(fixedcm, afterBloomDrawEndScene2D);
|
GLRenderer->PostProcessScene(fixedcm, flash, afterBloomDrawEndScene2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
void SetVSync(bool vsync);
|
void SetVSync(bool vsync);
|
||||||
|
|
||||||
void Draw2D() override;
|
void Draw2D() override;
|
||||||
void PostProcessScene(bool swscene, int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D) override;
|
void PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D) override;
|
||||||
|
|
||||||
bool HWGammaActive = false; // Are we using hardware or software gamma?
|
bool HWGammaActive = false; // Are we using hardware or software gamma?
|
||||||
std::shared_ptr<FGLDebug> mDebug; // Debug API
|
std::shared_ptr<FGLDebug> mDebug; // Debug API
|
||||||
|
|
|
@ -52,7 +52,7 @@ void FGLRenderer::RenderScreenQuad()
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGLRenderer::PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D)
|
void FGLRenderer::PostProcessScene(int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D)
|
||||||
{
|
{
|
||||||
int sceneWidth = mBuffers->GetSceneWidth();
|
int sceneWidth = mBuffers->GetSceneWidth();
|
||||||
int sceneHeight = mBuffers->GetSceneHeight();
|
int sceneHeight = mBuffers->GetSceneHeight();
|
||||||
|
@ -62,7 +62,7 @@ void FGLRenderer::PostProcessScene(int fixedcm, const std::function<void()> &aft
|
||||||
hw_postprocess.Pass1(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
hw_postprocess.Pass1(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
||||||
mBuffers->BindCurrentFB();
|
mBuffers->BindCurrentFB();
|
||||||
if (afterBloomDrawEndScene2D) afterBloomDrawEndScene2D();
|
if (afterBloomDrawEndScene2D) afterBloomDrawEndScene2D();
|
||||||
hw_postprocess.Pass2(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
hw_postprocess.Pass2(&renderstate, fixedcm, flash, sceneWidth, sceneHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
|
|
||||||
void PresentStereo();
|
void PresentStereo();
|
||||||
void RenderScreenQuad();
|
void RenderScreenQuad();
|
||||||
void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D);
|
void PostProcessScene(int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D);
|
||||||
void AmbientOccludeScene(float m5);
|
void AmbientOccludeScene(float m5);
|
||||||
void ClearTonemapPalette();
|
void ClearTonemapPalette();
|
||||||
void BlurScene(float gameinfobluramount);
|
void BlurScene(float gameinfobluramount);
|
||||||
|
|
|
@ -67,6 +67,9 @@ public:
|
||||||
size_t DynamicLinesOffset() const { return dynamicStartLine * sizeof(AABBTreeLine); }
|
size_t DynamicLinesOffset() const { return dynamicStartLine * sizeof(AABBTreeLine); }
|
||||||
|
|
||||||
virtual bool Update() = 0;
|
virtual bool Update() = 0;
|
||||||
|
|
||||||
|
virtual ~LevelAABBTree() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
TArray<int> FindNodePath(unsigned int line, unsigned int node);
|
TArray<int> FindNodePath(unsigned int line, unsigned int node);
|
||||||
|
|
|
@ -332,7 +332,7 @@ void FSkyVertexBuffer::SetupMatrices(FGameTexture *tex, float x_offset, float y_
|
||||||
modelMatrix.loadIdentity();
|
modelMatrix.loadIdentity();
|
||||||
modelMatrix.rotate(-180.0f + x_offset, 0.f, 1.f, 0.f);
|
modelMatrix.rotate(-180.0f + x_offset, 0.f, 1.f, 0.f);
|
||||||
|
|
||||||
float xscale = texw < 1024.f ? floor(1024.f / float(texw)) : 1.f;
|
float xscale = texw < 1024.f ? floorf(1024.f / float(texw)) : 1.f;
|
||||||
float yscale = 1.f;
|
float yscale = 1.f;
|
||||||
auto texskyoffset = tex->GetSkyOffset() + skyoffset;
|
auto texskyoffset = tex->GetSkyOffset() + skyoffset;
|
||||||
if (texh <= 128 && tiled)
|
if (texh <= 128 && tiled)
|
||||||
|
|
|
@ -532,20 +532,26 @@ void PPCameraExposure::UpdateTextures(int width, int height)
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void PPColormap::Render(PPRenderState *renderstate, int fixedcm)
|
void PPColormap::Render(PPRenderState *renderstate, int fixedcm, float flash)
|
||||||
{
|
{
|
||||||
|
ColormapUniforms uniforms;
|
||||||
|
|
||||||
if (fixedcm < CM_FIRSTSPECIALCOLORMAP || fixedcm >= CM_MAXCOLORMAP)
|
if (fixedcm < CM_FIRSTSPECIALCOLORMAP || fixedcm >= CM_MAXCOLORMAP)
|
||||||
{
|
{
|
||||||
return;
|
if (flash == 1.f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uniforms.MapStart = { 0,0,0, flash };
|
||||||
|
uniforms.MapRange = { 0,0,0, 1.f };
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FSpecialColormap* scm = &SpecialColormaps[fixedcm - CM_FIRSTSPECIALCOLORMAP];
|
||||||
|
|
||||||
FSpecialColormap *scm = &SpecialColormaps[fixedcm - CM_FIRSTSPECIALCOLORMAP];
|
uniforms.MapStart = { scm->ColorizeStart[0], scm->ColorizeStart[1], scm->ColorizeStart[2], flash };
|
||||||
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
|
uniforms.MapRange = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
|
||||||
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };
|
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };
|
||||||
|
}
|
||||||
ColormapUniforms uniforms;
|
|
||||||
uniforms.MapStart = { scm->ColorizeStart[0], scm->ColorizeStart[1], scm->ColorizeStart[2], 0.f };
|
|
||||||
uniforms.MapRange = m;
|
|
||||||
|
|
||||||
renderstate->PushGroup("colormap");
|
renderstate->PushGroup("colormap");
|
||||||
|
|
||||||
|
@ -1117,10 +1123,10 @@ void Postprocess::Pass1(PPRenderState* state, int fixedcm, int sceneWidth, int s
|
||||||
bloom.RenderBloom(state, sceneWidth, sceneHeight, fixedcm);
|
bloom.RenderBloom(state, sceneWidth, sceneHeight, fixedcm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Postprocess::Pass2(PPRenderState* state, int fixedcm, int sceneWidth, int sceneHeight)
|
void Postprocess::Pass2(PPRenderState* state, int fixedcm, float flash, int sceneWidth, int sceneHeight)
|
||||||
{
|
{
|
||||||
tonemap.Render(state);
|
tonemap.Render(state);
|
||||||
colormap.Render(state, fixedcm);
|
colormap.Render(state, fixedcm, flash);
|
||||||
lens.Render(state);
|
lens.Render(state);
|
||||||
fxaa.Render(state);
|
fxaa.Render(state);
|
||||||
customShaders.Run(state, "scene");
|
customShaders.Run(state, "scene");
|
||||||
|
|
|
@ -530,7 +530,7 @@ struct ColormapUniforms
|
||||||
class PPColormap
|
class PPColormap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Render(PPRenderState *renderstate, int fixedcm);
|
void Render(PPRenderState *renderstate, int fixedcm, float flash);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PPShader Colormap = { "shaders/pp/colormap.fp", "", ColormapUniforms::Desc() };
|
PPShader Colormap = { "shaders/pp/colormap.fp", "", ColormapUniforms::Desc() };
|
||||||
|
@ -841,7 +841,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
void Pass1(PPRenderState *state, int fixedcm, int sceneWidth, int sceneHeight);
|
void Pass1(PPRenderState *state, int fixedcm, int sceneWidth, int sceneHeight);
|
||||||
void Pass2(PPRenderState* state, int fixedcm, int sceneWidth, int sceneHeight);
|
void Pass2(PPRenderState* state, int fixedcm, float flash, int sceneWidth, int sceneHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Postprocess hw_postprocess;
|
extern Postprocess hw_postprocess;
|
||||||
|
|
|
@ -232,7 +232,7 @@ static uint8_t ToIntColorComponent(float v)
|
||||||
return clamp((int)(v * 255.0f + 0.5f), 0, 255);
|
return clamp((int)(v * 255.0f + 0.5f), 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyFrameBuffer::PostProcessScene(bool swscene, int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D)
|
void PolyFrameBuffer::PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D)
|
||||||
{
|
{
|
||||||
afterBloomDrawEndScene2D();
|
afterBloomDrawEndScene2D();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
void SetTextureFilterMode() override;
|
void SetTextureFilterMode() override;
|
||||||
void BeginFrame() override;
|
void BeginFrame() override;
|
||||||
void BlurScene(float amount) override;
|
void BlurScene(float amount) override;
|
||||||
void PostProcessScene(bool swscene, int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D) override;
|
void PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D) override;
|
||||||
void AmbientOccludeScene(float m5) override;
|
void AmbientOccludeScene(float m5) override;
|
||||||
//void SetSceneRenderTarget(bool useSSAO) override;
|
//void SetSceneRenderTarget(bool useSSAO) override;
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ public:
|
||||||
virtual FTexture *WipeStartScreen();
|
virtual FTexture *WipeStartScreen();
|
||||||
virtual FTexture *WipeEndScreen();
|
virtual FTexture *WipeEndScreen();
|
||||||
|
|
||||||
virtual void PostProcessScene(bool swscene, int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D) { if (afterBloomDrawEndScene2D) afterBloomDrawEndScene2D(); }
|
virtual void PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D) { if (afterBloomDrawEndScene2D) afterBloomDrawEndScene2D(); }
|
||||||
|
|
||||||
void ScaleCoordsFromWindow(int16_t &x, int16_t &y);
|
void ScaleCoordsFromWindow(int16_t &x, int16_t &y);
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ void VkPostprocess::SetActiveRenderTarget()
|
||||||
fb->GetRenderState()->SetRenderTarget(&buffers->PipelineImage[mCurrentPipelineImage], nullptr, buffers->GetWidth(), buffers->GetHeight(), VK_FORMAT_R16G16B16A16_SFLOAT, VK_SAMPLE_COUNT_1_BIT);
|
fb->GetRenderState()->SetRenderTarget(&buffers->PipelineImage[mCurrentPipelineImage], nullptr, buffers->GetWidth(), buffers->GetHeight(), VK_FORMAT_R16G16B16A16_SFLOAT, VK_SAMPLE_COUNT_1_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VkPostprocess::PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D)
|
void VkPostprocess::PostProcessScene(int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D)
|
||||||
{
|
{
|
||||||
auto fb = GetVulkanFrameBuffer();
|
auto fb = GetVulkanFrameBuffer();
|
||||||
int sceneWidth = fb->GetBuffers()->GetSceneWidth();
|
int sceneWidth = fb->GetBuffers()->GetSceneWidth();
|
||||||
|
@ -71,7 +71,7 @@ void VkPostprocess::PostProcessScene(int fixedcm, const std::function<void()> &a
|
||||||
hw_postprocess.Pass1(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
hw_postprocess.Pass1(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
||||||
SetActiveRenderTarget();
|
SetActiveRenderTarget();
|
||||||
afterBloomDrawEndScene2D();
|
afterBloomDrawEndScene2D();
|
||||||
hw_postprocess.Pass2(&renderstate, fixedcm, sceneWidth, sceneHeight);
|
hw_postprocess.Pass2(&renderstate, fixedcm, flash, sceneWidth, sceneHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VkPostprocess::BlitSceneToPostprocess()
|
void VkPostprocess::BlitSceneToPostprocess()
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
void RenderBuffersReset();
|
void RenderBuffersReset();
|
||||||
|
|
||||||
void SetActiveRenderTarget();
|
void SetActiveRenderTarget();
|
||||||
void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D);
|
void PostProcessScene(int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D);
|
||||||
|
|
||||||
void AmbientOccludeScene(float m5);
|
void AmbientOccludeScene(float m5);
|
||||||
void BlurScene(float gameinfobluramount);
|
void BlurScene(float gameinfobluramount);
|
||||||
|
|
|
@ -343,10 +343,10 @@ void VulkanFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function<voi
|
||||||
tex->SetUpdated(true);
|
tex->SetUpdated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VulkanFrameBuffer::PostProcessScene(bool swscene, int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D)
|
void VulkanFrameBuffer::PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D)
|
||||||
{
|
{
|
||||||
if (!swscene) mPostprocess->BlitSceneToPostprocess(); // Copy the resulting scene to the current post process texture
|
if (!swscene) mPostprocess->BlitSceneToPostprocess(); // Copy the resulting scene to the current post process texture
|
||||||
mPostprocess->PostProcessScene(fixedcm, afterBloomDrawEndScene2D);
|
mPostprocess->PostProcessScene(fixedcm, flash, afterBloomDrawEndScene2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* VulkanFrameBuffer::DeviceName() const
|
const char* VulkanFrameBuffer::DeviceName() const
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
void StartPrecaching() override;
|
void StartPrecaching() override;
|
||||||
void BeginFrame() override;
|
void BeginFrame() override;
|
||||||
void BlurScene(float amount) override;
|
void BlurScene(float amount) override;
|
||||||
void PostProcessScene(bool swscene, int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D) override;
|
void PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D) override;
|
||||||
void AmbientOccludeScene(float m5) override;
|
void AmbientOccludeScene(float m5) override;
|
||||||
void SetSceneRenderTarget(bool useSSAO) override;
|
void SetSceneRenderTarget(bool useSSAO) override;
|
||||||
void UpdateShadowMap() override;
|
void UpdateShadowMap() override;
|
||||||
|
|
|
@ -60,9 +60,6 @@ VkTexClamp TexClamp[] ={
|
||||||
{ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_REPEAT },
|
{ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_REPEAT },
|
||||||
{ VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE },
|
{ VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE },
|
||||||
{ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE },
|
{ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE },
|
||||||
{ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE },
|
|
||||||
{ VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT },
|
|
||||||
{ VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VkSamplerManager::VkSamplerManager(VulkanDevice *dev)
|
VkSamplerManager::VkSamplerManager(VulkanDevice *dev)
|
||||||
|
@ -86,14 +83,14 @@ void VkSamplerManager::Create()
|
||||||
{
|
{
|
||||||
int filter = sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter()? 0 : gl_texture_filter;
|
int filter = sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter()? 0 : gl_texture_filter;
|
||||||
|
|
||||||
for(int i = 0; i < 7; i++)
|
for (int i = CLAMP_NONE; i <= CLAMP_XY; i++)
|
||||||
{
|
{
|
||||||
SamplerBuilder builder;
|
SamplerBuilder builder;
|
||||||
builder.setMagFilter(TexFilter[filter].magFilter);
|
builder.setMagFilter(TexFilter[filter].magFilter);
|
||||||
builder.setMinFilter(TexFilter[filter].minFilter);
|
builder.setMinFilter(TexFilter[filter].minFilter);
|
||||||
builder.setAddressMode(TexClamp[i].clamp_u, TexClamp[i].clamp_v, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
builder.setAddressMode(TexClamp[i].clamp_u, TexClamp[i].clamp_v, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
||||||
builder.setMipmapMode(TexFilter[filter].mipfilter);
|
builder.setMipmapMode(TexFilter[filter].mipfilter);
|
||||||
if (i <= CLAMP_XY && TexFilter[filter].mipmapping)
|
if (TexFilter[filter].mipmapping)
|
||||||
{
|
{
|
||||||
builder.setAnisotropy(gl_texture_filter_anisotropic);
|
builder.setAnisotropy(gl_texture_filter_anisotropic);
|
||||||
builder.setMaxLod(100.0f); // According to the spec this value is clamped so something high makes it usable for all textures.
|
builder.setMaxLod(100.0f); // According to the spec this value is clamped so something high makes it usable for all textures.
|
||||||
|
@ -104,11 +101,43 @@ void VkSamplerManager::Create()
|
||||||
}
|
}
|
||||||
mSamplers[i] = builder.create(vDevice);
|
mSamplers[i] = builder.create(vDevice);
|
||||||
mSamplers[i]->SetDebugName("VkSamplerManager.mSamplers");
|
mSamplers[i]->SetDebugName("VkSamplerManager.mSamplers");
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
SamplerBuilder builder;
|
||||||
|
builder.setMagFilter(TexFilter[filter].magFilter);
|
||||||
|
builder.setMinFilter(TexFilter[filter].magFilter);
|
||||||
|
builder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
||||||
|
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||||
|
builder.setMaxLod(0.25f);
|
||||||
|
mSamplers[CLAMP_XY_NOMIP] = builder.create(vDevice);
|
||||||
|
mSamplers[CLAMP_XY_NOMIP]->SetDebugName("VkSamplerManager.mSamplers");
|
||||||
|
}
|
||||||
|
for (int i = CLAMP_NOFILTER; i <= CLAMP_NOFILTER_XY; i++)
|
||||||
|
{
|
||||||
|
SamplerBuilder builder;
|
||||||
|
builder.setMagFilter(VK_FILTER_NEAREST);
|
||||||
|
builder.setMinFilter(VK_FILTER_NEAREST);
|
||||||
|
builder.setAddressMode(TexClamp[i - CLAMP_NOFILTER].clamp_u, TexClamp[i - CLAMP_NOFILTER].clamp_v, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
||||||
|
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||||
|
builder.setMaxLod(0.25f);
|
||||||
|
mSamplers[i] = builder.create(vDevice);
|
||||||
|
mSamplers[i]->SetDebugName("VkSamplerManager.mSamplers");
|
||||||
|
}
|
||||||
|
// CAMTEX is repeating with texture filter and no mipmap
|
||||||
|
{
|
||||||
|
SamplerBuilder builder;
|
||||||
|
builder.setMagFilter(TexFilter[filter].magFilter);
|
||||||
|
builder.setMinFilter(TexFilter[filter].magFilter);
|
||||||
|
builder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT);
|
||||||
|
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||||
|
builder.setMaxLod(0.25f);
|
||||||
|
mSamplers[CLAMP_CAMTEX] = builder.create(vDevice);
|
||||||
|
mSamplers[CLAMP_CAMTEX]->SetDebugName("VkSamplerManager.mSamplers");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VkSamplerManager::Destroy()
|
void VkSamplerManager::Destroy()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 7; i++)
|
for (int i = 0; i < NUMSAMPLERS; i++)
|
||||||
mSamplers[i].reset();
|
mSamplers[i].reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ class VulkanDevice;
|
||||||
class VkSamplerManager
|
class VkSamplerManager
|
||||||
{
|
{
|
||||||
VulkanDevice *vDevice;
|
VulkanDevice *vDevice;
|
||||||
std::unique_ptr<VulkanSampler> mSamplers[7];
|
std::unique_ptr<VulkanSampler> mSamplers[NUMSAMPLERS];
|
||||||
|
|
||||||
//void UnbindAll();
|
//void UnbindAll();
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ void JitCompiler::SetupFrame()
|
||||||
offsetD = offsetA + (int)(sfunc->NumRegA * sizeof(void*));
|
offsetD = offsetA + (int)(sfunc->NumRegA * sizeof(void*));
|
||||||
offsetExtra = (offsetD + (int)(sfunc->NumRegD * sizeof(int32_t)) + 15) & ~15;
|
offsetExtra = (offsetD + (int)(sfunc->NumRegD * sizeof(int32_t)) + 15) & ~15;
|
||||||
|
|
||||||
if (sfunc->SpecialInits.Size() == 0 && sfunc->NumRegS == 0)
|
if (sfunc->SpecialInits.Size() == 0 && sfunc->NumRegS == 0 && sfunc->ExtraSpace == 0)
|
||||||
{
|
{
|
||||||
SetupSimpleFrame();
|
SetupSimpleFrame();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,7 @@ void FGameTexture::AddAutoMaterials()
|
||||||
{ "materials/ao/", &FGameTexture::AmbientOcclusion }
|
{ "materials/ao/", &FGameTexture::AmbientOcclusion }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (flags & GTexf_AutoMaterialsAdded) return; // do this only once
|
||||||
|
|
||||||
bool fullname = !!(flags & GTexf_FullNameTexture);
|
bool fullname = !!(flags & GTexf_FullNameTexture);
|
||||||
FString searchname = GetName();
|
FString searchname = GetName();
|
||||||
|
@ -177,6 +178,7 @@ void FGameTexture::AddAutoMaterials()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
flags |= GTexf_AutoMaterialsAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -460,7 +462,7 @@ float FTexCoordInfo::TextureAdjustWidth() const
|
||||||
{
|
{
|
||||||
float tscale = fabsf(mTempScale.X);
|
float tscale = fabsf(mTempScale.X);
|
||||||
if (tscale == 1.f) return (float)mRenderWidth;
|
if (tscale == 1.f) return (float)mRenderWidth;
|
||||||
else return mWidth / fabs(tscale);
|
else return mWidth / fabsf(tscale);
|
||||||
}
|
}
|
||||||
else return (float)mWidth;
|
else return (float)mWidth;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,14 @@ enum EGameTexFlags
|
||||||
GTexf_RenderFullbright = 32, // always draw fullbright
|
GTexf_RenderFullbright = 32, // always draw fullbright
|
||||||
GTexf_DisableFullbrightSprites = 64, // This texture will not be displayed as fullbright sprite
|
GTexf_DisableFullbrightSprites = 64, // This texture will not be displayed as fullbright sprite
|
||||||
GTexf_BrightmapChecked = 128, // Check for a colormap-based brightmap was already done.
|
GTexf_BrightmapChecked = 128, // Check for a colormap-based brightmap was already done.
|
||||||
|
GTexf_AutoMaterialsAdded = 256, // AddAutoMaterials has been called on this texture.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Refactoring helper to allow piece by piece adjustment of the API
|
// Refactoring helper to allow piece by piece adjustment of the API
|
||||||
class FGameTexture
|
class FGameTexture
|
||||||
{
|
{
|
||||||
friend class FMaterial;
|
friend class FMaterial;
|
||||||
|
friend class GLDefsParser; // this needs access to set up the texture properly
|
||||||
|
|
||||||
// Material layers. These are shared so reference counting is used.
|
// Material layers. These are shared so reference counting is used.
|
||||||
RefCountedPtr<FTexture> Base;
|
RefCountedPtr<FTexture> Base;
|
||||||
|
|
|
@ -625,8 +625,12 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
||||||
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
|
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
|
||||||
gtex->SetWorldPanning(true);
|
gtex->SetWorldPanning(true);
|
||||||
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
||||||
gtex->SetOffsets(0, oldtex->GetTexelLeftOffset(0), oldtex->GetTexelTopOffset(0));
|
double xscale1 = oldtex->GetTexelLeftOffset(0) * gtex->GetScaleX() / oldtex->GetScaleX();
|
||||||
gtex->SetOffsets(1, oldtex->GetTexelLeftOffset(1), oldtex->GetTexelTopOffset(1));
|
double xscale2 = oldtex->GetTexelLeftOffset(1) * gtex->GetScaleX() / oldtex->GetScaleX();
|
||||||
|
double yscale1 = oldtex->GetTexelTopOffset(0) * gtex->GetScaleY() / oldtex->GetScaleY();
|
||||||
|
double yscale2 = oldtex->GetTexelTopOffset(1) * gtex->GetScaleY() / oldtex->GetScaleY();
|
||||||
|
gtex->SetOffsets(0, xs_RoundToInt(xscale1), xs_RoundToInt(yscale1));
|
||||||
|
gtex->SetOffsets(1, xs_RoundToInt(xscale2), xs_RoundToInt(yscale2));
|
||||||
ReplaceTexture(tlist[i], gtex, true);
|
ReplaceTexture(tlist[i], gtex, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -721,8 +725,12 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
|
||||||
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
|
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
|
||||||
gtex->SetWorldPanning(true);
|
gtex->SetWorldPanning(true);
|
||||||
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
||||||
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
|
double xscale1 = oldtex->GetTexelLeftOffset(0) * gtex->GetScaleX() / oldtex->GetScaleX();
|
||||||
gtex->SetOffsets(1, xs_RoundToInt(oldtex->GetDisplayLeftOffset(1) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(1) * gtex->GetScaleY()));
|
double xscale2 = oldtex->GetTexelLeftOffset(1) * gtex->GetScaleX() / oldtex->GetScaleX();
|
||||||
|
double yscale1 = oldtex->GetTexelTopOffset(0) * gtex->GetScaleY() / oldtex->GetScaleY();
|
||||||
|
double yscale2 = oldtex->GetTexelTopOffset(1) * gtex->GetScaleY() / oldtex->GetScaleY();
|
||||||
|
gtex->SetOffsets(0, xs_RoundToInt(xscale1), xs_RoundToInt(yscale1));
|
||||||
|
gtex->SetOffsets(1, xs_RoundToInt(xscale2), xs_RoundToInt(yscale2));
|
||||||
ReplaceTexture(tlist[i], gtex, true);
|
ReplaceTexture(tlist[i], gtex, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,10 @@ inline float RAD2DEG(float deg)
|
||||||
return deg * float(180. / M_PI);
|
return deg * float(180. / M_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline double RAD2DEG(double deg)
|
||||||
|
{
|
||||||
|
return deg * (180. / M_PI);
|
||||||
|
}
|
||||||
|
|
||||||
// Auto-registration sections for GCC.
|
// Auto-registration sections for GCC.
|
||||||
// Apparently, you cannot do string concatenation inside section attributes.
|
// Apparently, you cannot do string concatenation inside section attributes.
|
||||||
|
|
|
@ -19,3 +19,23 @@ struct FloatRect
|
||||||
height*=yfac;
|
height*=yfac;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct DoubleRect
|
||||||
|
{
|
||||||
|
double left, top;
|
||||||
|
double width, height;
|
||||||
|
|
||||||
|
|
||||||
|
void Offset(double xofs, double yofs)
|
||||||
|
{
|
||||||
|
left += xofs;
|
||||||
|
top += yofs;
|
||||||
|
}
|
||||||
|
void Scale(double xfac, double yfac)
|
||||||
|
{
|
||||||
|
left *= xfac;
|
||||||
|
width *= xfac;
|
||||||
|
top *= yfac;
|
||||||
|
height *= yfac;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -743,7 +743,7 @@ void videoShowFrame(int32_t w)
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGLRenderer::GLRenderer->mBuffers->BlitSceneToTexture(); // Copy the resulting scene to the current post process texture
|
OpenGLRenderer::GLRenderer->mBuffers->BlitSceneToTexture(); // Copy the resulting scene to the current post process texture
|
||||||
screen->PostProcessScene(false, 0, []() {
|
screen->PostProcessScene(false, 0, 1.f, []() {
|
||||||
GLInterface.Draw2D(&twodpsp); // draws the weapon sprites
|
GLInterface.Draw2D(&twodpsp); // draws the weapon sprites
|
||||||
});
|
});
|
||||||
screen->Update();
|
screen->Update();
|
||||||
|
|
Loading…
Reference in a new issue