Skip to content

Commit

Permalink
Synesthesia3D:
Browse files Browse the repository at this point in the history
*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
  • Loading branch information
iftodebogdan committed Feb 25, 2017
1 parent 1fe61c4 commit bebb6ce
Show file tree
Hide file tree
Showing 33 changed files with 350 additions and 144 deletions.
12 changes: 6 additions & 6 deletions GITechDemo/Build/build_data_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ def Run():
#################
# Configuration #
#################

# Path to folder with data build scripts (relative to this script's folder)
dataSrcDir = "/../DataSrc/"

# List of scripts to run for building data
dataBuildScript = [
"compile_sponza_model.py",
"compile_utility_textures.py"
]

#################


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



# Done! Print some info.
logging.info("Done compiling data in " + str(time.clock() - start) + " seconds.")

return 0

########
Expand All @@ -100,4 +100,4 @@ def Run():

if __name__ == "__main__":
utils.SetupLogging("DataBuild")
Run()
sys.exit(Run())
50 changes: 25 additions & 25 deletions GITechDemo/Build/build_project_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def Run():
#################
# Configuration #
#################

# Name of .sln file for the current project
projectName = "GITechDemo"

Expand All @@ -60,7 +60,7 @@ def Run():
defaultArchitecture = "x64"
defaultVSBuildTools = "VS100COMNTOOLS"
defaultPlatformToolset = "v100"

#################


Expand All @@ -72,10 +72,10 @@ def Run():
#os.system('reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7"')
#os.system('reg delete "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "12.0"')
#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\\\\\"")

# Start timer
start = time.clock()

# Process command arguments
for opt in sys.argv:
if(opt.lower() == "rebuild"):
Expand Down Expand Up @@ -106,9 +106,9 @@ def Run():
if(opt.lower() == "vs2015"):
defaultVSBuildTools = "VS140COMNTOOLS"
defaultPlatformToolset = "vs140"



# Setup build tools
envSetupBat = "VsDevCmd.bat"
if(os.getenv(defaultVSBuildTools)):
Expand Down Expand Up @@ -142,10 +142,10 @@ def Run():
# envSetupBat = "vsvars32.bat"
else:
logging.error("No compatible version of Visual Studio found!")
exit()
return 1



# Compile tools, if required
build_tools_win.Run()
logging.info("")
Expand All @@ -155,20 +155,20 @@ def Run():
# Compile data, if required
build_data_win.Run()
logging.info("")


# Compile project
logging.info("Starting project build process...")
logging.info("Force rebuild: " + str(defaultForceRebuild))
logging.info("Build configuration: " + defaultBuildConfiguration)
logging.info("Architecture: " + defaultArchitecture)
logging.info("Platform toolset: " + defaultPlatformToolset)
logging.info("")

startProjectBuild = time.clock()
if utils.BuildSLN(projectName, pathToTools, defaultPlatformToolset, envSetupBat, defaultArchitecture, defaultBuildConfiguration, defaultForceRebuild) != 0:
logging.error("Could not complete project build process")
exit()
return 1
else:
logging.info( \
"Done building " + projectName + \
Expand All @@ -180,7 +180,7 @@ def Run():

# Copy and organize build files
logging.info("Configuring build:")

# Create directory structure
logging.info("Creating directory structure...")
rootBuildDir = os.path.realpath(utils.GetScriptAbsolutePath() + "/Windows/" + projectName)
Expand All @@ -200,19 +200,19 @@ def Run():
]
utils.CopyFiles(pathToBinaries[0], pathToBinaries[1], "*.exe")
utils.CopyFiles(pathToBinaries[0], pathToBinaries[1], "*.dll")

# Copy data
logging.info("Copying data...")
utils.CopyTree(utils.GetScriptAbsolutePath() + "/../Data/", rootBuildDir + "/data")

# Create batch file
logging.info("Creating batch file...")
startBat = open(
rootBuildDir + "/run_" +
("" if (defaultBuildConfiguration == "Release") else (defaultBuildConfiguration.lower() + "_")) +
defaultArchitecture.lower() + ".bat", "w"
)

startBat.write("\
@echo off\n\
:A\n\
Expand All @@ -225,18 +225,18 @@ def Run():
exit"
)
startBat.close()

logging.info("")



# Done! Print some info.
logging.info(
"Done building project " + projectName +
" (" + defaultBuildConfiguration + "|" + defaultArchitecture + ") in " +
str(time.clock() - start) + " seconds."
)

return 0

########
Expand All @@ -249,4 +249,4 @@ def Run():

if __name__ == "__main__":
utils.SetupLogging("ProjectBuild")
Run()
sys.exit(Run())
20 changes: 10 additions & 10 deletions GITechDemo/Build/build_tools_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ def Run():
#################
# Configuration #
#################

# List of .sln files for tools that are required for building data
toolsName = [
"Synesthesia3DTools"
]

