Skip to content

Commit bebb6ce

Browse files
committed
Synesthesia3D:
*added support for infinite projection matrix *fixed potential usage of uninitialized variable in ShaderProgramDX9.cpp GITechDemo: *added an artist parameter to control whether or not to use infinite projection matrix (used by default) *fixed sky box issues caused by infinite projection matrix *fixed an issue in DirectionalLight.hlsl in which some combination of camera, light and normal angles would cause a division by zero *fixed build scripts exit codes *commented code which set thread priorities in framework (it seemed to have caused occasional frame spikes) *FXAA is now applied based on a depth based edge detection system so as to minimize texture blurring *implemented support for borderless windowed mode *volumetric fog color is now an artist control *adjusted default parameters
1 parent 1fe61c4 commit bebb6ce

33 files changed

+350
-144
lines changed

GITechDemo/Build/build_data_win.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ def Run():
4646
#################
4747
# Configuration #
4848
#################
49-
49+
5050
# Path to folder with data build scripts (relative to this script's folder)
5151
dataSrcDir = "/../DataSrc/"
52-
52+
5353
# List of scripts to run for building data
5454
dataBuildScript = [
5555
"compile_sponza_model.py",
5656
"compile_utility_textures.py"
5757
]
58-
58+
5959
#################
6060

6161

@@ -80,14 +80,14 @@ def Run():
8080
logging.info(line.replace('\n', '').replace('\r', ''))
8181
if proc.wait() != 0:
8282
logging.info(script + " has failed!")
83-
exit()
83+
return 1
8484
logging.info("")
8585

8686

8787

8888
# Done! Print some info.
8989
logging.info("Done compiling data in " + str(time.clock() - start) + " seconds.")
90-
90+
9191
return 0
9292

9393
########
@@ -100,4 +100,4 @@ def Run():
100100

101101
if __name__ == "__main__":
102102
utils.SetupLogging("DataBuild")
103-
Run()
103+
sys.exit(Run())

GITechDemo/Build/build_project_win.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def Run():
5151
#################
5252
# Configuration #
5353
#################
54-
54+
5555
# Name of .sln file for the current project
5656
projectName = "GITechDemo"
5757

@@ -60,7 +60,7 @@ def Run():
6060
defaultArchitecture = "x64"
6161
defaultVSBuildTools = "VS100COMNTOOLS"
6262
defaultPlatformToolset = "v100"
63-
63+
6464
#################
6565

6666

@@ -72,10 +72,10 @@ def Run():
7272
#os.system('reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7"')
7373
#os.system('reg delete "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "12.0"')
7474
#os.system("reg add \"HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7\" /v \"12.0\" /t REG_SZ /d \"C:\Program Files (x86)\Microsoft Visual Studio 12.0\\\\\"")
75-
75+
7676
# Start timer
7777
start = time.clock()
78-
78+
7979
# Process command arguments
8080
for opt in sys.argv:
8181
if(opt.lower() == "rebuild"):
@@ -106,9 +106,9 @@ def Run():
106106
if(opt.lower() == "vs2015"):
107107
defaultVSBuildTools = "VS140COMNTOOLS"
108108
defaultPlatformToolset = "vs140"
109-
110-
111-
109+
110+
111+
112112
# Setup build tools
113113
envSetupBat = "VsDevCmd.bat"
114114
if(os.getenv(defaultVSBuildTools)):
@@ -142,10 +142,10 @@ def Run():
142142
# envSetupBat = "vsvars32.bat"
143143
else:
144144
logging.error("No compatible version of Visual Studio found!")
145-
exit()
146-
147-
148-
145+
return 1
146+
147+
148+
149149
# Compile tools, if required
150150
build_tools_win.Run()
151151
logging.info("")
@@ -155,20 +155,20 @@ def Run():
155155
# Compile data, if required
156156
build_data_win.Run()
157157
logging.info("")
158-
159-
158+
159+
160160
# Compile project
161161
logging.info("Starting project build process...")
162162
logging.info("Force rebuild: " + str(defaultForceRebuild))
163163
logging.info("Build configuration: " + defaultBuildConfiguration)
164164
logging.info("Architecture: " + defaultArchitecture)
165165
logging.info("Platform toolset: " + defaultPlatformToolset)
166166
logging.info("")
167-
167+
168168
startProjectBuild = time.clock()
169169
if utils.BuildSLN(projectName, pathToTools, defaultPlatformToolset, envSetupBat, defaultArchitecture, defaultBuildConfiguration, defaultForceRebuild) != 0:
170170
logging.error("Could not complete project build process")
171-
exit()
171+
return 1
172172
else:
173173
logging.info( \
174174
"Done building " + projectName + \
@@ -180,7 +180,7 @@ def Run():
180180

181181
# Copy and organize build files
182182
logging.info("Configuring build:")
183-
183+
184184
# Create directory structure
185185
logging.info("Creating directory structure...")
186186
rootBuildDir = os.path.realpath(utils.GetScriptAbsolutePath() + "/Windows/" + projectName)
@@ -200,19 +200,19 @@ def Run():
200200
]
201201
utils.CopyFiles(pathToBinaries[0], pathToBinaries[1], "*.exe")
202202
utils.CopyFiles(pathToBinaries[0], pathToBinaries[1], "*.dll")
203-
203+
204204
# Copy data
205205
logging.info("Copying data...")
206206
utils.CopyTree(utils.GetScriptAbsolutePath() + "/../Data/", rootBuildDir + "/data")
207-
207+
208208
# Create batch file
209209
logging.info("Creating batch file...")
210210
startBat = open(
211211
rootBuildDir + "/run_" +
212212
("" if (defaultBuildConfiguration == "Release") else (defaultBuildConfiguration.lower() + "_")) +
213213
defaultArchitecture.lower() + ".bat", "w"
214214
)
215-
215+
216216
startBat.write("\
217217
@echo off\n\
218218
:A\n\
@@ -225,18 +225,18 @@ def Run():
225225
exit"
226226
)
227227
startBat.close()
228-
228+
229229
logging.info("")
230-
231-
232-
230+
231+
232+
233233
# Done! Print some info.
234234
logging.info(
235235
"Done building project " + projectName +
236236
" (" + defaultBuildConfiguration + "|" + defaultArchitecture + ") in " +
237237
str(time.clock() - start) + " seconds."
238238
)
239-
239+
240240
return 0
241241

