Skip to content

Commit

Permalink
Legacy opengl renderer (#421)
Browse files Browse the repository at this point in the history
legacy single buffer renderer for speed freaks
  • Loading branch information
assertivist authored Aug 13, 2024
1 parent d1cdbd6 commit 4fe45e6
Show file tree
Hide file tree
Showing 8 changed files with 556 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Avara.msvc/AvaraCore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
<ClInclude Include="..\src\net\TrackerTags.h" />
<ClInclude Include="..\src\net\UDPTags.h" />
<ClInclude Include="..\src\render\AbstractRenderer.h" />
<ClInclude Include="..\src\render\LegacyOpenGLRenderer.h" />
<ClInclude Include="..\src\render\ModernOpenGLRenderer.h" />
<ClInclude Include="..\src\render\NullRenderer.h" />
<ClInclude Include="..\src\render\OpenGLShader.h" />
Expand Down Expand Up @@ -476,6 +477,7 @@
<ClCompile Include="..\src\net\CUDPComm.cpp" />
<ClCompile Include="..\src\net\CUDPConnection.cpp" />
<ClCompile Include="..\src\render\AbstractRenderer.cpp" />
<ClCompile Include="..\src\render\LegacyOpenGLRenderer.cpp" />
<ClCompile Include="..\src\render\ModernOpenGLRenderer.cpp" />
<ClCompile Include="..\src\render\OpenGLShader.cpp" />
<ClCompile Include="..\src\render\OpenGLVertices.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions Avara.msvc/AvaraCore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,9 @@
<ClInclude Include="..\platform\windows\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\render\LegacyOpenGLRenderer.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\util\ARGBColor.cpp">
Expand Down Expand Up @@ -1118,5 +1121,8 @@
<ClCompile Include="..\vendor\pugixml\pugixml.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\render\LegacyOpenGLRenderer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
9 changes: 9 additions & 0 deletions Avara.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
6025AE4E2C255E6A00A57EFB /* LegacyOpenGLRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60C274E22C23EBE9005B67A9 /* LegacyOpenGLRenderer.cpp */; };
940541ED2B5875B200E32241 /* OpenGLShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 940541EC2B5875B200E32241 /* OpenGLShader.cpp */; };
940541EE2B5875B200E32241 /* OpenGLShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 940541EC2B5875B200E32241 /* OpenGLShader.cpp */; };
9419E8472B49ECB1007C50D0 /* CTeamColorAdjuster.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9419E8462B49ECB1007C50D0 /* CTeamColorAdjuster.cpp */; };
Expand Down Expand Up @@ -387,6 +388,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
60C274E22C23EBE9005B67A9 /* LegacyOpenGLRenderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyOpenGLRenderer.cpp; sourceTree = "<group>"; };
60C274E32C23EBE9005B67A9 /* LegacyOpenGLRenderer.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = LegacyOpenGLRenderer.h; sourceTree = "<group>"; };
940541EB2B58744500E32241 /* OpenGLShader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenGLShader.h; sourceTree = "<group>"; };
940541EC2B5875B200E32241 /* OpenGLShader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OpenGLShader.cpp; sourceTree = "<group>"; };
9419E8452B49EC89007C50D0 /* CTeamColorAdjuster.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTeamColorAdjuster.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1083,6 +1086,8 @@
children = (
947F5C642B576B9F00F41689 /* ModernOpenGLRenderer.cpp */,
947F5C632B576ACD00F41689 /* ModernOpenGLRenderer.h */,
60C274E22C23EBE9005B67A9 /* LegacyOpenGLRenderer.cpp */,
60C274E32C23EBE9005B67A9 /* LegacyOpenGLRenderer.h */,
947F5C672B57A30100F41689 /* NullRenderer.h */,
940541EC2B5875B200E32241 /* OpenGLShader.cpp */,
940541EB2B58744500E32241 /* OpenGLShader.h */,
Expand Down Expand Up @@ -2390,6 +2395,7 @@
E5890CBF29895118007A875D /* CAbstractActor.cpp in Sources */,
E5890CAA29895118007A875D /* CAbstractPipe.cpp in Sources */,
E5890F0929895124007A875D /* stb_vorbis.c in Sources */,
6025AE4E2C255E6A00A57EFB /* LegacyOpenGLRenderer.cpp in Sources */,
E5890D0529895118007A875D /* CSoundMixer.cpp in Sources */,
E5890CF529895118007A875D /* CRamp.cpp in Sources */,
E5890C9F29895118007A875D /* Resource.cpp in Sources */,
Expand Down Expand Up @@ -2597,6 +2603,7 @@
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = "";
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -2621,6 +2628,7 @@
PRODUCT_BUNDLE_IDENTIFIER = net.avaraline.Avara;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_EMIT_LOC_STRINGS = YES;
};
name = Debug;
Expand Down Expand Up @@ -2661,6 +2669,7 @@
PRODUCT_BUNDLE_IDENTIFIER = net.avaraline.Avara;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_EMIT_LOC_STRINGS = YES;
};
name = Release;
Expand Down
9 changes: 8 additions & 1 deletion src/game/CAvaraApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "Tags.h"
#include "Debug.h"
#include "ModernOpenGLRenderer.h"
#include "LegacyOpenGLRenderer.h"

// included while we fake things out
#include "CPlayerManager.h"
Expand Down Expand Up @@ -79,7 +80,13 @@ CAvaraAppImpl::CAvaraAppImpl() : CApplication("Avara") {
ui->LoadImages(mNVGContext);
}

gRenderer = new ModernOpenGLRenderer(mSDLWindow);
if (Get(kUseLegacyRenderer)) {
gRenderer = new LegacyOpenGLRenderer(mSDLWindow);
}
else {
gRenderer = new ModernOpenGLRenderer(mSDLWindow);
}

gRenderer->UpdateViewRect(mSize.x, mSize.y, mPixelRatio);
gRenderer->SetFOV(Number(kFOV));
gRenderer->ResetLights();
Expand Down
2 changes: 2 additions & 0 deletions src/gui/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ using json = nlohmann::json;
#define kFullScreenTag "fullscreen"
#define kFOV "fov"
#define kFXAA "fxaa"
#define kUseLegacyRenderer "useLegacyRenderer"

// Other graphics settings
#define kColorBlindMode "colorBlindMode"
Expand Down Expand Up @@ -196,6 +197,7 @@ static json defaultPrefs = {
{kThrottle, 0},
{kGoodGamePhrases, {}},
{kShowElo, false},
{kUseLegacyRenderer, false}
};


Expand Down
Loading

0 comments on commit 4fe45e6

Please sign in to comment.