Merged OpenGL UDB dev branch

This commit is contained in:
ZZYZX 2019-12-24 19:49:43 +02:00
commit 6419cc04b0
257 changed files with 25868 additions and 66397 deletions

22
.gitignore vendored
View file

@ -8,4 +8,24 @@ obj
/Build/DevIL.dll
/Build/Plugins/*.dll
/Build/Builder.pdb
/Build/Builder.exe.config
/Build/Builder.exe.config
/Build/Plugins/*.pdb
/Source/Plugins/VisplaneExplorer/Resources/*.ilk
/Source/Plugins/VisplaneExplorer/Resources/*.exp
/Source/Plugins/VisplaneExplorer/Resources/*.lib
/Source/Plugins/VisplaneExplorer/Resources/*.pdb
/Source/Plugins/vpo_dll/Debug
/Source/Plugins/vpo_dll/*.user
/Build/BuilderNative.dll
/Build/BuilderNative.exp
/Build/BuilderNative.ilk
/Build/BuilderNative.lib
/Build/BuilderNative.pdb
/Source/Native/Debug
/Source/Native/Release
*.iobj
*.ipdb
/Source/Plugins/vpo_dll/Release
/Source/Core/*.user
/Build/libBuilderNative.so
/Build/OpenGLDebug.log

View file

@ -1,9 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -1,4 +1,4 @@
URL http://devbuilds.drdteam.org/gzdbbf/
URL http://devbuilds.drdteam.org/ultimatedoombuilder/
FileName Builder.exe
UpdateName GZDoom_Builder_Bugfix-r[REVNUM].7z
UpdaterName GZDB_Updater-x86.7z
UpdateName UltimateDoomBuilder-r[REVNUM]-x86.7z
UpdaterName UDB_Updater-x86.7z

View file

@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Builder", "Source\Core\Builder.csproj", "{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}"
ProjectSection(ProjectDependencies) = postProject
{78938655-9807-485E-9D4B-46226DC7AD27} = {78938655-9807-485E-9D4B-46226DC7AD27}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "Source\Plugins\BuilderModes\BuilderModes.csproj", "{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}"
EndProject
@ -35,6 +38,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomapMode", "Source\Plugi
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vpo_dll", "Source\Plugins\vpo_dll\vpo_dll.vcxproj", "{29C8D76F-DE3D-482D-AD7D-B86BBD0824DE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BuilderNative", "Source\Native\BuilderNative.vcxproj", "{78938655-9807-485E-9D4B-46226DC7AD27}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThreeDFloorMode", "Source\Plugins\3DFloorMode\ThreeDFloorMode.csproj", "{88CFD996-027B-4CBE-9828-26B2728B6127}"
EndProject
Global
@ -317,6 +322,28 @@ Global
{29C8D76F-DE3D-482D-AD7D-B86BBD0824DE}.Release|x64.Build.0 = Release|x64
{29C8D76F-DE3D-482D-AD7D-B86BBD0824DE}.Release|x86.ActiveCfg = Release|Win32
{29C8D76F-DE3D-482D-AD7D-B86BBD0824DE}.Release|x86.Build.0 = Release|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug + Profiler|Any CPU.ActiveCfg = Release|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug + Profiler|Any CPU.Build.0 = Release|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug + Profiler|x64.ActiveCfg = Debug|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug + Profiler|x64.Build.0 = Debug|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug + Profiler|x86.ActiveCfg = Debug|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug + Profiler|x86.Build.0 = Debug|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug|Any CPU.ActiveCfg = Debug|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug|x64.ActiveCfg = Debug|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug|x64.Build.0 = Debug|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug|x86.ActiveCfg = Debug|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Debug|x86.Build.0 = Debug|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Release + Profiler|Any CPU.ActiveCfg = Release|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Release + Profiler|Any CPU.Build.0 = Release|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Release + Profiler|x64.ActiveCfg = Release|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Release + Profiler|x64.Build.0 = Release|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Release + Profiler|x86.ActiveCfg = Release|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Release + Profiler|x86.Build.0 = Release|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Release|Any CPU.ActiveCfg = Release|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Release|x64.ActiveCfg = Release|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Release|x64.Build.0 = Release|x64
{78938655-9807-485E-9D4B-46226DC7AD27}.Release|x86.ActiveCfg = Release|Win32
{78938655-9807-485E-9D4B-46226DC7AD27}.Release|x86.Build.0 = Release|Win32
{88CFD996-027B-4CBE-9828-26B2728B6127}.Debug + Profiler|Any CPU.ActiveCfg = Debug|Any CPU
{88CFD996-027B-4CBE-9828-26B2728B6127}.Debug + Profiler|Any CPU.Build.0 = Debug|Any CPU
{88CFD996-027B-4CBE-9828-26B2728B6127}.Debug + Profiler|x64.ActiveCfg = Debug|x64

244
BuilderMono.sln Normal file
View file

@ -0,0 +1,244 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29201.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Builder", "Source\Core\BuilderMono.csproj", "{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "Source\Plugins\BuilderModes\BuilderModesMono.csproj", "{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderEffects", "Source\Plugins\BuilderEffects\BuilderEffectsMono.csproj", "{B859BE0F-A992-476D-A642-FA8EFE94AAA5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPicker", "Source\Plugins\ColorPicker\ColorPickerMono.csproj", "{A4761900-0EA3-4FE4-A919-847FD5080EFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagExplorer", "Source\Plugins\TagExplorer\TagExplorerMono.csproj", "{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommentsPanel", "Source\Plugins\CommentsPanel\CommentsPanelMono.csproj", "{58BD8A5B-1B48-435D-8473-A92F27D06C49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NodesViewer", "Source\Plugins\NodesViewer\NodesViewerMono.csproj", "{9F244231-6A0C-42A6-87C5-ED9620DEE096}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagRange", "Source\Plugins\TagRange\TagRangeMono.csproj", "{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisplaneExplorer", "Source\Plugins\VisplaneExplorer\VisplaneExplorerMono.csproj", "{CF670175-7099-4090-A330-EE25C7230139}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoundPropagation", "Source\Plugins\SoundPropagationMode\SoundPropagationMono.csproj", "{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StairSectorBuilder", "Source\Plugins\StairSectorBuilder\StairSectorBuilderMono.csproj", "{3F365121-906B-409D-BB1E-37E0A78056C2}"
ProjectSection(ProjectDependencies) = postProject
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C} = {818B3D10-F791-4C3F-9AF5-BB2D0079B63C}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomapMode", "Source\Plugins\AutomapMode\AutomapModeMono.csproj", "{B33F68D5-1335-400C-A1D7-7F5602A030EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug + Profiler|x64 = Debug + Profiler|x64
Debug + Profiler|x86 = Debug + Profiler|x86
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release + Profiler|x64 = Release + Profiler|x64
Release + Profiler|x86 = Release + Profiler|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug|x64.ActiveCfg = Debug|x64
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug|x64.Build.0 = Debug|x64
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug|x86.ActiveCfg = Debug|x86
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug|x86.Build.0 = Debug|x86
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|x64.ActiveCfg = Release|x64
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|x64.Build.0 = Release|x64
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|x86.ActiveCfg = Release|x86
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|x86.Build.0 = Release|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|x64.ActiveCfg = Debug|x64
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|x64.Build.0 = Debug|x64
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|x86.ActiveCfg = Debug|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|x86.Build.0 = Debug|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x64.ActiveCfg = Release|x64
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x64.Build.0 = Release|x64
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.ActiveCfg = Release|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.Build.0 = Release|x86
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug|x64.ActiveCfg = Debug|x64
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug|x64.Build.0 = Debug|x64
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug|x86.ActiveCfg = Debug|x86
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Debug|x86.Build.0 = Debug|x86
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release|x64.ActiveCfg = Release|x64
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release|x64.Build.0 = Release|x64
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release|x86.ActiveCfg = Release|x86
{B859BE0F-A992-476D-A642-FA8EFE94AAA5}.Release|x86.Build.0 = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x64.ActiveCfg = Debug|x64
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x64.Build.0 = Debug|x64
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.ActiveCfg = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.Build.0 = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x64.ActiveCfg = Release|x64
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x64.Build.0 = Release|x64
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.ActiveCfg = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.Build.0 = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x64.ActiveCfg = Debug|x64
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x64.Build.0 = Debug|x64
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.ActiveCfg = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.Build.0 = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x64.ActiveCfg = Release|x64
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x64.Build.0 = Release|x64
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.ActiveCfg = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.Build.0 = Release|x86
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|x64.ActiveCfg = Debug|x64
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|x64.Build.0 = Debug|x64
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|x86.ActiveCfg = Debug|x86
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Debug|x86.Build.0 = Debug|x86
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|x64.ActiveCfg = Release|x64
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|x64.Build.0 = Release|x64
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|x86.ActiveCfg = Release|x86
{58BD8A5B-1B48-435D-8473-A92F27D06C49}.Release|x86.Build.0 = Release|x86
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug|x64.ActiveCfg = Debug|x64
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug|x64.Build.0 = Debug|x64
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug|x86.ActiveCfg = Debug|x86
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Debug|x86.Build.0 = Debug|x86
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release|x64.ActiveCfg = Release|x64
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release|x64.Build.0 = Release|x64
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release|x86.ActiveCfg = Release|x86
{9F244231-6A0C-42A6-87C5-ED9620DEE096}.Release|x86.Build.0 = Release|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug|x64.ActiveCfg = Debug|x64
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug|x64.Build.0 = Debug|x64
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug|x86.ActiveCfg = Debug|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Debug|x86.Build.0 = Debug|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|x64.ActiveCfg = Release|x64
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|x64.Build.0 = Release|x64
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|x86.ActiveCfg = Release|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|x86.Build.0 = Release|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{CF670175-7099-4090-A330-EE25C7230139}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{CF670175-7099-4090-A330-EE25C7230139}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x64.ActiveCfg = Debug|x64
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x64.Build.0 = Debug|x64
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x86.ActiveCfg = Debug|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x86.Build.0 = Debug|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{CF670175-7099-4090-A330-EE25C7230139}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{CF670175-7099-4090-A330-EE25C7230139}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release|x64.ActiveCfg = Release|x64
{CF670175-7099-4090-A330-EE25C7230139}.Release|x64.Build.0 = Release|x64
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.ActiveCfg = Release|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.Build.0 = Release|x86
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug|x64.ActiveCfg = Debug|x64
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug|x64.Build.0 = Debug|x64
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug|x86.ActiveCfg = Debug|x86
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Debug|x86.Build.0 = Debug|x86
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release|x64.ActiveCfg = Release|x64
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release|x64.Build.0 = Release|x64
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release|x86.ActiveCfg = Release|x86
{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}.Release|x86.Build.0 = Release|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug + Profiler|x64.ActiveCfg = Debug + Profiler|x64
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug + Profiler|x64.Build.0 = Debug + Profiler|x64
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug + Profiler|x86.ActiveCfg = Debug + Profiler|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug + Profiler|x86.Build.0 = Debug + Profiler|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|x64.ActiveCfg = Debug|x64
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|x64.Build.0 = Debug|x64
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|x86.ActiveCfg = Debug|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Debug|x86.Build.0 = Debug|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release + Profiler|x64.ActiveCfg = Release + Profiler|x64
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release + Profiler|x64.Build.0 = Release + Profiler|x64
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release + Profiler|x86.ActiveCfg = Release + Profiler|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release + Profiler|x86.Build.0 = Release + Profiler|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x64.ActiveCfg = Release|x64
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x64.Build.0 = Release|x64
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x86.ActiveCfg = Release|x86
{3F365121-906B-409D-BB1E-37E0A78056C2}.Release|x86.Build.0 = Release|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug + Profiler|x64.ActiveCfg = Debug|x64
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug + Profiler|x64.Build.0 = Debug|x64
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug + Profiler|x86.ActiveCfg = Debug|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug + Profiler|x86.Build.0 = Debug|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug|x64.ActiveCfg = Debug|x64
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug|x64.Build.0 = Debug|x64
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug|x86.ActiveCfg = Debug|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Debug|x86.Build.0 = Debug|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release + Profiler|x64.ActiveCfg = Release|x64
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release + Profiler|x64.Build.0 = Release|x64
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release + Profiler|x86.ActiveCfg = Release|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release + Profiler|x86.Build.0 = Release|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release|x64.ActiveCfg = Release|x64
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release|x64.Build.0 = Release|x64
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release|x86.ActiveCfg = Release|x86
{B33F68D5-1335-400C-A1D7-7F5602A030EF}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3B8A71AA-A484-4F99-AE33-F11E20476E10}
EndGlobalSection
EndGlobal

674
LICENSE.txt Executable file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -1,216 +0,0 @@
@ECHO OFF
ECHO.
ECHO. This build script requires the following software to be installed:
ECHO. - Git command-line client
ECHO. - Microsoft Visual Studio 2008 or newer
ECHO. - Microsoft HTML Help compiler
ECHO. - Inno Setup 5
ECHO.
ECHO. You have to commit your work before using this script.
ECHO. Results will be in the 'Release' directory. Anything currently in
ECHO. the 'Release' directory may be overwritten.
ECHO.
ECHO.
SET STUDIODIR=c:\Program Files (x86)\Microsoft Visual Studio 14.0
SET HHWDIR=c:\Program Files (x86)\HTML Help Workshop
SET ISSDIR=c:\Program Files (x86)\Inno Setup 5
CALL "%STUDIODIR%\Common7\Tools\vsvars32.bat"
MKDIR "Release"
git.exe checkout "Source/Core/Properties/AssemblyInfo.cs" > NUL
git.exe checkout "Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs" > NUL
ECHO.
ECHO Writing GIT log file...
ECHO.
IF EXIST "Release\Changelog.xml" DEL /F /Q "Release\Changelog.xml" > NUL
(
echo [OB]?xml version="1.0" encoding="UTF-8"?[CB]
echo [OB]log[CB]
git.exe log master --since=2012-04-17 --pretty=format:"[OB]logentry commit=\"%%h\"[CB]%%n[OB]author[CB]%%an[OB]/author[CB]%%n[OB]date[CB]%%aI[OB]/date[CB]%%n[OB]msg[CB]%%B[OB]/msg[CB]%%n[OB]/logentry[CB]"
echo [OB]/log[CB]
) >"Release\Changelog.xml"
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Release\Changelog.xml" GOTO FILEFAIL
ECHO.
ECHO Compiling HTML Help file...
ECHO.
IF EXIST "Build\Refmanual.chm" DEL /F /Q "Build\Refmanual.chm" > NUL
"%HHWDIR%\hhc" Help\Refmanual.hhp
IF %ERRORLEVEL% NEQ 1 GOTO ERRORFAIL
IF NOT EXIST "Build\Refmanual.chm" GOTO FILEFAIL
ECHO.
ECHO Looking up current repository revision numbers...
ECHO.
IF EXIST "setenv.bat" DEL /F /Q "setenv.bat" > NUL
VersionFromGIT.exe "Source\Core\Properties\AssemblyInfo.cs" "Source\Plugins\BuilderModes\Properties\AssemblyInfo.cs" -O "setenv.bat"
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "setenv.bat" GOTO FILEFAIL
CALL "setenv.bat"
DEL /F /Q "setenv.bat"
ECHO.
ECHO Compiling GZDoom Builder core...
ECHO.
IF EXIST "Build\Builder.exe" DEL /F /Q "Build\Builder.exe" > NUL
IF EXIST "Source\Core\obj" RD /S /Q "Source\Core\obj"
msbuild "Source\Core\Builder.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Builder.exe" GOTO FILEFAIL
ECHO.
ECHO Compiling Automap Mode plugin...
ECHO.
IF EXIST "Build\Plugins\AutomapMode.dll" DEL /F /Q "Build\Plugins\AutomapMode.dll" > NUL
IF EXIST "Source\Plugins\AutomapMode\obj" RD /S /Q "Source\Plugins\AutomapMode\obj"
msbuild "Source\Plugins\AutomapMode\AutomapMode.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\AutomapMode.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Builder Effects plugin...
ECHO.
IF EXIST "Build\Plugins\BuilderEffects.dll" DEL /F /Q "Build\Plugins\BuilderEffects.dll" > NUL
IF EXIST "Source\Plugins\BuilderEffects\obj" RD /S /Q "Source\Plugins\BuilderEffects\obj"
msbuild "Source\Plugins\BuilderEffects\BuilderEffects.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\BuilderEffects.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Builder Modes plugin...
ECHO.
IF EXIST "Build\Plugins\BuilderModes.dll" DEL /F /Q "Build\Plugins\BuilderModes.dll" > NUL
IF EXIST "Source\Plugins\BuilderModes\obj" RD /S /Q "Source\Plugins\BuilderModes\obj"
msbuild "Source\Plugins\BuilderModes\BuilderModes.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\BuilderModes.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Color Picker plugin...
ECHO.
IF EXIST "Build\Plugins\ColorPicker.dll" DEL /F /Q "Build\Plugins\ColorPicker.dll" > NUL
IF EXIST "Source\Plugins\ColorPicker\obj" RD /S /Q "Source\Plugins\ColorPicker\obj"
msbuild "Source\Plugins\ColorPicker\ColorPicker.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\ColorPicker.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Comments Panel plugin...
ECHO.
IF EXIST "Build\Plugins\CommentsPanel.dll" DEL /F /Q "Build\Plugins\CommentsPanel.dll" > NUL
IF EXIST "Source\Plugins\CommentsPanel\obj" RD /S /Q "Source\Plugins\CommentsPanel\obj"
msbuild "Source\Plugins\CommentsPanel\CommentsPanel.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\CommentsPanel.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Nodes Viewer plugin...
ECHO.
IF EXIST "Build\Plugins\NodesViewer.dll" DEL /F /Q "Build\Plugins\NodesViewer.dll" > NUL
IF EXIST "Source\Plugins\NodesViewer\obj" RD /S /Q "Source\Plugins\NodesViewer\obj"
msbuild "Source\Plugins\NodesViewer\NodesViewer.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\NodesViewer.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Sound Propagation Mode plugin...
ECHO.
IF EXIST "Build\Plugins\SoundPropagationMode.dll" DEL /F /Q "Build\Plugins\SoundPropagationMode.dll" > NUL
IF EXIST "Source\Plugins\SoundPropagationMode\obj" RD /S /Q "Source\Plugins\SoundPropagationMode\obj"
msbuild "Source\Plugins\SoundPropagationMode\SoundPropagation.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\SoundPropagationMode.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Stair Sector Builder plugin...
ECHO.
IF EXIST "Build\Plugins\StairSectorBuilder.dll" DEL /F /Q "Build\Plugins\StairSectorBuilder.dll" > NUL
IF EXIST "Source\Plugins\StairSectorBuilder\obj" RD /S /Q "Source\Plugins\StairSectorBuilder\obj"
msbuild "Source\Plugins\StairSectorBuilder\StairSectorBuilder.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\StairSectorBuilder.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Tag Explorer plugin...
ECHO.
IF EXIST "Build\Plugins\TagExplorer.dll" DEL /F /Q "Build\Plugins\TagExplorer.dll" > NUL
IF EXIST "Source\Plugins\TagExplorer\obj" RD /S /Q "Source\Plugins\TagExplorer\obj"
msbuild "Source\Plugins\TagExplorer\TagExplorer.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\TagExplorer.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Tag Range plugin...
ECHO.
IF EXIST "Build\Plugins\TagRange.dll" DEL /F /Q "Build\Plugins\TagRange.dll" > NUL
IF EXIST "Source\Plugins\TagRange\obj" RD /S /Q "Source\Plugins\TagRange\obj"
msbuild "Source\Plugins\TagRange\TagRange.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\TagRange.dll" GOTO FILEFAIL
ECHO.
ECHO Compiling Visplane Explorer plugin...
ECHO.
IF EXIST "Build\Plugins\VisplaneExplorer.dll" DEL /F /Q "Build\Plugins\VisplaneExplorer.dll" > NUL
IF EXIST "Source\Plugins\VisplaneExplorer\obj" RD /S /Q "Source\Plugins\VisplaneExplorer\obj"
msbuild "Source\Plugins\VisplaneExplorer\VisplaneExplorer.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Plugins\VisplaneExplorer.dll" GOTO FILEFAIL
ECHO.
ECHO Creating changelog...
ECHO.
ChangelogMaker.exe "Release\Changelog.xml" "Build" "m-x-d>MaxED" %REVISIONNUMBER%
IF %ERRORLEVEL% NEQ 0 GOTO LOGFAIL
ECHO.
ECHO Building Setup Installer...
ECHO.
IF EXIST "Release\*.exe" DEL /F /Q "Release\*.exe" > NUL
"%ISSDIR%\iscc.exe" "Setup\gzbuilder_setup.iss"
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Release\GZDB-Bugfix Setup.exe" GOTO FILEFAIL
REN "Release\GZDB-Bugfix Setup.exe" "GZDB-Bugfix R%REVISIONNUMBER% Setup.exe"
git.exe checkout "Source\Core\Properties\AssemblyInfo.cs" > NUL
git.exe checkout "Source\Plugins\BuilderModes\Properties\AssemblyInfo.cs" > NUL
ECHO.
ECHO. BUILD DONE !
ECHO.
ECHO. Revision: %REVISIONNUMBER%
ECHO.
PAUSE > NUL
GOTO LEAVE
:ERRORFAIL
ECHO.
ECHO. BUILD FAILED (Tool returned error %ERRORLEVEL%)
ECHO.
PAUSE > NUL
GOTO LEAVE
:FILEFAIL
ECHO.
ECHO. BUILD FAILED (Output file was not built)
ECHO.
PAUSE > NUL
GOTO LEAVE
:LOGFAIL
ECHO.
ECHO. CHANGELOG GENERATION FAILED (Tool returned error %ERRORLEVEL%)
ECHO.
PAUSE > NUL
GOTO LEAVE
:LEAVE
exit

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
all: builder native
builder:
msbuild -p:Configuration=Debug BuilderMono.sln
native:
g++ -O2 --shared -g3 -o Build/libBuilderNative.so -fPIC -I Source/Native Source/Native/*.cpp Source/Native/gl_load/*.c -lX11 -ldl

View file

@ -5,15 +5,10 @@
**Required software:**
- [Microsoft .Net Framework 4.6.1](https://www.microsoft.com/en-ca/download/details.aspx?id=49981)
- [DirectX 9.0 Runtime](https://www.microsoft.com/en-us/download/details.aspx?id=35&44F86079-8679-400C-BFF2-9CA5F2BCBDFC=1)
**Links:**
- [Official thread at ZDoom.org](http://forum.zdoom.org/viewtopic.php?f=3&t=32392)
- [Unofficial thread at iddqd.ru](http://i.iddqd.ru/viewtopic.php?t=522) (in russian)
**This fork:**
- [Official thread link](https://forum.zdoom.org/viewtopic.php?f=44&t=54957)
- [Git builds at DRDTeam.org](http://devbuilds.drdteam.org/gzdbbf/)
- [Official thread link](https://forum.zdoom.org/viewtopic.php?f=232&t=66745)
- [Git builds at DRDTeam.org](https://devbuilds.drdteam.org/ultimatedoombuilder/)
More detailed info can be found in the **editor documentation** (Refmanual.chm)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -1,7 +0,0 @@
Disclaimer of warranty:
The software and documentation are provided as is without warranty of any kind. To the maximum extent permitted by applicable law, MaxED further disclaims all warranties, including without limitation any implied warranties of merchantability, fitness for a particular purpose, and noninfringement.
The entire risk arising out of the use or performance of the software and documentation remains with you.
To the maximum extent permitted by applicable law, in no event shall MaxED be liable for any consequential, incidental, direct, indirect, special, punitive, or other damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of this agreement or the use of or inability to use the product, even if MaxED has been advised of the possibility of such damages.

View file

@ -2,18 +2,18 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=GZDoom Builder
AppVerName=GZDoom Builder 2.4
AppPublisher=MaxED
AppName=Ultimate Doom Builder
AppVerName=Ultimate Doom Builder
AppPublisher=ZZYZX
AppPublisherURL=http://forum.zdoom.org/memberlist.php?mode=viewprofile&u=7012
AppSupportURL=http://forum.zdoom.org/viewtopic.php?f=3&t=32392
AppUpdatesURL=http://devbuilds.drdteam.org/doombuilder2-gzdb/
DefaultDirName={pf}\GZDoom Builder
DefaultGroupName=GZDoom Builder
AllowNoIcons=true
InfoBeforeFile=..\Setup\disclaimer.txt
LicenseFile=..\LICENSE.txt
OutputDir=..\Release
OutputBaseFilename=GZDB-Bugfix Setup
OutputBaseFilename=Setup
Compression=lzma/ultra64
SolidCompression=true
SourceDir=..\Build
@ -22,7 +22,7 @@ AppMutex=gzdoombuilder
PrivilegesRequired=admin
ShowLanguageDialog=no
LanguageDetectionMethod=none
MinVersion=0,5.01.2600
MinVersion=0,6.0
UninstallDisplayIcon={app}\Updater.exe
WizardImageFile=..\Setup\WizModernImage-IS.bmp
WizardSmallImageFile=..\Setup\WizModernSmallImage-IS.bmp
@ -35,7 +35,6 @@ Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:Ad
[Files]
Source: Setup\dotnetfx35setup.exe; DestDir: {tmp}; Flags: dontcopy
Source: Setup\dxwebsetup.exe; DestDir: {tmp}; Flags: dontcopy
Source: Setup\vcredist_x86.exe; DestDir: {tmp}; Flags: dontcopy
Source: Builder.exe; DestDir: {app}; Flags: ignoreversion
Source: GZBuilder.default.cfg; DestDir: {app}; Flags: ignoreversion
@ -43,9 +42,8 @@ Source: Updater.exe; DestDir: {app}; Flags: ignoreversion
Source: Updater.ini; DestDir: {app}; Flags: ignoreversion
Source: Refmanual.chm; DestDir: {app}; Flags: ignoreversion
Source: DevIL.dll; DestDir: {app}; Flags: ignoreversion
Source: SharpCompress.3.5.dll; DestDir: {app}; Flags: ignoreversion
Source: ScintillaNET.3.5.dll; DestDir: {app}; Flags: ignoreversion
Source: SlimDX.dll; DestDir: {app}; Flags: ignoreversion
Source: SharpCompress.dll; DestDir: {app}; Flags: ignoreversion
Source: ScintillaNET.dll; DestDir: {app}; Flags: ignoreversion
Source: TabControlEX.dll; DestDir: {app}; Flags: ignoreversion
Source: GPL.txt; DestDir: {app}; Flags: ignoreversion
Source: Compilers\*; DestDir: {app}\Compilers; Flags: ignoreversion recursesubdirs
@ -91,17 +89,12 @@ var
page_info_net: TOutputMsgWizardPage;
page_info_netfailed: TOutputMsgWizardPage;
page_setup_net: TOutputProgressWizardPage;
page_info_dx: TOutputMsgWizardPage;
page_info_dxfailed: TOutputMsgWizardPage;
page_setup_dx: TOutputProgressWizardPage;
page_info_vc: TOutputMsgWizardPage;
page_info_vcfailed: TOutputMsgWizardPage;
page_setup_vc: TOutputProgressWizardPage;
restartneeded: Boolean;
netinstallfailed: Boolean;
netisinstalled: Boolean;
dxinstallfailed: Boolean;
dxisinstalled: Boolean;
vcinstallfailed: Boolean;
vcisinstalled: Boolean;
@ -112,34 +105,6 @@ begin
RegKeyExists(HKLM, 'SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v3.5');
end;
function CheckDXVersion(): Boolean;
var
MajorVer, MinorVer: Integer;
StartPos: Integer;
TempStr, VerStr: string;
HasRequiredDll : Boolean;
begin
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\DirectX', 'Version', VerStr)) then begin
(* Extract major version *)
StartPos := Pos('.', VerStr);
MajorVer := StrToInt(Copy(VerStr, 1, StartPos - 1));
(* Remove major version and decimal point that follows *)
TempStr := Copy(VerStr, StartPos + 1, MaxInt);
(* Find next decimal point *)
StartPos := Pos('.', TempStr);
(* Extract minor version *)
MinorVer := StrToInt(Copy(TempStr, 1, StartPos - 1));
//mxd. The DX version alone is not accurate enough...
HasRequiredDll := FileExists(ExpandConstant('{syswow64}\d3dx9_43.dll'));
Result := ((MajorVer > 4) or ((MajorVer = 4) and (MinorVer >= 9))) and HasRequiredDll;
end
else begin
Result := false;
end;
end;
function CheckVCIsInstalled(): Boolean;
begin
//mxd. Any VC++ 2008 package will do, I assume...
@ -155,8 +120,6 @@ begin
restartneeded := false;
netinstallfailed := false;
netisinstalled := CheckNetIsInstalled();
dxinstallfailed := false;
dxisinstalled := CheckDXVersion();
vcinstallfailed := false;
vcisinstalled := CheckVCIsInstalled();
@ -176,22 +139,6 @@ begin
page_setup_net := CreateOutputProgressPage('Installing Microsoft .NET Framework 3.5', 'Setup is installing Microsoft .NET Framework 3.5, please wait...');
// Create DirectX pages
page_info_dx := CreateOutputMsgPage(wpPreparing,
'Installing DirectX 9.0', '',
'Setup has detected that your system is missing the required version of the DirectX. ' +
'Setup will now install or update your DirectX. This may take several minutes to complete.' + #10 + #10 +
'WARNING: The installer will download DirectX from the internet, but the progress bar will not ' +
'go forward until the download is complete. You may send Microsoft an angry letter about that.' + #10 + #10 +
'Click Install to begin.');
page_info_dxfailed := CreateOutputMsgPage(page_info_net.ID,
'Installing DirectX 9.0', '',
'Setup could not install DirectX 9.0.' + #10 + #10 +
'Click Back to try again, or Cancel to exit Setup.');
page_setup_dx := CreateOutputProgressPage('Installing DirectX 9.0', 'Setup is installing DirectX 9.0, please wait...');
// Create VC++ 2008 pages
page_info_vc := CreateOutputMsgPage(wpPreparing,
'Installing Visual C++ 2008 SP1 ATL Security Update', '',
@ -214,10 +161,6 @@ begin
Result := netisinstalled
else if(PageID = page_info_netfailed.ID) then
Result := (not netinstallfailed) and netisinstalled
else if(PageID = page_info_dx.ID) then // Skip DX pages?
Result := dxisinstalled
else if(PageID = page_info_dxfailed.ID) then
Result := (not dxinstallfailed) and dxisinstalled
else if(PageID = page_info_vc.ID) then // Skip VC++ pages?
Result := vcisinstalled
else if(PageID = page_info_vcfailed.ID) then
@ -236,13 +179,13 @@ end;
procedure CurPageChanged(CurPageID: Integer);
begin
if(CurPageID = wpReady) then begin
if(netisinstalled = false) or (dxisinstalled = false) or (vcisinstalled = false) then
if(netisinstalled = false) or (vcisinstalled = false) then
WizardForm.NextButton.Caption := 'Next';
end
else if(CurPageID = page_info_net.ID) or (CurPageID = page_info_dx.ID) or (CurPageID = page_info_vc.ID) then begin
else if(CurPageID = page_info_net.ID) or (CurPageID = page_info_vc.ID) then begin
WizardForm.NextButton.Caption := 'Install';
end
else if(CurPageID = page_info_netfailed.ID) or (CurPageID = page_info_dxfailed.ID) or (CurPageID = page_info_vcfailed.ID) then begin
else if(CurPageID = page_info_netfailed.ID) or (CurPageID = page_info_vcfailed.ID) then begin
WizardForm.NextButton.Visible := true;
WizardForm.NextButton.Enabled := false;
WizardForm.BackButton.Visible := true;
@ -288,35 +231,6 @@ begin
page_setup_net.Hide;
end;
end
// Next pressed on DX info page?
else if(CurPage = page_info_dx.ID) then begin
// Show progress page and run setup
page_setup_dx.Show;
try
begin
dxinstallfailed := false;
ExtractTemporaryFile('dxwebsetup.exe');
// We copy the file to the real temp directory so that it isn't removed when Setup is closed.
// Judging from the return codes, this installer may want to run again after a reboot.
// See the return codes here: http://support.microsoft.com/kb/177430
tempfile := RemoveBackslash(GetTempDir()) + '\dxwebsetup.exe';
FileCopy(ExpandConstant('{tmp}\dxwebsetup.exe'), tempfile, false);
Exec(tempfile, '/Q', '', SW_SHOW, ewWaitUntilTerminated, errorcode);
if(errorcode = 1) then begin
// Success, but restart needed!
restartneeded := true;
end
else if(errorcode <> 0) then begin
dxinstallfailed := true;
end;
dxisinstalled := CheckDXVersion();
end
finally
page_setup_dx.Hide;
end;
end
// Next pressed on VC info page?
else if(CurPage = page_info_vc.ID) then begin
// Show progress page and run setup

Binary file not shown.

Binary file not shown.

View file

@ -18,9 +18,8 @@
using System;
using System.Windows.Forms;
using SlimDX;
using SlimDX.DirectInput;
using CodeImp.DoomBuilder.Geometry;
using System.Runtime.InteropServices;
#endregion
@ -31,18 +30,8 @@ namespace CodeImp.DoomBuilder.Actions
#region ================== Variables
// Mouse input
private DirectInput dinput;
private Mouse mouse;
private RawMouse mouse;
// Disposing
private bool isdisposed;
#endregion
#region ================== Properties
public bool IsDisposed { get { return isdisposed; } }
#endregion
#region ================== Constructor / Disposer
@ -50,30 +39,8 @@ namespace CodeImp.DoomBuilder.Actions
// Constructor
public MouseInput(Control source)
{
// Initialize
dinput = new DirectInput();
// Start mouse input
mouse = new Mouse(dinput);
if(mouse == null) throw new Exception("No mouse device found.");
// Set mouse input settings
mouse.Properties.AxisMode = DeviceAxisMode.Relative;
// Set cooperative level
mouse.SetCooperativeLevel(source,
CooperativeLevel.Nonexclusive | CooperativeLevel.Foreground);
// Aquire device
try { mouse.Acquire(); }
#if DEBUG
catch(Exception e)
{
Console.WriteLine("MouseInput initialization failed: " + e.Message);
}
#else
catch(Exception) { }
#endif
mouse = new RawMouse(source);
// We have no destructor
GC.SuppressFinalize(this);
@ -82,20 +49,10 @@ namespace CodeImp.DoomBuilder.Actions
// Disposer
public void Dispose()
{
// Not already disposed?
if(!isdisposed)
if(mouse != null)
{
// Dispose
mouse.Unacquire();
mouse.Dispose();
dinput.Dispose();
// Clean up
mouse = null;
dinput = null;
// Done
isdisposed = true;
}
}
@ -110,62 +67,67 @@ namespace CodeImp.DoomBuilder.Actions
// This processes the input
public Vector2D Process()
{
// Poll the device
try
{
Result result = mouse.Poll();
if(result.IsSuccess)
{
// Get the changes since previous poll
MouseState ms = mouse.GetCurrentState();
MouseState ms = mouse.Poll();
// Calculate changes depending on sensitivity
float changex = ms.X * General.Settings.VisualMouseSensX * General.Settings.MouseSpeed * 0.01f;
float changey = ms.Y * General.Settings.VisualMouseSensY * General.Settings.MouseSpeed * 0.01f;
// Calculate changes depending on sensitivity
float changex = ms.X * General.Settings.VisualMouseSensX * General.Settings.MouseSpeed * 0.01f;
float changey = ms.Y * General.Settings.VisualMouseSensY * General.Settings.MouseSpeed * 0.01f;
// Return changes
return new Vector2D(changex, changey);
}
// Reaquire device
try { mouse.Acquire(); }
#if DEBUG
catch(Exception e)
{
Console.WriteLine("MouseInput process failed: " + e.Message);
}
#else
catch(Exception) { }
#endif
return new Vector2D();
}
#if DEBUG
catch(DirectInputException die)
{
Console.WriteLine("MouseInput process failed: " + die.Message);
// Reaquire device
try
{
mouse.Acquire();
}
catch(Exception e)
{
Console.WriteLine("MouseInput process failed: " + e.Message);
}
return new Vector2D();
}
#else
catch(DirectInputException)
{
// Reaquire device
try { mouse.Acquire(); }
catch(Exception) { }
return new Vector2D();
}
#endif
return new Vector2D(changex, changey);
}
#endregion
}
public struct MouseState
{
public MouseState(float x, float y) { X = x; Y = y; }
public float X { get; }
public float Y { get; }
}
public class RawMouse
{
public RawMouse(System.Windows.Forms.Control control)
{
Handle = RawMouse_New(control.Handle);
if (Handle == IntPtr.Zero)
throw new Exception("RawMouse_New failed");
}
~RawMouse()
{
Dispose();
}
public MouseState Poll()
{
return new MouseState(RawMouse_GetX(Handle), RawMouse_GetY(Handle));
}
public bool Disposed { get { return Handle == IntPtr.Zero; } }
public void Dispose()
{
if (!Disposed)
{
RawMouse_Delete(Handle);
Handle = IntPtr.Zero;
}
}
internal IntPtr Handle;
[DllImport("BuilderNative.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr RawMouse_New(IntPtr windowHandle);
[DllImport("BuilderNative.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void RawMouse_Delete(IntPtr handle);
[DllImport("BuilderNative.dll", CallingConvention = CallingConvention.Cdecl)]
static extern float RawMouse_GetX(IntPtr handle);
[DllImport("BuilderNative.dll", CallingConvention = CallingConvention.Cdecl)]
static extern float RawMouse_GetY(IntPtr handle);
}
}

View file

@ -11,7 +11,7 @@
<RootNamespace>CodeImp.DoomBuilder</RootNamespace>
<AssemblyName>Builder</AssemblyName>
<StartupObject>CodeImp.DoomBuilder.General</StartupObject>
<ApplicationIcon>Resources\GZDB2.ico</ApplicationIcon>
<ApplicationIcon>Resources\UDB2.ico</ApplicationIcon>
<Win32Resource>
</Win32Resource>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
@ -20,9 +20,24 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
@ -220,6 +235,18 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Rendering\Color3.cs" />
<Compile Include="Rendering\Color4.cs" />
<Compile Include="Rendering\IndexBuffer.cs" />
<Compile Include="Rendering\IRenderResource.cs" />
<Compile Include="Rendering\Matrix.cs" />
<Compile Include="Rendering\Mesh.cs" />
<Compile Include="Rendering\RenderDevice.cs" />
<Compile Include="Rendering\Texture.cs" />
<Compile Include="Rendering\Vector2.cs" />
<Compile Include="Rendering\Vector3.cs" />
<Compile Include="Rendering\Vector4.cs" />
<Compile Include="Rendering\VertexBuffer.cs" />
<Compile Include="Windows\ThingStatisticsForm.cs">
<SubType>Form</SubType>
</Compile>
@ -543,15 +570,11 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Rendering\Presentation.cs" />
<Compile Include="Rendering\Display2DShader.cs" />
<Compile Include="Rendering\ColorCollection.cs" />
<Compile Include="Rendering\ColorSetting.cs" />
<Compile Include="Rendering\D3DDevice.cs" />
<Compile Include="Data\ImageData.cs" />
<Compile Include="Rendering\D3DShader.cs" />
<Compile Include="Rendering\FlatQuad.cs" />
<Compile Include="Rendering\FlatVertex.cs" />
<Compile Include="Rendering\ID3DResource.cs" />
<Compile Include="Rendering\IRenderer2D.cs" />
<Compile Include="Rendering\IRenderer3D.cs" />
<Compile Include="Rendering\RenderLayers.cs" />
@ -564,10 +587,7 @@
<Compile Include="Rendering\Renderer.cs" />
<Compile Include="Rendering\Renderer2D.cs" />
<Compile Include="Rendering\Renderer3D.cs" />
<Compile Include="Rendering\ShaderManager.cs" />
<Compile Include="Rendering\Things2DShader.cs" />
<Compile Include="VisualModes\VisualSector.cs" />
<Compile Include="Rendering\World3DShader.cs" />
<Compile Include="Rendering\WorldVertex.cs" />
<Compile Include="ZDoom\DecorateActorStructure.cs" />
<Compile Include="ZDoom\DecorateStateGoto.cs" />
@ -591,10 +611,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Build\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="SlimDX, Version=v4.0.30319, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Build\SlimDX.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -648,7 +664,17 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<EmbeddedResource Include="Resources\display2d.vp" />
<EmbeddedResource Include="Resources\display2d_fsaa.fp" />
<EmbeddedResource Include="Resources\display2d_fullbright.fp" />
<EmbeddedResource Include="Resources\display2d_normal.fp" />
<None Include="Resources\MissingTexture.png" />
<EmbeddedResource Include="Resources\plotter.fp" />
<EmbeddedResource Include="Resources\plotter.vp" />
<EmbeddedResource Include="Resources\things2d.vp" />
<EmbeddedResource Include="Resources\things2d_fill.fp" />
<EmbeddedResource Include="Resources\things2d_sprite.fp" />
<EmbeddedResource Include="Resources\things2d_thing.fp" />
<None Include="Resources\UnknownImage.png" />
<None Include="Resources\treeview.png" />
<None Include="Resources\Folder.png" />
@ -664,6 +690,21 @@
<None Include="Resources\Status2.png" />
<None Include="Resources\Status0.png" />
<None Include="Resources\ColorPick.png" />
<EmbeddedResource Include="Resources\world3d_constant_color.fp" />
<EmbeddedResource Include="Resources\world3d_customvertexcolor.vp" />
<EmbeddedResource Include="Resources\world3d_customvertexcolor_fog.vp" />
<EmbeddedResource Include="Resources\world3d_fullbright.fp" />
<EmbeddedResource Include="Resources\world3d_fullbright_highlight.fp" />
<EmbeddedResource Include="Resources\world3d_lightpass.fp" />
<EmbeddedResource Include="Resources\world3d_lightpass.vp" />
<EmbeddedResource Include="Resources\world3d_main.fp" />
<EmbeddedResource Include="Resources\world3d_main.vp" />
<EmbeddedResource Include="Resources\world3d_main_fog.fp" />
<EmbeddedResource Include="Resources\world3d_main_highlight.fp" />
<EmbeddedResource Include="Resources\world3d_main_highlight_fog.fp" />
<EmbeddedResource Include="Resources\world3d_skybox.fp" />
<EmbeddedResource Include="Resources\world3d_skybox.vp" />
<EmbeddedResource Include="Resources\world3d_vertex_color.fp" />
<None Include="Resources\Zoom.png" />
<None Include="Resources\Properties.png" />
<None Include="Resources\NewMap2.png" />
@ -753,15 +794,13 @@
<DependentUpon>VertexInfoPanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Actions.cfg" />
<EmbeddedResource Include="Resources\display2d.fx" />
<EmbeddedResource Include="Resources\ThingTexture2D.png" />
<EmbeddedResource Include="Resources\things2d.fx" />
<EmbeddedResource Include="Resources\world3d.fx" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\MissingTexture3D.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\UDB2.ico" />
<None Include="app.manifest" />
<EmbeddedResource Include="Controls\Scripting\FindUsagesControl.resx">
<DependentUpon>FindUsagesControl.cs</DependentUpon>
@ -1102,7 +1141,7 @@
<Compile Include="Windows\LinedefEditFormUDMF.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\LinedefEditFormUDMF.designer.cs">
<Compile Include="Windows\LinedefEditFormUDMF.Designer.cs">
<DependentUpon>LinedefEditFormUDMF.cs</DependentUpon>
</Compile>
<Compile Include="Windows\MenuSection.cs" />
@ -1260,8 +1299,10 @@
<None Include="Resources\Angle5.png" />
<None Include="Resources\Angle6.png" />
<None Include="Resources\Angle7.png" />
<None Include="Resources\AboutBack.png" />
<Content Include="Resources\DB2.ico" />
<None Include="Resources\GZDB2.ico" />
<None Include="Resources\UDB.ico" />
<None Include="Resources\fog.png" />
<None Include="Resources\GZDB_Logo_small.png" />
<None Include="Resources\InfoLine.png" />
@ -1506,47 +1547,18 @@
<DependentUpon>VertexEditForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<PropertyGroup>
<PreBuildEvent>echo Current Output Directory: %25cd%25
echo Copying platform-appropriate DevIL.dll file.
copy /Y ..\DevIL\$(PlatformName)\DevIL.dll .\
echo Copying platform-appropriate SlimDX.dll file.
copy /Y ..\SlimDX\$(PlatformName)\SlimDX.dll .\
echo Copying platform-appropriate Updater.ini.
copy /Y ..\UpdaterConfig\Updater-$(PlatformName).ini Updater.ini</PreBuildEvent>
<PostBuildEvent>if exist "%25VSAPPIDDIR%25" goto tools17
if exist "%25VS140COMNTOOLS%25" goto tools140
if exist "%25VS120COMNTOOLS%25" goto tools120
if exist "%25VS110COMNTOOLS%25" goto tools110
if exist "%25VS100COMNTOOLS%25" goto tools100
if exist "%25VS90COMNTOOLS%25" goto tools90
:tools17
call "%25VSAPPIDDIR%25..\Tools\vsdevcmd" -arch=x86
goto end
:tools140
call "%25VS140COMNTOOLS%25vsvars32.bat"
goto end
:tools120
call "%25VS120COMNTOOLS%25vsvars32.bat"
goto end
:tools110
call "%25VS110COMNTOOLS%25vsvars32.bat"
goto end
:tools100
call "%25VS100COMNTOOLS%25vsvars32.bat"
goto end
:tools90
call "%25VS90COMNTOOLS%25vsvars32.bat"
goto end
:end
editbin.exe /NOLOGO /LARGEADDRESSAWARE "$(TargetPath)"</PostBuildEvent>
</PropertyGroup>
</Project>

File diff suppressed because it is too large Load diff

View file

@ -77,9 +77,9 @@ namespace CodeImp.DoomBuilder.Config
{
if(de.Key.ToString() != "interface" && de.Key.ToString() != "program")
{
//mxd
string include = de.Value.ToString().Replace(System.IO.Path.AltDirectorySeparatorChar, System.IO.Path.DirectorySeparatorChar);
if(files.Contains(include))
//mxd
string include = de.Value.ToString().Replace('\\', '/');
if (files.Contains(include))
General.ErrorLogger.Add(ErrorType.Warning, "Include file \"" + de.Value + "\" is double defined in \"" + name + "\" compiler configuration");
else
files.Add(include);

View file

@ -21,7 +21,9 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using CodeImp.DoomBuilder.IO;
#if !NO_SCINTILLA
using ScintillaNET;
#endif
#endregion
@ -75,7 +77,9 @@ namespace CodeImp.DoomBuilder.Config
private readonly string[] extensions;
private readonly bool casesensitive;
private readonly int insertcase;
#if !NO_SCINTILLA
private readonly Lexer lexer;
#endif
private readonly string keywordhelp;
private readonly string functionopen;
private readonly string functionclose;
@ -114,7 +118,9 @@ namespace CodeImp.DoomBuilder.Config
public string[] Extensions { get { return extensions; } }
public bool CaseSensitive { get { return casesensitive; } }
public int InsertCase { get { return insertcase; } }
#if !NO_SCINTILLA
public Lexer Lexer { get { return lexer; } }
#endif
public string KeywordHelp { get { return keywordhelp; } }
public string FunctionOpen { get { return functionopen; } }
public string FunctionClose { get { return functionclose; } }
@ -155,7 +161,9 @@ namespace CodeImp.DoomBuilder.Config
this.braces = new HashSet<char>(); //mxd
// Settings
#if !NO_SCINTILLA
lexer = Lexer.Null;
#endif
casesensitive = false;
codepage = 65001;
parameters = "";
@ -200,7 +208,9 @@ namespace CodeImp.DoomBuilder.Config
resultlump = cfg.ReadSetting("resultlump", "");
casesensitive = cfg.ReadSetting("casesensitive", true);
insertcase = cfg.ReadSetting("insertcase", 0);
#if !NO_SCINTILLA
lexer = (Lexer)cfg.ReadSetting("lexer", (int)Lexer.Container);
#endif
keywordhelp = cfg.ReadSetting("keywordhelp", "");
functionopen = cfg.ReadSetting("functionopen", "");
functionclose = cfg.ReadSetting("functionclose", "");

View file

@ -25,7 +25,9 @@ using System.Windows.Forms;
namespace CodeImp.DoomBuilder.Controls
{
#if !NO_FORMS_DESIGN
[Designer(typeof(ButtonsNumericTextboxDesigner))]
#endif
public partial class ButtonsNumericTextbox : UserControl
{
#region ================== Events

View file

@ -14,6 +14,8 @@
#endregion
#if !NO_FORMS_DESIGN
#region ================== Namespaces
using System.Collections;
@ -63,3 +65,5 @@ namespace CodeImp.DoomBuilder.Controls
}
}
}
#endif

View file

@ -136,21 +136,21 @@ namespace CodeImp.DoomBuilder
public static void StartTimer()
{
starttime = SlimDX.Configuration.Timer.ElapsedMilliseconds;
starttime = Clock.Timer.ElapsedMilliseconds;
}
public static void PauseTimer()
{
if(starttime == -1) throw new InvalidOperationException("DebugConsole.StartTimer() must be called before DebugConsole.PauseTimer()!");
storedtime += SlimDX.Configuration.Timer.ElapsedMilliseconds - starttime;
storedtime += Clock.Timer.ElapsedMilliseconds - starttime;
}
public static void StopTimer(string message)
{
if(starttime == -1) throw new InvalidOperationException("DebugConsole.StartTimer() must be called before DebugConsole.StopTimer()!");
long duration = SlimDX.Configuration.Timer.ElapsedMilliseconds - starttime + storedtime;
long duration = Clock.Timer.ElapsedMilliseconds - starttime + storedtime;
if(message.Contains("%"))
message = message.Replace("%", duration.ToString(CultureInfo.InvariantCulture));

View file

@ -21,7 +21,7 @@ using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Data;
using SlimDX;
using CodeImp.DoomBuilder.Rendering;
#endregion

View file

@ -71,14 +71,6 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Overrides
// Paint method
protected override void OnPaint(PaintEventArgs pe)
{
// Pass on to base
// Do we really want this?
if(!D3DDevice.IsRendering) base.RaisePaintEvent(this, pe); //mxd. Dont raise event when in the middle of rendering
}
//mxd
protected override void OnKeyUp(KeyEventArgs e)
{
@ -100,7 +92,7 @@ namespace CodeImp.DoomBuilder.Controls
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.Opaque, false);
this.UpdateStyles();
this.BackColor = SystemColors.ControlDarkDark;
this.BackColor = Color.FromArgb(32, 32, 40);
this.BackgroundImage = Properties.Resources.Splash3_trans;
this.BackgroundImageLayout = ImageLayout.Center;
}

View file

@ -251,9 +251,11 @@ namespace CodeImp.DoomBuilder.Controls.Scripting
{
// Show target text
t.MoveToLine(result.LineIndex);
#if !NO_SCINTILLA
int pos = t.Editor.Scintilla.Lines[result.LineIndex].Position + result.MatchStart;
t.SelectionStart = pos;
t.SelectionEnd = pos;
#endif
t.Focus();
// Show in resources control

View file

@ -27,11 +27,88 @@ using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.ZDoom.Scripting;
using ScintillaNET;
using System.Text;
#endregion
#if NO_SCINTILLA
namespace CodeImp.DoomBuilder.Controls
{
internal abstract class ScriptDocumentTab : TabPage
{
protected readonly ScriptEditorControl editor;
protected ScriptConfiguration config;
protected readonly ScriptEditorPanel panel;
protected ScriptDocumentTabType tabtype;
public virtual bool ExplicitSave { get { return true; } }
public virtual bool IsSaveAsRequired { get { return true; } }
public virtual bool IsClosable { get { return true; } }
public virtual bool IsReconfigurable { get { return true; } }
public virtual bool IsReadOnly { get { return false; } }
public virtual string Filename { get { return ""; } }
public ScriptEditorPanel Panel { get { return panel; } }
public ScriptEditorControl Editor { get; private set; }
public string Title { get; private set; }
public bool IsChanged { get { return false; } }
public int SelectionStart { get; set; }
public int SelectionEnd { get; set; }
public bool ShowWhitespace { get; set; }
public bool WrapLongLines { get; set; }
public string SelectedText { get { return ""; } }
public ScriptConfiguration Config { get { return config; } }
public new event EventHandler OnTextChanged;
protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config)
{
this.panel = panel;
this.config = config;
editor = new ScriptEditorControl();
this.Controls.Add(editor);
}
public bool LaunchKeywordHelp() { return false; }
public virtual void RefreshSettings() { }
public virtual void MoveToLine(int linenumber) { }
public virtual void ClearMarks() { }
public virtual void MarkScriptErrors(IEnumerable<CompilerError> errors) { }
public virtual bool VerifyErrorForScript(CompilerError e) { return false; }
public virtual void Compile() { }
public virtual bool Save() { return false; }
public virtual bool SaveAs(string filename) { return false; }
public virtual void ChangeScriptConfig(ScriptConfiguration newconfig) { }
public void Undo() { }
public void Redo() { }
public void Cut() { }
public void Copy() { }
public void Paste() { }
public bool FindNext(FindReplaceOptions options) { return false; }
public bool FindNext(FindReplaceOptions options, bool useselectionstart) { return false; }
public bool FindPrevious(FindReplaceOptions options) { return false; }
public void ReplaceSelection(string replacement) { }
internal virtual ScriptDocumentSettings GetViewSettings() { return new ScriptDocumentSettings {}; }
internal virtual void SetViewSettings(ScriptDocumentSettings settings) { }
internal void SetDefaultViewSettings() { }
internal List<CompilerError> UpdateNavigator() { return new List<CompilerError>(); }
internal ScriptType VerifyScriptType() { return ScriptType.UNKNOWN; }
internal void InsertSnippet(string name) { }
internal void IndentSelection(bool indent) { }
protected void SetTitle(string title) { }
protected void UpdateTitle() { }
protected void RemoveTrailingWhitespace() { }
}
}
#else
using ScintillaNET;
namespace CodeImp.DoomBuilder.Controls
{
internal abstract class ScriptDocumentTab : TabPage
@ -513,3 +590,5 @@ namespace CodeImp.DoomBuilder.Controls
#endregion
}
}
#endif

View file

@ -68,7 +68,9 @@ namespace CodeImp.DoomBuilder.Controls
{
// Set text and view settings
tabtype = ScriptDocumentTabType.FILE;
#if !NO_SCINTILLA
editor.Scintilla.Text = sourcetab.Editor.Scintilla.Text;
#endif
SetViewSettings(sourcetab.GetViewSettings());
// Set title

View file

@ -10,6 +10,68 @@ using CodeImp.DoomBuilder.Data.Scripting;
#endregion
#if NO_SCINTILLA
namespace CodeImp.DoomBuilder.Controls
{
//mxd. Document tab bound to a resource entry. Script type can't be changed. Can be readonly.
//Must be replaced with ScriptFileDocumentTab when unable to locate target resource entry to save to.
internal sealed class ScriptResourceDocumentTab : ScriptDocumentTab
{
private ScriptResource source;
private string hash;
private string filepathname;
public override bool IsReconfigurable { get { return false; } }
public override bool IsSaveAsRequired { get { return false; } }
public override bool IsReadOnly { get { return source.IsReadOnly; } }
public override string Filename { get { return filepathname; } }
internal ScriptResource Resource { get { return source; } }
internal ScriptResourceDocumentTab(ScriptEditorPanel panel, ScriptResource resource, ScriptConfiguration config) : base(panel, config)
{
source = resource;
filepathname = source.FilePathName;
this.ToolTipText = filepathname;
}
public override void Compile()
{
}
// This checks if a script error applies to this script
public override bool VerifyErrorForScript(CompilerError e)
{
return (string.Compare(e.filename, source.Filename, true) == 0);
}
public override bool Save()
{
if(source.IsReadOnly) return false;
return false;
}
internal override ScriptDocumentSettings GetViewSettings()
{
// Store resource location
var settings = base.GetViewSettings();
DataReader reader = source.Resource;
if(reader != null)
{
settings.ResourceLocation = reader.Location.location;
settings.Filename = Path.Combine(reader.Location.location, filepathname); // Make unique location
}
return settings;
}
internal void OnReloadResources()
{
}
}
}
#else
namespace CodeImp.DoomBuilder.Controls
{
//mxd. Document tab bound to a resource entry. Script type can't be changed. Can be readonly.
@ -175,3 +237,5 @@ namespace CodeImp.DoomBuilder.Controls
#endregion
}
}
#endif

View file

@ -36,9 +36,7 @@ using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.ZDoom;
using SlimDX;
using SlimDX.Direct3D9;
using Matrix = SlimDX.Matrix;
using Matrix = CodeImp.DoomBuilder.Rendering.Matrix;
using CodeImp.DoomBuilder.Controls;
#endregion
@ -923,7 +921,7 @@ namespace CodeImp.DoomBuilder.Data
if(modeldefentries[type].LoadState != ModelLoadState.None) return true;
//create models
ModelReader.Load(modeldefentries[type], containers, General.Map.Graphics.Device);
ModelReader.Load(modeldefentries[type], containers);
if(modeldefentries[type].Model != null)
{
@ -3299,24 +3297,17 @@ namespace CodeImp.DoomBuilder.Data
General.ErrorLogger.Add(ErrorType.Warning, "Skybox creation failed: unable to load texture \"" + skytex + "\"");
// Use the built-in texture
if(General.Map.Graphics.CheckAvailability())
{
ImageData tex = LoadInternalTexture("MissingSky3D.png");
tex.CreateTexture();
Bitmap bmp = tex.GetBitmap();
Bitmap sky;
lock (bmp)
{
sky = new Bitmap(bmp);
}
sky.RotateFlip(RotateFlipType.RotateNoneFlipX); // We don't want our built-in image mirrored...
skybox = MakeClassicSkyBox(sky);
tex.Dispose();
}
else
{
General.ErrorLogger.Add(ErrorType.Warning, "Skybox creation failed: Direct3D device is not available");
}
ImageData tex = LoadInternalTexture("MissingSky3D.png");
tex.CreateTexture();
Bitmap bmp = tex.GetBitmap();
Bitmap sky;
lock (bmp)
{
sky = new Bitmap(bmp);
}
sky.RotateFlip(RotateFlipType.RotateNoneFlipX); // We don't want our built-in image mirrored...
skybox = MakeClassicSkyBox(sky);
tex.Dispose();
}
}
@ -3414,39 +3405,24 @@ namespace CodeImp.DoomBuilder.Data
skyimage = ResizeImage(skyimage, (int)Math.Round(skyimage.Width * scaler), (int)Math.Round(skyimage.Height * scaler));
}
// Get Device and shader...
Device device = General.Map.Graphics.Device;
World3DShader effect = General.Map.Graphics.Shaders.World3D;
// Make custom rendertarget
const int cubemaptexsize = 1024;
Surface rendertarget = Surface.CreateRenderTarget(device, cubemaptexsize, cubemaptexsize, Format.A8R8G8B8, MultisampleType.None, 0, false);
Surface depthbuffer = Surface.CreateDepthStencil(device, cubemaptexsize, cubemaptexsize, General.Map.Graphics.DepthBuffer.Description.Format, MultisampleType.None, 0, false);
Texture rendertarget = new Texture(cubemaptexsize, cubemaptexsize);
// Start rendering
if(!General.Map.Graphics.StartRendering(true, new Color4(), rendertarget, depthbuffer))
{
General.ErrorLogger.Add(ErrorType.Error, "Skybox creation failed: unable to start rendering...");
// Get rid of unmanaged stuff...
rendertarget.Dispose();
depthbuffer.Dispose();
// No dice...
return null;
}
// Start rendering
General.Map.Graphics.StartRendering(true, new Color4(), rendertarget, true);
// Load the skysphere model...
BoundingBoxSizes bbs = new BoundingBoxSizes();
Stream modeldata = General.ThisAssembly.GetManifestResourceStream("CodeImp.DoomBuilder.Resources.SkySphere.md3");
ModelReader.MD3LoadResult meshes = ModelReader.ReadMD3Model(ref bbs, new Dictionary<int, string>(), modeldata, device, 0);
ModelReader.MD3LoadResult meshes = ModelReader.ReadMD3Model(ref bbs, new Dictionary<int, string>(), modeldata, 0);
if(meshes.Meshes.Count != 3) throw new Exception("Skybox creation failed: "
+ (string.IsNullOrEmpty(meshes.Errors) ? "skybox model must contain 3 surfaces" : meshes.Errors));
// Make skysphere textures...
Texture texside = TextureFromBitmap(device, skyimage);
Texture textop = TextureFromBitmap(device, topimg);
Texture texbottom = TextureFromBitmap(device, bottomimg);
Texture texside = TextureFromBitmap(skyimage);
Texture textop = TextureFromBitmap(topimg);
Texture texbottom = TextureFromBitmap(bottomimg);
// Calculate model scaling (gl.skydone.cpp:RenderDome() in GZDoom)
float yscale;
@ -3459,32 +3435,32 @@ namespace CodeImp.DoomBuilder.Data
yscale *= 1.65f;
// Make cubemap texture
CubeTexture cubemap = new CubeTexture(device, cubemaptexsize, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
Surface sysmemsurf = Surface.CreateOffscreenPlain(device, cubemaptexsize, cubemaptexsize, Format.A8R8G8B8, Pool.SystemMemory);
CubeTexture cubemap = new CubeTexture(General.Map.Graphics, cubemaptexsize);
// Set render settings...
device.SetRenderState(RenderState.ZEnable, false);
device.SetRenderState(RenderState.CullMode, Cull.None);
device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp);
device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp);
// Set render settings...
General.Map.Graphics.SetZEnable(false);
General.Map.Graphics.SetCullMode(Cull.None);
General.Map.Graphics.SetSamplerState(TextureAddress.Clamp);
// Setup matrices
Vector3 offset = new Vector3(0f, 0f, -1.8f); // Sphere size is 10 mu
Matrix mworld = Matrix.Multiply(Matrix.Identity, Matrix.Translation(offset) * Matrix.Scaling(1.0f, 1.0f, yscale));
Matrix mprojection = Matrix.PerspectiveFovLH(Angle2D.PIHALF, 1.0f, 0.5f, 100.0f);
Matrix mworld = Matrix.Translation(offset) * Matrix.Scaling(1.0f, 1.0f, yscale);
Matrix mprojection = Matrix.PerspectiveFov(Angle2D.PIHALF, 1.0f, 0.5f, 100.0f);
// Place camera at origin
effect.CameraPosition = new Vector4();
// Place camera at origin
General.Map.Graphics.SetUniform(UniformName.campos, new Vector4());
// Begin fullbright shaderpass
effect.Begin();
effect.BeginPass(1);
// Begin fullbright shaderpass
General.Map.Graphics.SetShader(ShaderName.world3d_fullbright);
General.Map.Graphics.SetUniform(UniformName.fogsettings, new Vector4(-1.0f));
// Render to the six faces of the cube map
for(int i = 0; i < 6; i++)
// Render to the six faces of the cube map
for (int i = 0; i < 6; i++)
{
Matrix faceview = GetCubeMapViewMatrix((CubeMapFace)i);
effect.WorldViewProj = mworld * faceview * mprojection;
General.Map.Graphics.SetUniform(UniformName.world, mworld);
General.Map.Graphics.SetUniform(UniformName.view, faceview);
General.Map.Graphics.SetUniform(UniformName.projection, mprojection);
// Render the skysphere meshes
for(int j = 0; j < meshes.Meshes.Count; j++)
@ -3492,53 +3468,24 @@ namespace CodeImp.DoomBuilder.Data
// Set appropriate texture
switch(meshes.Skins[j])
{
case "top.png": effect.Texture1 = textop; break;
case "bottom.png": effect.Texture1 = texbottom; break;
case "side.png": effect.Texture1 = texside; break;
case "top.png": General.Map.Graphics.SetTexture(textop); break;
case "bottom.png": General.Map.Graphics.SetTexture(texbottom); break;
case "side.png": General.Map.Graphics.SetTexture(texside); break;
default: throw new Exception("Unexpected skin!");
}
// Commit changes
effect.ApplySettings();
// Render mesh
meshes.Meshes[j].DrawSubset(0);
meshes.Meshes[j].Draw(General.Map.Graphics);
}
// Get rendered data from video memory...
device.GetRenderTargetData(rendertarget, sysmemsurf);
// ...Then copy it to destination texture
Surface targetsurf = cubemap.GetCubeMapSurface((CubeMapFace)i, 0);
DataRectangle sourcerect = sysmemsurf.LockRectangle(LockFlags.NoSystemLock);
DataRectangle targetrect = targetsurf.LockRectangle(LockFlags.NoSystemLock);
if(sourcerect.Data.CanRead && targetrect.Data.CanWrite)
{
byte[] data = new byte[sourcerect.Data.Length];
sourcerect.Data.ReadRange(data, 0, (int)sourcerect.Data.Length);
targetrect.Data.Write(data, 0, data.Length);
}
else
{
General.ErrorLogger.Add(ErrorType.Error, "Skybox creation failed: unable to copy to CubeTexture surface...");
}
// Unlock and dispose
sysmemsurf.UnlockRectangle();
targetsurf.UnlockRectangle();
targetsurf.Dispose();
General.Map.Graphics.CopyTexture(cubemap, (CubeMapFace)i);
}
// End rendering
effect.EndPass();
effect.End();
General.Map.Graphics.FinishRendering();
// Dispose unneeded stuff
rendertarget.Dispose();
depthbuffer.Dispose();
sysmemsurf.Dispose();
textop.Dispose();
texside.Dispose();
texbottom.Dispose();
@ -3684,7 +3631,7 @@ namespace CodeImp.DoomBuilder.Data
// sides[] must contain 6 square Po2 images in this order: North, East, South, West, Top, Bottom
private static CubeTexture MakeSkyBox(Bitmap[] sides, int targetsize, bool fliptop)
{
CubeTexture cubemap = new CubeTexture(General.Map.Graphics.Device, targetsize, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
CubeTexture cubemap = new CubeTexture(General.Map.Graphics, targetsize);
// Draw faces
sides[3].RotateFlip(RotateFlipType.Rotate90FlipNone);
@ -3710,21 +3657,7 @@ namespace CodeImp.DoomBuilder.Data
private static void DrawCubemapFace(CubeTexture texture, CubeMapFace face, Bitmap image)
{
DataRectangle rect = texture.LockRectangle(face, 0, LockFlags.NoSystemLock);
if(rect.Data.CanWrite)
{
BitmapData data = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
int len = Math.Abs(data.Stride) * image.Height;
rect.Data.WriteRange(data.Scan0, len);
image.UnlockBits(data);
}
else
{
General.ErrorLogger.Add(ErrorType.Error, "Skybox creation failed: CubeTexture is unwritable...");
}
texture.UnlockRectangle(face, 0);
General.Map.Graphics.SetPixels(texture, face, image);
}
private static Bitmap ResizeImage(Image image, int width, int height)
@ -3759,23 +3692,23 @@ namespace CodeImp.DoomBuilder.Data
switch(face)
{
case CubeMapFace.PositiveX:
lookdir = new Vector3(1.0f, 0.0f, 0.0f);
updir = new Vector3(0.0f, 1.0f, 0.0f);
break;
case CubeMapFace.NegativeX:
lookdir = new Vector3(-1.0f, 0.0f, 0.0f);
updir = new Vector3(0.0f, 1.0f, 0.0f);
break;
case CubeMapFace.NegativeX:
lookdir = new Vector3(1.0f, 0.0f, 0.0f);
updir = new Vector3(0.0f, 1.0f, 0.0f);
break;
case CubeMapFace.PositiveY:
lookdir = new Vector3(0.0f, 1.0f, 0.0f);
updir = new Vector3(0.0f, 0.0f, -1.0f);
lookdir = new Vector3(0.0f, -1.0f, 0.0f);
updir = new Vector3(0.0f, 0.0f, 1.0f);
break;
case CubeMapFace.NegativeY:
lookdir = new Vector3(0.0f, -1.0f, 0.0f);
updir = new Vector3(0.0f, 0.0f, 1.0f);
lookdir = new Vector3(0.0f, 1.0f, 0.0f);
updir = new Vector3(0.0f, 0.0f, -1.0f);
break;
case CubeMapFace.PositiveZ:
@ -3793,22 +3726,15 @@ namespace CodeImp.DoomBuilder.Data
}
Vector3 eye = new Vector3();
return Matrix.LookAtLH(eye, lookdir, updir);
return Matrix.LookAt(eye, lookdir, updir);
}
private static Texture TextureFromBitmap(Device device, Image image)
private static Texture TextureFromBitmap(Image image)
{
using(MemoryStream ms = new MemoryStream())
{
image.Save(ms, ImageFormat.Png);
ms.Seek(0, SeekOrigin.Begin);
// Classic skies textures can be NPo2 (and D3D Texture is resized to Po2 by default),
// so we need to explicitly specify the size
return Texture.FromStream(device, ms, (int) ms.Length,
image.Size.Width, image.Size.Height, 0, Usage.None, Format.Unknown,
Pool.Managed, Filter.None, Filter.None, 0);
}
using (var bitmap = new Bitmap(image))
{
return new Texture(General.Map.Graphics, bitmap);
}
}
#endregion

View file

@ -23,7 +23,7 @@ using CodeImp.DoomBuilder.Rendering;
namespace CodeImp.DoomBuilder.Data
{
public class DynamicBitmapImage : BitmapImage, ID3DResource
public class DynamicBitmapImage : BitmapImage, IRenderResource
{
#region ================== Variables

View file

@ -26,8 +26,6 @@ using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Windows;
using SlimDX;
using SlimDX.Direct3D9;
#endregion
@ -466,30 +464,14 @@ namespace CodeImp.DoomBuilder.Data
// Only do this when texture is not created yet
if(((texture == null) || (texture.Disposed)) && this.IsImageLoaded && !loadfailed)
{
Image img = bitmap;
Bitmap img = bitmap;
if(loadfailed) img = Properties.Resources.Failed;
// Write to memory stream and read from memory
MemoryStream memstream = new MemoryStream((img.Size.Width * img.Size.Height * 4) + 4096);
img.Save(memstream, ImageFormat.Bmp);
memstream.Seek(0, SeekOrigin.Begin);
if(dynamictexture)
{
texture = Texture.FromStream(General.Map.Graphics.Device, memstream, (int)memstream.Length,
img.Size.Width, img.Size.Height, mipmaplevels, Usage.Dynamic, Format.A8R8G8B8,
Pool.Default, General.Map.Graphics.PostFilter, General.Map.Graphics.MipGenerateFilter, 0);
}
else
{
texture = Texture.FromStream(General.Map.Graphics.Device, memstream, (int)memstream.Length,
img.Size.Width, img.Size.Height, mipmaplevels, Usage.None, Format.Unknown,
Pool.Managed, General.Map.Graphics.PostFilter, General.Map.Graphics.MipGenerateFilter, 0);
}
memstream.Dispose();
texture = new Texture(General.Map.Graphics, img);
if(dynamictexture)
{
if((width != texture.GetLevelDescription(0).Width) || (height != texture.GetLevelDescription(0).Height))
if((width != texture.Width) || (height != texture.Height))
throw new Exception("Could not create a texture with the same size as the image.");
}
@ -510,30 +492,7 @@ namespace CodeImp.DoomBuilder.Data
{
if((texture != null) && !texture.Disposed)
{
// Lock the bitmap and texture
BitmapData bmpdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Size.Width, bitmap.Size.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
DataRectangle texdata = texture.LockRectangle(0, LockFlags.Discard);
// Copy data
int* bp = (int*)bmpdata.Scan0.ToPointer();
int* tp = (int*)texdata.Data.DataPointer.ToPointer();
for(int y = 0; y < bmpdata.Height; y++)
{
for(int x = 0; x < bmpdata.Width; x++)
{
*tp = *bp;
bp++;
tp++;
}
// Skip extra data in texture
int extrapitch = (texdata.Pitch >> 2) - bmpdata.Width;
tp += extrapitch;
}
// Unlock
texture.UnlockRectangle(0);
bitmap.UnlockBits(bmpdata);
General.Map.Graphics.SetPixels(texture, bitmap);
}
}
}

View file

@ -10,10 +10,33 @@ using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.IO;
using ScintillaNET;
#endregion
#if NO_SCINTILLA
namespace CodeImp.DoomBuilder.Data.Scripting
{
[ScriptHandler(ScriptType.UNKNOWN)]
internal class ScriptHandler
{
public virtual void Initialize(ScriptEditorControl scriptcontrol, ScriptConfiguration scriptconfig)
{
}
public virtual List<CompilerError> UpdateFunctionBarItems(ScriptDocumentTab tab, MemoryStream stream, ComboBox target)
{
// Unsupported script type. Just clear the items
target.Items.Clear();
return new List<CompilerError>();
}
}
}
#else
using ScintillaNET;
namespace CodeImp.DoomBuilder.Data.Scripting
{
[ScriptHandler(ScriptType.UNKNOWN)]
@ -452,3 +475,5 @@ namespace CodeImp.DoomBuilder.Data.Scripting
#endregion
}
}
#endif

View file

@ -1,4 +1,4 @@
using SlimDX;
using CodeImp.DoomBuilder.Rendering;
namespace CodeImp.DoomBuilder.GZBuilder.Data
{

View file

@ -1,7 +1,7 @@
#region ================== Namespaces
using CodeImp.DoomBuilder.Data;
using SlimDX;
using CodeImp.DoomBuilder.Rendering;
#endregion

View file

@ -3,8 +3,6 @@
using System.Collections.Generic;
using CodeImp.DoomBuilder.GZBuilder.MD3;
using CodeImp.DoomBuilder.Rendering;
using SlimDX;
using SlimDX.Direct3D9;
#endregion

View file

@ -1,5 +1,5 @@
using System.Collections.Generic;
using SlimDX.Direct3D9;
using CodeImp.DoomBuilder.Rendering;
namespace CodeImp.DoomBuilder.GZBuilder.MD3
{

View file

@ -11,9 +11,8 @@ using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.GZBuilder.Data;
using SlimDX;
using SlimDX.Direct3D9;
using CodeImp.DoomBuilder.Geometry;
using System.Linq;
#endregion
@ -37,26 +36,17 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
}
private static readonly VertexElement[] vertexElements = new[]
{
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, 24, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0),
VertexElement.VertexDeclarationEnd
};
#endregion
#region ================== Load
public static void Load(ModelData mde, List<DataReader> containers, Device device)
public static void Load(ModelData mde, List<DataReader> containers)
{
if(mde.IsVoxel) LoadKVX(mde, containers, device);
else LoadModel(mde, containers, device);
if(mde.IsVoxel) LoadKVX(mde, containers);
else LoadModel(mde, containers);
}
private static void LoadKVX(ModelData mde, List<DataReader> containers, Device device)
private static void LoadKVX(ModelData mde, List<DataReader> containers)
{
mde.Model = new GZModel();
string unused = string.Empty;
@ -69,7 +59,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
if(ms == null) continue;
//load kvx
ReadKVX(mde, ms, device);
ReadKVX(mde, ms);
//done
ms.Close();
@ -87,7 +77,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
}
private static void LoadModel(ModelData mde, List<DataReader> containers, Device device)
private static void LoadModel(ModelData mde, List<DataReader> containers)
{
mde.Model = new GZModel();
BoundingBoxSizes bbs = new BoundingBoxSizes();
@ -121,13 +111,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
General.ErrorLogger.Add(ErrorType.Error, "Error while loading \"" + mde.ModelNames[i] + "\": frame names are not supported for MD3 models!");
continue;
}
result = ReadMD3Model(ref bbs, skins, ms, device, mde.FrameIndices[i]);
result = ReadMD3Model(ref bbs, skins, ms, mde.FrameIndices[i]);
break;
case ".md2":
result = ReadMD2Model(ref bbs, ms, device, mde.FrameIndices[i], mde.FrameNames[i]);
result = ReadMD2Model(ref bbs, ms, mde.FrameIndices[i], mde.FrameNames[i]);
break;
case ".3d":
result = Read3DModel(ref bbs, skins, ms, device, mde.FrameIndices[i], mde.ModelNames[i], containers);
result = Read3DModel(ref bbs, skins, ms, mde.FrameIndices[i], mde.ModelNames[i], containers);
break;
case ".obj":
// OBJ doesn't support frames, so print out an error
@ -136,7 +126,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
General.ErrorLogger.Add(ErrorType.Error, "Trying to load frame " + mde.FrameIndices[i] + " of model \"" + mde.ModelNames[i] + "\", but OBJ doesn't support frames!");
continue;
}
result = ReadOBJModel(ref bbs, skins, ms, device, mde.ModelNames[i]);
result = ReadOBJModel(ref bbs, skins, ms, mde.ModelNames[i]);
break;
default:
result.Errors = "model format is not supported";
@ -190,7 +180,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
if(!String.IsNullOrEmpty(mde.Path))
path = Path.Combine(mde.Path, path);
Texture t = GetTexture(containers, path, device);
Texture t = GetTexture(containers, path);
if(t != null)
{
@ -200,7 +190,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
// That didn't work, let's try to load the texture without the additional path
path = result.Skins[m].Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
t = GetTexture(containers, path, device);
t = GetTexture(containers, path);
if (t == null)
{
@ -215,7 +205,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
//Try to use texture loaded from MODELDEFS
else
{
Texture t = GetTexture(containers, mde.SkinNames[i], device);
Texture t = GetTexture(containers, mde.SkinNames[i]);
if(t == null)
{
@ -257,7 +247,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
mde.Model.Radius = Math.Max(Math.Max(Math.Abs(bbs.MinY), Math.Abs(bbs.MaxY)), Math.Max(Math.Abs(bbs.MinX), Math.Abs(bbs.MaxX)));
}
private static Texture GetTexture(List<DataReader> containers, string texturename, Device device)
private static Texture GetTexture(List<DataReader> containers, string texturename)
{
Texture t = null;
string[] extensions = new string[ModelData.SUPPORTED_TEXTURE_EXTENSIONS.Length + 1];
@ -273,7 +263,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
string name = Path.ChangeExtension(texturename, null) + extension;
name = name.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
t = LoadTexture(containers, name, device);
t = LoadTexture(containers, name);
if (t != null)
break;
@ -379,7 +369,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
public Vector3D Normal;
}
internal static MD3LoadResult Read3DModel(ref BoundingBoxSizes bbs, Dictionary<int, string> skins, Stream s, Device device, int frame, string filename, List<DataReader> containers)
internal static MD3LoadResult Read3DModel(ref BoundingBoxSizes bbs, Dictionary<int, string> skins, Stream s, int frame, string filename, List<DataReader> containers)
{
Stream stream_d;
Stream stream_a;
@ -579,7 +569,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
}
CreateMesh(device, ref result, out_verts, out_polys);
CreateMesh(ref result, out_verts, out_polys);
result.Skins.Add("");
}
else
@ -613,7 +603,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
}
CreateMesh(device, ref result, out_verts, out_polys);
CreateMesh(ref result, out_verts, out_polys);
result.Skins.Add(skins.ContainsKey(k)?skins[k].ToLowerInvariant():string.Empty);
}
}
@ -625,7 +615,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
#region ================== MD3
internal static MD3LoadResult ReadMD3Model(ref BoundingBoxSizes bbs, Dictionary<int, string> skins, Stream s, Device device, int frame)
internal static MD3LoadResult ReadMD3Model(ref BoundingBoxSizes bbs, Dictionary<int, string> skins, Stream s, int frame)
{
long start = s.Position;
MD3LoadResult result = new MD3LoadResult();
@ -710,7 +700,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
if(!useskins)
{
//create mesh
CreateMesh(device, ref result, vertList, polyIndecesList);
CreateMesh(ref result, vertList, polyIndecesList);
result.Skins.Add("");
}
else
@ -734,7 +724,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
polyIndecesList.AddRange(group.Value[i].ToArray());
}
CreateMesh(device, ref result, vertListsPerTexture[group.Key], polyIndecesList);
CreateMesh(ref result, vertListsPerTexture[group.Key], polyIndecesList);
result.Skins.Add(group.Key.ToLowerInvariant());
}
}
@ -831,7 +821,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
#region ================== MD2
private static MD3LoadResult ReadMD2Model(ref BoundingBoxSizes bbs, Stream s, Device device, int frame, string framename)
private static MD3LoadResult ReadMD2Model(ref BoundingBoxSizes bbs, Stream s, int frame, string framename)
{
long start = s.Position;
MD3LoadResult result = new MD3LoadResult();
@ -991,21 +981,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
//mesh
Mesh mesh = new Mesh(device, polyIndecesList.Count / 3, vertList.Count, MeshFlags.Use32Bit | MeshFlags.IndexBufferManaged | MeshFlags.VertexBufferManaged, vertexElements);
using(DataStream stream = mesh.LockVertexBuffer(LockFlags.None))
{
stream.WriteRange(vertList.ToArray());
}
mesh.UnlockVertexBuffer();
using(DataStream stream = mesh.LockIndexBuffer(LockFlags.None))
{
stream.WriteRange(polyIndecesList.ToArray());
}
mesh.UnlockIndexBuffer();
mesh.OptimizeInPlace(MeshOptimizeFlags.AttributeSort);
Mesh mesh = new Mesh(General.Map.Graphics, vertList.ToArray(), polyIndecesList.ToArray());
//store in result
result.Meshes.Add(mesh);
@ -1019,7 +995,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
#region ================== KVX
private static void ReadKVX(ModelData mde, Stream stream, Device device)
private static void ReadKVX(ModelData mde, Stream stream)
{
PixelColor[] palette = new PixelColor[256];
List<WorldVertex> verts = new List<WorldVertex>();
@ -1176,37 +1152,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
// Calculate model radius
mde.Model.Radius = Math.Max(Math.Max(Math.Abs(minY), Math.Abs(maxY)), Math.Max(Math.Abs(minX), Math.Abs(maxX)));
// Create texture
MemoryStream memstream = new MemoryStream((4096 * 4) + 4096);
using(Bitmap bmp = CreateVoxelTexture(palette)) bmp.Save(memstream, ImageFormat.Bmp);
memstream.Seek(0, SeekOrigin.Begin);
Texture texture = Texture.FromStream(device, memstream, (int)memstream.Length, 64, 64, 0, Usage.None, Format.Unknown, Pool.Managed, Filter.Point, Filter.Box, 0);
memstream.Dispose();
// Add texture
mde.Model.Textures.Add(texture);
// Create texture new Texture(bmp.Width)
using(Bitmap bmp = CreateVoxelTexture(palette))
{
mde.Model.Textures.Add(new Texture(General.Map.Graphics, bmp));
}
// Create mesh
MeshFlags meshflags = MeshFlags.Managed;
if(indices.Count > ushort.MaxValue - 1) meshflags |= MeshFlags.Use32Bit;
Mesh mesh = new Mesh(device, facescount, verts.Count, meshflags, vertexElements);
DataStream mstream = mesh.VertexBuffer.Lock(0, 0, LockFlags.None);
mstream.WriteRange(verts.ToArray());
mesh.VertexBuffer.Unlock();
mstream = mesh.IndexBuffer.Lock(0, 0, LockFlags.None);
if(indices.Count > ushort.MaxValue - 1)
mstream.WriteRange(indices.ToArray());
else
foreach(int index in indices) mstream.Write((ushort)index);
mesh.IndexBuffer.Unlock();
mesh.OptimizeInPlace(MeshOptimizeFlags.AttributeSort);
Mesh mesh = new Mesh(General.Map.Graphics, verts.ToArray(), indices.ToArray());
// Add mesh
mde.Model.Meshes.Add(mesh);
@ -1333,7 +1286,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
#region ================== OBJ
private static MD3LoadResult ReadOBJModel(ref BoundingBoxSizes bbs, Dictionary<int, string> skins, Stream s, Device device, string name)
private static MD3LoadResult ReadOBJModel(ref BoundingBoxSizes bbs, Dictionary<int, string> skins, Stream s, string name)
{
MD3LoadResult result = new MD3LoadResult();
@ -1473,7 +1426,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
// start a gather new faces for the next mesh
if(worldvertices.Count > 0)
{
CreateMesh(device, ref result, worldvertices, polyindiceslist);
CreateMesh(ref result, worldvertices, polyindiceslist);
worldvertices.Clear();
polyindiceslist.Clear();
}
@ -1494,7 +1447,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
linenum++;
}
CreateMesh(device, ref result, worldvertices, polyindiceslist);
CreateMesh(ref result, worldvertices, polyindiceslist);
// Overwrite internal textures with SurfaceSkin definitions if necessary
if (skins != null)
@ -1690,7 +1643,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
return null;
}
private static Texture LoadTexture(List<DataReader> containers, string path, Device device)
private static Texture LoadTexture(List<DataReader> containers, string path)
{
if(string.IsNullOrEmpty(path)) return null;
@ -1700,55 +1653,23 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
Texture texture = null;
//create texture
if(Path.GetExtension(path) == ".pcx") //pcx format requires special handling...
FileImageReader fir = new FileImageReader();
Bitmap bitmap = fir.ReadAsBitmap(ms);
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
ms.Close();
if(bitmap != null)
{
FileImageReader fir = new FileImageReader();
Bitmap bitmap = fir.ReadAsBitmap(ms);
ms.Close();
if(bitmap != null)
{
BitmapData bmlock = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat);
texture = new Texture(device, bitmap.Width, bitmap.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
DataRectangle textureLock = texture.LockRectangle(0, LockFlags.None);
textureLock.Data.WriteRange(bmlock.Scan0, bmlock.Height * bmlock.Stride);
bitmap.UnlockBits(bmlock);
texture.UnlockRectangle(0);
}
}
else
{
texture = Texture.FromStream(device, ms);
ms.Close();
texture = new Texture(General.Map.Graphics, bitmap);
}
return texture;
}
private static void CreateMesh(Device device, ref MD3LoadResult result, List<WorldVertex> verts, List<int> indices)
private static void CreateMesh(ref MD3LoadResult result, List<WorldVertex> verts, List<int> indices)
{
//create mesh
Mesh mesh = new Mesh(device, indices.Count / 3, verts.Count, MeshFlags.Use32Bit | MeshFlags.IndexBufferManaged | MeshFlags.VertexBufferManaged, vertexElements);
TextureAddress ta = (TextureAddress)device.GetSamplerState(0, SamplerState.AddressU);
using (DataStream stream = mesh.LockVertexBuffer(LockFlags.None))
{
stream.WriteRange(verts.ToArray());
}
mesh.UnlockVertexBuffer();
using(DataStream stream = mesh.LockIndexBuffer(LockFlags.None))
{
stream.WriteRange(indices.ToArray());
}
mesh.UnlockIndexBuffer();
mesh.OptimizeInPlace(MeshOptimizeFlags.AttributeSort);
Mesh mesh = new Mesh(General.Map.Graphics, verts.ToArray(), indices.ToArray());
//store in result
result.Meshes.Add(mesh);

View file

@ -14,20 +14,28 @@
#endregion
using SlimDX;
using System.Diagnostics;
namespace CodeImp.DoomBuilder
{
public static class Clock
{
// This queries the system for the current time
public static long CurrentTime { get { return Configuration.Timer.ElapsedMilliseconds; } }
static Clock()
{
Timer = new Stopwatch();
Timer.Start();
}
public static Stopwatch Timer { get; private set; }
// This queries the system for the current time
public static long CurrentTime { get { return Clock.Timer.ElapsedMilliseconds; } }
//mxd. Timer needs to be reset from time to time (like, every 2 days of continuously running the editor) to prevent float precision degradation.
internal static void Reset()
{
Configuration.Timer.Reset();
Configuration.Timer.Start();
Clock.Timer.Reset();
Clock.Timer.Start();
}
}
}

View file

@ -40,7 +40,6 @@ using CodeImp.DoomBuilder.Plugins;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.Windows;
using SlimDX.Direct3D9;
#endregion
@ -48,12 +47,20 @@ namespace CodeImp.DoomBuilder
{
public static class General
{
#region ================== API Declarations
#region ================== API Declarations
[DllImport("devil.dll")]
[DllImport("devil.dll")]
private static extern void ilInit();
[DllImport("user32.dll")]
#if NO_WIN32
internal static bool LockWindowUpdate(IntPtr hwnd) { return true; }
internal static bool MessageBeep(MessageBeepType type) { return true; }
internal static void ZeroMemory(IntPtr dest, int size) { }
internal static int SendMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam) { return 0; }
#else
[DllImport("user32.dll")]
internal static extern bool LockWindowUpdate(IntPtr hwnd);
[DllImport("kernel32.dll", EntryPoint = "RtlZeroMemory", SetLastError = false)]
@ -93,6 +100,7 @@ namespace CodeImp.DoomBuilder
//[DllImport("user32.dll")]
//internal static extern int GetScrollInfo(IntPtr windowptr, int bar, IntPtr scrollinfo);
#endif
#endregion
@ -544,9 +552,6 @@ namespace CodeImp.DoomBuilder
//mxd. Set CultureInfo
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
// Hook to DLL loading failure event
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
// Set current thread name
Thread.CurrentThread.Name = "Main Application";
@ -594,7 +599,7 @@ namespace CodeImp.DoomBuilder
// Remove the previous log file and start logging
if(File.Exists(logfile)) File.Delete(logfile);
string platform = Environment.Is64BitProcess ? "x64" : "x86";
General.WriteLogLine("GZDoom Builder R" + thisasm.GetName().Version.Revision + " (" + platform + ", " + commithash + ") startup"); //mxd
General.WriteLogLine("Ultimate Doom Builder R" + thisasm.GetName().Version.Revision + " (" + platform + ", " + commithash + ") startup"); //mxd
General.WriteLogLine("Application path: \"" + apppath + "\"");
General.WriteLogLine("Temporary path: \"" + temppath + "\"");
General.WriteLogLine("Local settings path: \"" + settingspath + "\"");
@ -621,6 +626,7 @@ namespace CodeImp.DoomBuilder
// Initialize static classes
MapSet.Initialize();
ilInit();
// Create main window
@ -638,12 +644,6 @@ namespace CodeImp.DoomBuilder
mainwindow.Update();
}
// Start Direct3D
General.WriteLogLine("Starting Direct3D graphics driver...");
try { D3DDevice.Startup(); }
catch(Direct3D9NotFoundException e) { AskDownloadDirectX(e.Message); return; }
catch(Direct3DX9NotFoundException e) { AskDownloadDirectX(e.Message); return; }
// Load plugin manager
General.WriteLogLine("Loading plugins...");
plugins = new PluginManager();
@ -741,58 +741,6 @@ namespace CodeImp.DoomBuilder
}
}
// This handles DLL linking errors
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
// Check if SlimDX failed loading
if(args.Name.Contains("SlimDX")) AskDownloadSlimDX();
// Return null
return null;
}
// This asks the user to download DirectX
private static void AskDownloadDirectX(string message)
{
// Cancel loading map from command-line parameters, if any.
// This causes problems, because when the window is shown, the map will
// be loaded and DirectX is initialized (which we seem to be missing)
CancelAutoMapLoad();
// Ask the user to download DirectX
if(MessageBox.Show("Unable to initialize DirectX: " + message + Environment.NewLine + Environment.NewLine +
"Do you want to install and/or update Microsoft DirectX 9.0 now?", "DirectX 9.0 Error", MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
// Go to DirectX End-User Runtime Web Installer page (mxd)
OpenWebsite("https://www.microsoft.com/en-us/download/details.aspx?id=35&44F86079-8679-400C-BFF2-9CA5F2BCBDFC=1");
}
// End program here
Terminate(false);
}
// This asks the user to download SlimDX (mxd)
private static void AskDownloadSlimDX()
{
// Cancel loading map from command-line parameters, if any.
// This causes problems, because when the window is shown, the map will
// be loaded and SlimDX is initialized (which we seem to be missing)
CancelAutoMapLoad();
// Ask the user to download SlimDX
if(MessageBox.Show("This application requires the latest version of SlimDX for .NET 2.0 installed on your computer." + Environment.NewLine +
"Do you want to install SlimDX now?", "SlimDX Error", MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
// Go to SlimDX download page
OpenWebsite("http://slimdx.org/download.php");
}
// End program here
Terminate(false);
}
// This parses the command line arguments
private static void ParseCommandLineArgs(string[] args)
{
@ -979,9 +927,9 @@ namespace CodeImp.DoomBuilder
autoloadfile = null;
}
#endregion
#endregion
#region ================== Terminate
#region ================== Terminate
// This is for plugins to use
public static void Exit(bool properexit)
@ -1034,7 +982,6 @@ namespace CodeImp.DoomBuilder
if(mainwindow != null) { mainwindow.Dispose(); mainwindow = null; }
if(actions != null) { actions.Dispose(); actions = null; }
if(types != null) { types.Dispose(); types = null; }
try { D3DDevice.Terminate(); } catch { }
// Application ends here and now
General.WriteLogLine("Termination done");
@ -1051,9 +998,9 @@ namespace CodeImp.DoomBuilder
Process.GetCurrentProcess().Kill();
}
#endregion
#endregion
#region ================== Management
#region ================== Management
// This creates a new map
[BeginAction("newmap")]
@ -1676,9 +1623,9 @@ namespace CodeImp.DoomBuilder
}
}
#endregion
#endregion
#region ================== Debug
#region ================== Debug
// This shows a major failure
public static void Fail(string message)
@ -1720,9 +1667,9 @@ namespace CodeImp.DoomBuilder
catch(Exception) { }
}
#endregion
#endregion
#region ================== Tools
#region ================== Tools
// This swaps two pointers
public static void Swap<T>(ref T a, ref T b)
@ -2103,10 +2050,14 @@ namespace CodeImp.DoomBuilder
// This returns the short path name for a file
public static string GetShortFilePath(string longpath)
{
#if NO_WIN32
return longpath;
#else
const int maxlen = 256;
StringBuilder shortname = new StringBuilder(maxlen);
GetShortPathName(longpath, shortname, maxlen);
return shortname.ToString();
#endif
}
//mxd
@ -2152,9 +2103,9 @@ namespace CodeImp.DoomBuilder
}
}
#endregion
#endregion
#region ================== mxd. Uncaught exceptions handling
#region ================== mxd. Uncaught exceptions handling
// In some cases the program can remain operational after these
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
@ -2217,7 +2168,7 @@ namespace CodeImp.DoomBuilder
}
}
#endregion
#endregion
}
}

View file

@ -395,7 +395,6 @@ namespace CodeImp.DoomBuilder
// Device reset may be needed...
if(General.Editing.Mode is ClassicMode)
{
General.Map.Graphics.Reset();
General.MainWindow.RedrawDisplay();
}
}

View file

@ -75,7 +75,7 @@ namespace CodeImp.DoomBuilder
private ConfigurationInfo configinfo;
private GameConfiguration config;
private DataManager data;
private D3DDevice graphics;
private RenderDevice graphics;
private Renderer2D renderer2d;
private Renderer3D renderer3d;
private WADReader tempwadreader;
@ -107,7 +107,7 @@ namespace CodeImp.DoomBuilder
public DataManager Data { get { return data; } }
public bool IsChanged { get { return changed | CheckScriptChanged(); } set { changed |= value; if(!maploading) General.MainWindow.UpdateMapChangedStatus(); } }
public bool IsDisposed { get { return isdisposed; } }
internal D3DDevice Graphics { get { return graphics; } }
internal RenderDevice Graphics { get { return graphics; } }
public IRenderer2D Renderer2D { get { return renderer2d; } }
public IRenderer3D Renderer3D { get { return renderer3d; } }
internal Renderer2D CRenderer2D { get { return renderer2d; } }
@ -261,8 +261,7 @@ namespace CodeImp.DoomBuilder
// Initiate graphics
General.WriteLogLine("Initializing graphics device...");
graphics = new D3DDevice(General.MainWindow.Display);
if(!graphics.Initialize()) return false;
graphics = new RenderDevice(General.MainWindow.Display);
// Create renderers
renderer2d = new Renderer2D(graphics);
@ -369,8 +368,7 @@ namespace CodeImp.DoomBuilder
// Initiate graphics
General.WriteLogLine("Initializing graphics device...");
graphics = new D3DDevice(General.MainWindow.Display);
if(!graphics.Initialize()) return false;
graphics = new RenderDevice(General.MainWindow.Display);
// Create renderers
renderer2d = new Renderer2D(graphics);

View file

@ -19,6 +19,11 @@ namespace CodeImp.DoomBuilder
{
internal static class UpdateChecker
{
#if NO_UPDATER
internal static void PerformCheck(bool verbosemode)
{
}
#else
private delegate DialogResult ShowWarningMessageDelegate(string message, MessageBoxButtons buttons);
private const string NO_UPDATE_REQUIRED = "Your version is up to date.";
@ -340,5 +345,6 @@ namespace CodeImp.DoomBuilder
result.Position = 0;
return result;
}
#endif
}
}

View file

@ -226,70 +226,83 @@ namespace CodeImp.DoomBuilder.Geometry
return new Vector2D(v1.x + u * (v2.x - v1.x), v1.y + u * (v2.y - v1.y));
}
// Cohen-Sutherland algorithm
public static Line2D ClipToRectangle(Line2D line, RectangleF rect, out bool intersects)
private static bool IsEqualFloat(float a, float b)
{
return Math.Abs(a - b) < 0.0001f;
}
// Some random self-written aglrithm instead of Cohen-Sutherland algorithm which used to hang up randomly
public static Line2D ClipToRectangle(Line2D line, RectangleF rect, out bool intersects)
{
int flags1 = MapSet.GetCSFieldBits(line.v1, rect);
int flags2 = MapSet.GetCSFieldBits(line.v2, rect);
intersects = false;
float rateXY = 0f;
if (line.v2.y != line.v1.y)
{
float dx = line.v2.x - line.v1.x;
float dy = line.v2.y - line.v1.y;
rateXY = dx / dy;
}
Line2D result = line;
while (true)
{
if (flags1 == 0 && flags2 == 0)
{
// Line is fully inside the box
intersects = true;
return result;
}
if ((flags1 & flags2) != 0)
{
// Both points are in the same outer area
intersects = false;
return new Line2D();
}
float x1 = line.v1.x, y1 = line.v1.y;
float x2 = line.v2.x, y2 = line.v2.y;
float x, y;
int outFlags = flags1 != 0 ? flags1 : flags2;
if ((outFlags & 0x1) > 0) // Top
{
x = result.v1.x + (result.v2.x - result.v1.x) * (rect.Top - result.v1.y) / (result.v2.y - result.v1.y);
y = rect.Top;
}
else if ((outFlags & 0x2) > 0) // Bottom
{
x = result.v1.x + (result.v2.x - result.v1.x) * (rect.Bottom - result.v1.y) / (result.v2.y - result.v1.y);
y = rect.Bottom;
}
else if ((outFlags & 0x4) > 0) // Left
{
y = result.v1.y + (result.v2.y - result.v1.y) * (rect.Left - result.v1.x) / (result.v2.x - result.v1.x);
x = rect.Left;
}
else if ((outFlags & 0x8) > 0) // Right
{
y = result.v1.y + (result.v2.y - result.v1.y) * (rect.Right - result.v1.x) / (result.v2.x - result.v1.x);
x = rect.Right;
}
else
{
intersects = true;
return result;
}
for (int i = 0; i < 2; i++)
{
// check x1,y1
if (y1 < rect.Top)
{
x1 += (rect.Top - y1) * rateXY;
y1 = rect.Top;
}
if (x1 < rect.Left)
{
if (rateXY != 0) y1 += (rect.Left - x1) / rateXY;
x1 = rect.Left;
}
// check x2,y2
if (y2 < rect.Top)
{
x2 += (rect.Top - y2) * rateXY;
y2 = rect.Top;
}
if (x2 < rect.Left)
{
if (rateXY != 0) y2 += (rect.Left - x2) / rateXY;
x2 = rect.Left;
}
// check x1,y1
if (y1 > rect.Bottom)
{
x1 -= (y1 - rect.Bottom) * rateXY;
y1 = rect.Bottom;
}
if (x1 > rect.Right)
{
if (rateXY != 0) y1 -= (x1 - rect.Right) / rateXY;
x1 = rect.Right;
}
// check x2,y2
if (y2 > rect.Bottom)
{
x2 -= (y2 - rect.Bottom) * rateXY;
y2 = rect.Bottom;
}
if (x2 > rect.Right)
{
if (rateXY != 0) y2 -= (x2 - rect.Right) / rateXY;
x2 = rect.Right;
}
}
if (outFlags == flags1)
{
result.v1 = new Vector2D(x, y);
flags1 = MapSet.GetCSFieldBits(result.v1, rect);
}
else
{
result.v2 = new Vector2D(x, y);
flags2 = MapSet.GetCSFieldBits(result.v2, rect);
}
}
}
if ((IsEqualFloat(x1, x2) && (IsEqualFloat(x1, rect.Left) || IsEqualFloat(x1, rect.Right)) ||
(IsEqualFloat(y1, y2) && (IsEqualFloat(y1, rect.Bottom) || IsEqualFloat(y1, rect.Top)))))
{
intersects = false;
return new Line2D();
}
intersects = true;
return new Line2D(x1, y1, x2, y2);
}
#endregion

View file

@ -26,7 +26,6 @@ using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.VisualModes;
using SlimDX;
#endregion
@ -2462,7 +2461,7 @@ namespace CodeImp.DoomBuilder.Geometry
/// </summary>
public static Vector2D HermiteSpline(Vector2D p1, Vector2D t1, Vector2D p2, Vector2D t2, float u)
{
return D3DDevice.V2D(Vector2.Hermite(D3DDevice.V2(p1), D3DDevice.V2(t1), D3DDevice.V2(p2), D3DDevice.V2(t2), u));
return RenderDevice.V2D(Vector2.Hermite(RenderDevice.V2(p1), RenderDevice.V2(t1), RenderDevice.V2(p2), RenderDevice.V2(t2), u));
}
/// <summary>
@ -2471,7 +2470,7 @@ namespace CodeImp.DoomBuilder.Geometry
/// </summary>
public static Vector3D HermiteSpline(Vector3D p1, Vector3D t1, Vector3D p2, Vector3D t2, float u)
{
return D3DDevice.V3D(Vector3.Hermite(D3DDevice.V3(p1), D3DDevice.V3(t1), D3DDevice.V3(p2), D3DDevice.V3(t2), u));
return RenderDevice.V3D(Vector3.Hermite(RenderDevice.V3(p1), RenderDevice.V3(t1), RenderDevice.V3(p2), RenderDevice.V3(t2), u));
}
//mxd

View file

@ -17,7 +17,7 @@
#region ================== Namespaces
using System;
using SlimDX;
using CodeImp.DoomBuilder.Rendering;
#endregion

View file

@ -844,9 +844,10 @@ namespace CodeImp.DoomBuilder.IO
// Determine the full path of the file to include
string includefile = Path.GetDirectoryName(file) + Path.DirectorySeparatorChar + args[0];
includefile = includefile.Replace('\\', '/');
//mxd. Caching
if(cfgcache.ContainsKey(includefile))
//mxd. Caching
if (cfgcache.ContainsKey(includefile))
{
IDictionary cinc = cfgcache[includefile];

View file

@ -77,7 +77,7 @@ namespace CodeImp.DoomBuilder.IO
internal unsafe class FileImageReader : IImageReader
{
#region ================== APIs
#region ================== APIs
[DllImport("devil.dll")]
private static extern void ilGenImages(int num, IntPtr images);
@ -388,9 +388,9 @@ namespace CodeImp.DoomBuilder.IO
private readonly Playpal guesspalette;
private IImageReader proxyreader;
#endregion
#endregion
#region ================== Constructor / Disposer
#region ================== Constructor / Disposer
// Constructor
public FileImageReader()
@ -421,9 +421,9 @@ namespace CodeImp.DoomBuilder.IO
GC.SuppressFinalize(this);
}
#endregion
#endregion
#region ================== Methods
#region ================== Methods
// This creates a Bitmap from the given data
// Returns null on failure
@ -686,6 +686,6 @@ namespace CodeImp.DoomBuilder.IO
return true;
}
#endregion
#endregion
}
}

View file

@ -76,6 +76,9 @@ namespace CodeImp.DoomBuilder.Map
// Clone
private int serializedindex;
// Rendering
private int lastProcessed;
#endregion
@ -101,7 +104,8 @@ namespace CodeImp.DoomBuilder.Map
public RectangleF Rect { get { return rect; } }
public int[] Args { get { return args; } }
internal int SerializedIndex { get { return serializedindex; } set { serializedindex = value; } }
internal bool FrontInterior { get { return frontinterior; } set { frontinterior = value; } }
internal int LastProcessed { get { return lastProcessed; } set { lastProcessed = value; } }
internal bool FrontInterior { get { return frontinterior; } set { frontinterior = value; } }
internal bool ImpassableFlag { get { return impassableflag; } }
internal int ColorPresetIndex { get { return colorPresetIndex; } } //mxd
internal bool ExtraFloorFlag; //mxd

View file

@ -23,7 +23,6 @@ using CodeImp.DoomBuilder.Geometry;
using System.Drawing;
using CodeImp.DoomBuilder.Rendering;
using System.Collections.ObjectModel;
using SlimDX;
#endregion
@ -88,6 +87,7 @@ namespace CodeImp.DoomBuilder.Map
//mxd. Rendering
private Color4 fogcolor;
private SectorFogMode fogmode;
private int lastProcessed;
//mxd. Slopes
private Vector3D floorslope;
@ -143,6 +143,7 @@ namespace CodeImp.DoomBuilder.Map
public float FloorSlopeOffset { get { return flooroffset; } set { BeforePropsChange(); flooroffset = value; updateneeded = true; } }
public Vector3D CeilSlope { get { return ceilslope; } set { BeforePropsChange(); ceilslope = value; updateneeded = true; } }
public float CeilSlopeOffset { get { return ceiloffset; } set { BeforePropsChange(); ceiloffset = value; updateneeded = true; } }
internal int LastProcessed { get { return lastProcessed; } set { lastProcessed = value; } }
#endregion

View file

@ -57,6 +57,9 @@ namespace CodeImp.DoomBuilder.Map
// Clone
private int serializedindex;
// Rendering
private int lastProcessed;
#endregion
@ -78,6 +81,7 @@ namespace CodeImp.DoomBuilder.Map
public long LongMiddleTexture { get { return longtexnamemid; } }
public long LongLowTexture { get { return longtexnamelow; } }
internal int SerializedIndex { get { return serializedindex; } set { serializedindex = value; } }
internal int LastProcessed { get { return lastProcessed; } set { lastProcessed = value; } }
#endregion

View file

@ -86,11 +86,14 @@ namespace CodeImp.DoomBuilder.Map
private bool fixedsize;
private bool directional; //mxd. If true, we need to render an arrow
#endregion
// Rendering
private int lastProcessed;
#region ================== Properties
#endregion
public MapSet Map { get { return map; } }
#region ================== Properties
public MapSet Map { get { return map; } }
public int Type { get { return type; } set { BeforePropsChange(); type = value; } } //mxd
public GZGeneral.LightData DynamicLightType { get { return dynamiclighttype; } internal set { BeforePropsChange(); dynamiclighttype = value; } }
public Vector3D Position { get { return pos; } }
@ -116,13 +119,14 @@ namespace CodeImp.DoomBuilder.Map
public ThingRenderMode RenderMode { get { return rendermode; } } //mxd
public bool IsDirectional { get { return directional; } } //mxd
public bool Highlighted { get { return highlighted; } set { highlighted = value; } } //mxd
internal int LastProcessed { get { return lastProcessed; } set { lastProcessed = value; } }
#endregion
#endregion
#region ================== Constructor / Disposer
#region ================== Constructor / Disposer
// Constructor
internal Thing(MapSet map, int listindex)
// Constructor
internal Thing(MapSet map, int listindex)
{
// Initialize
this.elementtype = MapElementType.THING; //mxd

151
Source/Core/NoScintilla.cs Normal file
View file

@ -0,0 +1,151 @@
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Data.Scripting;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.Controls.Scripting;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
#if NO_SCINTILLA
namespace CodeImp.DoomBuilder.Controls
{
internal class ScriptEditorPanel : UserControl
{
public ScriptDocumentTab ActiveTab { get { return null; } }
public bool ShowWhitespace { get { return false; } }
public bool WrapLongLines { get { return false; } }
public void Initialize(ScriptEditorForm form) { }
public void ApplySettings() { }
public void SaveSettings() { }
public int FindReplace(FindReplaceOptions options) { return 0; }
public bool FindNext(FindReplaceOptions options) { return false; }
public bool FindNext() { return false; }
public bool FindPrevious(FindReplaceOptions options) { return false; }
public bool FindPrevious() { return false; }
public bool FindNextWrapAround(FindReplaceOptions options) { return false; }
public bool FindPreviousWrapAround(FindReplaceOptions options) { return false; }
public bool Replace(FindReplaceOptions options) { return false; }
public bool FindUsages(FindReplaceOptions options, ScriptType scripttype) { return false; }
public void CloseFindReplace(bool closing) { }
public void OpenFindAndReplace() { }
public void GoToLine() { }
public void RefreshSettings() { }
public void ClearErrors() { }
public void ShowErrors(IEnumerable<CompilerError> errors, bool combine) { }
public void WriteOpenFilesToConfiguration() { }
public bool AskSaveAll() { return true; }
public bool CheckImplicitChanges() { return false; }
public void ForceFocus() { }
public void ImplicitSave() { }
public ScriptFileDocumentTab OpenFile(string filename, ScriptType scripttype) { return null; }
public void ExplicitSaveCurrentTab() { }
public void OpenBrowseScript() { }
public bool LaunchKeywordHelp() { return false; }
public void OnClose() { }
internal ScriptIconsManager Icons { get; private set; }
internal ScriptResourceDocumentTab OpenResource(ScriptResource resource) { return null; }
internal ScriptResourcesControl ScriptResourcesControl { get; private set; }
public void DisplayStatus(ScriptStatusType type, string message) { }
public void ShowError(TextResourceErrorItem error) { }
public void OnReloadResources() { }
}
internal class ScriptEditorControl : UserControl
{
private static Encoding encoding = Encoding.GetEncoding(1251); //mxd. ASCII with cyrillic support...
internal static Encoding Encoding { get { return encoding; } }
public delegate void ExplicitSaveTabDelegate();
public delegate void OpenScriptBrowserDelegate();
public delegate void OpenFindReplaceDelegate();
public delegate bool FindNextDelegate();
public delegate bool FindPreviousDelegate();
public delegate bool FindNextWrapAroundDelegate(FindReplaceOptions options);
public delegate bool FindPreviousWrapAroundDelegate(FindReplaceOptions options);
public delegate void GoToLineDelegate();
public delegate void CompileScriptDelegate();
public event ExplicitSaveTabDelegate OnExplicitSaveTab;
public event OpenScriptBrowserDelegate OnOpenScriptBrowser;
public event OpenFindReplaceDelegate OnOpenFindAndReplace;
public event FindNextDelegate OnFindNext;
public event FindPreviousDelegate OnFindPrevious;
public event FindNextWrapAroundDelegate OnFindNextWrapAround;
public event FindPreviousWrapAroundDelegate OnFindPreviousWrapAround;
public new event EventHandler OnTextChanged;
public event EventHandler OnFunctionBarDropDown;
public event GoToLineDelegate OnGoToLine;
public event CompileScriptDelegate OnCompileScript;
public bool IsChanged { get { return false; } }
public int SelectionStart { get; set; }
public int SelectionEnd { get; set; }
public new string Text { get; set; }
public string SelectedText { get; set; }
public bool ShowWhitespace { get; set; }
public bool WrapLongLines { get; set; }
public bool LaunchKeywordHelp() { return false; }
public void ReplaceSelection(string replacement) { }
public void MoveToLine(int linenumber) { }
public void EnsureLineVisible(int linenumber) { }
public int LineFromPosition(int position) { return 0; }
public void ClearMarks() { }
public void AddMark(int linenumber) { }
public void RefreshStyle() { }
public void SetupStyles(ScriptConfiguration config) { }
public string GetCurrentWord() { return ""; }
public string GetWordAt(int position) { return ""; }
public void Undo() { }
public void Redo() { }
public void ClearUndoRedo() { }
public void SetSavePoint() { }
public void Cut() { }
public void Copy() { }
public void Paste() { }
public void GrabFocus() { }
public byte[] GetText() { return null; }
public void SetText(byte[] text) { }
public void InsertSnippet(string[] lines) { }
public bool FindNext(FindReplaceOptions options, bool useselectionstart) { return false; }
public bool FindPrevious(FindReplaceOptions options) { return false; }
public void IndentSelection(bool indent) { }
public void DuplicateLine() { }
}
internal class ScriptEditorPreviewControl : UserControl
{
public string FontName { set; private get; }
public int FontSize { set; private get; }
public bool FontBold { set; private get; }
public int TabWidth { set; private get; }
public bool ShowLineNumbers { set; private get; }
public bool ShowFolding { set; private get; }
public Color ScriptBackground { set; private get; }
public Color FoldForeColor { set; private get; }
public Color FoldBackColor { set; private get; }
public Color LineNumbers { set; private get; }
public Color PlainText { set; private get; }
public Color Comments { set; private get; }
public Color Keywords { set; private get; }
public Color Properties { set; private get; }
public Color Literals { set; private get; }
public Color Constants { set; private get; }
public Color Strings { set; private get; }
public Color Includes { set; private get; }
public Color SelectionForeColor { set; private get; }
public Color SelectionBackColor { set; private get; }
public Color WhitespaceColor { set; private get; }
public Color BraceHighlight { set; private get; }
public Color BadBraceHighlight { set; private get; }
public Color ScriptIndicator { set; private get; }
}
}
#endif

View file

@ -52,7 +52,7 @@ namespace CodeImp.DoomBuilder.Plugins
public virtual string Name { get { return plugin.Name; } }
/// <summary>
/// Override this to return the minimum revision of the GZDoom Builder core that is
/// Override this to return the minimum revision of the Doom Builder core that is
/// required to use this plugin. You can find the revision number in the About dialog,
/// it is the right most part of the version number.
/// </summary>

View file

@ -121,7 +121,7 @@ namespace CodeImp.DoomBuilder.Plugins
if((thisrevision != 0) && (plug.MinimumRevision > thisrevision))
{
// Can't load this plugin because it is meant for a newer version
General.ErrorLogger.Add(ErrorType.Error, "Could not load plugin \"" + shortfilename + "\", the Plugin is made for GZDoom Builder R" + plug.MinimumRevision + " or newer and you are running R" + thisrevision + ".");
General.ErrorLogger.Add(ErrorType.Error, "Could not load plugin \"" + shortfilename + "\", the Plugin is made for Ultimate Doom Builder R" + plug.MinimumRevision + " or newer and you are running R" + thisrevision + ".");
throw new InvalidProgramException();
}
}

View file

@ -6,12 +6,12 @@ using CodeImp.DoomBuilder;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GZDoom Builder (Bugfix)")]
[assembly: AssemblyTitle("Ultimate Doom Builder")]
[assembly: AssemblyDescription("ZDoom, GZDoom and Zandronum map editor (can be used for Vanilla/Boom mapping too!)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeImp, MaxED")]
[assembly: AssemblyProduct("GZDoom Builder (Bugfix)")]
[assembly: AssemblyCopyright("Copyright © 2007, 2016")]
[assembly: AssemblyCompany("CodeImp, MaxED, ZZYZX, boris, dpJudas and others")]
[assembly: AssemblyProduct("Ultimate Doom Builder")]
[assembly: AssemblyCopyright("Copyright © 2007, 2016, 2017-2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.3050")]
[assembly: AssemblyVersion("3.0.0.3111")]
[assembly: NeutralResourcesLanguageAttribute("en")]
[assembly: AssemblyHash("3d156a3")]
[assembly: AssemblyHash("e187872")]

View file

@ -19,7 +19,7 @@ namespace CodeImp.DoomBuilder.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -70,6 +70,16 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap AboutBack {
get {
object obj = ResourceManager.GetObject("AboutBack", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -360,6 +370,46 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] display2d_fsaa {
get {
object obj = ResourceManager.GetObject("display2d_fsaa", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] display2d_fullbright {
get {
object obj = ResourceManager.GetObject("display2d_fullbright", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] display2d_normal {
get {
object obj = ResourceManager.GetObject("display2d_normal", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] display2d_vp {
get {
object obj = ResourceManager.GetObject("display2d_vp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -1020,6 +1070,26 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] plotter {
get {
object obj = ResourceManager.GetObject("plotter", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] plotter_vp {
get {
object obj = ResourceManager.GetObject("plotter_vp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -1510,6 +1580,46 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] things2d_fill {
get {
object obj = ResourceManager.GetObject("things2d_fill", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] things2d_sprite {
get {
object obj = ResourceManager.GetObject("things2d_sprite", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] things2d_thing {
get {
object obj = ResourceManager.GetObject("things2d_thing", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] things2d_vp {
get {
object obj = ResourceManager.GetObject("things2d_vp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -1530,6 +1640,16 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon UDB2 {
get {
object obj = ResourceManager.GetObject("UDB2", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -1690,6 +1810,156 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_constant_color {
get {
object obj = ResourceManager.GetObject("world3d_constant_color", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_customvertexcolor_fog_vp {
get {
object obj = ResourceManager.GetObject("world3d_customvertexcolor_fog_vp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_customvertexcolor_vp {
get {
object obj = ResourceManager.GetObject("world3d_customvertexcolor_vp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_fullbright {
get {
object obj = ResourceManager.GetObject("world3d_fullbright", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_fullbright_highlight {
get {
object obj = ResourceManager.GetObject("world3d_fullbright_highlight", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_lightpass {
get {
object obj = ResourceManager.GetObject("world3d_lightpass", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_lightpass_vp {
get {
object obj = ResourceManager.GetObject("world3d_lightpass_vp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_main {
get {
object obj = ResourceManager.GetObject("world3d_main", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_main_fog {
get {
object obj = ResourceManager.GetObject("world3d_main_fog", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_main_highlight {
get {
object obj = ResourceManager.GetObject("world3d_main_highlight", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_main_highlight_fog {
get {
object obj = ResourceManager.GetObject("world3d_main_highlight_fog", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_main_vp {
get {
object obj = ResourceManager.GetObject("world3d_main_vp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_skybox {
get {
object obj = ResourceManager.GetObject("world3d_skybox", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_skybox_vp {
get {
object obj = ResourceManager.GetObject("world3d_skybox_vp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] world3d_vertex_color {
get {
object obj = ResourceManager.GetObject("world3d_vertex_color", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -112,12 +112,12 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Clear.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -613,4 +613,85 @@
<data name="Github" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Github.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="display2d_vp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\display2d.vp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="display2d_fsaa" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\display2d_fsaa.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="display2d_fullbright" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\display2d_fullbright.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="display2d_normal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\display2d_normal.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="plotter_vp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\plotter.vp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="plotter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\plotter.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="things2d_vp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\things2d.vp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="things2d_fill" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\things2d_fill.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="things2d_sprite" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\things2d_sprite.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="things2d_thing" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\things2d_thing.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_constant_color" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_constant_color.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_customvertexcolor_vp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_customvertexcolor.vp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_customvertexcolor_fog_vp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_customvertexcolor_fog.vp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_fullbright" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_fullbright.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_fullbright_highlight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_fullbright_highlight.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_lightpass_vp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_lightpass.vp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_lightpass" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_lightpass.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_main_vp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_main.vp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_main" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_main.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_main_fog" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_main_fog.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_main_highlight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_main_highlight.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_main_highlight_fog" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_main_highlight_fog.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_skybox_vp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_skybox.vp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_skybox" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_skybox.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="world3d_vertex_color" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\world3d_vertex_color.fp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AboutBack" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AboutBack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="UDB2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\UDB2.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -12,7 +12,7 @@ namespace CodeImp.DoomBuilder.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.2.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View file

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeImp.DoomBuilder.Rendering
{
public struct Color3
{
public Color3(float r, float g, float b)
{
Red = r;
Green = g;
Blue = b;
}
public Color3(Vector3 c)
{
Red = c.X;
Green = c.Y;
Blue = c.Z;
}
public Color3(System.Drawing.Color c)
{
Red = c.R / 255.0f;
Green = c.G / 255.0f;
Blue = c.B / 255.0f;
}
public float Red;
public float Green;
public float Blue;
public override bool Equals(object o)
{
if (o is Color3)
{
Color3 v = (Color3)o;
return this == v;
}
else
{
return false;
}
}
public override int GetHashCode()
{
return Red.GetHashCode() + Green.GetHashCode() + Blue.GetHashCode();
}
public static bool operator ==(Color3 left, Color3 right)
{
return left.Red == right.Red && left.Green == right.Green && left.Blue == right.Blue;
}
public static bool operator !=(Color3 left, Color3 right)
{
return left.Red != right.Red || left.Green != right.Green || left.Blue != right.Blue;
}
}
}

View file

@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeImp.DoomBuilder.Rendering
{
public struct Color4
{
public Color4(int argb)
{
uint v = (uint)argb;
Alpha = ((v >> 24) & 0xff) / 255.0f;
Red = ((v >> 16) & 0xff) / 255.0f;
Green = ((v >> 8) & 0xff) / 255.0f;
Blue = (v & 0xff) / 255.0f;
}
public Color4(float r, float g, float b, float a)
{
Red = r;
Green = g;
Blue = b;
Alpha = a;
}
public Color4(Vector4 c)
{
Red = c.X;
Green = c.Y;
Blue = c.Z;
Alpha = c.W;
}
public Color4(System.Drawing.Color c)
{
Red = c.R / 255.0f;
Green = c.G / 255.0f;
Blue = c.B / 255.0f;
Alpha = c.A / 255.0f;
}
public float Red;
public float Green;
public float Blue;
public float Alpha;
public int ToArgb()
{
uint r = (uint)Math.Max(Math.Min(Red * 255.0f, 255.0f), 0.0f);
uint g = (uint)Math.Max(Math.Min(Green * 255.0f, 255.0f), 0.0f);
uint b = (uint)Math.Max(Math.Min(Blue * 255.0f, 255.0f), 0.0f);
uint a = (uint)Math.Max(Math.Min(Alpha * 255.0f, 255.0f), 0.0f);
return (int)((a << 24) | (r << 16) | (g << 8) | b);
}
public System.Drawing.Color ToColor()
{
return System.Drawing.Color.FromArgb(ToArgb());
}
public override bool Equals(object o)
{
if (o is Color4)
{
Color4 v = (Color4)o;
return this == v;
}
else
{
return false;
}
}
public static Color4 operator +(Color4 left, Color4 right)
{
return new Color4(left.Red + right.Red, left.Green + right.Green, left.Blue + right.Blue, left.Alpha + right.Alpha);
}
public static Color4 operator -(Color4 left, Color4 right)
{
return new Color4(left.Red - right.Red, left.Green - right.Green, left.Blue - right.Blue, left.Alpha - right.Alpha);
}
public static Color4 operator -(Color4 v)
{
return new Color4(-v.Red, -v.Green, -v.Blue, -v.Alpha);
}
public override int GetHashCode()
{
return Red.GetHashCode() + Green.GetHashCode() + Blue.GetHashCode() + Alpha.GetHashCode();
}
public static bool operator ==(Color4 left, Color4 right)
{
return left.Red == right.Red && left.Green == right.Green && left.Blue == right.Blue && left.Alpha == right.Alpha;
}
public static bool operator !=(Color4 left, Color4 right)
{
return left.Red != right.Red || left.Green != right.Green || left.Blue != right.Blue || left.Alpha != right.Alpha;
}
}
}

View file

@ -19,7 +19,6 @@
using System;
using System.Globalization;
using System.Drawing;
using SlimDX;
using Configuration = CodeImp.DoomBuilder.IO.Configuration;
#endregion
@ -299,7 +298,7 @@ namespace CodeImp.DoomBuilder.Rendering
public PixelColor CreateBrightVariant(PixelColor pc)
{
Color4 o = pc.ToColorValue();
Color4 c = new Color4(1f, 0f, 0f, 0f);
Color4 c = new Color4(0f, 0f, 0f, 1f);
// Create brighter color
c.Red = Saturate(o.Red * BRIGHT_MULTIPLIER + BRIGHT_ADDITION);
@ -312,7 +311,7 @@ namespace CodeImp.DoomBuilder.Rendering
public PixelColor CreateDarkVariant(PixelColor pc)
{
Color4 o = pc.ToColorValue();
Color4 c = new Color4(1f, 0f, 0f, 0f);
Color4 c = new Color4(0f, 0f, 0f, 1f);
// Create darker color
c.Red = Saturate(o.Red * DARK_MULTIPLIER + DARK_ADDITION);

View file

@ -1,5 +1,4 @@
using System.Drawing;
using SlimDX.Direct3D9;
using Font = System.Drawing.Font;
namespace CodeImp.DoomBuilder.Rendering
@ -22,9 +21,9 @@ namespace CodeImp.DoomBuilder.Rendering
public PixelColor BackColor { get { return label.BackColor; } set { label.BackColor = value; } }
public SizeF TextSize { get { return label.TextSize; } }
public void Update(float translatex, float translatey, float scalex, float scaley)
public void Update(RenderDevice graphics, float translatex, float translatey, float scalex, float scaley)
{
label.Update(translatex, translatey, scalex, scaley);
label.Update(graphics, translatex, translatey, scalex, scaley);
}
}
}

View file

@ -1,593 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Geometry;
using SlimDX;
using SlimDX.Direct3D9;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal class D3DDevice : IDisposable
{
#region ================== Constants
// NVPerfHUD device name
private const string NVPERFHUD_ADAPTER = "NVPerfHUD";
//mxd. Anisotropic filtering steps
public static readonly List<float> AF_STEPS = new List<float> { 1.0f, 2.0f, 4.0f, 8.0f, 16.0f };
//mxd. Antialiasing steps
public static readonly List<int> AA_STEPS = new List<int> { 0, 2, 4, 8 };
#endregion
#region ================== Variables
// Settings
private int adapter;
private Filter postfilter;
private Filter mipgeneratefilter;
private static bool isrendering; //mxd
// Main objects
private static Direct3D d3d;
private RenderTargetControl rendertarget;
private Capabilities devicecaps;
private Device device;
private Viewport viewport;
private readonly HashSet<ID3DResource> resources;
private ShaderManager shaders;
private Surface backbuffer;
private Surface depthbuffer;
// Disposing
private bool isdisposed;
#endregion
#region ================== Properties
internal Device Device { get { return device; } }
public bool IsDisposed { get { return isdisposed; } }
public static bool IsRendering { get { return isrendering; } } //mxd
internal RenderTargetControl RenderTarget { get { return rendertarget; } }
internal Viewport Viewport { get { return viewport; } }
internal ShaderManager Shaders { get { return shaders; } }
internal Surface BackBuffer { get { return backbuffer; } }
internal Surface DepthBuffer { get { return depthbuffer; } }
internal Filter PostFilter { get { return postfilter; } }
internal Filter MipGenerateFilter { get { return mipgeneratefilter; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
internal D3DDevice(RenderTargetControl rendertarget)
{
// Set render target
this.rendertarget = rendertarget;
// Create resources list
resources = new HashSet<ID3DResource>();
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
foreach(ID3DResource res in resources) res.UnloadResource();
if(shaders != null) shaders.Dispose();
rendertarget = null;
if(backbuffer != null) backbuffer.Dispose();
if(depthbuffer != null) depthbuffer.Dispose();
if(device != null) device.Dispose();
if(ObjectTable.Objects.Count > 1) //mxd. Direct3D itself is not disposed while the editor is running
{
//mxd. Get rid of any remaining D3D objects...
foreach(ComObject o in ObjectTable.Objects)
{
if(o is Direct3D) continue; // Don't dispose the device itself...
General.WriteLogLine("WARNING: D3D resource " + o
+ (o.Tag != null ? " (" + o.Tag + ")" : string.Empty) + " was not disposed properly!"
+ (o.CreationSource != null ? " Stack trace: " + o.CreationSource : string.Empty));
o.Dispose();
}
#if DEBUG
General.ShowWarningMessage("Some D3D resources were not disposed properly! See the event log for more details.",
MessageBoxButtons.OK);
#endif
}
// Done
isrendering = false; //mxd
isdisposed = true;
}
}
#endregion
#region ================== Renderstates
// This completes initialization after the device has started or has been reset
public void SetupSettings()
{
// Setup renderstates
device.SetRenderState(RenderState.AlphaBlendEnable, false);
device.SetRenderState(RenderState.AlphaBlendEnable, false);
device.SetRenderState(RenderState.AlphaFunc, Compare.GreaterEqual);
device.SetRenderState(RenderState.AlphaRef, 0x0000007E);
device.SetRenderState(RenderState.AlphaTestEnable, false);
device.SetRenderState(RenderState.Ambient, Color.White.ToArgb());
device.SetRenderState(RenderState.AmbientMaterialSource, ColorSource.Material);
device.SetRenderState(RenderState.AntialiasedLineEnable, false);
device.SetRenderState(RenderState.Clipping, true);
device.SetRenderState(RenderState.ColorVertex, false);
device.SetRenderState(RenderState.ColorWriteEnable, ColorWriteEnable.Red | ColorWriteEnable.Green | ColorWriteEnable.Blue | ColorWriteEnable.Alpha);
device.SetRenderState(RenderState.CullMode, Cull.None);
device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
device.SetRenderState(RenderState.DiffuseMaterialSource, ColorSource.Color1);
//device.SetRenderState(RenderState.DitherEnable, true);
device.SetRenderState(RenderState.FillMode, FillMode.Solid);
device.SetRenderState(RenderState.FogEnable, false);
device.SetRenderState(RenderState.FogTableMode, FogMode.Linear);
device.SetRenderState(RenderState.Lighting, false);
device.SetRenderState(RenderState.LocalViewer, false);
device.SetRenderState(RenderState.MultisampleAntialias, (General.Settings.AntiAliasingSamples > 0)); //mxd
device.SetRenderState(RenderState.NormalizeNormals, false);
device.SetRenderState(RenderState.PointSpriteEnable, false);
device.SetRenderState(RenderState.RangeFogEnable, false);
device.SetRenderState(RenderState.ShadeMode, ShadeMode.Gouraud);
device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
device.SetRenderState(RenderState.SpecularEnable, false);
device.SetRenderState(RenderState.StencilEnable, false);
device.SetRenderState(RenderState.TextureFactor, -1);
device.SetRenderState(RenderState.ZEnable, false);
device.SetRenderState(RenderState.ZWriteEnable, false);
device.PixelShader = null;
device.VertexShader = null;
// Matrices
device.SetTransform(TransformState.World, Matrix.Identity);
device.SetTransform(TransformState.View, Matrix.Identity);
device.SetTransform(TransformState.Projection, Matrix.Identity);
// Texture addressing
device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Wrap);
device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Wrap);
device.SetSamplerState(0, SamplerState.AddressW, TextureAddress.Wrap);
// Setup material
device.Material = new Material {
Ambient = new Color4(Color.White),
Diffuse = new Color4(Color.White),
Specular = new Color4(Color.White)
};
// Shader settings
shaders.World3D.SetConstants(General.Settings.VisualBilinear, Math.Min(devicecaps.MaxAnisotropy, General.Settings.FilterAnisotropy));
// Texture filters
postfilter = Filter.Point;
mipgeneratefilter = Filter.Box;
// Initialize presentations
Presentation.Initialize();
}
#endregion
#region ================== Initialization
// This starts up Direct3D
public static void Startup()
{
d3d = new Direct3D();
}
// This terminates Direct3D
public static void Terminate()
{
if(d3d != null)
{
d3d.Dispose();
d3d = null;
}
}
// This initializes the graphics
public bool Initialize()
{
// Use default adapter
this.adapter = 0; // Manager.Adapters.Default.Adapter;
try
{
// Make present parameters
PresentParameters displaypp = CreatePresentParameters(adapter);
// Determine device type for compatability with NVPerfHUD
DeviceType devtype;
if(d3d.Adapters[adapter].Details.Description.EndsWith(NVPERFHUD_ADAPTER))
devtype = DeviceType.Reference;
else
devtype = DeviceType.Hardware;
//mxd. Check maximum supported AA level...
for(int i = AA_STEPS.Count - 1; i > 0; i--)
{
if(General.Settings.AntiAliasingSamples < AA_STEPS[i]) continue;
if(d3d.CheckDeviceMultisampleType(this.adapter, devtype, d3d.Adapters[adapter].CurrentDisplayMode.Format, displaypp.Windowed, (MultisampleType)AA_STEPS[i]))
break;
if(General.Settings.AntiAliasingSamples > AA_STEPS[i - 1])
{
General.Settings.AntiAliasingSamples = AA_STEPS[i - 1];
// TODO: looks like setting Multisample here just resets it to MultisampleType.None,
// regardless of value in displaypp.Multisample. Why?..
displaypp.Multisample = (MultisampleType)General.Settings.AntiAliasingSamples;
}
}
// Get the device capabilities
devicecaps = d3d.GetDeviceCaps(adapter, devtype);
// Check if this adapter supports TnL
if((devicecaps.DeviceCaps & DeviceCaps.HWTransformAndLight) != 0)
{
// Initialize with hardware TnL
device = new Device(d3d, adapter, devtype, rendertarget.Handle,
CreateFlags.HardwareVertexProcessing, displaypp);
}
else
{
// Initialize with software TnL
device = new Device(d3d, adapter, devtype, rendertarget.Handle,
CreateFlags.SoftwareVertexProcessing, displaypp);
}
}
catch(Exception)
{
// Failed
MessageBox.Show(General.MainWindow, "Unable to initialize the Direct3D video device. Another application may have taken exclusive mode on this video device or the device does not support Direct3D at all.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
//mxd. Check if we can use shaders
if(device.Capabilities.PixelShaderVersion.Major < 2)
{
// Failed
MessageBox.Show(General.MainWindow, "Unable to initialize the Direct3D video device. Video device with Shader Model 2.0 support is required.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
// Add event to cancel resize event
//device.DeviceResizing += new CancelEventHandler(CancelResize);
// Keep a reference to the original buffers
backbuffer = device.GetBackBuffer(0, 0);
depthbuffer = device.DepthStencilSurface;
// Get the viewport
viewport = device.Viewport;
// Create shader manager
shaders = new ShaderManager(this);
// Initialize settings
SetupSettings();
// Done
return true;
}
// This is to disable the automatic resize reset
/*private static void CancelResize(object sender, CancelEventArgs e)
{
// Cancel resize event
e.Cancel = true;
}*/
// This creates present parameters
private PresentParameters CreatePresentParameters(int adapter)
{
PresentParameters displaypp = new PresentParameters();
// Get current display mode
DisplayMode currentmode = d3d.Adapters[adapter].CurrentDisplayMode;
// Make present parameters
displaypp.Windowed = true;
displaypp.SwapEffect = SwapEffect.Discard;
displaypp.BackBufferCount = 1;
displaypp.BackBufferFormat = currentmode.Format;
displaypp.BackBufferWidth = rendertarget.ClientSize.Width;
displaypp.BackBufferHeight = rendertarget.ClientSize.Height;
displaypp.EnableAutoDepthStencil = true;
displaypp.AutoDepthStencilFormat = Format.D24X8; //Format.D16;
displaypp.Multisample = (MultisampleType)General.Settings.AntiAliasingSamples;
displaypp.PresentationInterval = PresentInterval.Immediate;
// Return result
return displaypp;
}
#endregion
#region ================== Resetting
// This registers a resource
internal void RegisterResource(ID3DResource res)
{
// Add resource
resources.Add(res);
}
// This unregisters a resource
internal void UnregisterResource(ID3DResource res)
{
// Remove resource
resources.Remove(res);
}
// This resets the device and returns true on success
internal bool Reset()
{
// Unload all Direct3D resources
foreach(ID3DResource res in resources) res.UnloadResource();
// Lose backbuffers
if(backbuffer != null) backbuffer.Dispose();
if(depthbuffer != null) depthbuffer.Dispose();
backbuffer = null;
depthbuffer = null;
try
{
// Make present parameters
PresentParameters displaypp = CreatePresentParameters(adapter);
// Reset the device
device.Reset(displaypp);
}
#if DEBUG
catch(Exception e)
{
// Failed to re-initialize
Console.WriteLine("Device reset failed: " + e.Message);
return false;
}
#else
catch(Exception)
{
// Failed to re-initialize
return false;
}
#endif
// Keep a reference to the original buffers
backbuffer = device.GetBackBuffer(0, 0);
depthbuffer = device.DepthStencilSurface;
// Get the viewport
viewport = device.Viewport;
// Reload all Direct3D resources
foreach(ID3DResource res in resources) res.ReloadResource();
// Re-apply settings
SetupSettings();
// Success
return true;
}
#endregion
#region ================== Rendering
// This begins a drawing session
public bool StartRendering(bool clear, Color4 backcolor, Surface target, Surface depthbuffer)
{
// Check if we can render
if(CheckAvailability() && !isrendering) //mxd. Added isrendering check
{
// Set rendertarget
device.DepthStencilSurface = depthbuffer;
device.SetRenderTarget(0, target);
// Clear the screen
if(clear)
{
if(depthbuffer != null)
device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, backcolor, 1f, 0);
else
device.Clear(ClearFlags.Target, backcolor, 1f, 0);
}
// Ready to render
// [ZZ] Sometimes (apparently during massive lag) this may cause invalid call exception.
// Let's put this code here until proper fix is available.
// For now, eat the initial exception and try to recover.
for (int i = 0; i < 2; i++)
{
try
{
device.BeginScene();
break;
}
catch (SlimDXException e)
{
if (i != 0) throw e;
else
{
if (!CheckAvailability())
{
isrendering = false;
return false;
}
Reset();
}
}
}
isrendering = true; //mxd
return true;
}
else
{
// Minimized, you cannot see anything
isrendering = false; //mxd
return false;
}
}
// This clears a target
public void ClearRendertarget(Color4 backcolor, Surface target, Surface depthbuffer)
{
// Set rendertarget
device.DepthStencilSurface = depthbuffer;
device.SetRenderTarget(0, target);
if(depthbuffer != null)
device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, backcolor, 1f, 0);
else
device.Clear(ClearFlags.Target, backcolor, 1f, 0);
}
// This ends a drawing session
public void FinishRendering()
{
try
{
// Done
device.EndScene();
isrendering = false; //mxd
}
// Errors are not a problem here
catch(Exception) { }
}
// This presents what has been drawn
public void Present()
{
try
{
device.Present();
isrendering = false; //mxd
}
// Errors are not a problem here
catch(Exception) { }
}
// This checks if we can use the hardware at this moment
public bool CheckAvailability()
{
// When minimized, the hardware is not available
if(General.MainWindow.WindowState != FormWindowState.Minimized)
{
// Test the cooperative level
Result coopresult = device.TestCooperativeLevel();
// Check if device must be reset
if(!coopresult.IsSuccess)
{
// Should we reset?
if(coopresult.Name == "D3DERR_DEVICENOTRESET")
{
// Device is lost and must be reset now
Reset();
}
// Impossible to render at this point
return false;
}
else
{
// Ready to go!
return true;
}
}
else
{
// Minimized
return false;
}
}
#endregion
#region ================== Tools
// Make a color from ARGB
public static int ARGB(float a, float r, float g, float b)
{
return Color.FromArgb((int)(a * 255f), (int)(r * 255f), (int)(g * 255f), (int)(b * 255f)).ToArgb();
}
// Make a color from RGB
public static int RGB(int r, int g, int b)
{
return Color.FromArgb(255, r, g, b).ToArgb();
}
// This makes a Vector3 from Vector3D
public static Vector3 V3(Vector3D v3d)
{
return new Vector3(v3d.x, v3d.y, v3d.z);
}
// This makes a Vector3D from Vector3
public static Vector3D V3D(Vector3 v3)
{
return new Vector3D(v3.X, v3.Y, v3.Z);
}
// This makes a Vector2 from Vector2D
public static Vector2 V2(Vector2D v2d)
{
return new Vector2(v2d.x, v2d.y);
}
// This makes a Vector2D from Vector2
public static Vector2D V2D(Vector2 v2)
{
return new Vector2D(v2.X, v2.Y);
}
#endregion
}
}