242242
########
@@ -249,4 +249,4 @@ def Run():
249249

250250
if __name__ == "__main__":
251251
utils.SetupLogging("ProjectBuild")
252-
Run()
252+
sys.exit(Run())

GITechDemo/Build/build_tools_win.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@ def Run():
4444
#################
4545
# Configuration #
4646
#################
47-
47+
4848
# List of .sln files for tools that are required for building data
4949
toolsName = [
5050
"Synesthesia3DTools"
5151
]
52-
52+
5353
defaultForceRebuild = False
5454
defaultArchitecture = "x64"
5555
defaultVSBuildTools = "VS100COMNTOOLS"
5656
defaultPlatformToolset = "v100"
57-
57+
5858
#################
59-
60-
61-
59+
60+
61+
6262
########
6363
# Main #
6464
########
@@ -110,7 +110,7 @@ def Run():
110110
# envSetupBat = "vsvars32.bat"
111111
else:
112112
logging.error("No compatible version of Visual Studio found!")
113-
exit()
113+
return 1
114114

115115

116116

@@ -124,15 +124,15 @@ def Run():
124124
startPerTool = time.clock()
125125
if utils.BuildSLN(dep, pathToTools, defaultPlatformToolset, envSetupBat, defaultArchitecture, "Release", defaultForceRebuild) != 0:
126126
logging.error("Could not complete tool build process")
127-
exit()
127+
return 1
128128
# Done! Print some info.
129129
infoStr = "Done building"
130130
infoStr += " " + dep
131131
logging.info(infoStr + " (" + defaultArchitecture + ") in " + str(time.clock() - startPerTool) + " seconds.")
132132
logging.info("")
133133

134134
logging.info("Done building tools in " + str(time.clock() - start) + " seconds.")
135-
135+
136136
return 0
137137

138138
########
@@ -145,4 +145,4 @@ def Run():
145145

146146
if __name__ == "__main__":
147147
utils.SetupLogging("ToolsBuild")
148-
Run()
148+
sys.exit(Run())

GITechDemo/Code/AppMain/Framework/Framework.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace AppFramework
2929
public:
3030
Framework()
3131
: m_bPauseRendering(false)
32-
, m_bIsFullscreen(false)
32+
, m_eWindowMode(WM_WINDOWED)
3333
{ m_pInstance = this; };
3434
virtual ~Framework() { m_pInstance = nullptr; };
3535

@@ -41,7 +41,9 @@ namespace AppFramework
4141
#else
4242
const bool IsRenderingPaused() { return m_bPauseRendering; }
4343
#endif
44-
const bool IsFullscreen() { return m_bIsFullscreen; }
44+
const bool IsFullscreen() { return m_eWindowMode == WM_FULLSCREEN; }
45+
const bool IsWindowed() { return m_eWindowMode == WM_WINDOWED; }
46+
const bool IsBorderlessWindow() { return m_eWindowMode == WM_BORDERLESS; }
4547