defaultForceRebuild = False
defaultArchitecture = "x64"
defaultVSBuildTools = "VS100COMNTOOLS"
defaultPlatformToolset = "v100"

#################



########
# Main #
########
Expand Down Expand Up @@ -110,7 +110,7 @@ def Run():
# envSetupBat = "vsvars32.bat"
else:
logging.error("No compatible version of Visual Studio found!")
exit()
return 1



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

logging.info("Done building tools in " + str(time.clock() - start) + " seconds.")

return 0

########
Expand All @@ -145,4 +145,4 @@ def Run():

if __name__ == "__main__":
utils.SetupLogging("ToolsBuild")
Run()
sys.exit(Run())
20 changes: 15 additions & 5 deletions GITechDemo/Code/AppMain/Framework/Framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace AppFramework
public:
Framework()
: m_bPauseRendering(false)
, m_bIsFullscreen(false)
, m_eWindowMode(WM_WINDOWED)
{ m_pInstance = this; };
virtual ~Framework() { m_pInstance = nullptr; };

Expand All @@ -41,7 +41,9 @@ namespace AppFramework
#else
const bool IsRenderingPaused() { return m_bPauseRendering; }
#endif
const bool IsFullscreen() { return m_bIsFullscreen; }
const bool IsFullscreen() { return m_eWindowMode == WM_FULLSCREEN; }
const bool IsWindowed() { return m_eWindowMode == WM_WINDOWED; }
const bool IsBorderlessWindow() { return m_eWindowMode == WM_BORDERLESS; }

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

virtual void OnSwitchToFullscreenMode() { m_bIsFullscreen = true; }
virtual void OnSwitchToWindowedMode() { m_bIsFullscreen = false; }
virtual void OnSwitchToFullscreenMode() { m_eWindowMode = WM_FULLSCREEN; }
virtual void OnSwitchToWindowedMode() { m_eWindowMode = WM_WINDOWED; }
virtual void OnSwitchToBorderlessWindowedMode() { m_eWindowMode = WM_BORDERLESS; }

protected:
enum WindowMode
{
WM_WINDOWED,
WM_BORDERLESS,
WM_FULLSCREEN,
WM_MAX
} m_eWindowMode;

// Rendering pause
void PauseRendering(const bool pauseEnable) { m_bPauseRendering = pauseEnable; }
virtual float CalculateDeltaTime() = 0; // in miliseconds
// Pause rendering when not in focus
bool m_bPauseRendering;
bool m_bIsFullscreen;
static Framework* m_pInstance;
};
}
Expand Down
28 changes: 20 additions & 8 deletions GITechDemo/Code/AppMain/Framework/Windows/FrameworkWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,16 @@ int FrameworkWin::Run()
else
{
// Set the loading threads' priorities to above normal
if (!SetThreadPriority(hThread[i], THREAD_PRIORITY_ABOVE_NORMAL))
{
ErrorExit(TEXT("SetThreadPriority()"));
bExit = true;
}
//if (!SetThreadPriority(hThread[i], THREAD_PRIORITY_ABOVE_NORMAL))
//{
// ErrorExit(TEXT("SetThreadPriority()"));
// bExit = true;
//}
}
}

// Reduce this thread's priority since it isn't doing anything important right now
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
//SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
}
else
{
Expand Down Expand Up @@ -248,13 +248,14 @@ int FrameworkWin::Run()
if (bAppRdy)
{
cout << endl << "Resources successfully loaded in " << (float)(GetTicks() - startLoadingTicks) / 1000000.f << " seconds." << endl;
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
//SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
#ifndef _DEBUG
Sleep(2000);
// Free the console
FreeConsole();
#endif
ShowWindow(m_hWnd, SW_MAXIMIZE);
//ShowWindow(m_hWnd, SW_MAXIMIZE);
OnSwitchToWindowedMode();
BringWindowToTop(m_hWnd);
SetFocus(m_hWnd);
SetActiveWindow(m_hWnd);
Expand Down Expand Up @@ -597,6 +598,17 @@ void FrameworkWin::OnSwitchToWindowedMode()
OnSetWindowedCursor();
}

void FrameworkWin::OnSwitchToBorderlessWindowedMode()
{
Framework::OnSwitchToBorderlessWindowedMode();

OutputDebugString("[FrameworkWin] Setting windowed mode window style\n");
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP | WS_VISIBLE);
ShowWindow(m_hWnd, SW_SHOWMAXIMIZED);
SetWindowPos(m_hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
OnSetWindowedCursor();
}

void FrameworkWin::OnSetFullscreenCursor()
{
const POINT pt = { 0, 0 };
Expand Down
1 change: 1 addition & 0 deletions GITechDemo/Code/AppMain/Framework/Windows/FrameworkWin.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace AppFramework

void OnSwitchToFullscreenMode();
void OnSwitchToWindowedMode();
void OnSwitchToBorderlessWindowedMode();

private:
// Windows specific stuff
Expand Down

0 comments on commit bebb6ce

Please sign in to comment.