View file

@ -1,194 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.IO;
using SlimDX.Direct3D9;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal abstract class D3DShader : IDisposable
{
#region ================== Constants
#endregion
#region ================== Variables
// The manager
protected ShaderManager manager;
// The effect
protected Effect effect;
// The vertex declaration
protected VertexDeclaration vertexdecl;
// Disposing
protected bool isdisposed;
//mxd. Settings changes
protected bool settingschanged;
#endregion
#region ================== Properties
// Disposing
public bool IsDisposed { get { return isdisposed; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
protected D3DShader(ShaderManager manager)
{
// Initialize
this.manager = manager;
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public virtual void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
manager = null;
if(effect != null) effect.Dispose();
vertexdecl.Dispose();
// Done
isdisposed = true;
}
}
#endregion
#region ================== Methods
// This loads an effect
protected Effect LoadEffect(string fxfile)
{
Effect fx;
string errors = string.Empty;
// Load the resource
Stream fxdata = General.ThisAssembly.GetManifestResourceStream("CodeImp.DoomBuilder.Resources." + fxfile);
fxdata.Seek(0, SeekOrigin.Begin);
try
{
// Compile effect
fx = Effect.FromStream(General.Map.Graphics.Device, fxdata, null, null, null, ShaderFlags.None, null, out errors);
if(!string.IsNullOrEmpty(errors))
{
throw new Exception("Errors in effect file " + fxfile + ": " + errors);
}
}
catch(Exception)
{
string debugerrors = string.Empty; //mxd
// Compiling failed, try with debug information
try
{
//mxd. Rewind before use!
fxdata.Seek(0, SeekOrigin.Begin);
// Compile effect
fx = Effect.FromStream(General.Map.Graphics.Device, fxdata, null, null, null, ShaderFlags.Debug, null, out debugerrors);
if(!string.IsNullOrEmpty(debugerrors))
{
throw new Exception("Errors in effect file " + fxfile + ": " + debugerrors);
}
}
catch(Exception e)
{
//mxd. Try to get something. Anything!
string message;
if(!string.IsNullOrEmpty(debugerrors))
message = e.Message + "\nInitial message (debug mode): \"" + debugerrors + "\"";
else if(!string.IsNullOrEmpty(errors))
message = e.Message + "\nInitial message: \"" + errors + "\"";
else
message = e.ToString();
if(string.IsNullOrEmpty(message)) message = "No initial message...";
// No debug information, just crash
throw new Exception(e.GetType().Name + " while loading effect " + fxfile + ": " + message);
}
}
fxdata.Dispose();
// Set the technique to use
fx.Technique = manager.ShaderTechnique;
// Return result
return fx;
}
// This applies the shader
public void Begin()
{
// Set vertex declaration
General.Map.Graphics.Device.VertexDeclaration = vertexdecl;
// Set effect
effect.Begin(FX.DoNotSaveState);
}
// This begins a pass
public virtual void BeginPass(int index)
{
effect.BeginPass(index);
}
// This ends a pass
public void EndPass()
{
effect.EndPass();
}
// This ends te shader
public void End()
{
effect.End();
}
// This applies properties during a pass
public void ApplySettings()
{
if(settingschanged)
{
effect.CommitChanges();
settingschanged = false; //mxd
}
}
#endregion
}
}