4648
// Low level, platform specific functionality required by the application
4749
virtual void ShowCursor(const bool bShow) = 0;
@@ -53,16 +55,24 @@ namespace AppFramework
5355
virtual unsigned int GetTicks() = 0; // in microseconds
5456
virtual void Sleep(const unsigned int miliseconds) = 0;
5557

56-
virtual void OnSwitchToFullscreenMode() { m_bIsFullscreen = true; }
57-
virtual void OnSwitchToWindowedMode() { m_bIsFullscreen = false; }
58+
virtual void OnSwitchToFullscreenMode() { m_eWindowMode = WM_FULLSCREEN; }
59+
virtual void OnSwitchToWindowedMode() { m_eWindowMode = WM_WINDOWED; }
60+
virtual void OnSwitchToBorderlessWindowedMode() { m_eWindowMode = WM_BORDERLESS; }
5861

5962
protected:
63+
enum WindowMode
64+
{
65+
WM_WINDOWED,
66+
WM_BORDERLESS,
67+
WM_FULLSCREEN,
68+
WM_MAX
69+
} m_eWindowMode;
70+
6071
// Rendering pause
6172
void PauseRendering(const bool pauseEnable) { m_bPauseRendering = pauseEnable; }
6273
virtual float CalculateDeltaTime() = 0; // in miliseconds
6374
// Pause rendering when not in focus
6475
bool m_bPauseRendering;
65-
bool m_bIsFullscreen;
6676
static Framework* m_pInstance;
6777
};
6878
}

GITechDemo/Code/AppMain/Framework/Windows/FrameworkWin.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,16 @@ int FrameworkWin::Run()
153153
else
154154
{
155155
// Set the loading threads' priorities to above normal
156-
if (!SetThreadPriority(hThread[i], THREAD_PRIORITY_ABOVE_NORMAL))
157-
{
158-
ErrorExit(TEXT("SetThreadPriority()"));
159-
bExit = true;
160-
}
156+
//if (!SetThreadPriority(hThread[i], THREAD_PRIORITY_ABOVE_NORMAL))
157+
//{
158+
// ErrorExit(TEXT("SetThreadPriority()"));
159+
// bExit = true;
160+
//}
161161
}
162162
}
163163

164164
// Reduce this thread's priority since it isn't doing anything important right now
165-
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
165+
//SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
166166
}
167167
else
168168
{
@@ -248,13 +248,14 @@ int FrameworkWin::Run()
248248
if (bAppRdy)
249249
{
250250
cout << endl << "Resources successfully loaded in " << (float)(GetTicks() - startLoadingTicks) / 1000000.f << " seconds." << endl;
251-
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
251+
//SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
252252
#ifndef _DEBUG
253253
Sleep(2000);
254254
// Free the console
255255
FreeConsole();
256256
#endif
257-
ShowWindow(m_hWnd, SW_MAXIMIZE);
257+
//ShowWindow(m_hWnd, SW_MAXIMIZE);
258+
OnSwitchToWindowedMode();
258259
BringWindowToTop(m_hWnd);
259260
SetFocus(m_hWnd);
260261
SetActiveWindow(m_hWnd);
@@ -597,6 +598,17 @@ void FrameworkWin::OnSwitchToWindowedMode()
597598
OnSetWindowedCursor();
598599
}
599600

601+
void FrameworkWin::OnSwitchToBorderlessWindowedMode()
602+
{
603+
Framework::OnSwitchToBorderlessWindowedMode();
604+
605+
OutputDebugString("[FrameworkWin] Setting windowed mode window style\n");
606+
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP | WS_VISIBLE);
607+
ShowWindow(m_hWnd, SW_SHOWMAXIMIZED);
608+
SetWindowPos(m_hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
609+
OnSetWindowedCursor();
610+
}
611+
600612
void FrameworkWin::OnSetFullscreenCursor()
601613
{
602614
const POINT pt = { 0, 0 };

GITechDemo/Code/AppMain/Framework/Windows/FrameworkWin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ namespace AppFramework
5252

5353
void OnSwitchToFullscreenMode();
5454
void OnSwitchToWindowedMode();
55+
void OnSwitchToBorderlessWindowedMode();
5556

5657
private:
5758
// Windows specific stuff

0 commit comments

Comments
 (0)