View file

@ -1,130 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using SlimDX.Direct3D9;
using SlimDX;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal sealed class Display2DShader : D3DShader
{
#region ================== Variables
// Property handlers
private readonly EffectHandle texture1;
private readonly EffectHandle rendersettings;
private readonly EffectHandle transformsettings;
private readonly EffectHandle filtersettings;
private readonly EffectHandle desaturationHandle;
#endregion
#region ================== Properties
public Texture Texture1 { set { effect.SetTexture(texture1, value); settingschanged = true; } }
// [ZZ]
private float desaturation;
public float Desaturation
{
set
{
if (desaturation != value)
{
effect.SetValue(desaturationHandle, value);
desaturation = value;
settingschanged = true;
}
}
}
#endregion
#region ================== Constructor / Disposer
// Constructor
public Display2DShader(ShaderManager manager) : base(manager)
{
// Load effect from file
effect = LoadEffect("display2d.fx");
// Get the property handlers from effect
if(effect != null)
{
texture1 = effect.GetParameter(null, "texture1");
rendersettings = effect.GetParameter(null, "rendersettings");
transformsettings = effect.GetParameter(null, "transformsettings");
filtersettings = effect.GetParameter(null, "filtersettings");
desaturationHandle = effect.GetParameter(null, "desaturation"); // [ZZ]
}
// Initialize world vertex declaration
VertexElement[] elements = new[]
{
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd
};
vertexdecl = new VertexDeclaration(General.Map.Graphics.Device, elements);
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public override void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
if(texture1 != null) texture1.Dispose();
if(rendersettings != null) rendersettings.Dispose();
if(transformsettings != null) transformsettings.Dispose();
if(filtersettings != null) filtersettings.Dispose();
if(desaturationHandle != null) desaturationHandle.Dispose();
// Done
base.Dispose();
}
}
#endregion
#region ================== Methods
// This sets the settings
public void SetSettings(float texelx, float texely, float fsaafactor, float alpha, bool bilinear)
{
Vector4 values = new Vector4(texelx, texely, fsaafactor, alpha);
effect.SetValue(rendersettings, values);
Matrix world = manager.D3DDevice.Device.GetTransform(TransformState.World);
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
effect.SetValue(transformsettings, world * view);
TextureFilter filter = (bilinear ? TextureFilter.Linear : TextureFilter.Point);
effect.SetValue(filtersettings, (int)filter);
settingschanged = true; //mxd
}
#endregion
}
}

View file

@ -18,7 +18,6 @@
using System;
using System.Drawing;
using SlimDX.Direct3D9;
#endregion
@ -256,10 +255,10 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Rendering
// This renders the quad
public void Render(D3DDevice device)
public void Render(RenderDevice device)
{
// Render the quad
device.Device.DrawUserPrimitives(type, 0, 2, vertices);
device.Draw(type, 0, 2, vertices);
}
#endregion

View file

@ -15,13 +15,14 @@
#endregion
#region ================== Namespaces
using System.Runtime.InteropServices;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
// FlatVertex
public struct FlatVertex
// FlatVertex
[StructLayout(LayoutKind.Sequential)]
public struct FlatVertex
{
// Vertex format
public const int Stride = 24; //6 * 4

View file

@ -20,7 +20,7 @@
namespace CodeImp.DoomBuilder.Rendering
{
internal interface ID3DResource
internal interface IRenderResource
{
// This is used to unload the resouce
void UnloadResource();

View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace CodeImp.DoomBuilder.Rendering
{
public class IndexBuffer : IDisposable
{
public IndexBuffer()
{
Handle = IndexBuffer_New();
if (Handle == IntPtr.Zero)
throw new Exception("IndexBuffer_New failed");
}
~IndexBuffer()
{
Dispose();
}
public bool Disposed { get { return Handle == IntPtr.Zero; } }
public void Dispose()
{
if (!Disposed)
{
IndexBuffer_Delete(Handle);
Handle = IntPtr.Zero;
}
}
internal IntPtr Handle;
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr IndexBuffer_New();
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void IndexBuffer_Delete(IntPtr handle);
}
}

View file

@ -0,0 +1,352 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace CodeImp.DoomBuilder.Rendering
{
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 4)]
public struct Matrix
{
public float M11, M12, M13, M14;
public float M21, M22, M23, M24;
public float M31, M32, M33, M34;
public float M41, M42, M43, M44;
#if USE_CSHARP_MATH
public static Matrix Null
{
get
{
Matrix m = new Matrix();
m.M11 = 0.0f;
m.M12 = 0.0f;
m.M13 = 0.0f;
m.M14 = 0.0f;
m.M21 = 0.0f;
m.M22 = 0.0f;
m.M23 = 0.0f;
m.M24 = 0.0f;
m.M31 = 0.0f;
m.M32 = 0.0f;
m.M33 = 0.0f;
m.M34 = 0.0f;
m.M41 = 0.0f;
m.M42 = 0.0f;
m.M43 = 0.0f;
m.M44 = 0.0f;
return m;
}
}
public static Matrix Identity
{
get
{
Matrix m = Null;
m.M11 = 1.0f;
m.M22 = 1.0f;
m.M33 = 1.0f;
m.M44 = 1.0f;
return m;
}
}
public static Matrix Translation(Vector3 v)
{
Matrix m = Identity;
m.M41 = v.X;
m.M42 = v.Y;
m.M43 = v.Z;
return m;
}
public static Matrix Translation(float x, float y, float z)
{
Matrix m = Identity;
m.M41 = x;
m.M42 = y;
m.M43 = z;
return m;
}
public static Matrix RotationX(float angle)
{
float cos = (float)Math.Cos(angle);
float sin = (float)Math.Sin(angle);
Matrix result = Null;
result.M11 = 1.0f;
result.M22 = cos;
result.M23 = sin;
result.M32 = -sin;
result.M33 = cos;
result.M44 = 1.0f;
return result;
}
public static Matrix RotationY(float angle)
{
float cos = (float)Math.Cos(angle);
float sin = (float)Math.Sin(angle);
Matrix result = Null;
result.M11 = cos;
result.M13 = -sin;
result.M22 = 1.0f;
result.M31 = sin;
result.M33 = cos;
result.M44 = 1.0f;
return result;
}
public static Matrix RotationZ(float angle)
{
float cos = (float)Math.Cos(angle);
float sin = (float)Math.Sin(angle);
Matrix result = Null;
result.M11 = cos;
result.M12 = sin;
result.M21 = -sin;
result.M22 = cos;
result.M33 = 1.0f;
result.M44 = 1.0f;
return result;
}
public static Matrix Scaling(float x, float y, float z)
{
Matrix result = Null;
result.M11 = x;
result.M22 = y;
result.M33 = z;
result.M44 = 1.0f;
return result;
}
public static Matrix Scaling(Vector3 v)
{
Matrix result = Null;
result.M11 = v.X;
result.M22 = v.Y;
result.M33 = v.Z;
result.M44 = 1.0f;
return result;
}
public static Matrix Multiply(Matrix left, Matrix right)
{
Matrix result = new Matrix();
result.M11 = (left.M11 * right.M11) + (left.M12 * right.M21) + (left.M13 * right.M31) + (left.M14 * right.M41);
result.M12 = (left.M11 * right.M12) + (left.M12 * right.M22) + (left.M13 * right.M32) + (left.M14 * right.M42);
result.M13 = (left.M11 * right.M13) + (left.M12 * right.M23) + (left.M13 * right.M33) + (left.M14 * right.M43);
result.M14 = (left.M11 * right.M14) + (left.M12 * right.M24) + (left.M13 * right.M34) + (left.M14 * right.M44);
result.M21 = (left.M21 * right.M11) + (left.M22 * right.M21) + (left.M23 * right.M31) + (left.M24 * right.M41);
result.M22 = (left.M21 * right.M12) + (left.M22 * right.M22) + (left.M23 * right.M32) + (left.M24 * right.M42);
result.M23 = (left.M21 * right.M13) + (left.M22 * right.M23) + (left.M23 * right.M33) + (left.M24 * right.M43);
result.M24 = (left.M21 * right.M14) + (left.M22 * right.M24) + (left.M23 * right.M34) + (left.M24 * right.M44);
result.M31 = (left.M31 * right.M11) + (left.M32 * right.M21) + (left.M33 * right.M31) + (left.M34 * right.M41);
result.M32 = (left.M31 * right.M12) + (left.M32 * right.M22) + (left.M33 * right.M32) + (left.M34 * right.M42);
result.M33 = (left.M31 * right.M13) + (left.M32 * right.M23) + (left.M33 * right.M33) + (left.M34 * right.M43);
result.M34 = (left.M31 * right.M14) + (left.M32 * right.M24) + (left.M33 * right.M34) + (left.M34 * right.M44);
result.M41 = (left.M41 * right.M11) + (left.M42 * right.M21) + (left.M43 * right.M31) + (left.M44 * right.M41);
result.M42 = (left.M41 * right.M12) + (left.M42 * right.M22) + (left.M43 * right.M32) + (left.M44 * right.M42);
result.M43 = (left.M41 * right.M13) + (left.M42 * right.M23) + (left.M43 * right.M33) + (left.M44 * right.M43);
result.M44 = (left.M41 * right.M14) + (left.M42 * right.M24) + (left.M43 * right.M34) + (left.M44 * right.M44);
return result;
}
public static Matrix operator *(Matrix a, Matrix b)
{
return Matrix.Multiply(a, b);
}
#else
public static Matrix Null
{
get
{
Matrix result = new Matrix();
Matrix_Null(out result);
return result;
}
}
public static Matrix Identity
{
get
{
Matrix result = new Matrix();
Matrix_Identity(out result);
return result;
}
}
public static Matrix Translation(Vector3 v)
{
Matrix result = new Matrix();
Matrix_Translation(v.X, v.Y, v.Z, out result);
return result;
}
public static Matrix Translation(float x, float y, float z)
{
Matrix result = new Matrix();
Matrix_Translation(x, y, z, out result);
return result;
}
public static Matrix RotationX(float angle)
{
Matrix result = new Matrix();
Matrix_RotationX(angle, out result);
return result;
}
public static Matrix RotationY(float angle)
{
Matrix result = new Matrix();
Matrix_RotationY(angle, out result);
return result;
}
public static Matrix RotationZ(float angle)
{
Matrix result = new Matrix();
Matrix_RotationZ(angle, out result);
return result;
}
public static Matrix Scaling(float x, float y, float z)
{
Matrix result = new Matrix();
Matrix_Scaling(x, y, z, out result);
return result;
}
public static Matrix Scaling(Vector3 v)
{
Matrix result = new Matrix();
Matrix_Scaling(v.X, v.Y, v.Z, out result);
return result;
}
public static Matrix Multiply(Matrix left, Matrix right)
{
Matrix result = new Matrix();
Matrix_Multiply(ref left, ref right, out result);
return result;
}
public static Matrix operator *(Matrix a, Matrix b)
{
Matrix result = new Matrix();
Matrix_Multiply(ref a, ref b, out result);
return result;
}
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void Matrix_Null(out Matrix c);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void Matrix_Identity(out Matrix c);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void Matrix_Translation(float x, float y, float z, out Matrix c);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void Matrix_RotationX(float angle, out Matrix c);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void Matrix_RotationY(float angle, out Matrix c);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void Matrix_RotationZ(float angle, out Matrix c);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void Matrix_Scaling(float x, float y, float z, out Matrix c);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void Matrix_Multiply(ref Matrix a, ref Matrix b, out Matrix c);
#endif
public static Matrix LookAt(Vector3 eye, Vector3 target, Vector3 up)
{
Vector3 zaxis = Vector3.Normalize(target - eye);
Vector3 xaxis = Vector3.Normalize(Vector3.Cross(up, zaxis));
Vector3 yaxis = Vector3.Cross(zaxis, xaxis);
Matrix result = Null;
result.M11 = -xaxis.X;
result.M12 = yaxis.X;
result.M13 = -zaxis.X;
result.M21 = -xaxis.Y;
result.M22 = yaxis.Y;
result.M23 = -zaxis.Y;
result.M31 = -xaxis.Z;
result.M32 = yaxis.Z;
result.M33 = -zaxis.Z;
result.M44 = 1.0f;
return Matrix.Translation(-eye) * result;
}
public static Matrix PerspectiveFov(float fov, float aspect, float znear, float zfar)
{
float f = (float)(1.0 / Math.Tan(fov * 0.5f));
Matrix result = Null;
result.M11 = f / aspect;
result.M22 = f;
result.M33 = (zfar + znear) / (znear - zfar);
result.M34 = 2.0f * zfar * znear / (znear - zfar);
result.M43 = -1.0f;
return result;
}
public override bool Equals(object o)
{
if (o is Matrix)
{
Matrix v = (Matrix)o;
return this == v;
}
else
{
return false;
}
}
public override int GetHashCode()
{
return
M11.GetHashCode() + M12.GetHashCode() + M13.GetHashCode() + M14.GetHashCode() +
M21.GetHashCode() + M22.GetHashCode() + M23.GetHashCode() + M24.GetHashCode() +
M31.GetHashCode() + M32.GetHashCode() + M33.GetHashCode() + M34.GetHashCode() +
M41.GetHashCode() + M42.GetHashCode() + M43.GetHashCode() + M44.GetHashCode();
}
public static bool operator ==(Matrix left, Matrix right)
{
return
left.M11 == right.M11 && left.M12 == right.M12 && left.M13 == right.M13 && left.M14 == right.M14 &&
left.M21 == right.M21 && left.M22 == right.M22 && left.M23 == right.M23 && left.M24 == right.M24 &&
left.M31 == right.M31 && left.M32 == right.M32 && left.M33 == right.M33 && left.M34 == right.M34 &&
left.M41 == right.M41 && left.M42 == right.M42 && left.M43 == right.M43 && left.M44 == right.M44;
}
public static bool operator !=(Matrix left, Matrix right)
{
return
left.M11 != right.M11 || left.M12 != right.M12 || left.M13 != right.M13 || left.M14 != right.M14 ||
left.M21 != right.M21 || left.M22 != right.M22 || left.M23 != right.M23 || left.M24 != right.M24 ||
left.M31 != right.M31 || left.M32 != right.M32 || left.M33 != right.M33 || left.M34 != right.M34 ||
left.M41 != right.M41 || left.M42 != right.M42 || left.M43 != right.M43 || left.M44 != right.M44;
}
}
}

View file

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeImp.DoomBuilder.Rendering
{
internal class Mesh : IDisposable
{
public Mesh(RenderDevice graphics, WorldVertex[] vertexData, int[] indexData)
{
graphics.SetBufferData(Vertices, vertexData);
graphics.SetBufferData(Indices, indexData);
PrimitivesCount = indexData.Length / 3;
}
~Mesh()
{
Dispose();
}
internal void Draw(RenderDevice device)
{
device.SetVertexBuffer(Vertices);
device.SetIndexBuffer(Indices);
device.DrawIndexed(PrimitiveType.TriangleList, 0, PrimitivesCount);
device.SetIndexBuffer(null);
device.SetVertexBuffer(null);
}
public void Dispose()
{
Vertices.Dispose();
Indices.Dispose();
}
VertexBuffer Vertices = new VertexBuffer();
IndexBuffer Indices = new IndexBuffer();
int PrimitivesCount;
}
}

View file

@ -18,7 +18,6 @@
using System;
using System.Drawing;
using SlimDX;
#endregion
@ -93,6 +92,12 @@ namespace CodeImp.DoomBuilder.Rendering
return FromColor(Color.FromArgb(c));
}
// Return color multiplied by alpha
public PixelColor ApplyAlpha()
{
return new PixelColor(255, (byte)(r * a / 255), (byte)(g * a / 255), (byte)(b * a / 255));
}
// Return the inverse color
public PixelColor Inverse()
{
@ -126,19 +131,19 @@ namespace CodeImp.DoomBuilder.Rendering
// To ColorValue
public Color4 ToColorValue()
{
return new Color4(a * BYTE_TO_FLOAT,
r * BYTE_TO_FLOAT,
return new Color4(r * BYTE_TO_FLOAT,
g * BYTE_TO_FLOAT,
b * BYTE_TO_FLOAT);
b * BYTE_TO_FLOAT,
a * BYTE_TO_FLOAT);
}
// To ColorValue
public Color4 ToColorValue(float withalpha)
{
return new Color4(withalpha,
r * BYTE_TO_FLOAT,
return new Color4(r * BYTE_TO_FLOAT,
g * BYTE_TO_FLOAT,
b * BYTE_TO_FLOAT);
b * BYTE_TO_FLOAT,
withalpha);
}
// This returns a new PixelColor with adjusted alpha

View file

@ -23,104 +23,130 @@ using CodeImp.DoomBuilder.Geometry;
namespace CodeImp.DoomBuilder.Rendering
{
internal unsafe sealed class Plotter
{
#region ================== Constants
internal unsafe sealed class Plotter : IDisposable
{
#region ================== Constants
private const int DASH_INTERVAL = 16; //mxd
private const int DASH_INTERVAL = 16; //mxd
#endregion
#endregion
#region ================== Variables
#region ================== Variables
// Memory
private PixelColor* pixels;
private int width;
private int height;
private int visiblewidth;
private int visibleheight;
// Memory
private PixelColor[] pixels;
private int width;
private int height;
private int visiblewidth;
private int visibleheight;
// GL
public Texture Texture { get; private set; }
#endregion
#endregion
#region ================== Properties
#region ================== Properties
public int VisibleWidth { get { return visiblewidth; } }
public int VisibleHeight { get { return visibleheight; } }
public int Width { get { return width; } }
public int Height { get { return height; } }
public int VisibleWidth { get { return visiblewidth; } }
public int VisibleHeight { get { return visibleheight; } }
public int Width { get { return width; } }
public int Height { get { return height; } }
#endregion
#endregion
#region ================== Constructor / Disposer
#region ================== Constructor / Disposer
// Constructor
public Plotter(PixelColor* pixels, int width, int height, int visiblewidth, int visibleheight)
{
// Initialize
this.pixels = pixels;
this.width = width;
this.height = height;
this.visiblewidth = width;
this.visibleheight = height;
// We have no destructor
GC.SuppressFinalize(this);
}
// Constructor
public Plotter(int width, int height)
{
// Initialize
Texture = new Texture(width, height);
this.pixels = new PixelColor[width*height];
this.width = width;
this.height = height;
this.visiblewidth = width;
this.visibleheight = height;
}
#endregion
public void Dispose()
{
if (Texture != null)
{
Texture.Dispose();
Texture = null;
}
}
#region ================== Pixel Rendering
// This clears all pixels black
public void Clear()
{
// Clear memory
General.ZeroMemory(new IntPtr(pixels), width * height * sizeof(PixelColor));
}
// This draws a pixel normally
public void DrawPixelSolid(int x, int y, ref PixelColor c)
{
// Draw pixel when within range
if((x >= 0) && (x < visiblewidth) && (y >= 0) && (y < visibleheight))
pixels[y * width + x] = c;
}
#endregion
// This draws a pixel normally
public void DrawVertexSolid(int x, int y, int size, ref PixelColor c, ref PixelColor l, ref PixelColor d)
{
int x1 = x - size;
int x2 = x + size;
int y1 = y - size;
int y2 = y + size;
#region ================== Pixel Rendering
// Do unchecked?
if((x1 >= 0) && (x2 < visiblewidth) && (y1 >= 0) && (y2 < visibleheight))
{
// Filled square
for(int yp = y1; yp <= y2; yp++)
for(int xp = x1; xp <= x2; xp++)
pixels[yp * width + xp] = c;
private int TransformY(int y)
{
return height - y;
}
// Vertical edges
for(int yp = y1 + 1; yp <= y2 - 1; yp++)
{
pixels[yp * width + x1] = l;
pixels[yp * width + x2] = d;
}
// This clears all pixels black
public void Clear()
{
// Clear memory
fixed(PixelColor* pixel = pixels)
{
PixelColor* op = pixel;
for (int i = 0; i < pixels.Length; i++)
{
op->a = 0;
op++;
}
}
}
// Horizontal edges
for(int xp = x1 + 1; xp <= x2 - 1; xp++)
{
pixels[y1 * width + xp] = l;
pixels[y2 * width + xp] = d;
}
// This draws a pixel normally
public void DrawPixelSolid(int x, int y, ref PixelColor c)
{
y = TransformY(y);
// Corners
pixels[y2 * width + x2] = d;
pixels[y1 * width + x1] = l;
}
/*
// Draw pixel when within range
if ((x >= 0) && (x < visiblewidth) && (y >= 0) && (y < visibleheight))
pixels[y * width + x] = c;
}
// This draws a pixel normally
public void DrawVertexSolid(int x, int y, int size, ref PixelColor c, ref PixelColor l, ref PixelColor d)
{
y = TransformY(y);
int x1 = x - size;
int x2 = x + size;
int y1 = y - size;
int y2 = y + size;
// Do unchecked?
if ((x1 >= 0) && (x2 < visiblewidth) && (y1 >= 0) && (y2 < visibleheight))
{
// Filled square
for (int yp = y1; yp <= y2; yp++)
for (int xp = x1; xp <= x2; xp++)
pixels[yp * width + xp] = c;
// Vertical edges
for (int yp = y1 + 1; yp <= y2 - 1; yp++)
{
pixels[yp * width + x1] = l;
pixels[yp * width + x2] = d;
}
// Horizontal edges
for (int xp = x1 + 1; xp <= x2 - 1; xp++)
{
pixels[y1 * width + xp] = l;
pixels[y2 * width + xp] = d;
}
// Corners
pixels[y2 * width + x2] = d;
pixels[y1 * width + x1] = l;
}
/*
else
{
// Filled square
@ -147,219 +173,254 @@ namespace CodeImp.DoomBuilder.Rendering
DrawPixelSolid(x - size, y - size, l);
}
*/
}
}
// This draws a dotted grid line horizontally
public void DrawGridLineH(int y, int x1, int x2, ref PixelColor c)
{
int numpixels = visiblewidth >> 1;
int offset = y & 0x01;
int ywidth = y * width;
x1 = General.Clamp(x1 >> 1, 0, numpixels - 1);
x2 = General.Clamp(x2 >> 1, 0, numpixels - 1);
if((y >= 0) && (y < height))
{
// Draw all pixels on this line
for(int i = x1; i < x2; i++) pixels[ywidth + ((i << 1) | offset)] = c;
}
}
// This draws a dotted grid line horizontally
public void DrawGridLineH(int y, int x1, int x2, ref PixelColor c)
{
y = TransformY(y);
// This draws a dotted grid line vertically
public void DrawGridLineV(int x, int y1, int y2, ref PixelColor c)
{
int numpixels = visibleheight >> 1;
int offset = x & 0x01;
y1 = General.Clamp(y1 >> 1, 0, numpixels - 1);
y2 = General.Clamp(y2 >> 1, 0, numpixels - 1);
if((x >= 0) && (x < width))
{
// Draw all pixels on this line
for(int i = y1; i < y2; i++) pixels[((i << 1) | offset) * width + x] = c;
}
}
int numpixels = visiblewidth >> 1;
int offset = y & 0x01;
int ywidth = y * width;
x1 = General.Clamp(x1 >> 1, 0, numpixels - 1);
x2 = General.Clamp(x2 >> 1, 0, numpixels - 1);
// This draws a pixel alpha blended
public void DrawPixelAlpha(int x, int y, ref PixelColor c)
{
// Draw only when within range
if((x >= 0) && (x < visiblewidth) && (y >= 0) && (y < visibleheight))
{
// Get the target pixel
PixelColor* p = pixels + (y * width + x);
if ((y >= 0) && (y < height))
{
// Draw all pixels on this line
for (int i = x1; i < x2; i++) pixels[ywidth + ((i << 1) | offset)] = c;
}
}
// Not drawn on target yet?
if(*(int*)p == 0)
{
// Simply apply color to pixel
*p = c;
}
else
{
// Blend with pixel
float a = c.a * 0.003921568627450980392156862745098f;
if(p->a + c.a > 255) p->a = 255; else p->a += c.a;
p->r = (byte)(p->r * (1f - a) + c.r * a);
p->g = (byte)(p->g * (1f - a) + c.g * a);
p->b = (byte)(p->b * (1f - a) + c.b * a);
}
}
}
// This draws a dotted grid line vertically
public void DrawGridLineV(int x, int y1, int y2, ref PixelColor c)
{
y1 = TransformY(y1);
y2 = TransformY(y2);
// This draws a line normally
// See: http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
public void DrawLineSolid(int x1, int y1, int x2, int y2, ref PixelColor c, uint mask = 0xffffffff)
{
// Check if the line is outside the screen for sure.
// This is quickly done by checking in which area both points are. When this
// is above, below, right or left of the screen, then skip drawing the line.
if(((x1 < 0) && (x2 < 0)) ||
((x1 > visiblewidth) && (x2 > visiblewidth)) ||
((y1 < 0) && (y2 < 0)) ||
((y1 > visibleheight) && (y2 > visibleheight))) return;
int numpixels = visibleheight >> 1;
int offset = x & 0x01;
y1 = General.Clamp(y1 >> 1, 0, numpixels - 1);
y2 = General.Clamp(y2 >> 1, 0, numpixels - 1);
// Distance of the line
int dx = x2 - x1;
int dy = y2 - y1;
if ((x >= 0) && (x < width))
{
// Draw all pixels on this line
for (int i = y2; i < y1; i++) pixels[((i << 1) | offset) * width + x] = c;
}
}
// Positive (absolute) distance
int dxabs = Math.Abs(dx);
int dyabs = Math.Abs(dy);
// This draws a pixel alpha blended
public void DrawPixelAlpha(int x, int y, ref PixelColor c)
{
y = TransformY(y);
// Half distance
int x = dyabs >> 1;
int y = dxabs >> 1;
fixed (PixelColor* pixels = this.pixels)
{
// Draw only when within range
if ((x >= 0) && (x < visiblewidth) && (y >= 0) && (y < visibleheight))
{
// Get the target pixel
PixelColor* p = pixels + (y * width + x);
// Direction
int sdx = Math.Sign(dx);
int sdy = Math.Sign(dy);
// Not drawn on target yet?
if (*(int*)p == 0)
{
// Simply apply color to pixel
*p = c;
}
else
{
// Blend with pixel
float a = c.a * 0.003921568627450980392156862745098f;
if (p->a + c.a > 255) p->a = 255; else p->a += c.a;
p->r = (byte)(p->r * (1f - a) + c.r * a);
p->g = (byte)(p->g * (1f - a) + c.g * a);
p->b = (byte)(p->b * (1f - a) + c.b * a);
}
}
}
}
// Start position
int px = x1;
int py = y1;
// This draws a line normally
// See: http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
public void DrawLineSolid(int x1, int y1, int x2, int y2, ref PixelColor c, uint mask = 0xffffffff)
{
y1 = TransformY(y1);
y2 = TransformY(y2);
// When the line is completely inside screen,
// then do an unchecked draw, because all of its pixels are
// guaranteed to be within the memory range
if((x1 >= 0) && (x2 >= 0) && (x1 < visiblewidth) && (x2 < visiblewidth) &&
(y1 >= 0) && (y2 >= 0) && (y1 < visibleheight) && (y2 < visibleheight))
{
// Draw first pixel
pixels[py * width + px] = c;
// Check if the line is outside the screen for sure.
// This is quickly done by checking in which area both points are. When this
// is above, below, right or left of the screen, then skip drawing the line.
if (((x1 < 0) && (x2 < 0)) ||
((x1 > visiblewidth) && (x2 > visiblewidth)) ||
((y1 < 0) && (y2 < 0)) ||
((y1 > visibleheight) && (y2 > visibleheight))) return;
// Check if the line is more horizontal than vertical
if(dxabs >= dyabs)
{
for(int i = 0; i < dxabs; i++)
{
y += dyabs;
if(y >= dxabs)
{
y -= dxabs;
py += sdy;
}
px += sdx;
// Distance of the line
int dx = x2 - x1;
int dy = y2 - y1;
// Draw pixel
if ((mask & (1 << (i & 0x7))) != 0) {
pixels[py * width + px] = c;
}
}
}
// Else the line is more vertical than horizontal
else
{
for(int i = 0; i < dyabs; i++)
{
x += dxabs;
if(x >= dyabs)
{
x -= dyabs;
px += sdx;
}
py += sdy;
// Positive (absolute) distance
int dxabs = Math.Abs(dx);
int dyabs = Math.Abs(dy);
// Draw pixel
if ((mask & (1 << (i & 0x7))) != 0) {
pixels[py * width + px] = c;
}
}
}
}
else
{
// Draw first pixel
if((px >= 0) && (px < visiblewidth) && (py >= 0) && (py < visibleheight))
pixels[py * width + px] = c;
// Check if the line is more horizontal than vertical
if(dxabs >= dyabs)
{
for(int i = 0; i < dxabs; i++)
{
y += dyabs;
if(y >= dxabs)
{
y -= dxabs;
py += sdy;
}
px += sdx;
// Draw pixel
if ((mask & (1 << (i & 0x7))) != 0) {
if((px >= 0) && (px < visiblewidth) && (py >= 0) && (py < visibleheight))
pixels[py * width + px] = c;
}
}
}
// Else the line is more vertical than horizontal
else
{
for(int i = 0; i < dyabs; i++)
{
x += dxabs;
if(x >= dyabs)
{
x -= dyabs;
px += sdx;
}
py += sdy;
// Draw pixel
if ((mask & (1 << (i & 0x7))) != 0) {
if((px >= 0) && (px < visiblewidth) && (py >= 0) && (py < visibleheight))
pixels[py * width + px] = c;
}
}
}
}
}
// Half distance
int x = dyabs >> 1;
int y = dxabs >> 1;
//mxd
public void DrawLine3DFloor(Vector2D start, Vector2D end, ref PixelColor c, PixelColor c2)
{
Vector2D delta = end - start;
float length = delta.GetLength();
// Direction
int sdx = Math.Sign(dx);
int sdy = Math.Sign(dy);
if(length < DASH_INTERVAL * 2)
{
DrawLineSolid((int)start.x, (int)start.y, (int)end.x, (int)end.y, ref c2);
}
else
{
float d1 = DASH_INTERVAL / length;
float d2 = 1.0f - d1;
// Start position
int px = x1;
int py = y1;
Vector2D p1 = CurveTools.GetPointOnLine(start, end, d1);
Vector2D p2 = CurveTools.GetPointOnLine(start, end, d2);
// When the line is completely inside screen,
// then do an unchecked draw, because all of its pixels are
// guaranteed to be within the memory range
if ((x1 >= 0) && (x2 >= 0) && (x1 < visiblewidth) && (x2 < visiblewidth) &&
(y1 >= 0) && (y2 >= 0) && (y1 < visibleheight) && (y2 < visibleheight))
{
// Draw first pixel
pixels[py * width + px] = c;
DrawLineSolid((int)start.x, (int)start.y, (int)p1.x, (int)p1.y, ref c2);
DrawLineSolid((int)p1.x, (int)p1.y, (int)p2.x, (int)p2.y, ref c);
DrawLineSolid((int)p2.x, (int)p2.y, (int)end.x, (int)end.y, ref c2);
}
}
// Check if the line is more horizontal than vertical
if (dxabs >= dyabs)
{
for (int i = 0; i < dxabs; i++)
{
y += dyabs;
if (y >= dxabs)
{
y -= dxabs;
py += sdy;
}
px += sdx;
#endregion
}
// Draw pixel
if ((mask & (1 << (i & 0x7))) != 0)
{
pixels[py * width + px] = c;
}
}
}
// Else the line is more vertical than horizontal
else
{
for (int i = 0; i < dyabs; i++)
{
x += dxabs;
if (x >= dyabs)
{
x -= dyabs;
px += sdx;
}
py += sdy;
// Draw pixel
if ((mask & (1 << (i & 0x7))) != 0)
{
pixels[py * width + px] = c;
}
}
}
}
else
{
// Draw first pixel
if ((px >= 0) && (px < visiblewidth) && (py >= 0) && (py < visibleheight))
pixels[py * width + px] = c;
// Check if the line is more horizontal than vertical
if (dxabs >= dyabs)
{
for (int i = 0; i < dxabs; i++)
{
y += dyabs;
if (y >= dxabs)
{
y -= dxabs;
py += sdy;
}
px += sdx;
// Draw pixel
if ((mask & (1 << (i & 0x7))) != 0)
{
if ((px >= 0) && (px < visiblewidth) && (py >= 0) && (py < visibleheight))
pixels[py * width + px] = c;
}
}
}
// Else the line is more vertical than horizontal
else
{
for (int i = 0; i < dyabs; i++)
{
x += dxabs;
if (x >= dyabs)
{
x -= dyabs;
px += sdx;
}
py += sdy;
// Draw pixel
if ((mask & (1 << (i & 0x7))) != 0)
{
if ((px >= 0) && (px < visiblewidth) && (py >= 0) && (py < visibleheight))
pixels[py * width + px] = c;
}
}
}
}
}
//mxd
public void DrawLine3DFloor(Vector2D start, Vector2D end, ref PixelColor c, PixelColor c2)
{
Vector2D delta = end - start;
float length = delta.GetLength();
if (length < DASH_INTERVAL * 2)
{
DrawLineSolid((int)start.x, (int)start.y, (int)end.x, (int)end.y, ref c2);
}
else
{
float d1 = DASH_INTERVAL / length;
float d2 = 1.0f - d1;
Vector2D p1 = CurveTools.GetPointOnLine(start, end, d1);
Vector2D p2 = CurveTools.GetPointOnLine(start, end, d2);
DrawLineSolid((int)start.x, (int)start.y, (int)p1.x, (int)p1.y, ref c2);
DrawLineSolid((int)p1.x, (int)p1.y, (int)p2.x, (int)p2.y, ref c);
DrawLineSolid((int)p2.x, (int)p2.y, (int)end.x, (int)end.y, ref c2);
}
}
#endregion
#region ================== Drawing to rendertarget
public void DrawContents(RenderDevice graphics)
{
// set pixels of texture
// convert from pixelcolor to uint
fixed (PixelColor* pixels = this.pixels)
{
uint* uintpixels = (uint*)pixels;
uint* targetpixels = (uint*)graphics.MapPBO(Texture);
for (int i = 0; i < this.pixels.Length; i++)
*targetpixels++ = *uintpixels++;
graphics.UnmapPBO(Texture);
}
}
#endregion
}
}

View file

@ -0,0 +1,679 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Geometry;
using System.Runtime.InteropServices;
using System.Reflection;
using System.IO;
using System.Text;
using System.Linq;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
public class RenderDeviceException : Exception
{
public RenderDeviceException(string message) : base(message) { }
}
public class RenderDevice : IDisposable
{
public RenderDevice(RenderTargetControl rendertarget)
{
RenderTarget = rendertarget;
CreateDevice();
DeclareUniform(UniformName.rendersettings, "rendersettings", UniformType.Vec4);
DeclareUniform(UniformName.projection, "projection", UniformType.Mat4);
DeclareUniform(UniformName.desaturation, "desaturation", UniformType.Float);
DeclareUniform(UniformName.highlightcolor, "highlightcolor", UniformType.Vec4);
DeclareUniform(UniformName.view, "view", UniformType.Mat4);
DeclareUniform(UniformName.world, "world", UniformType.Mat4);
DeclareUniform(UniformName.modelnormal, "modelnormal", UniformType.Mat4);
DeclareUniform(UniformName.FillColor, "FillColor", UniformType.Vec4);
DeclareUniform(UniformName.vertexColor, "vertexColor", UniformType.Vec4);
DeclareUniform(UniformName.stencilColor, "stencilColor", UniformType.Vec4);
DeclareUniform(UniformName.lightPosAndRadius, "lightPosAndRadius", UniformType.Vec4);
DeclareUniform(UniformName.lightOrientation, "lightOrientation", UniformType.Vec3);
DeclareUniform(UniformName.light2Radius, "light2Radius", UniformType.Vec2);
DeclareUniform(UniformName.lightColor, "lightColor", UniformType.Vec4);
DeclareUniform(UniformName.ignoreNormals, "ignoreNormals", UniformType.Float);
DeclareUniform(UniformName.spotLight, "spotLight", UniformType.Float);
DeclareUniform(UniformName.campos, "campos", UniformType.Vec4);
DeclareUniform(UniformName.texturefactor, "texturefactor", UniformType.Vec4);
DeclareUniform(UniformName.fogsettings, "fogsettings", UniformType.Vec4);
DeclareUniform(UniformName.fogcolor, "fogcolor", UniformType.Vec4);
DeclareShader(ShaderName.display2d_fsaa, "display2d.vp", "display2d_fsaa.fp");
DeclareShader(ShaderName.display2d_normal, "display2d.vp", "display2d_normal.fp");
DeclareShader(ShaderName.display2d_fullbright, "display2d.vp", "display2d_fullbright.fp");
DeclareShader(ShaderName.things2d_thing, "things2d.vp", "things2d_thing.fp");
DeclareShader(ShaderName.things2d_sprite, "things2d.vp", "things2d_sprite.fp");
DeclareShader(ShaderName.things2d_fill, "things2d.vp", "things2d_fill.fp");
DeclareShader(ShaderName.plotter, "plotter.vp", "plotter.fp");
DeclareShader(ShaderName.world3d_main, "world3d_main.vp", "world3d_main.fp");
DeclareShader(ShaderName.world3d_fullbright, "world3d_main.vp", "world3d_fullbright.fp");
DeclareShader(ShaderName.world3d_main_highlight, "world3d_main.vp", "world3d_main_highlight.fp");
DeclareShader(ShaderName.world3d_fullbright_highlight, "world3d_main.vp", "world3d_fullbright_highlight.fp");
DeclareShader(ShaderName.world3d_main_vertexcolor, "world3d_customvertexcolor.vp", "world3d_main.fp");
DeclareShader(ShaderName.world3d_skybox, "world3d_skybox.vp", "world3d_skybox.fp");
DeclareShader(ShaderName.world3d_main_highlight_vertexcolor, "world3d_customvertexcolor.vp", "world3d_main_highlight.fp");
DeclareShader(ShaderName.world3d_main_fog, "world3d_lightpass.vp", "world3d_main_fog.fp");
DeclareShader(ShaderName.world3d_main_highlight_fog, "world3d_lightpass.vp", "world3d_main_highlight_fog.fp");
DeclareShader(ShaderName.world3d_main_fog_vertexcolor, "world3d_customvertexcolor_fog.vp", "world3d_main_fog.fp");
DeclareShader(ShaderName.world3d_main_highlight_fog_vertexcolor, "world3d_customvertexcolor_fog.vp", "world3d_main_highlight_fog.fp");
DeclareShader(ShaderName.world3d_vertex_color, "world3d_main.vp", "world3d_vertex_color.fp");
DeclareShader(ShaderName.world3d_constant_color, "world3d_customvertexcolor.vp", "world3d_constant_color.fp");
DeclareShader(ShaderName.world3d_lightpass, "world3d_lightpass.vp", "world3d_lightpass.fp");
SetupSettings();
}
~RenderDevice()
{
Dispose();
}
void CreateDevice()
{
// Grab the X11 Display handle by abusing reflection to access internal classes in the mono implementation.
// That's par for the course for everything in Linux, so yeah..
IntPtr display = IntPtr.Zero;
Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
if (xplatui != null)
{
display = (IntPtr)xplatui.GetField("DisplayHandle", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
}
Handle = RenderDevice_New(display, RenderTarget.Handle);
if (Handle == IntPtr.Zero)
throw new Exception("RenderDevice_New failed");
}
public bool Disposed { get { return Handle == IntPtr.Zero; } }
void ThrowIfFailed(bool result)
{
if (!result)
throw new RenderDeviceException(Marshal.PtrToStringAnsi(RenderDevice_GetError(Handle)));
}
public void Dispose()
{
if (!Disposed)
{
RenderDevice_Delete(Handle);
Handle = IntPtr.Zero;
}
}
public void DeclareUniform(UniformName name, string variablename, UniformType type)
{
RenderDevice_DeclareUniform(Handle, name, variablename, type);
}
public void DeclareShader(ShaderName name, string vertResourceName, string fragResourceName)
{
RenderDevice_DeclareShader(Handle, name, name.ToString(), GetResourceText(vertResourceName), GetResourceText(fragResourceName));
}
static string GetResourceText(string name)
{
string fullname = string.Format("CodeImp.DoomBuilder.Resources.{0}", name);
using (Stream stream = General.ThisAssembly.GetManifestResourceStream(fullname))
{
if (stream == null)
throw new Exception(string.Format("Resource {0} not found!", fullname));
byte[] data = new byte[stream.Length];
if (stream.Read(data, 0, data.Length) != data.Length)
throw new Exception("Could not read resource stream");
return Encoding.UTF8.GetString(data);
}
}
public void SetShader(ShaderName shader)
{
RenderDevice_SetShader(Handle, shader);
}
public void SetUniform(UniformName uniform, bool value)
{
RenderDevice_SetUniform(Handle, uniform, new float[] { value ? 1.0f : 0.0f }, 1);
}
public void SetUniform(UniformName uniform, float value)
{
RenderDevice_SetUniform(Handle, uniform, new float[] { value }, 1);
}
public void SetUniform(UniformName uniform, Vector2 value)
{
RenderDevice_SetUniform(Handle, uniform, new float[] { value.X, value.Y }, 2);
}
public void SetUniform(UniformName uniform, Vector3 value)
{
RenderDevice_SetUniform(Handle, uniform, new float[] { value.X, value.Y, value.Z }, 3);
}
public void SetUniform(UniformName uniform, Vector4 value)
{
RenderDevice_SetUniform(Handle, uniform, new float[] { value.X, value.Y, value.Z, value.W }, 4);
}
public void SetUniform(UniformName uniform, Color4 value)
{
RenderDevice_SetUniform(Handle, uniform, new float[] { value.Red, value.Green, value.Blue, value.Alpha }, 4);
}
public void SetUniform(UniformName uniform, Matrix matrix)
{
RenderDevice_SetUniform(Handle, uniform, ref matrix, 16);
}
public void SetUniform(UniformName uniform, ref Matrix matrix)
{
RenderDevice_SetUniform(Handle, uniform, ref matrix, 16);
}
public void SetVertexBuffer(VertexBuffer buffer)
{
RenderDevice_SetVertexBuffer(Handle, buffer != null ? buffer.Handle : IntPtr.Zero);
}
public void SetIndexBuffer(IndexBuffer buffer)
{
RenderDevice_SetIndexBuffer(Handle, buffer != null ? buffer.Handle : IntPtr.Zero);
}
public void SetAlphaBlendEnable(bool value)
{
RenderDevice_SetAlphaBlendEnable(Handle, value);
}
public void SetAlphaTestEnable(bool value)
{
RenderDevice_SetAlphaTestEnable(Handle, value);
}
public void SetCullMode(Cull mode)
{
RenderDevice_SetCullMode(Handle, mode);
}
public void SetBlendOperation(BlendOperation op)
{
RenderDevice_SetBlendOperation(Handle, op);
}
public void SetSourceBlend(Blend blend)
{
RenderDevice_SetSourceBlend(Handle, blend);
}
public void SetDestinationBlend(Blend blend)
{
RenderDevice_SetDestinationBlend(Handle, blend);
}
public void SetFillMode(FillMode mode)
{
RenderDevice_SetFillMode(Handle, mode);
}
public void SetMultisampleAntialias(bool value)
{
RenderDevice_SetMultisampleAntialias(Handle, value);
}
public void SetZEnable(bool value)
{
RenderDevice_SetZEnable(Handle, value);
}
public void SetZWriteEnable(bool value)
{
RenderDevice_SetZWriteEnable(Handle, value);
}
public void SetTexture(BaseTexture value)
{
RenderDevice_SetTexture(Handle, value != null ? value.Handle : IntPtr.Zero);
}
public void SetSamplerFilter(TextureFilter filter)
{
SetSamplerFilter(filter, filter, TextureFilter.None, 0.0f);
}
public void SetSamplerFilter(TextureFilter minfilter, TextureFilter magfilter, TextureFilter mipfilter, float maxanisotropy)
{
RenderDevice_SetSamplerFilter(Handle, minfilter, magfilter, mipfilter, maxanisotropy);
}
public void SetSamplerState(TextureAddress address)
{
RenderDevice_SetSamplerState(Handle, address);
}
public void DrawIndexed(PrimitiveType type, int startIndex, int primitiveCount)
{
ThrowIfFailed(RenderDevice_DrawIndexed(Handle, type, startIndex, primitiveCount));
}
public void Draw(PrimitiveType type, int startIndex, int primitiveCount)
{
ThrowIfFailed(RenderDevice_Draw(Handle, type, startIndex, primitiveCount));
}
public void Draw(PrimitiveType type, int startIndex, int primitiveCount, FlatVertex[] data)
{
ThrowIfFailed(RenderDevice_DrawData(Handle, type, startIndex, primitiveCount, data));
}
public void StartRendering(bool clear, Color4 backcolor)
{
ThrowIfFailed(RenderDevice_StartRendering(Handle, clear, backcolor.ToArgb(), IntPtr.Zero, true));
}
public void StartRendering(bool clear, Color4 backcolor, Texture target, bool usedepthbuffer)
{
ThrowIfFailed(RenderDevice_StartRendering(Handle, clear, backcolor.ToArgb(), target.Handle, usedepthbuffer));
}
public void FinishRendering()
{
ThrowIfFailed(RenderDevice_FinishRendering(Handle));
}
public void Present()
{
ThrowIfFailed(RenderDevice_Present(Handle));
}
public void ClearTexture(Color4 backcolor, Texture texture)
{
ThrowIfFailed(RenderDevice_ClearTexture(Handle, backcolor.ToArgb(), texture.Handle));
}
public void CopyTexture(CubeTexture dst, CubeMapFace face)
{
ThrowIfFailed(RenderDevice_CopyTexture(Handle, dst.Handle, face));
}
public void SetBufferData(IndexBuffer buffer, int[] data)
{
ThrowIfFailed(RenderDevice_SetIndexBufferData(Handle, buffer.Handle, data, data.Length * Marshal.SizeOf<int>()));
}
public void SetBufferData(VertexBuffer buffer, int length, VertexFormat format)
{
int stride = (format == VertexFormat.Flat) ? FlatVertex.Stride : WorldVertex.Stride;
ThrowIfFailed(RenderDevice_SetVertexBufferData(Handle, buffer.Handle, IntPtr.Zero, length * stride, format));
}
public void SetBufferData(VertexBuffer buffer, FlatVertex[] data)
{
ThrowIfFailed(RenderDevice_SetVertexBufferData(Handle, buffer.Handle, data, data.Length * Marshal.SizeOf<FlatVertex>(), VertexFormat.Flat));
}
public void SetBufferData(VertexBuffer buffer, WorldVertex[] data)
{
ThrowIfFailed(RenderDevice_SetVertexBufferData(Handle, buffer.Handle, data, data.Length * Marshal.SizeOf<WorldVertex>(), VertexFormat.World));
}
public void SetBufferSubdata(VertexBuffer buffer, long destOffset, FlatVertex[] data)
{
ThrowIfFailed(RenderDevice_SetVertexBufferSubdata(Handle, buffer.Handle, destOffset * FlatVertex.Stride, data, data.Length * FlatVertex.Stride));
}
public void SetBufferSubdata(VertexBuffer buffer, long destOffset, WorldVertex[] data)
{
ThrowIfFailed(RenderDevice_SetVertexBufferSubdata(Handle, buffer.Handle, destOffset * WorldVertex.Stride, data, data.Length * WorldVertex.Stride));
}
public void SetBufferSubdata(VertexBuffer buffer, FlatVertex[] data, long size)
{
if (size < 0 || size > data.Length) throw new ArgumentOutOfRangeException("size");
ThrowIfFailed(RenderDevice_SetVertexBufferSubdata(Handle, buffer.Handle, 0, data, size * FlatVertex.Stride));
}
public void SetPixels(Texture texture, System.Drawing.Bitmap bitmap)
{
System.Drawing.Imaging.BitmapData bmpdata = bitmap.LockBits(
new System.Drawing.Rectangle(0, 0, bitmap.Size.Width, bitmap.Size.Height),
System.Drawing.Imaging.ImageLockMode.ReadOnly,
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
try
{
ThrowIfFailed(RenderDevice_SetPixels(Handle, texture.Handle, bmpdata.Scan0));
}
finally
{
bitmap.UnlockBits(bmpdata);
}
}
public void SetPixels(CubeTexture texture, CubeMapFace face, System.Drawing.Bitmap bitmap)
{
System.Drawing.Imaging.BitmapData bmpdata = bitmap.LockBits(
new System.Drawing.Rectangle(0, 0, bitmap.Size.Width, bitmap.Size.Height),
System.Drawing.Imaging.ImageLockMode.ReadOnly,
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
try
{
ThrowIfFailed(RenderDevice_SetCubePixels(Handle, texture.Handle, face, bmpdata.Scan0));
}
finally
{
bitmap.UnlockBits(bmpdata);
}
}
public unsafe void SetPixels(Texture texture, uint* pixeldata)
{
ThrowIfFailed(RenderDevice_SetPixels(Handle, texture.Handle, new IntPtr(pixeldata)));
}
public unsafe void* MapPBO(Texture texture)
{
void* ptr = RenderDevice_MapPBO(Handle, texture.Handle).ToPointer();
ThrowIfFailed(ptr != null);
return ptr;
}
public void UnmapPBO(Texture texture)
{
ThrowIfFailed(RenderDevice_UnmapPBO(Handle, texture.Handle));
}
internal void RegisterResource(IRenderResource res)
{
}
internal void UnregisterResource(IRenderResource res)
{
}
public void SetupSettings()
{
// Setup renderstates
SetAlphaBlendEnable(false);
SetAlphaTestEnable(false);
SetCullMode(Cull.None);
SetDestinationBlend(Blend.InverseSourceAlpha);
SetFillMode(FillMode.Solid);
SetMultisampleAntialias((General.Settings.AntiAliasingSamples > 0));
SetSourceBlend(Blend.SourceAlpha);
SetUniform(UniformName.texturefactor, new Color4(1f, 1f, 1f, 1f));
SetZEnable(false);
SetZWriteEnable(false);
// Texture addressing
SetSamplerState(TextureAddress.Wrap);
//mxd. It's still nice to have anisotropic filtering when texture filtering is disabled
TextureFilter magminfilter = (General.Settings.VisualBilinear ? TextureFilter.Linear : TextureFilter.Point);
SetSamplerFilter(
General.Settings.FilterAnisotropy > 1.0f ? TextureFilter.Anisotropic : magminfilter,
magminfilter,
General.Settings.VisualBilinear ? TextureFilter.Linear : TextureFilter.None, // [SB] use None, otherwise textures are still filtered
General.Settings.FilterAnisotropy);
// Initialize presentations
Presentation.Initialize();
}
IntPtr Handle;
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr RenderDevice_New(IntPtr display, IntPtr window);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_Delete(IntPtr handle);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
static extern void RenderDevice_DeclareUniform(IntPtr handle, UniformName name, string variablename, UniformType type);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
static extern void RenderDevice_DeclareShader(IntPtr handle, ShaderName index, string name, string vertexShader, string fragShader);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr RenderDevice_GetError(IntPtr handle);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_SetShader(IntPtr handle, ShaderName name);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetUniform(IntPtr handle, UniformName name, float[] data, int count);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetUniform(IntPtr handle, UniformName name, ref Matrix data, int count);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetVertexBuffer(IntPtr handle, IntPtr buffer);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetIndexBuffer(IntPtr handle, IntPtr buffer);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetAlphaBlendEnable(IntPtr handle, bool value);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetAlphaTestEnable(IntPtr handle, bool value);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetCullMode(IntPtr handle, Cull mode);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetBlendOperation(IntPtr handle, BlendOperation op);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetSourceBlend(IntPtr handle, Blend blend);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetDestinationBlend(IntPtr handle, Blend blend);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetFillMode(IntPtr handle, FillMode mode);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetMultisampleAntialias(IntPtr handle, bool value);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetZEnable(IntPtr handle, bool value);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetZWriteEnable(IntPtr handle, bool value);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetTexture(IntPtr handle, IntPtr texture);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetSamplerFilter(IntPtr handle, TextureFilter minfilter, TextureFilter magfilter, TextureFilter mipfilter, float maxanisotropy);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void RenderDevice_SetSamplerState(IntPtr handle, TextureAddress address);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_Draw(IntPtr handle, PrimitiveType type, int startIndex, int primitiveCount);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_DrawIndexed(IntPtr handle, PrimitiveType type, int startIndex, int primitiveCount);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_DrawData(IntPtr handle, PrimitiveType type, int startIndex, int primitiveCount, FlatVertex[] data);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_StartRendering(IntPtr handle, bool clear, int backcolor, IntPtr target, bool usedepthbuffer);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_FinishRendering(IntPtr handle);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_Present(IntPtr handle);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_ClearTexture(IntPtr handle, int backcolor, IntPtr texture);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_CopyTexture(IntPtr handle, IntPtr dst, CubeMapFace face);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_SetIndexBufferData(IntPtr handle, IntPtr buffer, int[] data, long size);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_SetVertexBufferData(IntPtr handle, IntPtr buffer, IntPtr data, long size, VertexFormat format);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_SetVertexBufferData(IntPtr handle, IntPtr buffer, FlatVertex[] data, long size, VertexFormat format);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_SetVertexBufferData(IntPtr handle, IntPtr buffer, WorldVertex[] data, long size, VertexFormat format);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_SetVertexBufferSubdata(IntPtr handle, IntPtr buffer, long destOffset, FlatVertex[] data, long sizeInBytes);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool RenderDevice_SetVertexBufferSubdata(IntPtr handle, IntPtr buffer, long destOffset, WorldVertex[] data, long sizeInBytes);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
protected static extern bool RenderDevice_SetPixels(IntPtr handle, IntPtr texture, IntPtr data);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
protected static extern IntPtr RenderDevice_MapPBO(IntPtr handle, IntPtr texture);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
protected static extern bool RenderDevice_UnmapPBO(IntPtr handle, IntPtr texture);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
protected static extern bool RenderDevice_SetCubePixels(IntPtr handle, IntPtr texture, CubeMapFace face, IntPtr data);
//mxd. Anisotropic filtering steps
public static readonly List<float> AF_STEPS = new List<float> { 1.0f, 2.0f, 4.0f, 8.0f, 16.0f };
//mxd. Antialiasing steps
public static readonly List<int> AA_STEPS = new List<int> { 0, 2, 4, 8 };
internal RenderTargetControl RenderTarget { get; private set; }
// This makes a Vector3 from Vector3D
public static Vector3 V3(Vector3D v3d)
{
return new Vector3(v3d.x, v3d.y, v3d.z);
}
// This makes a Vector3D from Vector3
public static Vector3D V3D(Vector3 v3)
{
return new Vector3D(v3.X, v3.Y, v3.Z);
}
// This makes a Vector2 from Vector2D
public static Vector2 V2(Vector2D v2d)
{
return new Vector2(v2d.x, v2d.y);
}
// This makes a Vector2D from Vector2
public static Vector2D V2D(Vector2 v2)
{
return new Vector2D(v2.X, v2.Y);
}
}
public enum ShaderName : int
{
display2d_fsaa,
display2d_normal,
display2d_fullbright,
things2d_thing,
things2d_sprite,
things2d_fill,
plotter,
world3d_main,
world3d_fullbright,
world3d_main_highlight,
world3d_fullbright_highlight,
world3d_main_vertexcolor,
world3d_skybox,
world3d_main_highlight_vertexcolor,
world3d_p7,
world3d_main_fog,
world3d_p9,
world3d_main_highlight_fog,
world3d_p11,
world3d_main_fog_vertexcolor,
world3d_p13,
world3d_main_highlight_fog_vertexcolor,
world3d_vertex_color,
world3d_constant_color,
world3d_lightpass
}
public enum UniformType : int
{
Vec4,
Vec3,
Vec2,
Float,
Mat4
}
public enum UniformName : int
{
rendersettings,
projection,
desaturation,
highlightcolor,
view,
world,
modelnormal,
FillColor,
vertexColor,
stencilColor,
lightPosAndRadius,
lightOrientation,
light2Radius,
lightColor,
ignoreNormals,
spotLight,
campos,
texturefactor,
fogsettings,
fogcolor
}
public enum VertexFormat : int { Flat, World }
public enum Cull : int { None, Clockwise }
public enum Blend : int { InverseSourceAlpha, SourceAlpha, One }
public enum BlendOperation : int { Add, ReverseSubtract }
public enum FillMode : int { Solid, Wireframe }
public enum TextureAddress : int { Wrap, Clamp }
public enum PrimitiveType : int { LineList, TriangleList, TriangleStrip }
public enum TextureFilter : int { None, Point, Linear, Anisotropic }
}

View file

@ -25,7 +25,7 @@ using CodeImp.DoomBuilder.Geometry;
namespace CodeImp.DoomBuilder.Rendering
{
internal abstract class Renderer : ID3DResource, IDisposable
internal abstract class Renderer : IRenderResource, IDisposable
{
#region ================== Constants
@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Variables
// Graphics
protected D3DDevice graphics;
protected RenderDevice graphics;
protected static bool fullbrightness;
// Disposing
@ -53,7 +53,7 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Constructor / Disposer
// Constructor
protected Renderer(D3DDevice g)
protected Renderer(RenderDevice g)
{
// Initialize
this.graphics = g;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,120 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal class ShaderManager : ID3DResource, IDisposable
{
#region ================== Constants
#endregion
#region ================== Variables
// Settings
private readonly string shadertechnique;
// Shaders
private Display2DShader display2dshader;
private Things2DShader things2dshader;
private World3DShader world3dshader;
// Device
private D3DDevice device;
// Disposing
private bool isdisposed;
#endregion
#region ================== Properties
public string ShaderTechnique { get { return shadertechnique; } }
public Display2DShader Display2D { get { return display2dshader; } }
public Things2DShader Things2D { get { return things2dshader; } }
public World3DShader World3D { get { return world3dshader; } }
public bool IsDisposed { get { return isdisposed; } }
internal D3DDevice D3DDevice { get { return device; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public ShaderManager(D3DDevice device)
{
// Initialize
this.device = device;
shadertechnique = "SM20"; //mxd
// Load
ReloadResource();
// Register as resource
device.RegisterResource(this);
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
UnloadResource();
// Unregister as resource
device.UnregisterResource(this);
// Done
device = null;
isdisposed = true;
}
}
#endregion
#region ================== Resources
// Clean up resources
public void UnloadResource()
{
display2dshader.Dispose();
things2dshader.Dispose();
world3dshader.Dispose();
}
// Load resources
public void ReloadResource()
{
// Initialize effects
display2dshader = new Display2DShader(this);
things2dshader = new Things2DShader(this);
world3dshader = new World3DShader(this);
}
#endregion
}
}

View file

@ -17,7 +17,6 @@
#region ================== Namespaces
using System.Collections.Generic;
using SlimDX.Direct3D9;
#endregion

View file

@ -22,14 +22,12 @@ using System.Drawing;
using System.IO;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Map;
using SlimDX;
using SlimDX.Direct3D9;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal class SurfaceManager : ID3DResource
internal class SurfaceManager : IRenderResource
{
#region ================== Constants
@ -141,26 +139,19 @@ namespace CodeImp.DoomBuilder.Rendering
for(int i = 0; i < set.Value.buffersizes.Count; i++)
{
// Make the new buffer!
VertexBuffer b = new VertexBuffer(General.Map.Graphics.Device, FlatVertex.Stride * set.Value.buffersizes[i],
Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
VertexBuffer b = new VertexBuffer();
General.Map.Graphics.SetBufferData(b, set.Value.buffersizes[i], VertexFormat.Flat);
// Start refilling the buffer with sector geometry
DataStream bstream = b.Lock(0, FlatVertex.Stride * set.Value.buffersizes[i], LockFlags.Discard);
foreach(SurfaceEntry e in set.Value.entries)
// Start refilling the buffer with sector geometry
foreach (SurfaceEntry e in set.Value.entries)
{
if(e.bufferindex == i)
{
// Fill buffer
bstream.Seek(e.vertexoffset * FlatVertex.Stride, SeekOrigin.Begin);
bstream.WriteRange(e.floorvertices);
bstream.WriteRange(e.ceilvertices);
General.Map.Graphics.SetBufferSubdata(b, e.vertexoffset, e.floorvertices);
General.Map.Graphics.SetBufferSubdata(b, e.vertexoffset + e.floorvertices.Length, e.ceilvertices);
}
}
// Unlock buffer
b.Unlock();
bstream.Dispose();
// Add to list
set.Value.buffers[i] = b;
}
@ -249,7 +240,6 @@ namespace CodeImp.DoomBuilder.Rendering
// This ensures there is enough space for a given number of free entries (also adds new bufers if needed)
private void EnsureFreeBufferSpace(SurfaceBufferSet set, int freeentries)
{
DataStream bstream = null;
VertexBuffer vb = null;
// Check if we have to add entries
@ -282,8 +272,8 @@ namespace CodeImp.DoomBuilder.Rendering
if(!resourcesunloaded)
{
// Make the new buffer!
vb = new VertexBuffer(General.Map.Graphics.Device, FlatVertex.Stride * buffernumvertices,
Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
vb = new VertexBuffer();
General.Map.Graphics.SetBufferData(vb, buffernumvertices, VertexFormat.Flat);
// Add it.
set.buffers.Add(vb);
@ -305,15 +295,6 @@ namespace CodeImp.DoomBuilder.Rendering
// Reallocate a buffer
else
{
// Trash the old buffer
if(set.buffers[bufferindex].Tag != null)
{
bstream = (DataStream)set.buffers[bufferindex].Tag;
set.buffers[bufferindex].Unlock();
bstream.Dispose();
set.buffers[bufferindex].Tag = null;
}
if((set.buffers[bufferindex] != null) && !resourcesunloaded)
set.buffers[bufferindex].Dispose();
@ -334,20 +315,19 @@ namespace CodeImp.DoomBuilder.Rendering
if(!resourcesunloaded)
{
// Make the new buffer and lock it
vb = new VertexBuffer(General.Map.Graphics.Device, FlatVertex.Stride * buffernumvertices,
Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
bstream = vb.Lock(0, FlatVertex.Stride * theseentries.Count * verticesperentry, LockFlags.Discard);
}
// Start refilling the buffer with sector geometry
int vertexoffset = 0;
vb = new VertexBuffer();
General.Map.Graphics.SetBufferData(vb, buffernumvertices, VertexFormat.Flat);
}
// Start refilling the buffer with sector geometry
int vertexoffset = 0;
foreach(SurfaceEntry e in theseentries)
{
if(!resourcesunloaded)
{
// Fill buffer
bstream.WriteRange(e.floorvertices);
bstream.WriteRange(e.ceilvertices);
General.Map.Graphics.SetBufferSubdata(vb, vertexoffset, e.floorvertices);
General.Map.Graphics.SetBufferSubdata(vb, vertexoffset + e.floorvertices.Length, e.ceilvertices);
}
// Set the new location in the buffer
@ -359,9 +339,6 @@ namespace CodeImp.DoomBuilder.Rendering
if(!resourcesunloaded)
{
// Unlock buffer
vb.Unlock();
bstream.Dispose();
set.buffers[bufferindex] = vb;
}
else
@ -470,26 +447,9 @@ namespace CodeImp.DoomBuilder.Rendering
if(!resourcesunloaded)
{
// Lock the buffer
DataStream bstream;
VertexBuffer vb = set.buffers[e.bufferindex];
if(vb.Tag == null)
{
// Note: DirectX warns me that I am not using LockFlags.Discard or LockFlags.NoOverwrite here,
// but we don't have much of a choice since we want to update our data and not destroy other data
bstream = vb.Lock(0, set.buffersizes[e.bufferindex] * FlatVertex.Stride, LockFlags.None);
vb.Tag = bstream;
lockedbuffers.Add(vb);
}
else
{
bstream = (DataStream)vb.Tag;
}
// Write the vertices to buffer
bstream.Seek(e.vertexoffset * FlatVertex.Stride, SeekOrigin.Begin);
bstream.WriteRange(e.floorvertices);
bstream.WriteRange(e.ceilvertices);
General.Map.Graphics.SetBufferSubdata(vb, e.vertexoffset, e.floorvertices);
General.Map.Graphics.SetBufferSubdata(vb, e.vertexoffset + e.floorvertices.Length, e.ceilvertices);
}
}
}
@ -516,17 +476,6 @@ namespace CodeImp.DoomBuilder.Rendering
{
if(!resourcesunloaded)
{
foreach(VertexBuffer vb in lockedbuffers)
{
if(vb.Tag != null)
{
DataStream bstream = (DataStream)vb.Tag;
vb.Unlock();
bstream.Dispose();
vb.Tag = null;
}
}
// Clear list
lockedbuffers = new List<VertexBuffer>();
}
@ -657,43 +606,35 @@ namespace CodeImp.DoomBuilder.Rendering
}
// This renders the sorted sector surfaces
internal void RenderSectorSurfaces(D3DDevice graphics)
internal void RenderSectorSurfaces(RenderDevice graphics)
{
if(!resourcesunloaded)
{
int pass = Renderer.FullBrightness ? 2 : 1; //mxd
graphics.Shaders.Display2D.Begin();
ShaderName pass = Renderer.FullBrightness ? ShaderName.display2d_fullbright : ShaderName.display2d_normal; //mxd
foreach(KeyValuePair<ImageData, List<SurfaceEntry>> imgsurfaces in surfaces)
{
// Set texture
graphics.Shaders.Display2D.Texture1 = imgsurfaces.Key.Texture;
graphics.Shaders.Display2D.BeginPass(pass);
graphics.SetShader(pass);
graphics.SetTexture(imgsurfaces.Key.Texture);
// Go for all surfaces
VertexBuffer lastbuffer = null;
foreach(SurfaceEntry entry in imgsurfaces.Value)
{
graphics.Shaders.Display2D.Desaturation = entry.desaturation;
graphics.Shaders.Display2D.ApplySettings();
graphics.SetUniform(UniformName.desaturation, entry.desaturation);
// Set the vertex buffer
SurfaceBufferSet set = sets[entry.numvertices];
if(set.buffers[entry.bufferindex] != lastbuffer)
{
lastbuffer = set.buffers[entry.bufferindex];
graphics.Device.SetStreamSource(0, lastbuffer, 0, FlatVertex.Stride);
graphics.SetVertexBuffer(lastbuffer);
}
// Draw
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, entry.vertexoffset + (entry.numvertices * surfacevertexoffsetmul), entry.numvertices / 3);
graphics.Draw(PrimitiveType.TriangleList, entry.vertexoffset + (entry.numvertices * surfacevertexoffsetmul), entry.numvertices / 3);
}
graphics.Shaders.Display2D.EndPass();
}
graphics.Shaders.Display2D.End();
graphics.Shaders.Display2D.Desaturation = 0;
graphics.Shaders.Display2D.ApplySettings();
graphics.SetUniform(UniformName.desaturation, 0.0f);
}
}

View file

@ -22,8 +22,6 @@ using System.Drawing.Imaging;
using System.Drawing.Text;
using System.IO;
using System.Drawing;
using SlimDX.Direct3D9;
using SlimDX;
using CodeImp.DoomBuilder.Geometry;
using Font = System.Drawing.Font;
@ -44,10 +42,10 @@ namespace CodeImp.DoomBuilder.Rendering
PixelColor Color { get; set; }
PixelColor BackColor { get; set; }
void Update(float translatex, float translatey, float scalex, float scaley);
void Update(RenderDevice graphics, float translatex, float translatey, float scalex, float scaley);
}
public class TextLabel : IDisposable, ID3DResource, ITextLabel
public class TextLabel : IDisposable, IRenderResource, ITextLabel
{
#region ================== Constants
@ -108,7 +106,7 @@ namespace CodeImp.DoomBuilder.Rendering
public string Text { get { return text; } set { if(text != value) { text = value; textsize = Size.Empty; textureupdateneeded = true; } } }
public Font Font { get { return font; } set { font.Dispose(); font = value; textsize = Size.Empty; textureupdateneeded = true; } } //mxd
public bool TransformCoords { get { return transformcoords; } set { transformcoords = value; updateneeded = true; } }
public SizeF TextSize { get { if(textureupdateneeded) Update(General.Map.Renderer2D.TranslateX, General.Map.Renderer2D.TranslateY, General.Map.Renderer2D.Scale, -General.Map.Renderer2D.Scale); return textsize; } }
public SizeF TextSize { get { if(textureupdateneeded) Update(General.Map.Graphics, General.Map.Renderer2D.TranslateX, General.Map.Renderer2D.TranslateY, General.Map.Renderer2D.Scale, -General.Map.Renderer2D.Scale); return textsize; } }
public TextAlignmentX AlignX { get { return alignx; } set { alignx = value; updateneeded = true; } }
public TextAlignmentY AlignY { get { return aligny; } set { aligny = value; updateneeded = true; } }
public PixelColor Color { get { return color; } set { if(!color.Equals(value)) { color = value; textureupdateneeded = true; } } }
@ -241,7 +239,7 @@ namespace CodeImp.DoomBuilder.Rendering
}
// This updates the text if needed
public void Update(float translatex, float translatey, float scalex, float scaley)
public void Update(RenderDevice graphics, float translatex, float translatey, float scalex, float scaley)
{
// Check if transformation changed and needs to be updated
if(transformcoords && (translatex != lasttranslatex || translatey != lasttranslatey ||
@ -328,36 +326,21 @@ namespace CodeImp.DoomBuilder.Rendering
texture = null;
}
// Create label image
Bitmap img = CreateLabelImage(text, font, color, backcolor, drawbg, textrect, bgrect, texturesize, textorigin);
//texturesize = img.Size;
// Create texture
MemoryStream memstream = new MemoryStream((img.Size.Width * img.Size.Height * 4) + 4096);
img.Save(memstream, ImageFormat.Bmp);
memstream.Seek(0, SeekOrigin.Begin);
texture = Texture.FromStream(General.Map.Graphics.Device, memstream, (int)memstream.Length,
img.Size.Width, img.Size.Height, 1, Usage.None, Format.Unknown,
Pool.Managed, General.Map.Graphics.PostFilter, General.Map.Graphics.MipGenerateFilter, 0);
// Create label image
using (Bitmap img = CreateLabelImage(text, font, color, backcolor, drawbg, textrect, bgrect, texturesize, textorigin))
{
texture = new Texture(graphics, img);
}
}
//mxd. Create the buffer
if(textbuffer == null || textbuffer.Disposed)
{
textbuffer = new VertexBuffer(General.Map.Graphics.Device, 4 * FlatVertex.Stride,
Usage.Dynamic | Usage.WriteOnly, VertexFormat.None, Pool.Default);
textbuffer = new VertexBuffer();
}
//mxd. Lock the buffer
using(DataStream stream = textbuffer.Lock(0, 4 * FlatVertex.Stride, LockFlags.Discard | LockFlags.NoSystemLock))
{
FlatQuad quad = new FlatQuad(PrimitiveType.TriangleStrip, beginx, beginy, beginx + texturesize.Width, beginy + texturesize.Height);
stream.WriteRange(quad.Vertices);
}
// Done filling the vertex buffer
textbuffer.Unlock();
FlatQuad quad = new FlatQuad(PrimitiveType.TriangleStrip, beginx, beginy, beginx + texturesize.Width, beginy + texturesize.Height);
graphics.SetBufferData(textbuffer, quad.Vertices);
}
else
{

View file

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace CodeImp.DoomBuilder.Rendering
{
public class BaseTexture : IDisposable
{
public BaseTexture()
{
Handle = Texture_New();
if (Handle == IntPtr.Zero)
throw new Exception("Texture_New failed");
}
~BaseTexture()
{
Dispose();
}
public bool Disposed { get { return Handle == IntPtr.Zero; } }
public void Dispose()
{
if (!Disposed)
{
Texture_Delete(Handle);
Handle = IntPtr.Zero;
}
}
internal IntPtr Handle;
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
protected static extern IntPtr Texture_New();
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
protected static extern void Texture_Delete(IntPtr handle);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
protected static extern void Texture_Set2DImage(IntPtr handle, int width, int height);
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
protected static extern void Texture_SetCubeImage(IntPtr handle, int size);
}
public class Texture : BaseTexture
{
public Texture(int width, int height)
{
Width = width;
Height = height;
Texture_Set2DImage(Handle, Width, Height);
}
public Texture(RenderDevice device, System.Drawing.Bitmap bitmap)
{
Width = bitmap.Width;
Height = bitmap.Height;
Texture_Set2DImage(Handle, Width, Height);
device.SetPixels(this, bitmap);
}
public Texture(RenderDevice device, System.Drawing.Image image)
{
using (var bitmap = new System.Drawing.Bitmap(image))
{
Width = bitmap.Width;
Height = bitmap.Height;
Texture_Set2DImage(Handle, Width, Height);
device.SetPixels(this, bitmap);
}
}
public int Width { get; private set; }
public int Height { get; private set; }
public object Tag { get; set; }
}
public class CubeTexture : BaseTexture
{
public CubeTexture(RenderDevice device, int size)
{
Texture_SetCubeImage(Handle, size);
}
}
public enum CubeMapFace : int { PositiveX, PositiveY, PositiveZ, NegativeX, NegativeY, NegativeZ }
}

View file

@ -1,151 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using SlimDX.Direct3D9;
using SlimDX;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal sealed class Things2DShader : D3DShader
{
#region ================== Variables
// Property handlers
private readonly EffectHandle texture1;
private readonly EffectHandle rendersettings;
private readonly EffectHandle transformsettings;
private readonly EffectHandle fillcolor; //mxd
private readonly EffectHandle desaturationHandle; // [ZZ]
#endregion
#region ================== Properties
public Texture Texture1 { set { effect.SetTexture(texture1, value); settingschanged = true; } }
//mxd
private Color4 fc;
public Color4 FillColor
{
set
{
if(fc != value)
{
effect.SetValue(fillcolor, value);
fc = value;
settingschanged = true;
}
}
}
// [ZZ]
private float desaturation;
public float Desaturation
{
set
{
if (desaturation != value)
{
effect.SetValue(desaturationHandle, value);
desaturation = value;
settingschanged = true;
}
}
}
#endregion
#region ================== Constructor / Disposer
// Constructor
public Things2DShader(ShaderManager manager) : base(manager)
{
// Load effect from file
effect = LoadEffect("things2d.fx");
// Get the property handlers from effect
if(effect != null)
{
texture1 = effect.GetParameter(null, "texture1");
rendersettings = effect.GetParameter(null, "rendersettings");
transformsettings = effect.GetParameter(null, "transformsettings");
fillcolor = effect.GetParameter(null, "fillColor"); //mxd
desaturationHandle = effect.GetParameter(null, "desaturation"); // [ZZ]
}
// Initialize world vertex declaration
VertexElement[] elements = new[]
{
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd
};
vertexdecl = new VertexDeclaration(General.Map.Graphics.Device, elements);
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public override void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
if(texture1 != null) texture1.Dispose();
if(rendersettings != null) rendersettings.Dispose();
if(transformsettings != null) transformsettings.Dispose();
if(fillcolor != null) fillcolor.Dispose(); //mxd
if(desaturationHandle != null) desaturationHandle.Dispose();
// Done
base.Dispose();
}
}
#endregion
#region ================== Methods
// This sets the settings
public void SetSettings(float alpha)
{
Vector4 values = new Vector4(0.0f, 0.0f, 1.0f, alpha);
effect.SetValue(rendersettings, values);
Matrix world = manager.D3DDevice.Device.GetTransform(TransformState.World);
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
effect.SetValue(transformsettings, world * view);
settingschanged = true; //mxd
}
//mxd. Used to render models
public void SetTransformSettings(Matrix world)
{
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
effect.SetValue(transformsettings, world * view);
settingschanged = true;
}
#endregion
}
}

View file

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeImp.DoomBuilder.Rendering
{
public struct Vector2
{
public Vector2(float v)
{
X = v;
Y = v;
}
public Vector2(float x, float y)
{
X = x;
Y = y;
}
public float X;
public float Y;
public static Vector2 Hermite(Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount)
{
float squared = amount * amount;
float cubed = amount * squared;
float part1 = ((2.0f * cubed) - (3.0f * squared)) + 1.0f;
float part2 = (-2.0f * cubed) + (3.0f * squared);
float part3 = (cubed - (2.0f * squared)) + amount;
float part4 = cubed - squared;
return new Vector2(
(((value1.X * part1) + (value2.X * part2)) + (tangent1.X * part3)) + (tangent2.X * part4),
(((value1.Y * part1) + (value2.Y * part2)) + (tangent1.Y * part3)) + (tangent2.Y * part4));
}
public override bool Equals(object o)
{
if (o is Vector2)
{
Vector2 v = (Vector2)o;
return this == v;
}
else
{
return false;
}
}
public override int GetHashCode()
{
return X.GetHashCode() + Y.GetHashCode();
}
public static Vector2 operator +(Vector2 left, Vector2 right)
{
return new Vector2(left.X + right.X, left.Y + right.Y);
}
public static Vector2 operator -(Vector2 left, Vector2 right)
{
return new Vector2(left.X - right.X, left.Y - right.Y);
}
public static Vector2 operator -(Vector2 v)
{
return new Vector2(-v.X, -v.Y);
}
public static bool operator ==(Vector2 left, Vector2 right)
{
return left.X == right.X && left.Y == right.Y;
}
public static bool operator !=(Vector2 left, Vector2 right)
{
return left.X != right.X || left.Y != right.Y;
}
}
}

View file

@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeImp.DoomBuilder.Rendering
{
public struct Vector3
{
public Vector3(float v)
{
X = v;
Y = v;
Z = v;
}
public Vector3(Vector2 xy, float z)
{
X = xy.X;
Y = xy.Y;
Z = z;
}
public Vector3(float x, float y, float z)
{
X = x;
Y = y;
Z = z;
}
public float X;
public float Y;
public float Z;
public static Vector4 Transform(Vector3 vector, Matrix transform)
{
return new Vector4(
(((vector.X * transform.M11) + (vector.Y * transform.M21)) + (vector.Z * transform.M31)) + transform.M41,
(((vector.X * transform.M12) + (vector.Y * transform.M22)) + (vector.Z * transform.M32)) + transform.M42,
(((vector.X * transform.M13) + (vector.Y * transform.M23)) + (vector.Z * transform.M33)) + transform.M43,
(((vector.X * transform.M14) + (vector.Y * transform.M24)) + (vector.Z * transform.M34)) + transform.M44);
}
public static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount)
{
float squared = amount * amount;
float cubed = amount * squared;
float part1 = ((2.0f * cubed) - (3.0f * squared)) + 1.0f;
float part2 = (-2.0f * cubed) + (3.0f * squared);
float part3 = (cubed - (2.0f * squared)) + amount;
float part4 = cubed - squared;
return new Vector3(
(((value1.X * part1) + (value2.X * part2)) + (tangent1.X * part3)) + (tangent2.X * part4),
(((value1.Y * part1) + (value2.Y * part2)) + (tangent1.Y * part3)) + (tangent2.Y * part4),
(((value1.Z * part1) + (value2.Z * part2)) + (tangent1.Z * part3)) + (tangent2.Z * part4));
}
public static float DistanceSquared(Vector3 a, Vector3 b)
{
Vector3 c = b - a;
return Vector3.Dot(c, c);
}
public static float Dot(Vector3 a, Vector3 b)
{
return a.X * b.X + a.Y * b.Y + a.Z * b.Z;
}
public static Vector3 Cross(Vector3 left, Vector3 right)
{
Vector3 result = new Vector3();
result.X = left.Y * right.Z - left.Z * right.Y;
result.Y = left.Z * right.X - left.X * right.Z;
result.Z = left.X * right.Y - left.Y * right.X;
return result;
}
public float Length()
{
return (float)Math.Sqrt(Vector3.Dot(this, this));
}
public static Vector3 Normalize(Vector3 v)
{
v.Normalize();
return v;
}
public void Normalize()
{
float len = Length();
if (len > 0.0f)
{
X /= len;
Y /= len;
Z /= len;
}
}
public override bool Equals(object o)
{
if (o is Vector3)
{
Vector3 v = (Vector3)o;
return this == v;
}
else
{
return false;
}
}
public override int GetHashCode()
{
return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode();
}
public static Vector3 operator +(Vector3 left, Vector3 right)
{
return new Vector3(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
}
public static Vector3 operator -(Vector3 left, Vector3 right)
{
return new Vector3(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
}
public static Vector3 operator -(Vector3 v)
{
return new Vector3(-v.X, -v.Y, -v.Z);
}
public static bool operator ==(Vector3 left, Vector3 right)
{
return left.X == right.X && left.Y == right.Y && left.Z == right.Z;
}
public static bool operator !=(Vector3 left, Vector3 right)
{
return left.X != right.X || left.Y != right.Y || left.Z != right.Z;
}
}
}

View file

@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeImp.DoomBuilder.Rendering
{
public struct Vector4
{
public Vector4(float v)
{
X = v;
Y = v;
Z = v;
W = v;
}
public Vector4(Vector2 xy, float z, float w)
{
X = xy.X;
Y = xy.Y;
Z = z;
W = w;
}
public Vector4(Vector3 xyz, float w)
{
X = xyz.X;
Y = xyz.Y;
Z = xyz.Z;
W = w;
}
public Vector4(float x, float y, float z, float w)
{
X = x;
Y = y;
Z = z;
W = w;
}
public float X;
public float Y;
public float Z;
public float W;
public override bool Equals(object o)
{
if (o is Vector4)
{
Vector4 v = (Vector4)o;
return this == v;
}
else
{
return false;
}
}
public static Vector4 operator +(Vector4 left, Vector4 right)
{
return new Vector4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);
}
public static Vector4 operator -(Vector4 left, Vector4 right)
{
return new Vector4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W);
}
public static Vector4 operator -(Vector4 v)
{
return new Vector4(-v.X, -v.Y, -v.Z, -v.W);
}
public override int GetHashCode()
{
return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode();
}
public static bool operator ==(Vector4 left, Vector4 right)
{
return left.X == right.X && left.Y == right.Y && left.Z == right.Z && left.W == right.W;
}
public static bool operator !=(Vector4 left, Vector4 right)
{
return left.X != right.X || left.Y != right.Y || left.Z != right.Z || left.W != right.W;
}
}
}

View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace CodeImp.DoomBuilder.Rendering
{
public class VertexBuffer : IDisposable
{
public VertexBuffer()
{
Handle = VertexBuffer_New();
if (Handle == IntPtr.Zero)
throw new Exception("VertexBuffer_New failed");
}
~VertexBuffer()
{
Dispose();
}
public bool Disposed { get { return Handle == IntPtr.Zero; } }
public void Dispose()
{
if (!Disposed)
{
VertexBuffer_Delete(Handle);
Handle = IntPtr.Zero;
}
}
internal IntPtr Handle;
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr VertexBuffer_New();
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
static extern void VertexBuffer_Delete(IntPtr handle);
}
}

View file

@ -2,13 +2,12 @@
using System;
using CodeImp.DoomBuilder.VisualModes;
using SlimDX.Direct3D9;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal sealed class VisualVertexHandle : IDisposable, ID3DResource
internal sealed class VisualVertexHandle : IDisposable, IRenderResource
{
#region ================== Variables
@ -85,9 +84,8 @@ namespace CodeImp.DoomBuilder.Rendering
v2, v3,
v3, v0 };
upper = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * vu.Length, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
upper.Lock(0, WorldVertex.Stride * vu.Length, LockFlags.None).WriteRange(vu);
upper.Unlock();
upper = new VertexBuffer();
General.Map.Graphics.SetBufferData(upper, vu);
WorldVertex[] vl = new[]{ c, v4,
c, v5,
@ -99,9 +97,8 @@ namespace CodeImp.DoomBuilder.Rendering
v6, v7,
v7, v4 };
lower = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * vl.Length, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
lower.Lock(0, WorldVertex.Stride * vl.Length, LockFlags.None).WriteRange(vl);
lower.Unlock();
lower = new VertexBuffer();
General.Map.Graphics.SetBufferData(lower, vl);
}
// This is called before a device is reset

View file

@ -1,373 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using SlimDX.Direct3D9;
using SlimDX;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal sealed class World3DShader : D3DShader
{
#region ================== Variables
// Property handlers
private readonly EffectHandle texture1;
private readonly EffectHandle worldviewproj;
private readonly EffectHandle minfiltersettings;
private readonly EffectHandle magfiltersettings;
private readonly EffectHandle mipfiltersettings;
private readonly EffectHandle maxanisotropysetting;
private readonly EffectHandle highlightcolor;
//mxd
private readonly EffectHandle vertexColorHandle;
private readonly EffectHandle lightPositionAndRadiusHandle; //lights
private readonly EffectHandle lightOrientationHandle;
private readonly EffectHandle light2RadiusHandle;
private readonly EffectHandle lightColorHandle;
private readonly EffectHandle desaturationHandle;
private readonly EffectHandle ignoreNormalsHandle;
private readonly EffectHandle spotLightHandle;
private readonly EffectHandle world;
private readonly EffectHandle modelnormal;
private readonly EffectHandle camPosHandle; //used for fog rendering
// [ZZ]
private readonly EffectHandle stencilColorHandle;
#endregion
#region ================== Properties
private Matrix wwp;
public Matrix WorldViewProj
{
set
{
if(wwp != value)
{
effect.SetValue(worldviewproj, value);
wwp = value;
settingschanged = true;
}
}
}
public BaseTexture Texture1 { set { effect.SetTexture(texture1, value); settingschanged = true; } }
//mxd
private Color4 vertexcolor;
public Color4 VertexColor
{
set
{
if(vertexcolor != value)
{
effect.SetValue(vertexColorHandle, value);
vertexcolor = value;
settingschanged = true;
}
}
}
// [ZZ]
private Color4 stencilcolor;
public Color4 StencilColor
{
set
{
if (stencilcolor != value)
{
effect.SetValue(stencilColorHandle, value);
stencilcolor = value;
settingschanged = true;
}
}
}
//lights
private Color4 lightcolor;
public Color4 LightColor
{
set
{
if(lightcolor != value)
{
effect.SetValue(lightColorHandle, value);
lightcolor = value;
settingschanged = true;
}
}
}
// [ZZ] desaturation!
private float desaturation;
public float Desaturation
{
set
{
if (desaturation != value)
{
effect.SetValue(desaturationHandle, value);
desaturation = value;
settingschanged = true;
}
}
}
// [ZZ] emulating broken gz lights
private bool ignorenormals;
public bool IgnoreNormals
{
set
{
if (ignorenormals != value)
{
effect.SetValue(ignoreNormalsHandle, value ? 1f : 0f);
ignorenormals = value;
settingschanged = true;
}
}
}
private bool spotlight;
public bool SpotLight
{
set
{
if (spotlight != value)
{
effect.SetValue(spotLightHandle, value ? 1f : 0f);
spotlight = value;
settingschanged = true;
}
}
}
private Vector4 lightpos;
public Vector4 LightPositionAndRadius
{
set
{
if(lightpos != value)
{
effect.SetValue(lightPositionAndRadiusHandle, value);
lightpos = value;
settingschanged = true;
}
}
}
private Vector3 lightori;
public Vector3 LightOrientation
{
set
{
if (lightori != value)
{
effect.SetValue(lightOrientationHandle, value);
lightori = value;
settingschanged = true;
}
}
}
private Vector2 light2rad;
public Vector2 Light2Radius
{
set
{
if (light2rad != value)
{
effect.SetValue(light2RadiusHandle, value);
light2rad = value;
settingschanged = true;
}
}
}
//fog
private Vector4 campos;
public Vector4 CameraPosition
{
set
{
if(campos != value)
{
effect.SetValue(camPosHandle, value);
campos = value;
settingschanged = true;
}
}
}
private Matrix mworld;
public Matrix World
{
set
{
if(mworld != value)
{
effect.SetValue(world, value);
mworld = value;
settingschanged = true;
}
}
}
private Matrix mmodelnormal;
public Matrix ModelNormal
{
set
{
if (mmodelnormal != value)
{
effect.SetValue(modelnormal, value);
mmodelnormal = value;
settingschanged = true;
}
}
}
//mxd. This sets the highlight color
private Color4 hicolor;
public Color4 HighlightColor
{
set
{
if(hicolor != value)
{
effect.SetValue(highlightcolor, value);
hicolor = value;
settingschanged = true;
}
}
}
#endregion
#region ================== Constructor / Disposer
// Constructor
public World3DShader(ShaderManager manager) : base(manager)
{
// Load effect from file
effect = LoadEffect("world3d.fx");
// Get the property handlers from effect
if(effect != null)
{
worldviewproj = effect.GetParameter(null, "worldviewproj");
texture1 = effect.GetParameter(null, "texture1");
minfiltersettings = effect.GetParameter(null, "minfiltersettings");
magfiltersettings = effect.GetParameter(null, "magfiltersettings");
mipfiltersettings = effect.GetParameter(null, "mipfiltersettings");
highlightcolor = effect.GetParameter(null, "highlightcolor");
maxanisotropysetting = effect.GetParameter(null, "maxanisotropysetting");
//mxd
vertexColorHandle = effect.GetParameter(null, "vertexColor");
//lights
lightPositionAndRadiusHandle = effect.GetParameter(null, "lightPosAndRadius");
lightOrientationHandle = effect.GetParameter(null, "lightOrientation");
light2RadiusHandle = effect.GetParameter(null, "light2Radius");
lightColorHandle = effect.GetParameter(null, "lightColor");
desaturationHandle = effect.GetParameter(null, "desaturation");
ignoreNormalsHandle = effect.GetParameter(null, "ignoreNormals");
spotLightHandle = effect.GetParameter(null, "spotLight");
//fog
camPosHandle = effect.GetParameter(null, "campos");
// [ZZ]
stencilColorHandle = effect.GetParameter(null, "stencilColor");
world = effect.GetParameter(null, "world");
modelnormal = effect.GetParameter(null, "modelnormal");
}
// Initialize world vertex declaration
VertexElement[] ve = {
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, 24, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0), //mxd
VertexElement.VertexDeclarationEnd
};
vertexdecl = new VertexDeclaration(General.Map.Graphics.Device, ve);
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public override void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
if(texture1 != null) texture1.Dispose();
if(worldviewproj != null) worldviewproj.Dispose();
if(minfiltersettings != null) minfiltersettings.Dispose();
if(magfiltersettings != null) magfiltersettings.Dispose();
if(mipfiltersettings != null) mipfiltersettings.Dispose();
if(highlightcolor != null) highlightcolor.Dispose();
if(maxanisotropysetting != null) maxanisotropysetting.Dispose();
//mxd
if(vertexColorHandle != null) vertexColorHandle.Dispose();
if(lightColorHandle != null) lightColorHandle.Dispose();
if(desaturationHandle != null) desaturationHandle.Dispose();
if(ignoreNormalsHandle != null) ignoreNormalsHandle.Dispose();
if(light2RadiusHandle != null) light2RadiusHandle.Dispose();
if(lightOrientationHandle != null) lightOrientationHandle.Dispose();
if(lightPositionAndRadiusHandle != null) lightPositionAndRadiusHandle.Dispose();
if(camPosHandle != null) camPosHandle.Dispose();
if(stencilColorHandle != null) stencilColorHandle.Dispose();
if(world != null) world.Dispose();
if(modelnormal != null) modelnormal.Dispose();
// Done
base.Dispose();
}
}
#endregion
#region ================== Methods
// This sets the constant settings
public void SetConstants(bool bilinear, float maxanisotropy)
{
//mxd. It's still nice to have anisotropic filtering when texture filtering is disabled
TextureFilter magminfilter = (bilinear ? TextureFilter.Linear : TextureFilter.Point);
effect.SetValue(magfiltersettings, magminfilter);
effect.SetValue(minfiltersettings, (maxanisotropy > 1.0f ? TextureFilter.Anisotropic : magminfilter));
effect.SetValue(mipfiltersettings, (bilinear ? TextureFilter.Linear : TextureFilter.None)); // [SB] use None, otherwise textures are still filtered
effect.SetValue(maxanisotropysetting, maxanisotropy);
settingschanged = true; //mxd
}
#endregion
}
}

View file

@ -17,13 +17,15 @@
#region ================== Namespaces
using CodeImp.DoomBuilder.Geometry;
using System.Runtime.InteropServices;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
// WorldVertex
public struct WorldVertex
// WorldVertex
[StructLayout(LayoutKind.Sequential)]
public struct WorldVertex
{
// Vertex format
public const int Stride = 36; //mxd: 9 * 4, was 6 * 4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 KiB

After

Width:  |  Height:  |  Size: 324 KiB

BIN
Source/Core/Resources/UDB.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
Source/Core/Resources/UDB2.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Some files were not shown because too many files have changed in this diff Show more