diff --git a/System/ALAudio.dll b/System/ALAudio.dll index 71db7e7..6cc9453 100644 Binary files a/System/ALAudio.dll and b/System/ALAudio.dll differ diff --git a/System/ALAudio.so b/System/ALAudio.so index d6b30bb..fd00c1d 100644 Binary files a/System/ALAudio.so and b/System/ALAudio.so differ diff --git a/System/AkelEdit.dll b/System/AkelEdit.dll new file mode 100644 index 0000000..5ad6375 Binary files /dev/null and b/System/AkelEdit.dll differ diff --git a/System/Botpack.u b/System/Botpack.u index e173c6b..31f0934 100644 Binary files a/System/Botpack.u and b/System/Botpack.u differ diff --git a/System/Cluster.dll b/System/Cluster.dll index 6b65643..b0b4020 100644 Binary files a/System/Cluster.dll and b/System/Cluster.dll differ diff --git a/System/Cluster.so b/System/Cluster.so index 7606f2c..8f6b860 100644 Binary files a/System/Cluster.so and b/System/Cluster.so differ diff --git a/System/Core.dll b/System/Core.dll index 11cba8d..b5e083c 100644 Binary files a/System/Core.dll and b/System/Core.dll differ diff --git a/System/Core.so b/System/Core.so index 0e708f7..276a792 100644 Binary files a/System/Core.so and b/System/Core.so differ diff --git a/System/D3D9Drv.dll b/System/D3D9Drv.dll index b401e29..b52114d 100644 Binary files a/System/D3D9Drv.dll and b/System/D3D9Drv.dll differ diff --git a/System/D3DDrv.dll b/System/D3DDrv.dll index cf91a9c..f73c709 100644 Binary files a/System/D3DDrv.dll and b/System/D3DDrv.dll differ diff --git a/System/Default.ini b/System/Default.ini index 13a9b1d..f32075f 100644 --- a/System/Default.ini +++ b/System/Default.ini @@ -46,6 +46,8 @@ Paths=../Maps/*.unr Paths=../Textures/*.utx Paths=../Sounds/*.uax Paths=../Music/*.umx +LangPaths=../SystemLocalized//*. +LangPaths=../System/*. Suppress=DevLoad Suppress=DevSave Suppress=DevNetTraffic @@ -67,10 +69,16 @@ MinClientVersion=432 MD5PostJoinCheck=true ServerActors=IpDrv.UdpBeacon ServerActors=IpServer.UdpServerQuery -ServerActors=IpServer.UdpServerUplink MasterServerAddress=unreal.epicgames.com MasterServerPort=27900 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=utmaster.epicgames.com MasterServerPort=27900 ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.333networks.com MasterServerPort=27900 ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.qtracker.com MasterServerPort=27900 ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.telefragged.com MasterServerPort=27500 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.errorist.eu MasterServerPort=27900 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.hlkclan.net MasterServerPort=27900 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.openspy.net MasterServerPort=27900 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.oldunreal.com MasterServerPort=27900 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=master2.oldunreal.com MasterServerPort=27900 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.hypercoop.tk MasterServerPort=27900 ServerActors=UWeb.WebServer ServerPackages=SoldierSkins ServerPackages=CommandoSkins @@ -237,6 +245,9 @@ LanServerMaxTickRate=60 ServerName=Another UT Server ShortName=UT Server +[Engine.Canvas] +DynamicFontUnicodeRange=0000-007f,0080-00ff,0100-017f,0180-024f,0370-03ff,0400-04ff,0500-052f,2de0-2dff,a640-a69f,1c80-1c8f + [IpDrv.TcpipConnection] SimPacketLoss=0 SimLatency=0 @@ -498,6 +509,9 @@ EditPackages=IpServer EditPackages=UTServerAdmin EditPackages=UTMenu EditPackages=UTBrowser +EditPackages=MultiMesh +EditPackages=Relics +EditPackages=RelicsBindings [UMenu.UnrealConsole] RootWindow=UMenu.UMenuRootWindow @@ -603,7 +617,15 @@ ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,GameType=La [UBrowserAll] ListFactories[0]=UBrowser.UBrowserGSpyFact,MasterServerAddress=utmaster.epicgames.com,MasterServerTCPPort=28900,Region=0,GameName=ut -ListFactories[2]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.333networks.com,MasterServerTCPPort=28900,Region=0,GameName=ut +ListFactories[1]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.333networks.com,MasterServerTCPPort=28900,GameName=ut +ListFactories[2]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.errorist.eu,MasterServerTCPPort=28900,GameName=ut +ListFactories[3]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.oldunreal.com,MasterServerTCPPort=28900,GameName=ut +ListFactories[4]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.openspy.net,MasterServerTCPPort=28900,GameName=ut +ListFactories[5]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.hlkclan.net,MasterServerTCPPort=28900,GameName=ut +ListFactories[6]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.hypercoop.tk,MasterServerTCPPort=28900,GameName=ut +ListFactories[7]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master2.oldunreal.com,MasterServerTCPPort=28900,GameName=ut +ListFactories[8]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.telefragged.com,MasterServerTCPPort=28900,GameName=ut +ListFactories[9]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.qtracker.com,MasterServerTCPPort=28900,GameName=ut bHidden=True bFallbackFactories=False diff --git a/System/Editor.dll b/System/Editor.dll index 238d884..6d9278c 100644 Binary files a/System/Editor.dll and b/System/Editor.dll differ diff --git a/System/Editor.so b/System/Editor.so index 8b870b3..8df8ba9 100644 Binary files a/System/Editor.so and b/System/Editor.so differ diff --git a/System/Editor.u b/System/Editor.u index 50edb78..c68acde 100644 Binary files a/System/Editor.u and b/System/Editor.u differ diff --git a/System/Engine.dll b/System/Engine.dll index aa93263..9b988c0 100644 Binary files a/System/Engine.dll and b/System/Engine.dll differ diff --git a/System/Engine.so b/System/Engine.so index d3e6946..73cd339 100644 Binary files a/System/Engine.so and b/System/Engine.so differ diff --git a/System/Engine.u b/System/Engine.u index 1a4ae9b..d2c187f 100644 Binary files a/System/Engine.u and b/System/Engine.u differ diff --git a/System/Fire.dll b/System/Fire.dll index 3866398..4cc254e 100644 Binary files a/System/Fire.dll and b/System/Fire.dll differ diff --git a/System/Fire.so b/System/Fire.so index a859f06..041a540 100644 Binary files a/System/Fire.so and b/System/Fire.so differ diff --git a/System/Galaxy.dll b/System/Galaxy.dll index 1faa250..59774bf 100644 Binary files a/System/Galaxy.dll and b/System/Galaxy.dll differ diff --git a/System/IpDrv.dll b/System/IpDrv.dll index db58e9e..c48f69e 100644 Binary files a/System/IpDrv.dll and b/System/IpDrv.dll differ diff --git a/System/IpDrv.so b/System/IpDrv.so index c60043f..68cf7fe 100644 Binary files a/System/IpDrv.so and b/System/IpDrv.so differ diff --git a/System/NullNetDriver.so b/System/NullNetDriver.so index f791e04..0bd5f92 100644 Binary files a/System/NullNetDriver.so and b/System/NullNetDriver.so differ diff --git a/System/OldUnreal469c.u b/System/OldUnreal469c.u new file mode 100644 index 0000000..ae8ad4f Binary files /dev/null and b/System/OldUnreal469c.u differ diff --git a/System/OpenAL32.dll b/System/OpenAL32.dll index 1c0ad19..006a093 100644 Binary files a/System/OpenAL32.dll and b/System/OpenAL32.dll differ diff --git a/System/OpenGLDrv.dll b/System/OpenGLDrv.dll index d2e77ef..664899e 100644 Binary files a/System/OpenGLDrv.dll and b/System/OpenGLDrv.dll differ diff --git a/System/OpenGLDrv.so b/System/OpenGLDrv.so index 4dd1705..7b98f41 100644 Binary files a/System/OpenGLDrv.so and b/System/OpenGLDrv.so differ diff --git a/System/Packages.md5 b/System/Packages.md5 index 4905b51..7a6d997 100644 Binary files a/System/Packages.md5 and b/System/Packages.md5 differ diff --git a/System/Render.dll b/System/Render.dll index 1c1c4a4..a39ed20 100644 Binary files a/System/Render.dll and b/System/Render.dll differ diff --git a/System/Render.so b/System/Render.so index aff6509..89f618a 100644 Binary files a/System/Render.so and b/System/Render.so differ diff --git a/System/SDLDrv.so b/System/SDLDrv.so index d22a7c8..be633bd 100644 Binary files a/System/SDLDrv.so and b/System/SDLDrv.so differ diff --git a/System/Setup.exe b/System/Setup.exe index 4d8c329..704a0b5 100644 Binary files a/System/Setup.exe and b/System/Setup.exe differ diff --git a/System/SoftDrv.dll b/System/SoftDrv.dll index ce6fb0e..be5ca48 100644 Binary files a/System/SoftDrv.dll and b/System/SoftDrv.dll differ diff --git a/System/UBrowser.u b/System/UBrowser.u index dcadf89..df3b7e4 100644 Binary files a/System/UBrowser.u and b/System/UBrowser.u differ diff --git a/System/UCC.exe b/System/UCC.exe index ea711a8..5f708a4 100644 Binary files a/System/UCC.exe and b/System/UCC.exe differ diff --git a/System/UMenu.u b/System/UMenu.u index 4c68e89..9869184 100644 Binary files a/System/UMenu.u and b/System/UMenu.u differ diff --git a/System/UTMenu.u b/System/UTMenu.u index 5efd89b..75fdc73 100644 Binary files a/System/UTMenu.u and b/System/UTMenu.u differ diff --git a/System/UTServerAdmin.u b/System/UTServerAdmin.u index 7cc4c08..1f00ab0 100644 Binary files a/System/UTServerAdmin.u and b/System/UTServerAdmin.u differ diff --git a/System/UWeb.dll b/System/UWeb.dll index 9d202fe..78eca5d 100644 Binary files a/System/UWeb.dll and b/System/UWeb.dll differ diff --git a/System/UWeb.so b/System/UWeb.so index d15d813..cf9e233 100644 Binary files a/System/UWeb.so and b/System/UWeb.so differ diff --git a/System/UWindow.u b/System/UWindow.u index 179f3c0..42df1a0 100644 Binary files a/System/UWindow.u and b/System/UWindow.u differ diff --git a/System/UnrealEd.exe b/System/UnrealEd.exe index a40fa69..1124145 100644 Binary files a/System/UnrealEd.exe and b/System/UnrealEd.exe differ diff --git a/System/UnrealI.u b/System/UnrealI.u index 737a538..da80143 100644 Binary files a/System/UnrealI.u and b/System/UnrealI.u differ diff --git a/System/UnrealShare.u b/System/UnrealShare.u index 6414b99..8345dc6 100644 Binary files a/System/UnrealShare.u and b/System/UnrealShare.u differ diff --git a/System/UnrealTournament.exe b/System/UnrealTournament.exe index ce15088..fc7a86e 100644 Binary files a/System/UnrealTournament.exe and b/System/UnrealTournament.exe differ diff --git a/System/WinDrv.dll b/System/WinDrv.dll index 9dd2fd2..43baecb 100644 Binary files a/System/WinDrv.dll and b/System/WinDrv.dll differ diff --git a/System/Window.dll b/System/Window.dll index 724e040..50e9a59 100644 Binary files a/System/Window.dll and b/System/Window.dll differ diff --git a/System/XOpenGLDrv.dll b/System/XOpenGLDrv.dll index 31046b7..5b03a5b 100644 Binary files a/System/XOpenGLDrv.dll and b/System/XOpenGLDrv.dll differ diff --git a/System/XOpenGLDrv.so b/System/XOpenGLDrv.so index adc7e66..b8b9a71 100644 Binary files a/System/XOpenGLDrv.so and b/System/XOpenGLDrv.so differ diff --git a/System/fmod.dll b/System/fmod.dll index b355583..2a032dd 100644 Binary files a/System/fmod.dll and b/System/fmod.dll differ diff --git a/System/libSDL2-2.0.so.0 b/System/libSDL2-2.0.so.0 index cf0d192..399d03f 100644 Binary files a/System/libSDL2-2.0.so.0 and b/System/libSDL2-2.0.so.0 differ diff --git a/System/libfmod.so.12 b/System/libfmod.so.12 deleted file mode 100644 index 9ab0f60..0000000 Binary files a/System/libfmod.so.12 and /dev/null differ diff --git a/System/libfmod.so.13 b/System/libfmod.so.13 new file mode 100644 index 0000000..f235fd9 Binary files /dev/null and b/System/libfmod.so.13 differ diff --git a/System/libmpg123.so b/System/libmpg123.so new file mode 100644 index 0000000..415d2c7 Binary files /dev/null and b/System/libmpg123.so differ diff --git a/System/libopenal.so.1 b/System/libopenal.so.1 index ca2f3db..f620ac9 100755 Binary files a/System/libopenal.so.1 and b/System/libopenal.so.1 differ diff --git a/System/libxmp.dll b/System/libxmp.dll index 8c5ba2e..e7e9424 100644 Binary files a/System/libxmp.dll and b/System/libxmp.dll differ diff --git a/System/libxmp.so.4 b/System/libxmp.so.4 index a4d8461..3484093 100755 Binary files a/System/libxmp.so.4 and b/System/libxmp.so.4 differ diff --git a/System/mpg123.dll b/System/mpg123.dll new file mode 100644 index 0000000..6ea91cd Binary files /dev/null and b/System/mpg123.dll differ diff --git a/System/relics.u b/System/relics.u index dcf6035..6546c41 100644 Binary files a/System/relics.u and b/System/relics.u differ diff --git a/System/ucc-bin b/System/ucc-bin index d3f64b8..aa7ffa6 100755 Binary files a/System/ucc-bin and b/System/ucc-bin differ diff --git a/System/ucc-bin-x86 b/System/ucc-bin-x86 index d3f64b8..aa7ffa6 100755 Binary files a/System/ucc-bin-x86 and b/System/ucc-bin-x86 differ diff --git a/System/udemo.dll b/System/udemo.dll index ba54e97..3c7bf33 100644 Binary files a/System/udemo.dll and b/System/udemo.dll differ diff --git a/System/udemo.so b/System/udemo.so index f4ae98b..082db15 100644 Binary files a/System/udemo.so and b/System/udemo.so differ diff --git a/System/ut-bin b/System/ut-bin index 075ea70..d0d59ab 100755 Binary files a/System/ut-bin and b/System/ut-bin differ diff --git a/System/ut-bin-x86 b/System/ut-bin-x86 index 075ea70..d0d59ab 100755 Binary files a/System/ut-bin-x86 and b/System/ut-bin-x86 differ diff --git a/System/wx-ut-bin b/System/wx-ut-bin index 7f37fac..3bdac55 100644 Binary files a/System/wx-ut-bin and b/System/wx-ut-bin differ diff --git a/System/wx-ut-bin-x86 b/System/wx-ut-bin-x86 index 7f37fac..3bdac55 100644 Binary files a/System/wx-ut-bin-x86 and b/System/wx-ut-bin-x86 differ diff --git a/System/xopengl/DrawComplexSinglePass.frag b/System/xopengl/DrawComplexSinglePass.frag index 2d16fa3..c089542 100644 --- a/System/xopengl/DrawComplexSinglePass.frag +++ b/System/xopengl/DrawComplexSinglePass.frag @@ -5,49 +5,110 @@ * Created by Smirftsch =============================================================================*/ +// DrawComplex TexCoords Indices +const uint IDX_DIFFUSE_COORDS = 0u; +const uint IDX_LIGHTMAP_COORDS = 1u; +const uint IDX_FOGMAP_COORDS = 2u; +const uint IDX_DETAIL_COORDS = 3u; +const uint IDX_MACRO_COORDS = 4u; +const uint IDX_ENVIROMAP_COORDS = 5u; +const uint IDX_DIFFUSE_INFO = 6u; +const uint IDX_MACRO_INFO = 7u; +const uint IDX_BUMPMAP_INFO = 8u; +const uint IDX_HEIGHTMAP_INFO = 9u; +const uint IDX_X_AXIS = 10u; +const uint IDX_Y_AXIS = 11u; +const uint IDX_Z_AXIS = 12u; +const uint IDX_DRAWCOLOR = 13u; +const uint IDX_DISTANCE_FOG_COLOR = 14u; +const uint IDX_DISTANCE_FOG_INFO = 15u; + +#if BINDLESSTEXTURES +layout(std140) uniform TextureHandles +{ + layout(bindless_sampler) sampler2D Textures[NUMTEXTURES]; +}; +#endif + uniform sampler2D Texture0; //Base Texture uniform sampler2D Texture1; //Lightmap -uniform sampler2D Texture2; //DetailTexture -uniform sampler2D Texture3; //MacroTexture -uniform sampler2D Texture4; //BumpMap -uniform sampler2D Texture5; //FogMap +uniform sampler2D Texture2; //Fogmap +uniform sampler2D Texture3; //Detail Texture +uniform sampler2D Texture4; //Macro Texture +uniform sampler2D Texture5; //BumpMap uniform sampler2D Texture6; //EnvironmentMap +uniform sampler2D Texture7; //HeightMap -uniform bool FogChanged; -uniform bool bHitTesting; -uniform uint PolyFlags; -uniform uint RendMap; -uniform uint TexNum[8]; -uniform float AlphaThreshold; -uniform float Gamma; -uniform vec4 DrawColor; -uniform vec4 TexCoords[16]; -//TexCoords[11]; TextureInfo Diffuse, Specular, Alpha, Scale -//TexCoords[12]; BumpTextureInfo Diffuse, Specular, Alpha, Scale -//TexCoords[13]; MacroTextureInfo Diffuse, Specular, Alpha, Scale for MacroTex / Parallax -//TexCoords[14]; unused -//TexCoords[15]; unused, unused, Texture Format, DrawFlags. +in vec3 vCoords; +#if EDITOR +flat in vec3 vSurfaceNormal; +#endif +#if ENGINE_VERSION==227 || BUMPMAPS +in vec4 vEyeSpacePos; +flat in mat3 vTBNMat; +#endif in vec2 vTexCoords; in vec2 vLightMapCoords; +in vec2 vFogMapCoords; +in vec3 vTangentViewPos; +in vec3 vTangentFragPos; + +#if DETAILTEXTURES in vec2 vDetailTexCoords; +#endif +#if MACROTEXTURES in vec2 vMacroTexCoords; +#endif +#if BUMPMAPS in vec2 vBumpTexCoords; -in vec2 vFogMapCoords; +#endif +#if ENGINE_VERSION==227 in vec2 vEnvironmentTexCoords; -in vec3 vCoords; -in vec3 vNormals; -in vec3 Surface_Normal; -in vec4 vEyeSpacePos; -in mat3 TBNMat; +#endif #ifdef GL_ES layout ( location = 0 ) out vec4 FragColor; +# if SIMULATEMULTIPASS +layout ( location = 1 ) out vec4 FragColor1; +#endif #else +# if SIMULATEMULTIPASS +layout ( location = 0, index = 1) out vec4 FragColor1; +#endif layout ( location = 0, index = 0) out vec4 FragColor; -//layout ( location = 0, index = 1) out vec4 FragColor1; #endif +#if SHADERDRAWPARAMETERS +flat in uint vTexNum; +flat in uint vLightMapTexNum; +flat in uint vFogMapTexNum; +flat in uint vDetailTexNum; +flat in uint vMacroTexNum; +flat in uint vBumpMapTexNum; +flat in uint vEnviroMapTexNum; +flat in uint vHeightMapTexNum; +flat in uint vDrawFlags; +flat in uint vTextureFormat; +flat in uint vPolyFlags; +flat in float vBaseDiffuse; +flat in float vBaseAlpha; +flat in float vParallaxScale; +flat in float vGamma; +flat in float vBumpMapSpecular; +# if EDITOR +flat in uint vHitTesting; +flat in uint vRendMap; +flat in vec4 vDrawColor; +# endif +flat in vec4 vDistanceFogColor; +flat in vec4 vDistanceFogInfo; +#else +float vBumpMapSpecular; +uniform vec4 TexCoords[16]; +uniform uint TexNum[16]; +uniform uint DrawFlags[4]; +#endif vec3 rgb2hsv(vec3 c) { @@ -68,52 +129,150 @@ vec3 hsv2rgb(vec3 c) return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } -vec2 ParallaxMapping(in vec2 PTexCoords, in vec3 ViewDir, out float parallaxHeight) //http://sunandblackcat.com/tipFullView.php?topicid=28 +#if ENGINE_VERSION==227 +vec2 ParallaxMapping(vec2 ptexCoords, vec3 viewDir, uint TexNum, out float parallaxHeight) { - float parallaxScale = TexCoords[13].w; - // determine required number of layers + +#if BASIC_PARALLAX + +// very basic implementation + float height = 0.f; + # if BINDLESSTEXTURES + if (TexNum > 0u) + height = texture(Textures[TexNum], ptexCoords).r; + else height = texture(Texture7, ptexCoords).r; + # else + height = texture(Texture7, ptexCoords).r; + # endif + + return ptexCoords - viewDir.xy * (height * 0.1); + +#endif // BASIC_PARALLAX + +#if OCCLUSION_PARALLAX + +// parallax occlusion mapping + #if !SHADERDRAWPARAMETERS + float vParallaxScale = TexCoords[IDX_HEIGHTMAP_INFO].z * 0.025; // arbitrary to get DrawScale into (for this purpose) sane regions. + float vTimeSeconds = TexCoords[IDX_HEIGHTMAP_INFO].w; // Surface.Level->TimeSeconds + #endif + + //vParallaxScale += 8.0f * sin(vTimeSeconds) + 4.0 * cos(2.3f * vTimeSeconds); + + // number of depth layers + const float minLayers = 8; + const float maxLayers = 32; + float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0.0, 0.0, 1.0), viewDir))); + // calculate the size of each layer + float layerDepth = 1.0 / numLayers; + // depth of current layer + float currentLayerDepth = 0.0; + // the amount to shift the texture coordinates per layer (from vector P) + vec2 P = viewDir.xy / viewDir.z * vParallaxScale; + vec2 deltaTexCoords = P / numLayers; + + // get initial values + vec2 currentTexCoords = ptexCoords; + float currentDepthMapValue = 0.0; + + # if BINDLESSTEXTURES + if (TexNum > 0u) + currentDepthMapValue = texture(Textures[TexNum], currentTexCoords).r; + else currentDepthMapValue = texture(Texture7, currentTexCoords).r; + # else + currentDepthMapValue = texture(Texture7, currentTexCoords).r; + # endif + + while(currentLayerDepth < currentDepthMapValue) + { + // shift texture coordinates along direction of P + currentTexCoords -= deltaTexCoords; + // get depthmap value at current texture coordinates + # if BINDLESSTEXTURES + if (TexNum > 0u) + currentDepthMapValue = texture(Textures[TexNum], currentTexCoords).r; + else currentDepthMapValue = texture(Texture7, currentTexCoords).r; + # else + currentDepthMapValue = texture(Texture7, currentTexCoords).r; + # endif + + // get depth of next layer + currentLayerDepth += layerDepth; + } + + // get texture coordinates before collision (reverse operations) + vec2 prevTexCoords = currentTexCoords + deltaTexCoords; + + // get depth after and before collision for linear interpolation + float afterDepth = currentDepthMapValue - currentLayerDepth; + + float beforeDepth = 0.0; + # if BINDLESSTEXTURES + if (TexNum > 0u) + beforeDepth = texture(Textures[TexNum], currentTexCoords).r - currentLayerDepth + layerDepth; + else beforeDepth = texture(Texture7, currentTexCoords).r - currentLayerDepth + layerDepth; + # else + beforeDepth = texture(Texture7, currentTexCoords).r - currentLayerDepth + layerDepth; + # endif + + // interpolation of texture coordinates + float weight = afterDepth / (afterDepth - beforeDepth); + vec2 finalTexCoords = prevTexCoords * weight + currentTexCoords * (1.0 - weight); + + return finalTexCoords; +#endif // OCCLUSION_PARALLAX + +#if RELIEF_PARALLAX + +// Relief Parallax Mapping + + // determine required number of layers const float minLayers = 10.0; - const float maxLayers = 45.0; - float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0, 0, 1), ViewDir))); + const float maxLayers = 15.0; + float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0, 0, 1), viewDir))); + + #if !SHADERDRAWPARAMETERS + float vParallaxScale = TexCoords[IDX_HEIGHTMAP_INFO].z * 0.025; // arbitrary to get DrawScale into (for this purpose) sane regions. + float vTimeSeconds = TexCoords[IDX_HEIGHTMAP_INFO].w; // Surface.Level->TimeSeconds + #endif // height of each layer float layerHeight = 1.0 / numLayers; // depth of current layer float currentLayerHeight = 0.0; // shift of texture coordinates for each iteration - vec2 dtex = parallaxScale * ViewDir.xy / ViewDir.z / numLayers; + vec2 dtex = vParallaxScale * viewDir.xy / viewDir.z / numLayers; // current texture coordinates - vec2 currentTextureCoords = PTexCoords; + vec2 currentTexCoords = ptexCoords; // depth from heightmap - float heightFromTexture = 0.f; - - #ifdef BINDLESSTEXTURES - if (TexNum[3] > uint(0)) - heightFromTexture = -texture(Textures[TexNum[3]], currentTextureCoords).r; - else - heightFromTexture = -texture(Texture3, currentTextureCoords).r; - #else - heightFromTexture = -texture(Texture3, currentTextureCoords).r; - #endif + float heightFromTexture = 0.0; + # if BINDLESSTEXTURES + if (TexNum > 0u) + heightFromTexture = texture(Textures[TexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif // while point is above surface while(heightFromTexture > currentLayerHeight) { // go to the next layer currentLayerHeight += layerHeight; + // shift texture coordinates along V - currentTextureCoords -= dtex; + currentTexCoords -= dtex; + // new depth from heightmap - #ifdef BINDLESSTEXTURES - if (TexNum[3] > uint(0)) - heightFromTexture = -texture(Textures[TexNum[3]], currentTextureCoords).r; - else - heightFromTexture = -texture(Texture3, currentTextureCoords).r; - #else - heightFromTexture = -texture(Texture3, currentTextureCoords).r; - #endif + # if BINDLESSTEXTURES + if (TexNum > 0u) + heightFromTexture = texture(Textures[TexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif } /////////////////////////////////////////////////////////// @@ -124,7 +283,7 @@ vec2 ParallaxMapping(in vec2 PTexCoords, in vec3 ViewDir, out float parallaxHeig float deltaHeight = layerHeight / 2.0; // return to the mid point of previous layer - currentTextureCoords += deltaTexCoord; + currentTexCoords += deltaTexCoord; currentLayerHeight -= deltaHeight; // binary search to increase precision of Steep Paralax Mapping @@ -136,98 +295,227 @@ vec2 ParallaxMapping(in vec2 PTexCoords, in vec3 ViewDir, out float parallaxHeig deltaHeight /= 2.0; // new depth from heightmap - #ifdef BINDLESSTEXTURES - if (TexNum[3] > uint(0)) - heightFromTexture = -texture(Textures[TexNum[3]], currentTextureCoords).r; - else - heightFromTexture = -texture(Texture3, currentTextureCoords).r; - #else - heightFromTexture = -texture(Texture3, currentTextureCoords).r; - #endif + # if BINDLESSTEXTURES + if (TexNum > 0u) + heightFromTexture = texture(Textures[TexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif // shift along or agains vector V if(heightFromTexture > currentLayerHeight) // below the surface { - currentTextureCoords -= deltaTexCoord; + currentTexCoords -= deltaTexCoord; currentLayerHeight += deltaHeight; } else // above the surface { - currentTextureCoords += deltaTexCoord; + currentTexCoords += deltaTexCoord; currentLayerHeight -= deltaHeight; } } // return results parallaxHeight = currentLayerHeight; - return currentTextureCoords; + return currentTexCoords; + +#endif // RELIEF_PARALLAX + return ptexCoords; } -void main (void) + +// unused. Maybe later. +/* +float parallaxSoftShadowMultiplier(in vec3 L, in vec2 initialTexCoord, in float initialHeight) { - vec4 TotalColor = vec4(0.0,0.0,0.0,0.0); + float shadowMultiplier = 1; - int NumLights = int(LightData4[0].y); - mat3 InFrameCoords = mat3(FrameCoords[1].xyz, FrameCoords[2].xyz, FrameCoords[3].xyz); // TransformPointBy... - mat3 InFrameUncoords = mat3(FrameUncoords[1].xyz, FrameUncoords[2].xyz, FrameUncoords[3].xyz); + const float minLayers = 15; + const float maxLayers = 30; - vec2 texCoords = vTexCoords; + #if !SHADERDRAWPARAMETERS + float vParallaxScale = TexCoords[IDX_MACRO_INFO].w * 0.025; // arbitrary to get DrawScale into (for this purpose) sane regions. + #endif - uint DrawFlags = uint(TexCoords[15].w); - uint TextureFormat = uint(TexCoords[15].z); + // calculate lighting only for surface oriented to the light source + if(dot(vec3(0, 0, 1), L) > 0) + { + // calculate initial parameters + float numSamplesUnderSurface = 0; + shadowMultiplier = 0; + float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0, 0, 1), L))); + float layerHeight = initialHeight / numLayers; + vec2 texStep = vParallaxScale * L.xy / L.z / numLayers; + + // current parameters + float currentLayerHeight = initialHeight - layerHeight; + vec2 currentTexCoords = initialTexCoord + texStep; + float heightFromTexture = 0.0; + # if BINDLESSTEXTURES + if (vMacroTexNum > 0u) + heightFromTexture = texture(Textures[vMacroTexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif + + int stepIndex = 1; + + // while point is below depth 0.0 ) + while(currentLayerHeight > 0) + { + // if point is under the surface + if(heightFromTexture < currentLayerHeight) + { + // calculate partial shadowing factor + numSamplesUnderSurface += 1; + float newShadowMultiplier = (currentLayerHeight - heightFromTexture) * + (1.0 - stepIndex / numLayers); + shadowMultiplier = max(shadowMultiplier, newShadowMultiplier); + } + + // offset to the next layer + stepIndex += 1; + currentLayerHeight -= layerHeight; + currentTexCoords += texStep; + # if BINDLESSTEXTURES + if (vMacroTexNum > 0u) + heightFromTexture = texture(Textures[vMacroTexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif + } - bool UseHeightMap = ((PolyFlags&PF_HeightMap) == PF_HeightMap); + // Shadowing factor should be 1 if there were no points under the surface + if(numSamplesUnderSurface < 1) + { + shadowMultiplier = 1; + } + else + { + shadowMultiplier = 1.0 - shadowMultiplier; + } + } + return shadowMultiplier; +} +*/ +#endif - // ParallaxMap - if (((DrawFlags & DF_MacroTexture) == DF_MacroTexture) && UseHeightMap == true) - { - float parallaxHeight=0.0; +#if 1 +void main (void) +{ + mat3 InFrameCoords = mat3(FrameCoords[1].xyz, FrameCoords[2].xyz, FrameCoords[3].xyz); // TransformPointBy... + mat3 InFrameUncoords = mat3(FrameUncoords[1].xyz, FrameUncoords[2].xyz, FrameUncoords[3].xyz); + + vec4 TotalColor = vec4(1.0); + vec2 texCoords = vTexCoords; + +#if !SHADERDRAWPARAMETERS + uint vDrawFlags = DrawFlags[0]; + uint vTextureFormat = DrawFlags[1]; + uint vPolyFlags = DrawFlags[2]; + uint vRendMap = DrawFlags[3]; + bool bHitTesting = bool(TexNum[12]); + float vBaseDiffuse = TexCoords[IDX_DIFFUSE_INFO].x; + float vBaseAlpha = TexCoords[IDX_DIFFUSE_INFO].z; + float vGamma = TexCoords[IDX_Z_AXIS].w; + vec4 vDrawColor = TexCoords[IDX_DRAWCOLOR]; + vec4 vBumpMapInfo = TexCoords[IDX_BUMPMAP_INFO]; + vec4 vDistanceFogColor = TexCoords[IDX_DISTANCE_FOG_COLOR]; + vec4 vDistanceFogInfo = TexCoords[IDX_DISTANCE_FOG_INFO]; + vec4 vHeightMapInfo = TexCoords[IDX_HEIGHTMAP_INFO]; +# if BINDLESSTEXTURES + uint vTexNum = TexNum[0]; + uint vLightMapTexNum = TexNum[1]; + uint vFogMapTexNum = TexNum[2]; + uint vDetailTexNum = TexNum[3]; + uint vMacroTexNum = TexNum[4]; + uint vBumpMapTexNum = TexNum[5]; + uint vEnviroMapTexNum = TexNum[6]; + uint vHeightMapTexNum = TexNum[7]; +#else + uint vMacroTexNum = 0u; //otherwise undefined if !BINDLESSTEXTURES + uint vHeightMapTexNum = 0u; +# endif +#else +# if EDITOR + bool bHitTesting = bool(vHitTesting); +# endif +#endif - vec3 EyeDirection_tangentspace = normalize(TBNMat * vEyeSpacePos.xyz); - texCoords = ParallaxMapping(texCoords,EyeDirection_tangentspace,parallaxHeight); +#if HARDWARELIGHTS || BUMPMAPS + vec3 TangentViewDir = normalize( vTangentViewPos - vTangentFragPos ); + int NumLights = int(LightData4[0].y); + float parallaxHeight = 1.0; - // get self-shadowing factor for elements of parallax - //float shadowMultiplier = parallaxSoftShadowMultiplier(L, texCoords, parallaxHeight - 0.05); - } + #if !SHADERDRAWPARAMETERS + vBumpMapSpecular = TexCoords[IDX_BUMPMAP_INFO].y; + #endif + +#if BASIC_PARALLAX || OCCLUSION_PARALLAX || RELIEF_PARALLAX + // ParallaxMap + if ((vDrawFlags & DF_HeightMap) == DF_HeightMap) + { + // get new texture coordinates from Parallax Mapping + texCoords = ParallaxMapping(vTexCoords, TangentViewDir, vHeightMapTexNum, parallaxHeight); - vec4 Color; - #ifdef BINDLESSTEXTURES - if (TexNum[0] > uint(0)) - Color = texture(Textures[TexNum[0]], texCoords); - else Color = texture(Texture0, texCoords); - #else + //if(texCoords.x > 1.0 || texCoords.y > 1.0 || texCoords.x < 0.0 || texCoords.y < 0.0) + // discard;// texCoords = vTexCoords; + } +#endif + +#endif + vec4 Color = vec4(1.0); +#if BINDLESSTEXTURES + if (vTexNum > 0u) + Color = texture(Textures[vTexNum], texCoords); + else Color = texture(Texture0, texCoords); +#else Color = texture(Texture0, texCoords); +#endif + + #if SRGB + if((vPolyFlags & PF_Modulated)!=PF_Modulated) + { + Color.r=max(1.055 * pow(Color.r, 0.416666667) - 0.055, 0.0); + Color.g=max(1.055 * pow(Color.g, 0.416666667) - 0.055, 0.0); + Color.b=max(1.055 * pow(Color.b, 0.416666667) - 0.055, 0.0); + } #endif - - if (TexCoords[11].x > 0.0) - Color *= TexCoords[11].x; // Diffuse factor. - if (TexCoords[11].z > 0.0) - Color.a *= TexCoords[11].z; // Alpha. + if (vBaseDiffuse > 0.0) + Color *= vBaseDiffuse; // Diffuse factor. - if ( TextureFormat == TEXF_BC5) //BC5 (GL_COMPRESSED_RG_RGTC2) compression + if (vBaseAlpha > 0.0) + Color.a *= vBaseAlpha; // Alpha. + + if (vTextureFormat == TEXF_BC5) //BC5 (GL_COMPRESSED_RG_RGTC2) compression Color.b = sqrt(1.0 - Color.r*Color.r + Color.g*Color.g); // Handle PF_Masked. - if ( (PolyFlags&PF_Masked) == PF_Masked ) + if ( (vPolyFlags&PF_Masked) == PF_Masked ) { if(Color.a < 0.5) discard; else Color.rgb /= Color.a; } - else if ( (PolyFlags&PF_AlphaBlend) == PF_AlphaBlend && Color.a < 0.01 ) + else if ( (vPolyFlags&PF_AlphaBlend) == PF_AlphaBlend && Color.a < 0.01 ) discard; - if ((PolyFlags&PF_Mirrored) == PF_Mirrored) +/* if ((vPolyFlags&PF_Mirrored) == PF_Mirrored) { //add mirror code here. } +*/ TotalColor=Color; - #ifdef HARDWARELIGHTS + vec4 LightColor = vec4(1.0); +#if HARDWARELIGHTS float LightAdd = 0.0f; - vec4 TotalAdd = vec4(0.0,0.0,0.0,0.0); + LightColor = vec4(0.0,0.0,0.0,0.0); for (int i=0; i < NumLights; i++) { @@ -241,7 +529,7 @@ void main (void) if (dist < RWorldLightRadius) { // Light color - vec3 LightColor = vec3(LightData1[i].x,LightData1[i].y,LightData1[i].z); + vec4 CurrentLightColor = vec4(LightData1[i].x,LightData1[i].y,LightData1[i].z, 1.0); float MinLight = 0.05; float b = WorldLightRadius / (RWorldLightRadius * MinLight); @@ -249,72 +537,93 @@ void main (void) //float attenuation = 0.82*(1.0-smoothstep(LightRadius,24.0*LightRadius+0.50,dist)); - TotalAdd += (vec4(LightColor,1.0) * attenuation); + LightColor += CurrentLightColor * attenuation; } } - TotalColor *= TotalAdd; - #else + TotalColor *= LightColor; +#else // LightMap - if ((DrawFlags & DF_LightMap) == DF_LightMap) + if ((vDrawFlags & DF_LightMap) == DF_LightMap) { - vec4 LightColor; - #ifdef BINDLESSTEXTURES - if (TexNum[1] > uint(0)) - LightColor = texture(Textures[TexNum[1]], vLightMapCoords); - else LightColor = texture(Texture1, vLightMapCoords); - #else +# if BINDLESSTEXTURES + if (vLightMapTexNum > 0u) + LightColor = texture(Textures[vLightMapTexNum], vLightMapCoords); + else + LightColor = texture(Texture1, vLightMapCoords); +# else LightColor = texture(Texture1, vLightMapCoords); - #endif - #ifdef GL_ES +# endif +# ifdef GL_ES TotalColor*=vec4(LightColor.bgr,1.0); - #else +# else TotalColor*=vec4(LightColor.rgb,1.0); - #endif - TotalColor=clamp(TotalColor*2.0,0.0,1.0); //saturate. +# endif + TotalColor.rgb=clamp(TotalColor.rgb*2.0,0.0,1.0); //saturate. } - #endif + +#endif // DetailTextures - float bNear = clamp(1.0-(vCoords.z/380.0),0.0,1.0); - if (((DrawFlags & DF_DetailTexture) == DF_DetailTexture) && bNear > 0.0) +#if DETAILTEXTURES + if (((vDrawFlags & DF_DetailTexture) == DF_DetailTexture)) { + float NearZ = vCoords.z/512.0; + float DetailScale = 1.0; + float bNear; vec4 DetailTexColor; - #ifdef BINDLESSTEXTURES - if (TexNum[2] > uint(0)) - DetailTexColor = texture(Textures[TexNum[2]], vDetailTexCoords); - else DetailTexColor = texture(Texture2, vDetailTexCoords); - #else - DetailTexColor = texture(Texture2, vDetailTexCoords); - #endif - - vec3 hsvDetailTex = rgb2hsv(DetailTexColor.rgb); // cool idea Han :) - hsvDetailTex.b += (DetailTexColor.r - 0.1); - hsvDetailTex = hsv2rgb(hsvDetailTex); - DetailTexColor=vec4(hsvDetailTex,0.0); - DetailTexColor = mix(vec4(1.0,1.0,1.0,1.0), DetailTexColor, bNear); //fading out. - TotalColor*=DetailTexColor; + vec3 hsvDetailTex; + + for(int i=0; i < DetailMax; ++i) + { + if (i > 0) + { + NearZ *= 4.223f; + DetailScale *= 4.223f; + } + bNear = clamp(0.65-NearZ,0.0,1.0); + + if (bNear > 0.0) + { + # if BINDLESSTEXTURES + if (vDetailTexNum > 0u) + DetailTexColor = texture(Textures[vDetailTexNum], vDetailTexCoords * DetailScale); + else DetailTexColor = texture(Texture3, vDetailTexCoords * DetailScale); + # else + DetailTexColor = texture(Texture3, vDetailTexCoords * DetailScale); + # endif + + vec3 hsvDetailTex = rgb2hsv(DetailTexColor.rgb); // cool idea Han :) + hsvDetailTex.b += (DetailTexColor.r - 0.1); + hsvDetailTex = hsv2rgb(hsvDetailTex); + DetailTexColor=vec4(hsvDetailTex,0.0); + DetailTexColor = mix(vec4(1.0,1.0,1.0,1.0), DetailTexColor, bNear); //fading out. + + TotalColor.rgb*=DetailTexColor.rgb; + } + } } +#endif // MacroTextures - if (((DrawFlags & DF_MacroTexture) == DF_MacroTexture) && UseHeightMap == false) +#if MACROTEXTURES + if ((vDrawFlags & DF_MacroTexture) == DF_MacroTexture) { vec4 MacrotexColor; - #ifdef BINDLESSTEXTURES - if (TexNum[3] > uint(0)) - MacrotexColor = texture(Textures[TexNum[3]], vMacroTexCoords); - else - MacrotexColor = texture(Texture3, vMacroTexCoords); - #else - MacrotexColor = texture(Texture3, vMacroTexCoords); - #endif - - if ( (PolyFlags&PF_Masked) == PF_Masked ) +# if BINDLESSTEXTURES + if (vMacroTexNum > 0u) + MacrotexColor = texture(Textures[vMacroTexNum], vMacroTexCoords); + else MacrotexColor = texture(Texture4, vMacroTexCoords); +# else + MacrotexColor = texture(Texture4, vMacroTexCoords); +# endif + + if ( (vPolyFlags&PF_Masked) == PF_Masked ) { if(MacrotexColor.a < 0.5) discard; else MacrotexColor.rgb /= MacrotexColor.a; } - else if ( (PolyFlags&PF_AlphaBlend) == PF_AlphaBlend && MacrotexColor.a < 0.01 ) + else if ( (vPolyFlags&PF_AlphaBlend) == PF_AlphaBlend && MacrotexColor.a < 0.01 ) discard; vec3 hsvMacroTex = rgb2hsv(MacrotexColor.rgb); @@ -323,173 +632,170 @@ void main (void) MacrotexColor=vec4(hsvMacroTex,1.0); TotalColor*=MacrotexColor; } +#endif // BumpMap (Normal Map) - if ((DrawFlags & DF_BumpMap) == DF_BumpMap) +#if BUMPMAPS + if ((vDrawFlags & DF_BumpMap) == DF_BumpMap) { //normal from normal map vec3 TextureNormal; - vec3 TextureNormal_tangentspace; - #ifdef BINDLESSTEXTURES - if (TexNum[4] > uint(0)) - TextureNormal = texture(Textures[TexNum[4]], vBumpTexCoords).rgb * 2.0 - 1.0; - else - TextureNormal = texture(Texture4, vBumpTexCoords).rgb * 2.0 - 1.0; - #else - TextureNormal = texture(Texture4, vBumpTexCoords).rgb * 2.0 - 1.0; - #endif - - TextureNormal.b = sqrt(1.0 - TextureNormal.r*TextureNormal.r + TextureNormal.g*TextureNormal.g); - - TextureNormal_tangentspace = TextureNormal; +# if BINDLESSTEXTURES + if (vBumpMapTexNum > 0u) + TextureNormal = normalize(texture(Textures[vBumpMapTexNum], texCoords).rgb * 2.0 - 1.0); // has to be texCoords instead of vBumpTexCoords, otherwise alignment won't work on bumps. + else TextureNormal = normalize(texture(Texture5, texCoords).rgb * 2.0 - 1.0); +# else + TextureNormal = normalize(texture(Texture5, texCoords).rgb * 2.0 - 1.0); +# endif vec3 BumpColor; vec3 TotalBumpColor=vec3(0.0,0.0,0.0); - vec3 EyeDirection_tangentspace = TBNMat * vEyeSpacePos.xyz; for(int i=0; iCoords. + float dist = distance(vCoords, InLightPos); float MinLight = 0.05; float b = NormalLightRadius / (NormalLightRadius * NormalLightRadius * MinLight); float attenuation = NormalLightRadius / (dist+b*dist*dist); - if ( (PolyFlags&PF_Unlit) == PF_Unlit) + if ( (vPolyFlags&PF_Unlit) == PF_Unlit) InLightPos=vec3(1.0,1.0,1.0); //no idea whats best here. Arbitrary value based on some tests. if ( (NormalLightRadius == 0.0 || (dist > NormalLightRadius) || ( bZoneNormalLight && (LightData4[i].z != LightData4[i].w))) && !bSunlight)// Do not consider if not in range or in a different zone. continue; - vec3 LightPosition_cameraspace = ( viewMat * vec4(InLightPos,1)).xyz; - vec3 LightDirection_cameraspace = vEyeSpacePos.xyz - LightPosition_cameraspace; - vec3 LightDirection_tangentspace = TBNMat * LightDirection_cameraspace; - - vec3 LightDir = normalize(LightDirection_tangentspace); - // Cosine of the angle between the normal and the light direction, - // clamped above 0 - // - light is at the vertical of the triangle -> 1 - // - light is perpendicular to the triangle -> 0 - // - light is behind the triangle -> 0 - float cosTheta = clamp( dot( TextureNormal_tangentspace, LightDir ), 0.0,1.0 ); - - vec3 E = normalize(EyeDirection_tangentspace); - // Direction in which the triangle reflects the light - vec3 R = reflect(-LightDir,TextureNormal_tangentspace); - // Cosine of the angle between the Eye vector and the Reflect vector, - // clamped to 0 - // - Looking into the reflection -> 1 - // - Looking elsewhere -> < 1 - float cosAlpha = clamp( dot( E,R ), 0.0,1.0 ); - - vec3 LightColor = vec3(LightData1[i].x,LightData1[i].y,LightData1[i].z); - vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * Color.xyz; - - if (TexCoords[12].y > 0.0) // Specular - TotalBumpColor += (MaterialAmbientColor + Color.xyz * LightColor * cosTheta * pow(cosAlpha,TexCoords[12].y)) * attenuation; - else - TotalBumpColor += (MaterialAmbientColor + Color.xyz * LightColor * cosTheta) * attenuation; + vec3 TangentLightPos = vTBNMat * InLightPos; + vec3 TangentlightDir = normalize( TangentLightPos - vTangentFragPos ); + + // ambient + vec3 ambient = 0.1 * TotalColor.xyz; + + // diffuse + float diff = max(dot(TangentlightDir, TextureNormal), 0.0); + vec3 diffuse = diff * TotalColor.xyz; + + // specular + vec3 halfwayDir = normalize(TangentlightDir + TangentViewDir); + float spec = pow(max(dot(TextureNormal, halfwayDir), 0.0), 8.0); + vec3 specular = vec3(max(vBumpMapSpecular,0.1)) * spec * CurrentLightColor * LightBrightness; + TotalBumpColor += (ambient + diffuse + specular) * attenuation; } - if (TotalBumpColor.x != 0.0 || TotalBumpColor.y != 0.0 || TotalBumpColor.z != 0.0) //no light close enough. - TotalColor*=vec4(clamp(TotalBumpColor,0.0,1.0),1.0); + TotalColor+=vec4(clamp(TotalBumpColor,0.0,1.0),1.0); } +#endif // FogMap - if ((DrawFlags & DF_FogMap) == DF_FogMap) + vec4 FogColor = vec4(1.0); + if ((vDrawFlags & DF_FogMap) == DF_FogMap) { - vec4 FogColor; - #ifdef BINDLESSTEXTURES - if (TexNum[5] > uint(0)) - FogColor = texture(Textures[TexNum[5]], vFogMapCoords); - else FogColor = texture(Texture5, vFogMapCoords); - #else - FogColor = texture(Texture5, vFogMapCoords); - #endif - - TotalColor.rgb = TotalColor.rgb * (1.0-FogColor.a) + FogColor.rgb; - TotalColor.a = FogColor.a; +#if BINDLESSTEXTURES + if (vFogMapTexNum > 0u) + FogColor = texture(Textures[vFogMapTexNum], vFogMapCoords); + else + FogColor = texture(Texture2, vFogMapCoords); + +#else + FogColor = texture(Texture2, vFogMapCoords); +#endif + TotalColor.rgb = TotalColor.rgb * (1.0-FogColor.a) + FogColor.rgb; + TotalColor.a = FogColor.a; } // EnvironmentMap - if ((DrawFlags & DF_EnvironmentMap) == DF_EnvironmentMap) +#if ENGINE_VERSION==227 + if ((vDrawFlags & DF_EnvironmentMap) == DF_EnvironmentMap) { vec4 EnvironmentColor; - #ifdef BINDLESSTEXTURES - if (TexNum[6] > uint(0)) - EnvironmentColor = texture(Textures[TexNum[6]], vEnvironmentTexCoords); - else EnvironmentColor = texture(Texture6, vEnvironmentTexCoords); - #else +# if BINDLESSTEXTURES + if (vEnviroMapTexNum > 0u) + EnvironmentColor = texture(Textures[vEnviroMapTexNum], vEnvironmentTexCoords); + else EnvironmentColor = texture(Texture6, vEnvironmentTexCoords); +# else EnvironmentColor = texture(Texture6, vEnvironmentTexCoords); - #endif - if ( (PolyFlags&PF_Masked) == PF_Masked ) +# endif + if ( (vPolyFlags&PF_Masked) == PF_Masked ) { if(EnvironmentColor.a < 0.5) discard; else EnvironmentColor.rgb /= EnvironmentColor.a; } - else if ( (PolyFlags&PF_AlphaBlend) == PF_AlphaBlend && EnvironmentColor.a < 0.01 ) + else if ( (vPolyFlags&PF_AlphaBlend) == PF_AlphaBlend && EnvironmentColor.a < 0.01 ) discard; TotalColor*=vec4(EnvironmentColor.rgb,1.0); } +#endif - TotalColor=clamp(TotalColor,0.0,1.0); //saturate. + //TotalColor=clamp(TotalColor,0.0,1.0); //saturate. // Add DistanceFog - if (DistanceFogValues.w >= 0.0) +#if ENGINE_VERSION==227 + // stijn: Very slow! Went from 135 to 155FPS on CTF-BT-CallousV3 by just disabling this branch even tho 469 doesn't do distance fog + int FogMode = int(vDistanceFogInfo.w); + if (FogMode >= 0) { FogParameters DistanceFogParams; - DistanceFogParams.FogStart = DistanceFogValues.x; - DistanceFogParams.FogEnd = DistanceFogValues.y; - DistanceFogParams.FogDensity = DistanceFogValues.z; - DistanceFogParams.FogMode = int(DistanceFogValues.w); + DistanceFogParams.FogStart = vDistanceFogInfo.x; + DistanceFogParams.FogEnd = vDistanceFogInfo.y; + DistanceFogParams.FogDensity = vDistanceFogInfo.z; + DistanceFogParams.FogMode = FogMode; - if ( (PolyFlags&PF_Modulated) == PF_Modulated ) + if ( (vPolyFlags&PF_Modulated) == PF_Modulated ) DistanceFogParams.FogColor = vec4(0.5,0.5,0.5,0.0); - else if ( (PolyFlags&PF_Translucent) == PF_Translucent && (PolyFlags&PF_Environment) != PF_Environment) + else if ( (vPolyFlags&PF_Translucent) == PF_Translucent && (vPolyFlags&PF_Environment) != PF_Environment) DistanceFogParams.FogColor = vec4(0.0,0.0,0.0,0.0); - else DistanceFogParams.FogColor = DistanceFogColor; + else DistanceFogParams.FogColor = vDistanceFogColor; DistanceFogParams.FogCoord = abs(vEyeSpacePos.z/vEyeSpacePos.w); TotalColor = mix(TotalColor, DistanceFogParams.FogColor, getFogFactor(DistanceFogParams)); } +#endif - if((PolyFlags & PF_Modulated)!=PF_Modulated) + if((vPolyFlags & PF_Modulated)!=PF_Modulated) { - // Gamma -#ifdef GL_ES - // 1.055*pow(x,(1.0 / 2.4) ) - 0.055 - // FixMe: ugly rough srgb to linear conversion. - TotalColor.r=(1.055*pow(TotalColor.r,(1.0-Gamma / 2.4))-0.055); - TotalColor.g=(1.055*pow(TotalColor.g,(1.0-Gamma / 2.4))-0.055); - TotalColor.b=(1.055*pow(TotalColor.b,(1.0-Gamma / 2.4))-0.055); +#if EDITOR + // Gamma + float InGamma = vGamma*GammaMultiplierUED; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); #else - TotalColor.r=pow(TotalColor.r,2.7-Gamma*1.7); - TotalColor.g=pow(TotalColor.g,2.7-Gamma*1.7); - TotalColor.b=pow(TotalColor.b,2.7-Gamma*1.7); + // Gamma + float InGamma = vGamma*GammaMultiplier; // vGamma is a value from 0.1 to 1.0 + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); #endif } -#ifdef EDITOR +#if EDITOR // Editor support. - if (RendMap == REN_Zones || RendMap == REN_PolyCuts || RendMap == REN_Polys) + if (vRendMap == REN_Zones || vRendMap == REN_PolyCuts || vRendMap == REN_Polys) { TotalColor +=0.5; - TotalColor *= DrawColor; + TotalColor *= vDrawColor; } - else if ( RendMap==REN_Normals ) //Thank you han! + else if ( vRendMap==REN_Normals ) //Thank you han! { // Dot. - float T = 0.5*dot(normalize(vCoords),Surface_Normal); + float T = 0.5*dot(normalize(vCoords),vSurfaceNormal); // Selected. - if ( (PolyFlags&PF_Selected)==PF_Selected ) + if ( (vPolyFlags&PF_Selected)==PF_Selected ) { TotalColor = vec4(0.0,0.0,abs(T),1.0); } @@ -499,12 +805,12 @@ void main (void) TotalColor = vec4(max(0.0,T),max(0.0,-T),0.0,1.0); } } - else if ( RendMap==REN_PlainTex ) + else if ( vRendMap==REN_PlainTex ) { TotalColor = Color; } - if ( (RendMap!=REN_Normals) && ((PolyFlags&PF_Selected) == PF_Selected) ) + if ( (vRendMap!=REN_Normals) && ((vPolyFlags&PF_Selected) == PF_Selected) ) { TotalColor.r = (TotalColor.r*0.75); TotalColor.g = (TotalColor.g*0.75); @@ -516,13 +822,38 @@ void main (void) // HitSelection, Zoneview etc. if (bHitTesting) - TotalColor = DrawColor; // Use ONLY DrawColor. + TotalColor = vDrawColor; // Use ONLY DrawColor. #endif - //FragColor1 = mix(TotalColor,LightColor,1.0);// way to fix skybox etc?? - FragColor = TotalColor; +# if SIMULATEMULTIPASS + if((vPolyFlags & PF_Modulated) == PF_Modulated) + { + FragColor = TotalColor; + FragColor1 = (vec4(1.0,1.0,1.0,1.0)-TotalColor); + } + else + { + FragColor = TotalColor; + FragColor1 = (vec4(1.0,1.0,1.0,1.0)-TotalColor)*LightColor; + } +#else + FragColor = TotalColor; +#endif + + +} +#else +void main(void) +{ +# if BINDLESSTEXTURES + vec4 Color = texture(Textures[vBaseTexNum], vTexCoords); +# else + vec4 Color = texture(Texture0, vTexCoords); +# endif + FragColor = Color; } +#endif /* // diff --git a/System/xopengl/DrawComplexSinglePass.vert b/System/xopengl/DrawComplexSinglePass.vert index ba4dbd2..dd634bc 100644 --- a/System/xopengl/DrawComplexSinglePass.vert +++ b/System/xopengl/DrawComplexSinglePass.vert @@ -3,109 +3,283 @@ Revision history: * Created by Smirftsch -=============================================================================*/ +=============================================================================*/ -layout (location = 0) in vec3 Coords; // == gl_Vertex -layout (location = 1) in vec4 Normals; // Surface Normals - -uniform vec4 TexCoords[16]; +// DrawComplex TexCoords Indices +const uint IDX_DIFFUSE_COORDS = 0u; +const uint IDX_LIGHTMAP_COORDS = 1u; +const uint IDX_FOGMAP_COORDS = 2u; +const uint IDX_DETAIL_COORDS = 3u; +const uint IDX_MACRO_COORDS = 4u; +const uint IDX_ENVIROMAP_COORDS = 5u; +const uint IDX_DIFFUSE_INFO = 6u; +const uint IDX_MACRO_INFO = 7u; +const uint IDX_BUMPMAP_INFO = 8u; +const uint IDX_HEIGHTMAP_INFO = 9u; +const uint IDX_X_AXIS = 10u; +const uint IDX_Y_AXIS = 11u; +const uint IDX_Z_AXIS = 12u; +const uint IDX_DRAWCOLOR = 13u; +const uint IDX_DISTANCE_FOG_COLOR = 14u; +const uint IDX_DISTANCE_FOG_INFO = 15u; + +layout (location = 0) in vec4 Coords; // == gl_Vertex +layout (location = 1) in vec4 Normal; // == gl_Vertex out vec3 vCoords; out vec4 vEyeSpacePos; out vec2 vTexCoords; out vec2 vLightMapCoords; -out vec2 vFogMapCoords; +out vec2 vFogMapCoords; +out vec3 vTangentViewPos; +out vec3 vTangentFragPos; +#if DETAILTEXTURES out vec2 vDetailTexCoords; +#endif +#if MACROTEXTURES out vec2 vMacroTexCoords; +#endif +#if BUMPMAPS out vec2 vBumpTexCoords; -out vec2 vEnvironmentTexCoords; -out vec3 vNormals; -out vec3 Surface_Normal; // f.e. Render normal view. -out mat3 TBNMat; -out float gl_ClipDistance[MAX_CLIPPINGPLANES]; +#endif +#if ENGINE_VERSION==227 +out vec2 vEnvironmentTexCoords; +#endif +#if EDITOR +flat out vec3 vSurfaceNormal; // f.e. Render normal view. +#endif +#if ENGINE_VERSION==227 || BUMPMAPS +flat out mat3 vTBNMat; +#endif -void main(void) +#if SHADERDRAWPARAMETERS +struct DrawComplexShaderDrawParams { - mat4 modelviewMat = modelMat * viewMat; - mat4 modelviewprojMat = projMat * viewMat * modelMat; + vec4 DiffuseUV; // 0 + vec4 LightMapUV; // 1 + vec4 FogMapUV; // 2 + vec4 DetailUV; // 3 + vec4 MacroUV; // 4 + vec4 EnviroMapUV; // 5 + vec4 DiffuseInfo; // 6 + vec4 MacroInfo; // 7 + vec4 BumpMapInfo; // 8 + vec4 HeightMapInfo; // 9 + vec4 XAxis; // 10 + vec4 YAxis; // 11 + vec4 ZAxis; // 12 + vec4 DrawColor; // 13 + vec4 DistanceFogColor; // 14 + vec4 DistanceFogInfo; // 15 + uvec4 TexNum[4]; + uvec4 DrawFlags; +}; - vEyeSpacePos = modelviewMat*vec4(Coords, 1.0); - - // Point Coords - vCoords = Coords.xyz; +layout(std430, binding = 6) buffer AllDrawComplexShaderDrawParams +{ + DrawComplexShaderDrawParams DrawComplexParams[]; +}; - // UDot/VDot calculation. - vec3 MapCoordsXAxis = TexCoords[7].xyz; - vec3 MapCoordsYAxis = TexCoords[8].xyz; - vec3 MapCoordsZAxis = TexCoords[9].xyz; - vec3 MapCoordsOrigin = TexCoords[10].xyz; +flat out uint vTexNum; +flat out uint vLightMapTexNum; +flat out uint vFogMapTexNum; +flat out uint vDetailTexNum; +flat out uint vMacroTexNum; +flat out uint vBumpMapTexNum; +flat out uint vEnviroMapTexNum; +flat out uint vHeightMapTexNum; +flat out uint vHeightMapNum; +flat out uint vDrawFlags; +flat out uint vTextureFormat; +flat out uint vPolyFlags; +flat out float vBaseDiffuse; +flat out float vBaseAlpha; +flat out float vParallaxScale; +flat out float vGamma; +flat out float vBumpMapSpecular; +flat out float vTimeSeconds; +# if EDITOR +flat out uint vHitTesting; +flat out uint vRendMap; +flat out vec4 vDrawColor; +# endif +flat out vec4 vDistanceFogColor; +flat out vec4 vDistanceFogInfo; +#else +uniform vec4 TexCoords[16]; +uniform uint TexNum[16]; +uniform uint DrawFlags[4]; +#endif - float UDot = dot(MapCoordsXAxis,MapCoordsOrigin); - float VDot = dot(MapCoordsYAxis,MapCoordsOrigin); - float MapDotU = dot(MapCoordsXAxis,Coords.xyz) - UDot; - float MapDotV = dot(MapCoordsYAxis,Coords.xyz) - VDot; - vec2 MapDot = vec2(MapDotU,MapDotV); +#ifndef GL_ES +out float gl_ClipDistance[MAX_CLIPPINGPLANES]; +#endif - vec2 TexMapMult = TexCoords[0].xy; - vec2 TexMapPan = TexCoords[0].zw; +#if 1 +void main(void) +{ +#if SHADERDRAWPARAMETERS + vec4 XAxis = DrawComplexParams[gl_DrawID].XAxis; + vec4 YAxis = DrawComplexParams[gl_DrawID].YAxis; + vec4 ZAxis = DrawComplexParams[gl_DrawID].ZAxis; + vec4 DiffuseUV = DrawComplexParams[gl_DrawID].DiffuseUV; + vec4 LightMapUV = DrawComplexParams[gl_DrawID].LightMapUV; + vec4 FogMapUV = DrawComplexParams[gl_DrawID].FogMapUV; + vec4 DetailUV = DrawComplexParams[gl_DrawID].DetailUV; + vec4 MacroUV = DrawComplexParams[gl_DrawID].MacroUV; + vec4 EnviroMapUV = DrawComplexParams[gl_DrawID].EnviroMapUV; - vec2 LightMapMult = TexCoords[1].xy; - vec2 LightMapPan = TexCoords[1].zw; + vDrawFlags = DrawComplexParams[gl_DrawID].DrawFlags[0]; + vTextureFormat = DrawComplexParams[gl_DrawID].DrawFlags[1]; + vPolyFlags = DrawComplexParams[gl_DrawID].DrawFlags[2]; +# if EDITOR + vRendMap = DrawComplexParams[gl_DrawID].DrawFlags[3]; + vHitTesting = DrawComplexParams[gl_DrawID].TexNum[3].x + vDrawColor = DrawComplexParams[gl_DrawID].DrawColor; +# endif + vTexNum = DrawComplexParams[gl_DrawID].TexNum[0].x; + vLightMapTexNum = DrawComplexParams[gl_DrawID].TexNum[0].y; + vFogMapTexNum = DrawComplexParams[gl_DrawID].TexNum[0].z; + vDetailTexNum = DrawComplexParams[gl_DrawID].TexNum[0].w; + vMacroTexNum = DrawComplexParams[gl_DrawID].TexNum[1].x; + vBumpMapTexNum = DrawComplexParams[gl_DrawID].TexNum[1].y; + vEnviroMapTexNum = DrawComplexParams[gl_DrawID].TexNum[1].z; + vHeightMapTexNum = DrawComplexParams[gl_DrawID].TexNum[1].w; + vBaseDiffuse = DrawComplexParams[gl_DrawID].DiffuseInfo.x; + vBaseAlpha = DrawComplexParams[gl_DrawID].DiffuseInfo.z; + vBumpMapSpecular = DrawComplexParams[gl_DrawID].BumpMapInfo.y; + vParallaxScale = DrawComplexParams[gl_DrawID].HeightMapInfo.z * 0.025; + vTimeSeconds = DrawComplexParams[gl_DrawID].HeightMapInfo.w; + vGamma = ZAxis.w; + vDistanceFogColor = DrawComplexParams[gl_DrawID].DistanceFogColor; + vDistanceFogInfo = DrawComplexParams[gl_DrawID].DistanceFogInfo; +#else + vec4 XAxis = TexCoords[IDX_X_AXIS]; + vec4 YAxis = TexCoords[IDX_Y_AXIS]; + vec4 ZAxis = TexCoords[IDX_Z_AXIS]; + vec4 DiffuseUV = TexCoords[IDX_DIFFUSE_COORDS]; + vec4 LightMapUV = TexCoords[IDX_LIGHTMAP_COORDS]; + vec4 FogMapUV = TexCoords[IDX_FOGMAP_COORDS]; + vec4 DetailUV = TexCoords[IDX_DETAIL_COORDS]; + vec4 MacroUV = TexCoords[IDX_MACRO_COORDS]; + vec4 EnviroMapUV = TexCoords[IDX_ENVIROMAP_COORDS]; - vec2 DetailTexMapMult = TexCoords[2].xy; - vec2 DetailTexMapPan = TexCoords[2].zw; + uint vDrawFlags = DrawFlags[0]; +#endif - vec2 MacroTexMapMult = TexCoords[3].xy; - vec2 MacroTexMapPan = TexCoords[3].zw; + // Point Coords + vCoords = Coords.xyz; - vec2 BumpMapTexMapMult = TexCoords[4].xy; - vec2 BumpMapTexMapPan = TexCoords[4].zw; + // UDot/VDot calculation. + vec3 MapCoordsXAxis = XAxis.xyz; + vec3 MapCoordsYAxis = YAxis.xyz; +#if EDITOR || ENGINE_VERSION==227 || BUMPMAPS + vec3 MapCoordsZAxis = ZAxis.xyz; +#endif - vec2 FogMapTexMapMult = TexCoords[5].xy; - vec2 FogMapTexMapPan = TexCoords[5].zw; + float UDot = XAxis.w; + float VDot = YAxis.w; - vec2 EnvironmentMapTexMapMult = TexCoords[6].xy; - vec2 EnvironmentMapTexMapPan = TexCoords[6].zw; + float MapDotU = dot(MapCoordsXAxis, Coords.xyz) - UDot; + float MapDotV = dot(MapCoordsYAxis, Coords.xyz) - VDot; + vec2 MapDot = vec2(MapDotU, MapDotV); //Texture UV to fragment - vTexCoords = (MapDot - TexMapPan) * TexMapMult; + vec2 TexMapMult = DiffuseUV.xy; + vec2 TexMapPan = DiffuseUV.zw; + vTexCoords = (MapDot - TexMapPan) * TexMapMult; //Texture UV Lightmap to fragment - vLightMapCoords = (MapDot - LightMapPan) * LightMapMult; + if ((vDrawFlags & DF_LightMap) == DF_LightMap) + { + vec2 LightMapMult = LightMapUV.xy; + vec2 LightMapPan = LightMapUV.zw; + vLightMapCoords = (MapDot - LightMapPan) * LightMapMult; + } + + // Texture UV FogMap + if ((vDrawFlags & DF_FogMap) == DF_FogMap) + { + vec2 FogMapMult = FogMapUV.xy; + vec2 FogMapPan = FogMapUV.zw; + vFogMapCoords = (MapDot - FogMapPan) * FogMapMult; + } // Texture UV DetailTexture - vDetailTexCoords = (MapDot - DetailTexMapPan) * DetailTexMapMult; +#if DETAILTEXTURES + if ((vDrawFlags & DF_DetailTexture) == DF_DetailTexture) + { + vec2 DetailMult = DetailUV.xy; + vec2 DetailPan = DetailUV.zw; + vDetailTexCoords = (MapDot - DetailPan) * DetailMult; + } +#endif // Texture UV Macrotexture - vMacroTexCoords = (MapDot - MacroTexMapPan) * MacroTexMapMult; - - // Texture UV BumpMap - vBumpTexCoords = (MapDot - BumpMapTexMapPan) * BumpMapTexMapMult; - - // Texture UV FogMap - vFogMapCoords = (MapDot - FogMapTexMapPan) * FogMapTexMapMult; - +#if MACROTEXTURES + if ((vDrawFlags & DF_MacroTexture) == DF_MacroTexture) + { + vec2 MacroMult = MacroUV.xy; + vec2 MacroPan = MacroUV.zw; + vMacroTexCoords = (MapDot - MacroPan) * MacroMult; + } +#endif + // Texture UV EnvironmentMap - vEnvironmentTexCoords = (MapDot - EnvironmentMapTexMapPan) * EnvironmentMapTexMapMult; +#if ENGINE_VERSION==227 + if ((vDrawFlags & DF_EnvironmentMap) == DF_EnvironmentMap) + { + vec2 EnvironmentMapMult = EnviroMapUV.xy; + vec2 EnvironmentMapPan = EnviroMapUV.zw; + vEnvironmentTexCoords = (MapDot - EnvironmentMapPan) * EnvironmentMapMult; + } +#endif - vec3 T = normalize(vec3(-MapCoordsXAxis.x,MapCoordsXAxis.y,MapCoordsXAxis.z)); - vec3 B = normalize(vec3(MapCoordsYAxis.x,-MapCoordsYAxis.y,-MapCoordsYAxis.z)); - vec3 N = normalize(vec3(-MapCoordsZAxis.x,MapCoordsZAxis.y,MapCoordsZAxis.z)); //SurfNormals. +#if ENGINE_VERSION==227 || BUMPMAPS + vEyeSpacePos = modelviewMat*vec4(Coords.xyz, 1.0); + vec3 EyeSpacePos = normalize(FrameCoords[0].xyz);// despite pretty perfect results (so far) this still seems somewhat wrong to me. + + if ((vDrawFlags & (DF_MacroTexture|DF_BumpMap)) != 0u) + { + vec3 T = normalize(vec3(MapCoordsXAxis.x,MapCoordsXAxis.y,MapCoordsXAxis.z)); + vec3 B = normalize(vec3(MapCoordsYAxis.x,MapCoordsYAxis.y,MapCoordsYAxis.z)); + vec3 N = normalize(vec3(MapCoordsZAxis.x,MapCoordsZAxis.y,MapCoordsZAxis.z)); //SurfNormals. - // TBN must have right handed coord system. - if (dot(cross(N, T), B) < 0.0) - T = T * -1.0; + // TBN must have right handed coord system. + //if (dot(cross(N, T), B) < 0.0) + // T = T * -1.0; - TBNMat = transpose(mat3(T, B, N)); + vTBNMat = transpose(mat3(T, B, N)); + + vTangentViewPos = vTBNMat * EyeSpacePos.xyz; + vTangentFragPos = vTBNMat * Coords.xyz; + } +#endif - Surface_Normal = MapCoordsZAxis; +#if EDITOR + vSurfaceNormal = MapCoordsZAxis; +#endif - // Normals - vNormals = Normals.xyz; + gl_Position = modelviewprojMat * vec4(Coords.xyz, 1.0); + +#if SUPPORTSCLIPDISTANCE + uint ClipIndex = uint(ClipParams.x); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,Coords.xyz); +#endif // SUPPORTSCLIPDISTANCE +} +#else +void main (void) +{ - uint ClipIndex = uint(ClipParams.x); + vEyeSpacePos = modelviewMat*vec4(Coords.xyz, 1.0); + // Point Coords + vCoords = Coords.xyz; - gl_Position = modelviewprojMat * vec4(Coords, 1.0); - gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,Coords); -} + vTexCoords = vec2(0.0, 0.0); +#if BINDLESSTEXTURES +// BaseTexNum = uint(TexNums0.x); +#endif + gl_Position = modelviewprojMat * vec4(Coords.xyz, 1.0); + } +#endif diff --git a/System/xopengl/DrawGouraud.frag b/System/xopengl/DrawGouraud.frag index 41c7d7f..9756cde 100644 --- a/System/xopengl/DrawGouraud.frag +++ b/System/xopengl/DrawGouraud.frag @@ -1,394 +1,455 @@ -/*============================================================================= - Fragmentshader for DrawGouraudPolygon, in 227 also DrawGouraudPolygonList. - - Revision history: - * Created by Smirftsch -=============================================================================*/ - -uniform sampler2D Texture0; // Base Texture -uniform sampler2D Texture1; // DetailTexture -uniform sampler2D Texture2; // BumpMap -uniform sampler2D Texture3; // MacroTex - -uniform vec4 DrawColor; -uniform uint PolyFlags; -uniform uint RendMap; -uniform bool bHitTesting; -uniform float Gamma; -uniform bool DrawGouraudFog;//VertexFog - -in vec4 gTexUV; // + MacrotexUV -in vec2 gDetailTexUV; -in vec3 gCoords; -in vec2 gTexCoords; // TexCoords -in vec4 gNormals; -in vec4 gEyeSpacePos; -in vec4 gLightColor; -in vec4 gFogColor; //VertexFog -in vec4 gLightSpacePos; -in vec4 gTextureInfo; //Additional texture info: TextureDiffuse, BumpTextureSpecular, bMacroTex, MacroTexNum -flat in uint gTexNum; -flat in uint gDetailTexNum; +/*============================================================================= + Fragmentshader for DrawGouraudPolygon, in 227 also DrawGouraudPolygonList. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +#if BINDLESSTEXTURES +layout(std140) uniform TextureHandles +{ + sampler2D Textures[NUMTEXTURES]; +}; +#endif + +uniform sampler2D Texture0; // Base Texture +uniform sampler2D Texture1; // DetailTexture +uniform sampler2D Texture2; // BumpMap +uniform sampler2D Texture3; // MacroTex + +in vec3 gCoords; +in vec2 gTexCoords; // TexCoords +in vec2 gDetailTexCoords; +in vec2 gMacroTexCoords; +in vec4 gNormals; +in vec4 gEyeSpacePos; +in vec4 gLightColor; +in vec4 gFogColor; //VertexFog +flat in vec3 gTextureInfo; // diffuse, alpha, bumpmap specular +flat in uint gTexNum; +flat in uint gDetailTexNum; flat in uint gBumpTexNum; +flat in uint gMacroTexNum; flat in uint gDrawFlags; -flat in uint gTextureFormat; -in mat3 TBNMat; - -out vec4 FragColor; - -vec3 rgb2hsv(vec3 c) -{ - // some nice stuff from http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl - vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); - vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); - vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); - - float d = q.x - min(q.w, q.y); - float e = 1.0e-10; - return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); -} - -vec3 hsv2rgb(vec3 c) -{ - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); -} - -void main(void) -{ - vec4 TotalColor = vec4(0.0,0.0,0.0,0.0); - vec4 Color; - - vec2 texCoords = gTexCoords; - - int NumLights = int(LightData4[0].y); - mat3 InFrameCoords = mat3(FrameCoords[1].xyz, FrameCoords[2].xyz, FrameCoords[3].xyz); // TransformPointBy... - mat3 InFrameUncoords = mat3(FrameUncoords[1].xyz, FrameUncoords[2].xyz, FrameUncoords[3].xyz); - - #ifdef BINDLESSTEXTURES - if (gTexNum > 0u) - Color = texture(Textures[uint(gTexNum)], (texCoords*gTexUV.xy)); - else Color = texture(Texture0, (texCoords*gTexUV.xy)); - #else - Color = texture(Texture0, (texCoords*gTexUV.xy)); - #endif - - if (gTextureInfo.x > 0.0) +flat in uint gTextureFormat; +flat in uint gPolyFlags; +flat in float gGamma; +flat in vec4 gDistanceFogColor; +flat in vec4 gDistanceFogInfo; +in vec3 gTangentViewPos; +in vec3 gTangentFragPos; +in mat3 gTBNMat; + +#if EDITOR +flat in vec4 gDrawColor; +flat in uint gRendMap; +flat in uint gHitTesting; +#endif + +#ifdef GL_ES +layout ( location = 0 ) out vec4 FragColor; +# if SIMULATEMULTIPASS +layout ( location = 1 ) out vec4 FragColor1; +#endif +#else +# if SIMULATEMULTIPASS +layout ( location = 0, index = 1) out vec4 FragColor1; +#endif +layout ( location = 0, index = 0) out vec4 FragColor; +#endif + +vec3 rgb2hsv(vec3 c) +{ + // some nice stuff from http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); + vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 hsv2rgb(vec3 c) +{ + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + +void main(void) +{ + mat3 InFrameCoords = mat3(FrameCoords[1].xyz, FrameCoords[2].xyz, FrameCoords[3].xyz); // TransformPointBy... + mat3 InFrameUncoords = mat3(FrameUncoords[1].xyz, FrameUncoords[2].xyz, FrameUncoords[3].xyz); + + vec4 TotalColor = vec4(0.0,0.0,0.0,0.0); + vec4 Color; + + int NumLights = int(LightData4[0].y); + +#if BINDLESSTEXTURES + if (uint(gTexNum) > 0u) + Color = texture(Textures[uint(gTexNum)], gTexCoords); + else Color = texture(Texture0, gTexCoords); +#else + Color = texture(Texture0, gTexCoords); +#endif + + #if SRGB + if((gPolyFlags & PF_Modulated)!=PF_Modulated) + { + Color.r=max(1.055 * pow(Color.r, 0.416666667) - 0.055, 0.0); + Color.g=max(1.055 * pow(Color.g, 0.416666667) - 0.055, 0.0); + Color.b=max(1.055 * pow(Color.b, 0.416666667) - 0.055, 0.0); + } + #endif + + if (gTextureInfo.x > 0.0) Color *= gTextureInfo.x; // Diffuse factor. - if (gTextureInfo.z > 0.0) - Color.a *= gTextureInfo.z; // Alpha. + if (gTextureInfo.y > 0.0) + Color.a *= gTextureInfo.y; // Alpha. if (gTextureFormat == TEXF_BC5) //BC5 (GL_COMPRESSED_RG_RGTC2) compression - Color.b = sqrt(1.0 - Color.r*Color.r + Color.g*Color.g); - - // Handle PF_Masked. - if ( (PolyFlags&PF_Masked) == PF_Masked ) - { - if(Color.a < 0.5) - discard; - else Color.rgb /= Color.a; - } - else if ( ((PolyFlags&PF_AlphaBlend) == PF_AlphaBlend) && Color.a < 0.01 ) - discard; - - vec4 LightColor; - - #ifdef HARDWARELIGHTS - float LightAdd = 0.0f; - vec4 TotalAdd = vec4(0.0,0.0,0.0,0.0); - - for (int i=0; i < NumLights; i++) - { - float WorldLightRadius = LightData4[i].x; - float LightRadius = LightData2[i].w; - float RWorldLightRadius = WorldLightRadius*WorldLightRadius; - - vec3 InLightPos = ((LightPos[i].xyz - FrameCoords[0].xyz)*InFrameCoords); // Frame->Coords. - float dist = distance(gCoords, InLightPos); - - if (dist < RWorldLightRadius) - { - // Light color - vec3 RGBColor = vec3(LightData1[i].x,LightData1[i].y,LightData1[i].z); - - float MinLight = 0.025; - float b = WorldLightRadius / (RWorldLightRadius * MinLight); - float attenuation = WorldLightRadius / (dist+b*dist*dist); - - //float attenuation = 0.82*(1.0-smoothstep(LightRadius,24.0*LightRadius+0.50,dist)); - - TotalAdd += (vec4(RGBColor,1.0) * attenuation); - } - } - LightColor = TotalAdd; - #else - LightColor = gLightColor; - #endif - - // Handle PF_RenderFog. - if ((PolyFlags&PF_RenderFog) == PF_RenderFog) - { - // Handle PF_RenderFog|PF_Modulated. - if ( (PolyFlags&PF_Modulated)== PF_Modulated ) - { - // Compute delta to modulation identity. - vec3 Delta = vec3(0.5) - Color.xyz; - - // Reduce delta by (squared) fog intensity. - //Delta *= 1.0 - sqrt(gFogColor.a); - Delta *= 1.0 - gFogColor.a; - Delta *= vec3(1.0) - gFogColor.rgb; - - TotalColor = vec4(vec3(0.5)-Delta,Color.a); - } - // Normal. - else - { - Color*=LightColor; - //TotalColor=mix(Color, vec4(gFogColor.xyz,1.0), gFogColor.w); - TotalColor.rgb = Color.rgb * (1.0-gFogColor.a) + gFogColor.rgb; - TotalColor.a = Color.a; - } - - } - // No Fog. - else if((PolyFlags & PF_Modulated) == PF_Modulated) - { - TotalColor = Color; - } - else - { - TotalColor = Color * vec4(LightColor.rgb,1.0); - } - - - float bNear = clamp(1.0-(gCoords.z/380.0),0.0,1.0); - if( ((gDrawFlags & DF_DetailTexture) == DF_DetailTexture) && bNear > 0.0) - { - vec4 DetailTexColor; - #ifdef BINDLESSTEXTURES - if (gDetailTexNum > 0u) - DetailTexColor = texture(Textures[gDetailTexNum], (gTexCoords*gDetailTexUV)); - else - DetailTexColor = texture(Texture1, (gTexCoords*gDetailTexUV)); // DetailTexture - #else - DetailTexColor = texture(Texture1, (gTexCoords*gDetailTexUV)); // DetailTexture - #endif - vec3 hsvDetailTex = rgb2hsv(DetailTexColor.rgb); - hsvDetailTex.b += (DetailTexColor.r - 0.1); - hsvDetailTex = hsv2rgb(hsvDetailTex); - DetailTexColor=vec4(hsvDetailTex,0.0); - DetailTexColor = mix(vec4(1.0,1.0,1.0,1.0), DetailTexColor, bNear); //fading out. - TotalColor*=DetailTexColor; - } - - if ((gDrawFlags & DF_MacroTexture) == DF_MacroTexture) - { - vec4 MacroTexColor; - #ifdef BINDLESSTEXTURES - if (gDetailTexNum > 0u) - MacroTexColor = texture(Textures[uint(gTextureInfo.w)], (gTexCoords*gTexUV.zw)); - else - MacroTexColor = texture(Texture3, (gTexCoords*gTexUV.zw)); // MacroTexture - #else - MacroTexColor = texture(Texture3, (gTexCoords*gTexUV.zw)); // MacroTexture - #endif - vec3 hsvMacroTex = rgb2hsv(MacroTexColor.rgb); - hsvMacroTex.b += (MacroTexColor.r - 0.1); - hsvMacroTex = hsv2rgb(hsvMacroTex); - MacroTexColor=vec4(hsvMacroTex,1.0); - TotalColor*=MacroTexColor; - } - - // BumpMap - if ((gDrawFlags & DF_BumpMap) == DF_BumpMap) - { - //normal from normal map - vec3 TextureNormal; - vec3 TextureNormal_tangentspace; - - #ifdef BINDLESSTEXTURES - if (gBumpTexNum > uint(0)) - TextureNormal = texture(Textures[gBumpTexNum], gTexCoords*gTexUV.xy).rgb * 2.0 - 1.0; - else - TextureNormal = texture(Texture2, gTexCoords*gTexUV.xy).rgb * 2.0 - 1.0; - #else - TextureNormal = texture(Texture2, gTexCoords*gTexUV.xy).rgb * 2.0 - 1.0; + Color.b = sqrt(1.0 - Color.r*Color.r + Color.g*Color.g); + + // Handle PF_Masked. + if ( (gPolyFlags&PF_Masked) == PF_Masked ) + { + if(Color.a < 0.5) + discard; + else Color.rgb /= Color.a; + } + else if ( ((gPolyFlags&PF_AlphaBlend) == PF_AlphaBlend) && Color.a < 0.01 ) + discard; + + vec4 LightColor; + + #if HARDWARELIGHTS + float LightAdd = 0.0f; + vec4 TotalAdd = vec4(0.0,0.0,0.0,0.0); + + for (int i=0; i < NumLights; i++) + { + float WorldLightRadius = LightData4[i].x; + float LightRadius = LightData2[i].w; + float RWorldLightRadius = WorldLightRadius*WorldLightRadius; + + vec3 InLightPos = ((LightPos[i].xyz - FrameCoords[0].xyz)*InFrameCoords); // Frame->Coords. + float dist = distance(gCoords, InLightPos); + + if (dist < RWorldLightRadius) + { + // Light color + vec3 RGBColor = vec3(LightData1[i].x,LightData1[i].y,LightData1[i].z); + + float MinLight = 0.025; + float b = WorldLightRadius / (RWorldLightRadius * MinLight); + float attenuation = WorldLightRadius / (dist+b*dist*dist); + + //float attenuation = 0.82*(1.0-smoothstep(LightRadius,24.0*LightRadius+0.50,dist)); + + TotalAdd += (vec4(RGBColor,1.0) * attenuation); + } + } + LightColor = TotalAdd; + #else + LightColor = gLightColor; + #endif + + // Handle PF_RenderFog. + if ((gPolyFlags&PF_RenderFog) == PF_RenderFog) + { + // Handle PF_RenderFog|PF_Modulated. + if ( (gPolyFlags&PF_Modulated)== PF_Modulated ) + { + // Compute delta to modulation identity. + vec3 Delta = vec3(0.5) - Color.xyz; + + // Reduce delta by (squared) fog intensity. + //Delta *= 1.0 - sqrt(gFogColor.a); + Delta *= 1.0 - gFogColor.a; + Delta *= vec3(1.0) - gFogColor.rgb; + + TotalColor = vec4(vec3(0.5)-Delta,Color.a); + } + // Normal. + else + { + Color*=LightColor; + //TotalColor=mix(Color, vec4(gFogColor.xyz,1.0), gFogColor.w); + TotalColor.rgb = Color.rgb * (1.0-gFogColor.a) + gFogColor.rgb; + TotalColor.a = Color.a; + } + + } + // No Fog. + else if((gPolyFlags & PF_Modulated) == PF_Modulated) + { + TotalColor = Color; + } + else + { + TotalColor = Color * vec4(LightColor.rgb,1.0); + } + + +#if DETAILTEXTURES + if (((gDrawFlags & DF_DetailTexture) == DF_DetailTexture)) + { + float NearZ = gCoords.z/512.0; + float DetailScale = 1.0; + float bNear; + vec4 DetailTexColor; + vec3 hsvDetailTex; + + for(int i=0; i < DetailMax; ++i) + { + if (i > 0) + { + NearZ *= 4.223f; + DetailScale *= 4.223f; + } + bNear = clamp(0.65-NearZ,0.0,1.0); + + if (bNear > 0.0) + { + # if BINDLESSTEXTURES + if (gDetailTexNum > 0u) + DetailTexColor = texture(Textures[gDetailTexNum], gDetailTexCoords * DetailScale); + else DetailTexColor = texture(Texture1, gDetailTexCoords * DetailScale); + # else + DetailTexColor = texture(Texture1, gDetailTexCoords * DetailScale); + # endif + + vec3 hsvDetailTex = rgb2hsv(DetailTexColor.rgb); // cool idea Han :) + hsvDetailTex.b += (DetailTexColor.r - 0.1); + hsvDetailTex = hsv2rgb(hsvDetailTex); + DetailTexColor = vec4(hsvDetailTex,0.0); + DetailTexColor = mix(vec4(1.0,1.0,1.0,1.0), DetailTexColor, bNear); //fading out. + + TotalColor.rgb*=DetailTexColor.rgb; + } + } + } +#endif + + +#if MACROTEXTURES + if ((gDrawFlags & DF_MacroTexture) == DF_MacroTexture && (gDrawFlags & DF_BumpMap) != DF_BumpMap) + { + vec4 MacroTexColor; + #if BINDLESSTEXTURES + if (gMacroTexNum > 0u) + MacroTexColor = texture(Textures[gMacroTexNum], gMacroTexCoords); + else + MacroTexColor = texture(Texture3, gMacroTexCoords); // MacroTexture + #else + MacroTexColor = texture(Texture3, gMacroTexCoords); // MacroTexture #endif + vec3 hsvMacroTex = rgb2hsv(MacroTexColor.rgb); + hsvMacroTex.b += (MacroTexColor.r - 0.1); + hsvMacroTex = hsv2rgb(hsvMacroTex); + MacroTexColor=vec4(hsvMacroTex,1.0); + TotalColor*=MacroTexColor; + } +#endif + + // BumpMap +#if BUMPMAPS + if ((gDrawFlags & DF_BumpMap) == DF_BumpMap) + { + vec3 TangentViewDir = normalize( gTangentViewPos - gTangentFragPos ); + + //normal from normal map + vec3 TextureNormal; +#if BINDLESSTEXTURES + if (gBumpTexNum > uint(0)) + TextureNormal = texture(Textures[gBumpTexNum], gTexCoords).rgb * 2.0 - 1.0; + else + TextureNormal = texture(Texture2, gTexCoords).rgb * 2.0 - 1.0; +#else + TextureNormal = texture(Texture2, gTexCoords).rgb * 2.0 - 1.0; +#endif + + vec3 BumpColor; + vec3 TotalBumpColor=vec3(0.0,0.0,0.0); + + for(int i=0; iCoords. + + float dist = distance(gCoords, InLightPos); + + float MinLight = 0.05; + float b = NormalLightRadius / (NormalLightRadius * NormalLightRadius * MinLight); + float attenuation = NormalLightRadius / (dist+b*dist*dist); + + if ( (gPolyFlags&PF_Unlit) == PF_Unlit) + InLightPos=vec3(1.0,1.0,1.0); //no idea whats best here. Arbitrary value based on some tests. + + if ( (NormalLightRadius == 0.0 || (dist > NormalLightRadius) || ( bZoneNormalLight && (LightData4[i].z != LightData4[i].w))) && !bSunlight)// Do not consider if not in range or in a different zone. + continue; + + vec3 TangentLightPos = gTBNMat * InLightPos; + vec3 TangentlightDir = normalize( TangentLightPos - gTangentFragPos ); + + // ambient + vec3 ambient = 0.1 * TotalColor.xyz; + + // diffuse + float diff = max(dot(TangentlightDir, TextureNormal), 0.0); + vec3 diffuse = diff * TotalColor.xyz; + + // specular + vec3 halfwayDir = normalize(TangentlightDir + TangentViewDir); + float spec = pow(max(dot(TextureNormal, halfwayDir), 0.0), 8.0); + vec3 specular = vec3(0.01) * spec * CurrentLightColor * LightBrightness; + + TotalBumpColor += (ambient + diffuse + specular) * attenuation; + + } + TotalColor+=vec4(clamp(TotalBumpColor,0.0,1.0),1.0); + } +#endif + - TextureNormal.b = sqrt(1.0 - TextureNormal.r*TextureNormal.r + TextureNormal.g*TextureNormal.g); - - TextureNormal_tangentspace = TextureNormal; - - vec3 BumpColor; - vec3 TotalBumpColor=vec3(0.0,0.0,0.0); - vec3 EyeDirection_tangentspace = TBNMat * gEyeSpacePos.xyz; - - for(int i=0; iCoords. - float dist = distance(gCoords, InLightPos); - - float MinLight = 0.05; - float b = NormalLightRadius / (NormalLightRadius * NormalLightRadius * MinLight); - float attenuation = NormalLightRadius / (dist+b*dist*dist); - - if ( (PolyFlags&PF_Unlit) == PF_Unlit) - InLightPos=vec3(1.0,1.0,1.0); //no idea whats best here. Arbitrary value based on some tests. - - if ( (NormalLightRadius == 0.0 || (dist > NormalLightRadius) || ( bZoneNormalLight && (LightData4[i].z != LightData4[i].w))) && !bSunlight)// Do not consider if not in range or in a different zone. - continue; - - vec3 LightPosition_cameraspace = ( viewMat * vec4(InLightPos,1)).xyz; - vec3 LightDirection_cameraspace = gEyeSpacePos.xyz - LightPosition_cameraspace; - vec3 LightDirection_tangentspace = TBNMat * LightDirection_cameraspace; - - vec3 LightDir = normalize(LightDirection_tangentspace); - // Cosine of the angle between the normal and the light direction, - // clamped above 0 - // - light is at the vertical of the triangle -> 1 - // - light is perpendicular to the triangle -> 0 - // - light is behind the triangle -> 0 - float cosTheta = clamp( dot( TextureNormal_tangentspace, LightDir ), 0.0,1.0 ); - - vec3 E = normalize(EyeDirection_tangentspace); - // Direction in which the triangle reflects the light - vec3 R = reflect(-LightDir,TextureNormal_tangentspace); - // Cosine of the angle between the Eye vector and the Reflect vector, - // clamped to 0 - // - Looking into the reflection -> 1 - // - Looking elsewhere -> < 1 - float cosAlpha = clamp( dot( E,R ), 0.0,1.0 ); - - vec3 LightColor = vec3(LightData1[i].x,LightData1[i].y,LightData1[i].z); - vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * Color.xyz; - - if (gTextureInfo.y > 0.0) // Specular - TotalBumpColor += (MaterialAmbientColor + Color.xyz * LightColor * cosTheta * pow(cosAlpha,gTextureInfo.y)) * attenuation; - else - TotalBumpColor += (MaterialAmbientColor + Color.xyz * LightColor * cosTheta) * attenuation; - - } - if (TotalBumpColor.x != 0.0 || TotalBumpColor.y != 0.0 || TotalBumpColor.z != 0.0) //no light close enough. - TotalColor*=vec4(clamp(TotalBumpColor,0.0,1.0),1.0); - } - - - // Add DistanceFog - if (DistanceFogValues.w >= 0.0) + // Add DistanceFog +#if ENGINE_VERSION==227 + if (gDistanceFogInfo.w >= 0.0) { FogParameters DistanceFogParams; - DistanceFogParams.FogStart = DistanceFogValues.x; - DistanceFogParams.FogEnd = DistanceFogValues.y; - DistanceFogParams.FogDensity = DistanceFogValues.z; - DistanceFogParams.FogMode = int(DistanceFogValues.w); + DistanceFogParams.FogStart = gDistanceFogInfo.x; + DistanceFogParams.FogEnd = gDistanceFogInfo.y; + DistanceFogParams.FogDensity = gDistanceFogInfo.z; + DistanceFogParams.FogMode = int(gDistanceFogInfo.w); - if ( (PolyFlags&PF_Modulated) == PF_Modulated ) + if ( (gPolyFlags&PF_Modulated) == PF_Modulated ) DistanceFogParams.FogColor = vec4(0.5,0.5,0.5,0.0); - else if ( (PolyFlags&PF_Translucent) == PF_Translucent && (PolyFlags&PF_Environment) != PF_Environment) + else if ( (gPolyFlags&PF_Translucent) == PF_Translucent && (gPolyFlags&PF_Environment) != PF_Environment) DistanceFogParams.FogColor = vec4(0.0,0.0,0.0,0.0); - else DistanceFogParams.FogColor = DistanceFogColor; + else DistanceFogParams.FogColor = gDistanceFogColor; DistanceFogParams.FogCoord = abs(gEyeSpacePos.z/gEyeSpacePos.w); TotalColor = mix(TotalColor, DistanceFogParams.FogColor, getFogFactor(DistanceFogParams)); } +#endif + + if((gPolyFlags & PF_Modulated)!=PF_Modulated) + { +#if EDITOR + // Gamma + float InGamma = gGamma*GammaMultiplierUED; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#else + // Gamma + float InGamma = gGamma*GammaMultiplier; // gGamma is a value from 0.1 to 1.0 + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#endif + } + +#if EDITOR + // Editor support. + if (gRendMap == REN_Zones || gRendMap == REN_PolyCuts || gRendMap == REN_Polys || gRendMap==REN_PlainTex) + { + TotalColor = Color; + + if ( (gPolyFlags&PF_Selected) == PF_Selected ) + { + TotalColor.r = (TotalColor.r*0.75); + TotalColor.g = (TotalColor.g*0.75); + TotalColor.b = (TotalColor.b*0.75) + 0.1; + TotalColor = clamp(TotalColor,0.0,1.0); + if(TotalColor.a < 0.5) + TotalColor.a = 0.51; + } + } + else if ( gRendMap==REN_Normals ) + { + // Dot. + float T = 0.5*dot(normalize(gCoords),gNormals.xyz); + + // Selected. + if ( (gPolyFlags&PF_Selected)==PF_Selected ) + { + TotalColor = vec4(0.0,0.0,abs(T),1.0); + } + // Normal. + else + { + TotalColor = vec4(max(0.0,T),max(0.0,-T),0.0,1.0); + } + } + + // HitSelection, Zoneview etc. + if (bool(gHitTesting)) + TotalColor = gDrawColor; // Use DrawColor. + + // Texture.Alpha support. + if ( (gPolyFlags&PF_AlphaBlend) == PF_AlphaBlend && gDrawColor.a > 0.0 ) + TotalColor.a *= gDrawColor.a; +#endif + +# if SIMULATEMULTIPASS + if((gPolyFlags & PF_Modulated) == PF_Modulated) + { + FragColor = TotalColor; + FragColor1 = (vec4(1.0,1.0,1.0,1.0)-TotalColor); + } + else + { + FragColor = TotalColor; + FragColor1 = (vec4(1.0,1.0,1.0,1.0)-TotalColor)*LightColor; + } +#else + FragColor = TotalColor; +#endif + +} + +// Blending translation table +/* +//PF_Modulated +//glBlendFunc( GL_DST_COLOR, GL_SRC_COLOR ); +//pixel_color * gl_FragColor + +GL_ONE vec4(1.0) +GL_ZERO vec4(0.0) +GL_SRC_COLOR gl_FragColor +GL_SRC_ALPHA vec4(gl_FragColor.a) +GL_DST_COLOR pixel_color +GL_DST_ALPHA vec4(pixel_color.a) +GL_ONE_MINUS_SRC_COLOR vec4(1.0) - gl_FragColor +GL_ONE_MINUS_SRC_ALPHA vec4(1.0 - gl_FragColor.a) +GL_ONE_MINUS_DST_COLOR vec4(1.0) - pixel_color +GL_ONE_MINUS_DST_ALPHA vec4(1.0 - pixel_color.a) + +if (gPolyFlags & PF_Invisible) + glBlendFunc(GL_ZERO, GL_ONE); + +if (gPolyFlags & PF_Translucent) + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); + +if (gPolyFlags & PF_Modulated) + glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); + +if (gPolyFlags & PF_AlphaBlend) + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - if((PolyFlags & PF_Modulated)!=PF_Modulated) - { - // Gamma -#ifdef GL_ES - // 1.055*pow(x,(1.0 / 2.4) ) - 0.055 - // FixMe: ugly rough srgb to linear conversion. - TotalColor.r=(1.055*pow(TotalColor.r,(1.0-Gamma / 2.4))-0.055); - TotalColor.g=(1.055*pow(TotalColor.g,(1.0-Gamma / 2.4))-0.055); - TotalColor.b=(1.055*pow(TotalColor.b,(1.0-Gamma / 2.4))-0.055); -#else - TotalColor.r=pow(TotalColor.r,2.7-Gamma*1.7); - TotalColor.g=pow(TotalColor.g,2.7-Gamma*1.7); - TotalColor.b=pow(TotalColor.b,2.7-Gamma*1.7); -#endif - } - -#ifdef EDITOR - // Editor support. - if (RendMap == REN_Zones || RendMap == REN_PolyCuts || RendMap == REN_Polys || RendMap==REN_PlainTex) - { - TotalColor = Color; - - if ( (PolyFlags&PF_Selected) == PF_Selected ) - { - TotalColor.r = (TotalColor.r*0.75); - TotalColor.g = (TotalColor.g*0.75); - TotalColor.b = (TotalColor.b*0.75) + 0.1; - TotalColor = clamp(TotalColor,0.0,1.0); - if(TotalColor.a < 0.5) - TotalColor.a = 0.51; - } - } - else if ( RendMap==REN_Normals ) - { - // Dot. - float T = 0.5*dot(normalize(gCoords),gNormals.xyz); - - // Selected. - if ( (PolyFlags&PF_Selected)==PF_Selected ) - { - TotalColor = vec4(0.0,0.0,abs(T),1.0); - } - // Normal. - else - { - TotalColor = vec4(max(0.0,T),max(0.0,-T),0.0,1.0); - } - } - - // HitSelection, Zoneview etc. - if (bHitTesting) - TotalColor = DrawColor; // Use DrawColor. -#endif - - // Texture.Alpha support. - if ( (PolyFlags&PF_AlphaBlend) == PF_AlphaBlend && DrawColor.a > 0.0 ) - TotalColor.a *= DrawColor.a; - - FragColor = TotalColor; -} - -// Blending translation table -/* -//PF_Modulated -//glBlendFunc( GL_DST_COLOR, GL_SRC_COLOR ); -//pixel_color * gl_FragColor - -GL_ONE vec4(1.0) -GL_ZERO vec4(0.0) -GL_SRC_COLOR gl_FragColor -GL_SRC_ALPHA vec4(gl_FragColor.a) -GL_DST_COLOR pixel_color -GL_DST_ALPHA vec4(pixel_color.a) -GL_ONE_MINUS_SRC_COLOR vec4(1.0) - gl_FragColor -GL_ONE_MINUS_SRC_ALPHA vec4(1.0 - gl_FragColor.a) -GL_ONE_MINUS_DST_COLOR vec4(1.0) - pixel_color -GL_ONE_MINUS_DST_ALPHA vec4(1.0 - pixel_color.a) - -if (PolyFlags & PF_Invisible) - glBlendFunc(GL_ZERO, GL_ONE); - -if (PolyFlags & PF_Translucent) - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); - -if (PolyFlags & PF_Modulated) - glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); - -if (PolyFlags & PF_AlphaBlend) - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - -if (PolyFlags & PF_Highlighted) - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); -*/ +if (gPolyFlags & PF_Highlighted) + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); +*/ diff --git a/System/xopengl/DrawGouraud.geo b/System/xopengl/DrawGouraud.geo index 919bf83..b746d46 100644 --- a/System/xopengl/DrawGouraud.geo +++ b/System/xopengl/DrawGouraud.geo @@ -1,105 +1,144 @@ -/*============================================================================= - Geometryshader for DrawGouraud - - For BumpMap (normal map), tangent and bitangent calculation. - Read https://wiki.delphigl.com/index.php/TBN_Matrix - - Revision history: - * Created by Smirftsch -=============================================================================*/ - -layout(triangles) in; -layout(triangle_strip, max_vertices=3) out; - -flat in uint vTexNum[]; -flat in uint vDetailTexNum[]; -flat in uint vBumpTexNum[]; -flat in uint vDrawFlags[]; -flat in uint vTextureFormat[]; - -in vec4 vTexUV[]; -in vec2 vTexCoords[]; -in vec3 vCoords[]; -in vec4 vNormals[]; -in vec4 vEyeSpacePos[]; -in vec4 vLightColor[]; -in vec4 vFogColor[]; -in vec4 vDistanceFogColor[]; -in vec2 vDetailTexUV[]; -in vec4 vLightSpacePos[]; -in vec4 vTextureInfo[]; - -flat out uint gTexNum; -flat out uint gDetailTexNum; -flat out uint gBumpTexNum; -flat out uint gDrawFlags; -flat out uint gTextureFormat; - -out vec4 gTexUV; -out vec2 gTexCoords; -out vec3 gCoords; -out vec4 gNormals; -out vec4 gEyeSpacePos; -out vec4 gLightColor; -out vec4 gFogColor; -out vec2 gDetailTexUV; -out vec4 gLightSpacePos; -out vec4 gTextureInfo; -out mat3 TBNMat; +/*============================================================================= + Geometryshader for DrawGouraud + + For BumpMap (normal map), tangent and bitangent calculation. + Read https://wiki.delphigl.com/index.php/TBN_Matrix + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; + +flat in uint vTexNum[]; +flat in uint vDetailTexNum[]; +flat in uint vBumpTexNum[]; +flat in uint vMacroTexNum[]; +flat in uint vDrawFlags[]; +flat in uint vTextureFormat[]; +flat in uint vPolyFlags[]; +flat in float vGamma[]; + +flat in vec3 vTextureInfo[]; // diffuse, alpha, bumpmap specular +flat in vec4 vDistanceFogColor[]; +flat in vec4 vDistanceFogInfo[]; + +#if EDITOR +flat in vec4 vDrawColor[]; +flat in uint vRendMap[]; +flat in uint vHitTesting[]; +#endif + +in vec3 vCoords[]; +in vec4 vNormals[]; +in vec2 vTexCoords[]; +in vec2 vDetailTexCoords[]; +in vec2 vMacroTexCoords[]; +in vec4 vEyeSpacePos[]; +in vec4 vLightColor[]; +in vec4 vFogColor[]; + +flat out uint gTexNum; +flat out uint gDetailTexNum; +flat out uint gBumpTexNum; +flat out uint gMacroTexNum; +flat out uint gDrawFlags; +flat out uint gTextureFormat; +flat out uint gPolyFlags; +flat out float gGamma; + +out vec3 gCoords; +out vec4 gNormals; +out vec2 gTexCoords; +out vec2 gDetailTexCoords; +out vec2 gMacroTexCoords; +out vec4 gEyeSpacePos; +out vec4 gLightColor; +out vec4 gFogColor; + +out mat3 gTBNMat; +out vec3 gTangentViewPos; +out vec3 gTangentFragPos; + +flat out vec3 gTextureInfo; +flat out vec4 gDistanceFogColor; +flat out vec4 gDistanceFogInfo; +#if EDITOR +flat out vec4 gDrawColor; +flat out uint gRendMap; +flat out uint gHitTesting; +#endif + out float gl_ClipDistance[MAX_CLIPPINGPLANES]; - -vec3 GetTangent(vec3 A, vec3 B, vec3 C, vec2 Auv, vec2 Buv, vec2 Cuv) -{ - float Bv_Cv = Buv.y - Cuv.y; - if(Bv_Cv == 0.0) - return (B-C)/(Buv.x-Cuv.x); - - float Quotient = (Auv.y - Cuv.y)/(Bv_Cv); - vec3 D = C + (B -C) * Quotient; - vec2 Duv = Cuv + (Buv-Cuv) * Quotient; - return (D-A)/(Duv.x - Auv.x); -} -vec3 GetBitangent(vec3 A, vec3 B, vec3 C, vec2 Auv, vec2 Buv, vec2 Cuv) -{ - return GetTangent(A, C, B, Auv.yx, Cuv.yx, Buv.yx); -} - -void main(void) -{ - vec3 Tangent = GetTangent(vCoords[0], vCoords[1], vCoords[2], vTexCoords[0], vTexCoords[1], vTexCoords[2]); - vec3 Bitangent = GetBitangent(vCoords[0], vCoords[1], vCoords[2], vTexCoords[0], vTexCoords[1], vTexCoords[2]); - uint ClipIndex = uint(ClipParams.x); - - for(int i=0; i<3; ++i) - { - mat4 vmodelviewprojMat = projMat * viewMat * modelMat; - - vec3 T = normalize(vec3(modelMat[i] * vec4(Tangent,0.0))); - vec3 B = normalize(vec3(modelMat[i] * vec4(Bitangent,0.0))); - vec3 N = normalize(vec3(modelMat[i] * vNormals[i])); - // TBN must have right handed coord system. - if (dot(cross(N, T), B) < 0.0) - T = T * -1.0; - TBNMat = mat3(T, B, N); - - gEyeSpacePos = vEyeSpacePos[i]; - gLightColor = vLightColor[i]; - gFogColor = vFogColor[i]; - gTexUV = vTexUV[i]; - gDetailTexUV = vDetailTexUV[i]; - gNormals = vNormals[i]; - gTexCoords = vTexCoords[i]; - gCoords = vCoords[i]; - gTexNum = vTexNum[i]; - gDetailTexNum = vDetailTexNum[i]; - gBumpTexNum = vBumpTexNum[i]; - gLightSpacePos = vLightSpacePos[i]; - gTextureInfo = vTextureInfo[i]; - gDrawFlags = vDrawFlags[i]; - gTextureFormat = vTextureFormat[i]; - - gl_Position = vmodelviewprojMat * gl_in[i].gl_Position; - gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[i]);// - EmitVertex(); - } -} + +vec3 GetTangent(vec3 A, vec3 B, vec3 C, vec2 Auv, vec2 Buv, vec2 Cuv) +{ + float Bv_Cv = Buv.y - Cuv.y; + if(Bv_Cv == 0.0) + return (B-C)/(Buv.x-Cuv.x); + + float Quotient = (Auv.y - Cuv.y)/(Bv_Cv); + vec3 D = C + (B -C) * Quotient; + vec2 Duv = Cuv + (Buv-Cuv) * Quotient; + return (D-A)/(Duv.x - Auv.x); +} +vec3 GetBitangent(vec3 A, vec3 B, vec3 C, vec2 Auv, vec2 Buv, vec2 Cuv) +{ + return GetTangent(A, C, B, Auv.yx, Cuv.yx, Buv.yx); +} + +void main(void) +{ + mat3 InFrameCoords = mat3(FrameCoords[1].xyz, FrameCoords[2].xyz, FrameCoords[3].xyz); // TransformPointBy... + mat3 InFrameUncoords = mat3(FrameUncoords[1].xyz, FrameUncoords[2].xyz, FrameUncoords[3].xyz); + + vec3 Tangent = GetTangent(vCoords[0], vCoords[1], vCoords[2], vTexCoords[0], vTexCoords[1], vTexCoords[2]); + vec3 Bitangent = GetBitangent(vCoords[0], vCoords[1], vCoords[2], vTexCoords[0], vTexCoords[1], vTexCoords[2]); + uint ClipIndex = uint(ClipParams.x); + + for(int i=0; i<3; ++i) + { + vec3 T = normalize(vec3(modelMat * vec4(Tangent,0.0))); + vec3 B = normalize(vec3(modelMat * vec4(Bitangent,0.0))); + vec3 N = normalize(vec3(modelMat * vNormals[i])); + + // TBN must have right handed coord system. + //if (dot(cross(N, T), B) < 0.0) + // T = T * -1.0; + + gTBNMat = mat3(T, B, N); + + gEyeSpacePos = vEyeSpacePos[i]; + gLightColor = vLightColor[i]; + gFogColor = vFogColor[i]; + gNormals = vNormals[i]; + gTexCoords = vTexCoords[i]; + gDetailTexCoords = vDetailTexCoords[i]; + gMacroTexCoords = vMacroTexCoords[i]; + gCoords = vCoords[i]; + gTexNum = vTexNum[i]; + gDetailTexNum = vDetailTexNum[i]; + gBumpTexNum = vBumpTexNum[i]; + gMacroTexNum = vMacroTexNum[i]; + gTextureInfo = vTextureInfo[i]; + gDrawFlags = vDrawFlags[i]; + gPolyFlags = vPolyFlags[i]; + gGamma = vGamma[i]; + gTextureFormat = vTextureFormat[i]; + gDistanceFogColor = vDistanceFogColor[i]; + gDistanceFogInfo = vDistanceFogInfo[i]; + + gTangentViewPos = gTBNMat * normalize(FrameCoords[0].xyz); + gTangentFragPos = gTBNMat * gCoords.xyz; + +#if EDITOR + gDrawColor = vDrawColor[i]; + gRendMap = vRendMap[i]; + gHitTesting = vHitTesting[i]; +#endif + gl_Position = modelviewprojMat * gl_in[i].gl_Position; + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[i]); + EmitVertex(); + } +} diff --git a/System/xopengl/DrawGouraud.vert b/System/xopengl/DrawGouraud.vert index c47937c..2ae5757 100644 --- a/System/xopengl/DrawGouraud.vert +++ b/System/xopengl/DrawGouraud.vert @@ -1,140 +1,233 @@ -/*============================================================================= - Vertexshader for DrawGouraudPolygon, in 227 also DrawGouraudPolygonList. - - Revision history: - * Created by Smirftsch -=============================================================================*/ - -layout (location = 0) in vec3 Coords; // == gl_Vertex -layout (location = 1) in vec4 Normals; // Normals -layout (location = 2) in vec2 TexCoords; // TexCoords -layout (location = 3) in vec2 LightMapCoords; -layout (location = 4) in vec4 FogColor; -layout (location = 5) in vec4 TextureInfo; //.z == TextureAlpha , .w ==MacroTexNum -layout (location = 7) in vec4 LightColor; -layout (location = 8) in vec3 TexNum; -layout (location = 9) in vec4 TexUV; // + MacroTexUV -layout (location = 10) in vec4 DetailTexUV; // + Format, DrawFlags - -#ifdef GL_ES -//No geometry shader in GL_ES. - -flat out uint gTexNum; -flat out uint gDetailTexNum; +/*============================================================================= + Vertexshader for DrawGouraudPolygon, in 227 also DrawGouraudPolygonList. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +// DrawGouraud DrawData Indices +const uint IDX_DIFFUSE_INFO = 0u; +const uint IDX_DETAIL_MACRO_INFO = 1u; +const uint IDX_MISC_INFO = 2u; +const uint IDX_EDITOR_DRAWCOLOR = 3u; +const uint IDX_DISTANCE_FOG_COLOR = 4u; +const uint IDX_DISTANCE_FOG_INFO = 5u; + +layout (location = 0) in vec3 Coords; // == gl_Vertex +layout (location = 1) in vec3 Normals; // Normals +layout (location = 2) in vec2 TexCoords; // TexCoords +layout (location = 3) in vec4 LightColor; +layout (location = 4) in vec4 FogColor; + +#ifdef GL_ES +//No geometry shader in GL_ES. + +flat out uint gTexNum; +flat out uint gDetailTexNum; flat out uint gBumpTexNum; +flat out uint gMacroTexNum; flat out uint gDrawFlags; -flat out uint gTextureFormat; - -out vec4 gTexUV; -out vec2 gTexCoords; -out vec3 gCoords; -out vec4 gNormals; -out vec4 gEyeSpacePos; -out vec4 gLightColor; -out vec4 gFogColor; -out vec2 gDetailTexUV; -out vec4 gTextureInfo; -out mat3 TBNMat; -out mat4 gviewMat; -out float gl_ClipDistance[MAX_CLIPPINGPLANES]; - -#else +flat out uint gTextureFormat; +flat out uint gPolyFlags; +flat out float gGamma; + +flat out vec3 gTextureInfo; // diffuse, alpha, bumpmap specular +flat out vec4 gDistanceFogColor; +flat out vec4 gDistanceFogInfo; + +out vec3 gCoords; +out vec4 gNormals; +out vec2 gTexCoords; +out vec2 gDetailTexCoords; +out vec2 gMacroTexCoords; +out vec4 gEyeSpacePos; +out vec4 gLightColor; +out vec4 gFogColor; +out mat3 gTBNMat; +out vec3 gTangentViewPos; +out vec3 gTangentFragPos; + +# if EDITOR +flat out vec4 gDrawColor; +flat out uint gRendMap; +flat out uint gHitTesting; +# endif + +uniform vec4 DrawData[6]; +uniform uint TexNum[4]; +uniform uint DrawFlags[4]; + +#else // GL_ES + +# if SHADERDRAWPARAMETERS +struct DrawGouraudShaderDrawParams +{ + vec4 DiffuseInfo; // 0 + vec4 DetailMacroInfo; // 1 + vec4 MiscInfo; // 2 + vec4 DrawColor; // 3 + vec4 DistanceFogColor; // 4 + vec4 DistanceFogInfo; // 5 + uvec4 TexNum; + uvec4 DrawFlags; +}; + +layout(std430, binding = 7) buffer AllDrawGouraudShaderDrawParams +{ + DrawGouraudShaderDrawParams DrawGouraudParams[]; +}; +# else +uniform vec4 DrawData[6]; +uniform uint TexNum[4]; +uniform uint DrawFlags[4]; +# endif + flat out uint vTexNum; -flat out uint vDetailTexNum; +flat out uint vDetailTexNum; flat out uint vBumpTexNum; +flat out uint vMacroTexNum; flat out uint vDrawFlags; -flat out uint vTextureFormat; - -out vec2 vTexCoords; -out vec3 vCoords; -out vec4 vNormals; -out vec4 vEyeSpacePos; -out vec4 vLightColor; -out vec4 vFogColor; -out vec4 vTexUV; -out vec2 vDetailTexUV; -out vec4 vLightSpacePos; -out vec4 vTextureInfo; -out mat4 vprojMat; -out mat4 vmodelMat; -out mat4 vviewMat; +flat out uint vTextureFormat; +flat out uint vPolyFlags; +flat out float vGamma; + +flat out vec3 vTextureInfo; // diffuse, alpha, bumpmap specular +flat out vec4 vDistanceFogColor; +flat out vec4 vDistanceFogInfo; + +out vec3 vCoords; +out vec4 vNormals; +out vec2 vTexCoords; +out vec2 vDetailTexCoords; +out vec2 vMacroTexCoords; +out vec4 vEyeSpacePos; +out vec4 vLightColor; +out vec4 vFogColor; + +# if EDITOR +flat out vec4 vDrawColor; +flat out uint vRendMap; +flat out uint vHitTesting; +# endif + #endif -void main(void) -{ - mat4 modelviewMat = modelMat * viewMat; - mat4 modelviewprojMat = projMat * viewMat * modelMat; - -#ifdef GL_ES - - gEyeSpacePos = modelviewMat*vec4(Coords, 1.0); - - // Point Coords - gCoords = Coords; - - //Texture UV to fragment - gTexCoords=TexCoords; - - gLightColor = LightColor; - gFogColor = FogColor; - gTexUV = TexUV; - gDetailTexUV = DetailTexUV.xy; - gNormals = Normals; - - gTexNum = uint(TexNum.x); - gDetailTexNum = uint(TexNum.y); - gBumpTexNum = uint(TexNum.z); - gTextureFormat = uint(DetailTexUV.z); - gDrawFlags = uint(DetailTexUV.w); - - gTextureInfo = TextureInfo; - - gviewMat = viewMat; - - vec3 T = vec3(1.0,1.0,1.0); //Arbitrary. - vec3 B = vec3(1.0,1.0,1.0); //Replace with actual values extracted from mesh generation some day. - vec3 N = normalize(Normals.xyz); //Normals. - - // TBN must have right handed coord system. - if (dot(cross(N, T), B) < 0.0) - T = T * -1.0; - - TBNMat = transpose(mat3(T, B, N)); +void main(void) +{ +#ifdef GL_ES + gEyeSpacePos = modelviewMat*vec4(Coords, 1.0); + + gCoords = Coords; + gNormals = vec4(Normals.xyz, 0); + gTexCoords = TexCoords * DrawData[IDX_DIFFUSE_INFO].xy; + gDetailTexCoords = TexCoords * DrawData[IDX_DETAIL_MACRO_INFO].xy; + gMacroTexCoords = TexCoords * DrawData[IDX_DETAIL_MACRO_INFO].zw; + gLightColor = LightColor; + gFogColor = FogColor; + + gTexNum = TexNum[0]; + gDetailTexNum = TexNum[1]; + gBumpTexNum = TexNum[2]; + gMacroTexNum = TexNum[3]; + + gDrawFlags = DrawFlags[0]; + gTextureFormat = uint(DrawData[IDX_MISC_INFO].w); + gPolyFlags = DrawFlags[2]; + gGamma = DrawData[IDX_MISC_INFO].y; + + gTextureInfo = vec3(DrawData[IDX_DIFFUSE_INFO].zw, DrawData[IDX_MISC_INFO].x); + gDistanceFogColor = DrawData[IDX_DISTANCE_FOG_COLOR]; + gDistanceFogInfo = DrawData[IDX_DISTANCE_FOG_INFO]; + +# if EDITOR + gHitTesting = DrawFlags[1]; + gRendMap = DrawFlags[3]; + gDrawColor = DrawData[IDX_EDITOR_DRAWCOLOR]; +# endif + + vec3 T = vec3(1.0,1.0,1.0); //Arbitrary. + vec3 B = vec3(1.0,1.0,1.0); //Replace with actual values extracted from mesh generation some day. + vec3 N = normalize(Normals.xyz); //Normals. + + // TBN must have right handed coord system. + //if (dot(cross(N, T), B) < 0.0) + // T = T * -1.0; + + gTBNMat = transpose(mat3(T, B, N)); + gTangentViewPos = gTBNMat * normalize(FrameCoords[0].xyz); + gTangentFragPos = gTBNMat * gCoords.xyz; - uint ClipIndex = uint(ClipParams.x); - gl_Position = modelviewprojMat * vec4(Coords, 1.0); + +#if SUPPORTSCLIPDISTANCE + uint ClipIndex = uint(ClipParams.x); gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,gEyeSpacePos.xyz); - -#else - vec4 pos=modelviewprojMat * vec4(Coords, 1.0); - - vLightSpacePos = lightSpaceMat*modelMat*vec4(Coords, 1.0); - - vEyeSpacePos = modelviewMat*vec4(Coords, 1.0); - - // Point Coords - vCoords = Coords; - - //Texture UV to fragment - vTexCoords=TexCoords; - - vLightColor = LightColor; - vFogColor = FogColor; - vTexUV = TexUV; - vDetailTexUV = DetailTexUV.xy; - vNormals = Normals; - - vTexNum = uint(TexNum.x); - vDetailTexNum = uint(TexNum.y); - vBumpTexNum = uint(TexNum.z); - vTextureFormat = uint(DetailTexUV.z); - vDrawFlags = uint(DetailTexUV.w); - - vTextureInfo = TextureInfo; - +#endif // SUPPORTSCLIPDISTANCE + +#else + vEyeSpacePos = modelviewMat*vec4(Coords, 1.0); + + vCoords = Coords; + vNormals = vec4(Normals.xyz, 0); + vLightColor = LightColor; + vFogColor = FogColor; + +# if SHADERDRAWPARAMETERS + vTexCoords = TexCoords * DrawGouraudParams[gl_DrawID].DiffuseInfo.xy; + vDetailTexCoords = TexCoords * DrawGouraudParams[gl_DrawID].DetailMacroInfo.xy; + vMacroTexCoords = TexCoords * DrawGouraudParams[gl_DrawID].DetailMacroInfo.zw; + + vTexNum = DrawGouraudParams[gl_DrawID].TexNum[0]; + vDetailTexNum = DrawGouraudParams[gl_DrawID].TexNum[1]; + vBumpTexNum = DrawGouraudParams[gl_DrawID].TexNum[2]; + vMacroTexNum = DrawGouraudParams[gl_DrawID].TexNum[3]; + + vDrawFlags = DrawGouraudParams[gl_DrawID].DrawFlags[0]; + vTextureFormat = uint(DrawGouraudParams[gl_DrawID].MiscInfo.w); + vPolyFlags = DrawGouraudParams[gl_DrawID].DrawFlags[2]; + vGamma = DrawGouraudParams[gl_DrawID].MiscInfo.y; + + vTextureInfo = vec3( + DrawGouraudParams[gl_DrawID].DiffuseInfo.zw, + DrawGouraudParams[gl_DrawID].MiscInfo.x); + vDistanceFogColor = DrawGouraudParams[gl_DrawID].DistanceFogColor; + vDistanceFogInfo = DrawGouraudParams[gl_DrawID].DistanceFogInfo; + +# if EDITOR + vHitTesting = DrawGouraudParams[gl_DrawID].DrawFlags[1]; + vRendMap = DrawGouraudParams[gl_DrawID].DrawFlags[3]; + vDrawColor = DrawGouraudParams[gl_DrawID].DrawColor; +# endif + +# else // SHADERDRAWPARAMETERS + + vTexCoords = TexCoords * DrawData[IDX_DIFFUSE_INFO].xy; + vDetailTexCoords = TexCoords * DrawData[IDX_DETAIL_MACRO_INFO].xy; + vMacroTexCoords = TexCoords * DrawData[IDX_DETAIL_MACRO_INFO].zw; + + vTexNum = TexNum[0]; + vDetailTexNum = TexNum[1]; + vBumpTexNum = TexNum[2]; + vMacroTexNum = TexNum[3]; + + vDrawFlags = DrawFlags[0]; + vTextureFormat = uint(DrawData[IDX_MISC_INFO].w); + vPolyFlags = DrawFlags[2]; + vGamma = DrawData[IDX_MISC_INFO].y; + + vTextureInfo = vec3(DrawData[IDX_DIFFUSE_INFO].zw, DrawData[IDX_MISC_INFO].x); + vDistanceFogColor = DrawData[IDX_DISTANCE_FOG_COLOR]; + vDistanceFogInfo = DrawData[IDX_DISTANCE_FOG_INFO]; + +# if EDITOR + vHitTesting = DrawFlags[1]; + vRendMap = DrawFlags[3]; + vDrawColor = DrawData[IDX_EDITOR_DRAWCOLOR]; +# endif +# endif + gl_Position = vec4(Coords, 1.0); - -#endif - -} + +#endif + +} diff --git a/System/xopengl/DrawSimple.frag b/System/xopengl/DrawSimple.frag index dd70f21..9e207bd 100644 --- a/System/xopengl/DrawSimple.frag +++ b/System/xopengl/DrawSimple.frag @@ -4,7 +4,7 @@ Revision history: * Created by Smirftsch =============================================================================*/ - + uniform vec4 DrawColor; uniform uint LineFlags; uniform bool bHitTesting; @@ -17,30 +17,44 @@ const uint LINE_None = 0x00u; const uint LINE_Transparent = 0x01u; const uint LINE_DepthCued = 0x02u; -out vec4 FragColor; +#ifdef GL_ES +layout ( location = 0 ) out vec4 FragColor; +# if SIMULATEMULTIPASS +layout ( location = 1 ) out vec4 FragColor1; +#endif +#else +# if SIMULATEMULTIPASS +layout ( location = 0, index = 1) out vec4 FragColor1; +#endif +layout ( location = 0, index = 0) out vec4 FragColor; +#endif void main(void) -{ - vec4 TotalColor = DrawColor; - - if (bHitTesting) - TotalColor = DrawColor; // Use (still) DrawColor. Maybe needed later. Nonsense now. +{ + vec4 TotalColor = DrawColor; if ( (LineFlags&LINE_Transparent)==LINE_Transparent ) { - } -#ifndef EDITOR - #ifdef GL_ES - // 1.055*pow(x,(1.0 / 2.4) ) - 0.055 - // FixMe: ugly rough srgb to linear conversion. - TotalColor.r=(1.055*pow(TotalColor.r,(1.0-Gamma / 2.4))-0.055); - TotalColor.g=(1.055*pow(TotalColor.g,(1.0-Gamma / 2.4))-0.055); - TotalColor.b=(1.055*pow(TotalColor.b,(1.0-Gamma / 2.4))-0.055); - #else - TotalColor.r=pow(TotalColor.r,2.7-Gamma*1.7); - TotalColor.g=pow(TotalColor.g,2.7-Gamma*1.7); - TotalColor.b=pow(TotalColor.b,2.7-Gamma*1.7); - #endif + } +#if EDITOR + if (!bHitTesting) + { + // Gamma + float InGamma = Gamma*GammaMultiplierUED; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); + } +#else + // Gamma + float InGamma = Gamma*GammaMultiplier; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#endif + +# if SIMULATEMULTIPASS + FragColor1 = vec4(1.0,1.0,1.0,1.0)-TotalColor; #endif FragColor = TotalColor; } diff --git a/System/xopengl/DrawSimple.vert b/System/xopengl/DrawSimple.vert index c9a23b6..bbe025c 100644 --- a/System/xopengl/DrawSimple.vert +++ b/System/xopengl/DrawSimple.vert @@ -6,17 +6,19 @@ =============================================================================*/ layout (location = 0) in vec3 Coords; // == gl_Vertex + +#ifndef GL_ES out float gl_ClipDistance[MAX_CLIPPINGPLANES]; +#endif void main(void) { - mat4 modelviewMat = modelMat * viewMat; - mat4 modelviewprojMat = projMat * viewMat * modelMat; - vec4 vEyeSpacePos = modelviewMat*vec4(Coords, 1.0); - uint ClipIndex = uint(ClipParams.x); - gl_Position = modelviewprojMat * vec4(Coords, 1.0); + +#ifndef GL_ES + uint ClipIndex = uint(ClipParams.x); gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,Coords); +#endif } diff --git a/System/xopengl/DrawTile.frag b/System/xopengl/DrawTile.frag index d5bb835..abb2aa1 100644 --- a/System/xopengl/DrawTile.frag +++ b/System/xopengl/DrawTile.frag @@ -5,30 +5,56 @@ * Created by Smirftsch =============================================================================*/ - uniform uint PolyFlags; uniform bool bHitTesting; -uniform float Gamma; -uniform vec4 HitDrawColor; - +uniform float Gamma; +uniform vec4 HitDrawColor; + in vec2 gTexCoords; -in vec4 gDrawColor; +flat in vec4 gDrawColor; flat in uint gTexNum; -out vec4 FragColor; -uniform sampler2D Texture0; +#if BINDLESSTEXTURES +layout(std140) uniform TextureHandles +{ + sampler2D Textures[NUMTEXTURES]; +}; +#endif + +uniform sampler2D Texture0; + +#ifdef GL_ES +layout ( location = 0 ) out vec4 FragColor; +# if SIMULATEMULTIPASS +layout ( location = 1 ) out vec4 FragColor1; +#endif +#else +# if SIMULATEMULTIPASS +layout ( location = 0, index = 1) out vec4 FragColor1; +#endif +layout ( location = 0, index = 0) out vec4 FragColor; +#endif void main(void) { vec4 TotalColor; - vec4 Color; - - #ifdef BINDLESSTEXTURES - if (gTexNum > 0u) - Color = texture(Textures[gTexNum], gTexCoords); - else Color = texture(Texture0, gTexCoords); - #else - Color = texture(Texture0, gTexCoords); + vec4 Color; + + #if BINDLESSTEXTURES + if (gTexNum > 0u) + Color = texture(Textures[gTexNum], gTexCoords); + else Color = texture(Texture0, gTexCoords); + #else + Color = texture(Texture0, gTexCoords); + #endif + + #if SRGB + if((PolyFlags & PF_Modulated)!=PF_Modulated) + { + Color.r=max(1.055 * pow(Color.r, 0.416666667) - 0.055, 0.0); + Color.g=max(1.055 * pow(Color.g, 0.416666667) - 0.055, 0.0); + Color.b=max(1.055 * pow(Color.b, 0.416666667) - 0.055, 0.0); + } #endif // Handle PF_Masked. @@ -45,21 +71,22 @@ void main(void) if((PolyFlags & PF_Modulated)!=PF_Modulated) { - // Gamma -#ifdef GL_ES - // 1.055*pow(x,(1.0 / 2.4) ) - 0.055 - // FixMe: ugly rough srgb to linear conversion. - TotalColor.r=(1.055*pow(TotalColor.r,(1.0-Gamma / 2.4))-0.055); - TotalColor.g=(1.055*pow(TotalColor.g,(1.0-Gamma / 2.4))-0.055); - TotalColor.b=(1.055*pow(TotalColor.b,(1.0-Gamma / 2.4))-0.055); -#else - TotalColor.r=pow(TotalColor.r,2.7-Gamma*1.7); - TotalColor.g=pow(TotalColor.g,2.7-Gamma*1.7); - TotalColor.b=pow(TotalColor.b,2.7-Gamma*1.7); +#if EDITOR + // Gamma + float InGamma = Gamma*GammaMultiplierUED; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#else + // Gamma + float InGamma = Gamma*GammaMultiplier; // Gamma is a value from 0.1 to 1.0 + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); #endif } -#ifdef EDITOR +#if EDITOR // Editor support. if ( (PolyFlags&PF_Selected) == PF_Selected ) { @@ -72,5 +99,10 @@ void main(void) TotalColor = HitDrawColor; // Use HitDrawColor. #endif - FragColor = TotalColor; +# if SIMULATEMULTIPASS + FragColor = TotalColor; + FragColor1 = vec4(1.0,1.0,1.0,1.0)-TotalColor; +#else + FragColor = TotalColor; +#endif } diff --git a/System/xopengl/DrawTile.geo b/System/xopengl/DrawTile.geo index 25e63da..2222610 100644 --- a/System/xopengl/DrawTile.geo +++ b/System/xopengl/DrawTile.geo @@ -12,20 +12,18 @@ flat in uint vTexNum[]; in vec4 vTexCoords0[]; in vec4 vTexCoords1[]; in vec4 vTexCoords2[]; -in vec4 vDrawColor[]; +flat in vec4 vDrawColor[]; in vec4 vEyeSpacePos[]; in vec3 vCoords[]; out vec2 gTexCoords; -out vec4 gDrawColor; +flat out vec4 gDrawColor; flat out uint gTexNum; out float gl_ClipDistance[MAX_CLIPPINGPLANES]; void main() { - mat4 modelviewprojMat = projMat * viewMat * modelMat; - uint ClipIndex = uint(ClipParams.x); gTexNum = vTexNum[0]; diff --git a/System/xopengl/DrawTile.vert b/System/xopengl/DrawTile.vert index b5caf96..814e467 100644 --- a/System/xopengl/DrawTile.vert +++ b/System/xopengl/DrawTile.vert @@ -1,22 +1,21 @@ -/*============================================================================= - Vertexshader for DrawTile. - - Revision history: - * Created by Smirftsch -=============================================================================*/ - +/*============================================================================= + Vertexshader for DrawTile. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + layout (location = 0) in vec3 Coords; // == gl_Vertex -layout (location = 7) in vec4 DrawColor; +layout (location = 7) in vec4 DrawColor; layout (location = 8) in float TexNum; - -#ifdef GL_ES -//No geometry shader in GL_ES. -layout (location = 2) in vec2 TexCoords; - -out vec2 gTexCoords; -out vec4 gDrawColor; + +#ifdef GL_ES +//No geometry shader in GL_ES. +layout (location = 2) in vec2 TexCoords; + +out vec2 gTexCoords; +flat out vec4 gDrawColor; flat out uint gTexNum; -out float gl_ClipDistance[MAX_CLIPPINGPLANES]; #else layout (location = 2) in vec4 TexCoords0; @@ -27,27 +26,48 @@ out vec3 vCoords; out vec4 vTexCoords0; out vec4 vTexCoords1; out vec4 vTexCoords2; -out vec4 vDrawColor; +flat out vec4 vDrawColor; flat out uint vTexNum; out vec4 vEyeSpacePos; #endif - -void main(void) + +/* +#if SHADERDRAWPARAMETERS +struct DrawTileShaderDrawParams +{ + vec4 FrameCoords; // (RFX2, RFY2, FX2, FY2) + vec4 TextureInfo; // (UMult, VMult, TexNum, Gamma) + vec4 DrawColor; // Color for the tile + vec4 HitDrawColor; // Selection color for UEd + uvec4 DrawParams; // (PolyFlags, bHitTesting, unused, unused) +}; + +layout(std430, binding = 6) buffer AllDrawTileShaderDrawParams { - mat4 modelviewMat = modelMat * viewMat; -#ifdef GL_ES - mat4 modelviewprojMat = projMat * viewMat * modelMat; + DrawTileShaderDrawParams DrawTileParams[]; +}; + +flat out uint vTexNum; +flat out uint vPolyFlags; +flat out float vGamma; +# if EDITOR +flat out bool vHitTesting; +flat out vec4 vHitDrawColor; +# endif +#endif +*/ + +void main(void) +{ +#ifdef GL_ES vec4 gEyeSpacePos = modelviewMat*vec4(Coords, 1.0); - gTexNum = uint(TexNum); - gTexCoords = TexCoords; + gTexNum = uint(TexNum); + gTexCoords = TexCoords; gDrawColor = DrawColor; - uint ClipIndex = uint(ClipParams.x); - gl_Position = modelviewprojMat * vec4(Coords, 1.0); - gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,Coords.xyz); #else vEyeSpacePos = modelviewMat*vec4(Coords, 1.0); vCoords = Coords; @@ -57,8 +77,8 @@ void main(void) vTexCoords1 = TexCoords1; vTexCoords2 = TexCoords2; vDrawColor = DrawColor; - - gl_Position = vec4(Coords, 1.0); -#endif -} - + + gl_Position = vec4(Coords, 1.0); +#endif +} + diff --git a/System/xopengl/Extensions.incl b/System/xopengl/Extensions.incl index ef88b7f..7bf7a23 100644 --- a/System/xopengl/Extensions.incl +++ b/System/xopengl/Extensions.incl @@ -5,12 +5,16 @@ Revision history: * Created by Smirftsch =============================================================================*/ -#ifdef BINDLESSTEXTURES +#if BINDLESSTEXTURES #extension GL_ARB_bindless_texture : require -#extension GL_ARB_gpu_shader_int64 : enable +#extension GL_ARB_gpu_shader_int64 : enable // we store bindless textures in interface blocks. This only works if we support int64s in GLSL #extension GL_ARB_shading_language_420pack : enable #endif +#if SHADERDRAWPARAMETERS +#extension GL_ARB_shader_draw_parameters : require +#endif + #ifdef GL_ES // The following extension appears not to be available on RaspberryPi4 at the moment. #extension GL_EXT_clip_cull_distance : enable diff --git a/System/xopengl/Globals.incl b/System/xopengl/Globals.incl index 4186511..505f6f2 100644 --- a/System/xopengl/Globals.incl +++ b/System/xopengl/Globals.incl @@ -1,135 +1,136 @@ -/*============================================================================= - Globals.incl, shader globals. - This data is added after loading extensions. - Note that #version is internally added before, depending on - if GL or GLES is being used: - - if Core: - GL #version 330 core - or if UsingBindlessTextures || UsingPersistentBuffers - GL #version 450 core - - if ES: - GLES #version 300 es - - UsingBindlessTextures also sets #define BINDLESSTEXTURES - - To see invalid or unused shader vars comment Suppress=Dev in game ini - or set UseOpenGLDebug=True and a DebugLevel>=2 (GL_DEBUG_SEVERITY_LOW) - - Geometry shaders are only available in Core profile - Use #ifdef GL_ES in such cases - - Using UED adds #define EDITOR - - Revision history: - * Created by Smirftsch -=============================================================================*/ - -//Unreal 227 / UT PolyFlags. May require edits for other UE1 games. -const uint PF_None = 0x00000000u; // None. -const uint PF_Invisible = 0x00000001u; // Poly is invisible. -const uint PF_Masked = 0x00000002u; // Poly should be drawn masked. -const uint PF_Translucent = 0x00000004u; // Poly is transparent. -const uint PF_NotSolid = 0x00000008u; // Poly is not solid; doesn't block. -const uint PF_Environment = 0x00000010u; // Poly should be drawn environment mapped. -const uint PF_Semisolid = 0x00000020u; // Poly is semi-solid = collision solid; Csg nonsolid. -const uint PF_Modulated = 0x00000040u; // Modulation transparency. -const uint PF_FakeBackdrop = 0x00000080u; // Poly looks exactly like backdrop. -const uint PF_TwoSided = 0x00000100u; // Poly is visible from both sides. -const uint PF_AutoUPan = 0x00000200u; // Automatically pans in U direction. -const uint PF_AutoVPan = 0x00000400u; // Automatically pans in V direction. -const uint PF_NoSmooth = 0x00000800u; // Don't smooth textures. -const uint PF_BigWavy = 0x00001000u; // Poly has a big wavy pattern in it. -const uint PF_SpecialPoly = 0x00001000u; // Game-specific poly-level render control (reuse BigWavy flag) -const uint PF_HeightMap = 0x00001000u; // Use Macrotexture as HeightMap -const uint PF_SmallWavy = 0x00002000u; // Small wavy pattern (for water/enviro reflection). -const uint PF_Flat = 0x00004000u; // Flat surface. -const uint PF_ForceViewZone = 0x00004000u; // Force current iViewZone in OccludeBSP (reuse Flat flag) -const uint PF_LowShadowDetail = 0x00008000u; // Low detail shadows. -const uint PF_NoMerge = 0x00010000u; // Don't merge poly's nodes before lighting when rendering. -const uint PF_AlphaBlend = 0x00020000u; // This poly should be alpha blended. In UT PF_CloudWavy, but of little use without DXT3/DXT5 texture flags. -const uint PF_DirtyShadows = 0x00040000u; // Dirty shadows. -const uint PF_BrightCorners = 0x00080000u; // Brighten convex corners. -const uint PF_SpecialLit = 0x00100000u; // Only special lit lights apply to this poly. -const uint PF_Gouraud = 0x00200000u; // Gouraud shaded. -const uint PF_NoBoundRejection = 0x00200000u; // Disable bound rejection in OccludeBSP (reuse Gouraud flag) -const uint PF_Unlit = 0x00400000u; // Unlit. -const uint PF_HighShadowDetail = 0x00800000u; // High detail shadows. -const uint PF_Portal = 0x04000000u; // Portal between iZones. -const uint PF_Mirrored = 0x08000000u; // Reflective surface. - -// Editor flags. -const uint PF_Memorized = 0x01000000u; // Editor: Poly is remembered. -const uint PF_Selected = 0x02000000u; // Editor: Poly is selected. -const uint PF_Highlighted = 0x10000000u; // Editor: Poly is highlighted. -const uint PF_FlatShaded = 0x40000000u; // FPoly has been split by SplitPolyWithPlane. - -// Internal. -const uint PF_EdProcessed = 0x40000000u; // FPoly was already processed in editorBuildFPolys. -const uint PF_EdCut = 0x80000000u; // FPoly has been split by SplitPolyWithPlane. -const uint PF_RenderFog = 0x40000000u; // Render with fog mapping. -const uint PF_Occlude = 0x80000000u; // Occludes even if PF_NoOcclude. -const uint PF_RenderHint = 0x01000000u; // Rendering optimization hint. - -#ifdef EDITOR -// enum ERenderType -const uint REN_None = 0u; // Hide completely. -const uint REN_Wire = 1u; // Wireframe of EdPolys. -const uint REN_Zones = 2u; // Show zones and zone portals. -const uint REN_Polys = 3u; // Flat-shaded Bsp. -const uint REN_PolyCuts = 4u; // Flat-shaded Bsp with normals displayed. -const uint REN_DynLight = 5u; // Illuminated texture mapping. -const uint REN_PlainTex = 6u; // Plain texture mapping. -const uint REN_OrthXY = 13u; // Orthogonal overhead (XY) view. -const uint REN_OrthXZ = 14u; // Orthogonal XZ view. -const uint REN_OrthYZ = 15u; // Orthogonal YZ view. -const uint REN_TexView = 16u; // Viewing a texture (no actor). -const uint REN_TexBrowser = 17u; // Viewing a texture browser (no actor). -const uint REN_MeshView = 18u; // Viewing a mesh. -const uint REN_LightingOnly = 19u; // Render only lights on plain white texture. -const uint REN_Normals = 20u; // Render normals only. -const uint REN_MAX = 21u; -#endif - -// Spatial Lighting -const uint LE_None=0u; -const uint LE_TorchWaver=1u; -const uint LE_FireWaver=2u; -const uint LE_WateryShimmer=3u; -const uint LE_Searchlight=4u; -const uint LE_SlowWave=5u; -const uint LE_FastWave=6u; -const uint LE_CloudCast=7u; -const uint LE_StaticSpot=8u; -const uint LE_Shock=9u; -const uint LE_Disco=10u; -const uint LE_Warp=11u; -const uint LE_Spotlight=12u; -const uint LE_NonIncidence=13u; -const uint LE_Shell=14u; -const uint LE_OmniBumpMap=15u; -const uint LE_Interference=16u; -const uint LE_Cylinder=17u; -const uint LE_Rotor=18u; -const uint LE_Sunlight=19u; -const uint LE_MAX=20u; - -// Light modulation -const uint LT_None=0u; -const uint LT_Steady=1u; -const uint LT_Pulse=2u; -const uint LT_Blink=3u; -const uint LT_Flicker=4u; -const uint LT_Strobe=5u; -const uint LT_BackdropLight=6u; -const uint LT_SubtlePulse=7u; -const uint LT_TexturePaletteOnce=8u; -const uint LT_TexturePaletteLoop=9u; -const uint LT_RandomPulse=10u; //using random LightPeriod. -const uint LT_RandomSubtlePulse=11u; //using random LightPeriod. - -// Texture Formats +/*============================================================================= + Globals.incl, shader globals. + This data is added after loading extensions. + Note that #version is internally added before, depending on + if GL or GLES is being used: + + if Core: + GL #version 330 core + or if UsingBindlessTextures || UsingPersistentBuffers + GL #version 450 core + + if ES: + GLES #version 300 es + + UsingBindlessTextures also sets #define BINDLESSTEXTURES + + To see invalid or unused shader vars comment Suppress=Dev in game ini + or set UseOpenGLDebug=True and a DebugLevel>=2 (GL_DEBUG_SEVERITY_LOW) + + Geometry shaders are only available in Core profile + Use #ifdef GL_ES in such cases + + Using UED adds #define EDITOR + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +//Unreal 227 / UT PolyFlags. May require edits for other UE1 games. +const uint PF_None = 0x00000000u; // None. +const uint PF_Invisible = 0x00000001u; // Poly is invisible. +const uint PF_Masked = 0x00000002u; // Poly should be drawn masked. +const uint PF_Translucent = 0x00000004u; // Poly is transparent. +const uint PF_NotSolid = 0x00000008u; // Poly is not solid; doesn't block. +const uint PF_Environment = 0x00000010u; // Poly should be drawn environment mapped. +const uint PF_Semisolid = 0x00000020u; // Poly is semi-solid = collision solid; Csg nonsolid. +const uint PF_Modulated = 0x00000040u; // Modulation transparency. +const uint PF_FakeBackdrop = 0x00000080u; // Poly looks exactly like backdrop. +const uint PF_TwoSided = 0x00000100u; // Poly is visible from both sides. +const uint PF_AutoUPan = 0x00000200u; // Automatically pans in U direction. +const uint PF_AutoVPan = 0x00000400u; // Automatically pans in V direction. +const uint PF_NoSmooth = 0x00000800u; // Don't smooth textures. +const uint PF_BigWavy = 0x00001000u; // Poly has a big wavy pattern in it. +const uint PF_SpecialPoly = 0x00001000u; // Game-specific poly-level render control (reuse BigWavy flag) +const uint PF_HeightMap = 0x00001000u; // Use Macrotexture as HeightMap +const uint PF_SmallWavy = 0x00002000u; // Small wavy pattern (for water/enviro reflection). +const uint PF_Flat = 0x00004000u; // Flat Mesh. +const uint PF_WaterWavy = 0x00004000u; // WaterWavy Surface flag (reuse Flat flag). +const uint PF_ForceViewZone = 0x00004000u; // Force current iViewZone in OccludeBSP (reuse Flat flag) +const uint PF_LowShadowDetail = 0x00008000u; // Low detail shadows. +const uint PF_NoMerge = 0x00010000u; // Don't merge poly's nodes before lighting when rendering. +const uint PF_AlphaBlend = 0x00020000u; // This poly should be alpha blended. In UT PF_CloudWavy, but of little use without DXT3/DXT5 texture flags. +const uint PF_DirtyShadows = 0x00040000u; // Dirty shadows. +const uint PF_BrightCorners = 0x00080000u; // Brighten convex corners. +const uint PF_SpecialLit = 0x00100000u; // Only special lit lights apply to this poly. +const uint PF_Gouraud = 0x00200000u; // Gouraud shaded. +const uint PF_NoBoundRejection = 0x00200000u; // Disable bound rejection in OccludeBSP (reuse Gouraud flag) +const uint PF_Unlit = 0x00400000u; // Unlit. +const uint PF_HighShadowDetail = 0x00800000u; // High detail shadows. +const uint PF_Portal = 0x04000000u; // Portal between iZones. +const uint PF_Mirrored = 0x08000000u; // Reflective surface. + +// Editor flags. +const uint PF_Memorized = 0x01000000u; // Editor: Poly is remembered. +const uint PF_Selected = 0x02000000u; // Editor: Poly is selected. +const uint PF_Highlighted = 0x10000000u; // Editor: Poly is highlighted. +const uint PF_FlatShaded = 0x40000000u; // FPoly has been split by SplitPolyWithPlane. + +// Internal. +const uint PF_EdProcessed = 0x40000000u; // FPoly was already processed in editorBuildFPolys. +const uint PF_EdCut = 0x80000000u; // FPoly has been split by SplitPolyWithPlane. +const uint PF_RenderFog = 0x40000000u; // Render with fog mapping. +const uint PF_Occlude = 0x80000000u; // Occludes even if PF_NoOcclude. +const uint PF_RenderHint = 0x01000000u; // Rendering optimization hint. + +#if EDITOR +// enum ERenderType +const uint REN_None = 0u; // Hide completely. +const uint REN_Wire = 1u; // Wireframe of EdPolys. +const uint REN_Zones = 2u; // Show zones and zone portals. +const uint REN_Polys = 3u; // Flat-shaded Bsp. +const uint REN_PolyCuts = 4u; // Flat-shaded Bsp with normals displayed. +const uint REN_DynLight = 5u; // Illuminated texture mapping. +const uint REN_PlainTex = 6u; // Plain texture mapping. +const uint REN_OrthXY = 13u; // Orthogonal overhead (XY) view. +const uint REN_OrthXZ = 14u; // Orthogonal XZ view. +const uint REN_OrthYZ = 15u; // Orthogonal YZ view. +const uint REN_TexView = 16u; // Viewing a texture (no actor). +const uint REN_TexBrowser = 17u; // Viewing a texture browser (no actor). +const uint REN_MeshView = 18u; // Viewing a mesh. +const uint REN_LightingOnly = 19u; // Render only lights on plain white texture. +const uint REN_Normals = 20u; // Render normals only. +const uint REN_MAX = 21u; +#endif + +// Spatial Lighting +const uint LE_None=0u; +const uint LE_TorchWaver=1u; +const uint LE_FireWaver=2u; +const uint LE_WateryShimmer=3u; +const uint LE_Searchlight=4u; +const uint LE_SlowWave=5u; +const uint LE_FastWave=6u; +const uint LE_CloudCast=7u; +const uint LE_StaticSpot=8u; +const uint LE_Shock=9u; +const uint LE_Disco=10u; +const uint LE_Warp=11u; +const uint LE_Spotlight=12u; +const uint LE_NonIncidence=13u; +const uint LE_Shell=14u; +const uint LE_OmniBumpMap=15u; +const uint LE_Interference=16u; +const uint LE_Cylinder=17u; +const uint LE_Rotor=18u; +const uint LE_Sunlight=19u; +const uint LE_MAX=20u; + +// Light modulation +const uint LT_None=0u; +const uint LT_Steady=1u; +const uint LT_Pulse=2u; +const uint LT_Blink=3u; +const uint LT_Flicker=4u; +const uint LT_Strobe=5u; +const uint LT_BackdropLight=6u; +const uint LT_SubtlePulse=7u; +const uint LT_TexturePaletteOnce=8u; +const uint LT_TexturePaletteLoop=9u; +const uint LT_RandomPulse=10u; //using random LightPeriod. +const uint LT_RandomSubtlePulse=11u; //using random LightPeriod. + +// Texture Formats const uint TEXF_P8 = 0x00u; const uint TEXF_BGRA8_LM = 0x01u; const uint TEXF_R5G6B5 = 0x02u; @@ -253,99 +254,93 @@ const uint TEXF_RGB9E5 = 0x8cu; const uint TEXF_P8_RGB9E5 = 0x8du; const uint TEXF_R1 = 0x8eu; const uint TEXF_NODATA = 0xfeu; -const uint TEXF_MAX = 0xffu; - -// DrawFlags -const uint DF_DiffuseTexture = 0x00000001u; -const uint DF_DetailTexture = 0x00000002u; -const uint DF_MacroTexture = 0x00000004u; -const uint DF_BumpMap = 0x00000008u; -const uint DF_LightMap = 0x00000010u; -const uint DF_FogMap = 0x00000020u; -const uint DF_EnvironmentMap = 0x00000040u; - - -layout(std140) uniform GlobalMatrices -{ - mat4 modelMat; - mat4 viewMat; - mat4 projMat; - mat4 lightSpaceMat; -}; - -layout(std140) uniform ClipPlaneParams -{ - vec4 ClipParams; // Clipping params, ClipIndex,0,0,0 - vec4 ClipPlane; // Clipping planes. Plane.X, Plane.Y, Plane.Z, Plane.W -}; - -// Light information. -layout(std140) uniform StaticLightInfo -{ - vec4 LightPos[MAX_LIGHTS]; - vec4 LightData1[MAX_LIGHTS]; // LightBrightness, LightHue, LightSaturation, LightCone - vec4 LightData2[MAX_LIGHTS]; // LightEffect, LightPeriod, LightPhase, LightRadius - vec4 LightData3[MAX_LIGHTS]; // LightType, VolumeBrightness, VolumeFog, VolumeRadius - vec4 LightData4[MAX_LIGHTS]; // WorldLightRadius, NumLights, ZoneNumber, CameraRegion->ZoneNumber - vec4 LightData5[MAX_LIGHTS]; // NormalLightRadius, bZoneNormalLight, unused, unused -}; - -layout(std140) uniform DistanceFogParams -{ - vec4 DistanceFogColor; // Fog color - vec4 DistanceFogValues; -}; - -layout(std140) uniform GlobalCoords -{ - mat4 FrameCoords; - mat4 FrameUncoords; -}; - -#ifdef BINDLESSTEXTURES -layout(std140) uniform TextureHandles -{ - sampler2D Textures[NUMTEXTURES]; -}; -#endif - -//DistanceFog -struct FogParameters -{ - vec4 FogColor; // Fog color - float FogStart; // Only for linear fog - float FogEnd; // Only for linear fog - float FogDensity; // For exp and exp2 equation - float FogCoord; - int FogMode; // 0 = linear, 1 = exp, 2 = exp2 -}; - -float getFogFactor(FogParameters DistanceFog) -{ - - // DistanceFogValues.x = FogStart - // DistanceFogValues.y = FogEnd - // DistanceFogValues.z = FogDensity - // DistanceFogValues.w = FogMode - //FogResult = (Values.y-FogCoord)/(Values.y-Values.x); - - float FogResult = 1.0; - if(DistanceFog.FogMode == 0 ) - FogResult = ((DistanceFog.FogEnd-DistanceFog.FogCoord)/(DistanceFog.FogEnd-DistanceFog.FogStart)); - else if(DistanceFog.FogMode == 1) - FogResult = exp(-DistanceFog.FogDensity*DistanceFog.FogCoord); - else if(DistanceFog.FogMode == 2) - FogResult = exp(-pow(DistanceFog.FogDensity*DistanceFog.FogCoord, 2.0)); - - FogResult = 1.0-clamp(FogResult, 0.0, 1.0); - - return FogResult; -} - -float PlaneDot( vec4 Plane, vec3 Point ) -{ - return dot(Plane.xyz,Point)-Plane.w; -} - -// The following directive resets the line number to 1 to have the correct output logging for a possible error within the shader files. -#line 1 +const uint TEXF_MAX = 0xffu; + +// DrawFlags +const uint DF_DiffuseTexture = 0x00000001u; +const uint DF_LightMap = 0x00000002u; +const uint DF_FogMap = 0x00000004u; +const uint DF_DetailTexture = 0x00000008u; +const uint DF_MacroTexture = 0x00000010u; +const uint DF_BumpMap = 0x00000020u; +const uint DF_EnvironmentMap = 0x00000040u; +const uint DF_HeightMap = 0x00000080u; + +layout(std140) uniform GlobalMatrices +{ + mat4 modelMat; + mat4 viewMat; + mat4 modelviewMat; + mat4 modelviewprojMat; + mat4 lightSpaceMat; +}; + +layout(std140) uniform ClipPlaneParams +{ + vec4 ClipParams; // Clipping params, ClipIndex,0,0,0 + vec4 ClipPlane; // Clipping planes. Plane.X, Plane.Y, Plane.Z, Plane.W +}; + +// Light information. +layout(std140) uniform StaticLightInfo +{ + vec4 LightPos[MAX_LIGHTS]; + vec4 LightData1[MAX_LIGHTS]; // LightBrightness, LightHue, LightSaturation, LightCone + vec4 LightData2[MAX_LIGHTS]; // LightEffect, LightPeriod, LightPhase, LightRadius + vec4 LightData3[MAX_LIGHTS]; // LightType, VolumeBrightness, VolumeFog, VolumeRadius + vec4 LightData4[MAX_LIGHTS]; // WorldLightRadius, NumLights, ZoneNumber, CameraRegion->ZoneNumber + vec4 LightData5[MAX_LIGHTS]; // NormalLightRadius, bZoneNormalLight, unused, unused +}; + +layout(std140) uniform DistanceFogParams +{ + vec4 DistanceFogColor; // Fog color + vec4 DistanceFogValues; +}; + +layout(std140) uniform GlobalCoords +{ + mat4 FrameCoords; + mat4 FrameUncoords; +}; + +//DistanceFog +struct FogParameters +{ + vec4 FogColor; // Fog color + float FogStart; // Only for linear fog + float FogEnd; // Only for linear fog + float FogDensity; // For exp and exp2 equation + float FogCoord; + int FogMode; // 0 = linear, 1 = exp, 2 = exp2 +}; + +float getFogFactor(FogParameters DistanceFog) +{ + + // DistanceFogValues.x = FogStart + // DistanceFogValues.y = FogEnd + // DistanceFogValues.z = FogDensity + // DistanceFogValues.w = FogMode + //FogResult = (Values.y-FogCoord)/(Values.y-Values.x); + + float FogResult = 1.0; + if(DistanceFog.FogMode == 0 ) + FogResult = ((DistanceFog.FogEnd-DistanceFog.FogCoord)/(DistanceFog.FogEnd-DistanceFog.FogStart)); + else if(DistanceFog.FogMode == 1) + FogResult = exp(-DistanceFog.FogDensity*DistanceFog.FogCoord); + else if(DistanceFog.FogMode == 2) + FogResult = exp(-pow(DistanceFog.FogDensity*DistanceFog.FogCoord, 2.0)); + + FogResult = 1.0-clamp(FogResult, 0.0, 1.0); + + return FogResult; +} + +float PlaneDot( vec4 Plane, vec3 Point ) +{ + return dot(Plane.xyz,Point)-Plane.w; +} + +// The following directive resets the line number to 1 to have the correct output logging for a possible error within the shader files. +#line 1 diff --git a/System64/ALAudio.so b/System64/ALAudio.so new file mode 100644 index 0000000..02595a8 Binary files /dev/null and b/System64/ALAudio.so differ diff --git a/System64/Cluster.so b/System64/Cluster.so new file mode 100644 index 0000000..1dc3175 Binary files /dev/null and b/System64/Cluster.so differ diff --git a/System64/Core.so b/System64/Core.so new file mode 100644 index 0000000..fafb9ec Binary files /dev/null and b/System64/Core.so differ diff --git a/System64/DefUser.ini b/System64/DefUser.ini new file mode 100644 index 0000000..0a44df3 --- /dev/null +++ b/System64/DefUser.ini @@ -0,0 +1,421 @@ +[DefaultPlayer] +Name=Player +Class=Botpack.TMale2 +team=255 +skin=SoldierSkins.blkt +Face=SoldierSkins.Othello + +[Engine.Input] +Aliases[0]=(Command="Button bFire | Fire",Alias=Fire) +Aliases[1]=(Command="Button bAltFire | AltFire",Alias=AltFire) +Aliases[2]=(Command="Axis aBaseY Speed=+300.0",Alias=MoveForward) +Aliases[3]=(Command="Axis aBaseY Speed=-300.0",Alias=MoveBackward) +Aliases[4]=(Command="Axis aBaseX Speed=-150.0",Alias=TurnLeft) +Aliases[5]=(Command="Axis aBaseX Speed=+150.0",Alias=TurnRight) +Aliases[6]=(Command="Axis aStrafe Speed=-300.0",Alias=StrafeLeft) +Aliases[7]=(Command="Axis aStrafe Speed=+300.0",Alias=StrafeRight) +Aliases[8]=(Command="Jump | Axis aUp Speed=+300.0",Alias=Jump) +Aliases[9]=(Command="Button bDuck | Axis aUp Speed=-300.0",Alias=Duck) +Aliases[10]=(Command="Button bLook",Alias=Look) +Aliases[11]=(Command="Toggle bLook",Alias=LookToggle) +Aliases[12]=(Command="ActivateItem",Alias=InventoryActivate) +Aliases[13]=(Command="NextItem",Alias=InventoryNext) +Aliases[14]=(Command="PrevItem",Alias=InventoryPrevious) +Aliases[15]=(Command="Axis aLookUp Speed=+100.0",Alias=LookUp) +Aliases[16]=(Command="Axis aLookUp Speed=-100.0",Alias=LookDown) +Aliases[17]=(Command="Button bSnapLevel",Alias=CenterView) +Aliases[18]=(Command="Button bRun",Alias=Walking) +Aliases[19]=(Command="Button bStrafe",Alias=Strafe) +Aliases[20]=(Command="NextWeapon",Alias=NextWeapon) +Aliases[21]=(Command="ActivateTranslator",Alias=ActivateTranslator) +Aliases[22]=(Command="ActivateHint",Alias=ActivateHint) +Aliases[23]=(Command="Button bFreeLook",Alias=FreeLook) +Aliases[24]=(Command="ViewClass Pawn",Alias=ViewTeam) +Aliases[25]=(Command="",Alias=None) +Aliases[26]=(Command="",Alias=None) +Aliases[27]=(Command="",Alias=None) +Aliases[28]=(Command="",Alias=None) +Aliases[29]=(Command="",Alias=None) +Aliases[30]=(Command="",Alias=None) +Aliases[31]=(Command="",Alias=None) +Aliases[32]=(Command="",Alias=None) +Aliases[33]=(Command="",Alias=None) +Aliases[34]=(Command="",Alias=None) +Aliases[35]=(Command="",Alias=None) +Aliases[36]=(Command="",Alias=None) +Aliases[37]=(Command="",Alias=None) +Aliases[38]=(Command="",Alias=None) +Aliases[39]=(Command="",Alias=None) +LeftMouse=Fire +RightMouse=AltFire +MiddleMouse=MoveForward +Tab=Type +Enter=InventoryActivate +Shift=Walking +Ctrl=Jump +Alt=Fire +Pause=Pause +CapsLock=LookToggle +Escape=ShowMenu +Space=Jump +PageDown=LookDown +End=CenterView +Left=StrafeLeft +Up=MoveForward +Right=StrafeRight +Down=MoveBackward +Insert= +Delete=LookUp +0=SwitchWeapon 10 +1=SwitchWeapon 1 +2=SwitchWeapon 2 +3=SwitchWeapon 3 +4=SwitchWeapon 4 +5=SwitchWeapon 5 +6=SwitchWeapon 6 +7=SwitchWeapon 7 +8=SwitchWeapon 8 +9=SwitchWeapon 9 +LeftBracket=hook +RightBracket=hookup +C=Duck +G=Grab +L=Taunt wave +M=Look +O=Toggle bExtra0 +S=Axis aUp Speed=+300.0 +T=Talk +Z=Strafe +F1=ShowScores +F2=ShowServerInfo +F3=ShowObjectives +F4= +F5=ViewTeam +F6=Stat Net +F7= +F8= +F9=SShot +F10=Cancel +F11=Brightness +F12=EndFullscreen +Equals=GrowHUD +Comma=StrafeLeft +Minus=ShrinkHUD +Period=StrafeRight +Slash=NextWeapon +LeftBracket=InventoryPrevious +Backslash=ChangeHud +RightBracket=InventoryNext +MouseX=Axis aMouseX Speed=6.0 +MouseY=Axis aMouseY Speed=6.0 +MouseW= +None= +Cancel= +Backspace= +PageUp= +home= +Select= +Print= +Execute= +PrintScrn= +Help= +A= +B= +D= +E= +f=Feigndeath +H=Taunt Thrust +i=turretchangeweapon +j=Taunt Taunt1 +K=Taunt Victory1 +O=mutate Kick +P= +Q=GetWeapon BotPack.Translocator +R=TeamTalk +U=kamikaze +V= +W= +X= +NumPad0=ViewPlayerNum 0 +NumPad1=ViewPlayerNum 1 +NumPad2=ViewPlayerNum 2 +NumPad3=ViewPlayerNum 3 +NumPad4=ViewPlayerNum 4 +NumPad5=ViewPlayerNum 5 +NumPad6=ViewPlayerNum 6 +NumPad7=ViewPlayerNum 7 +NumPad8=ViewPlayerNum 8 +NumPad9=ViewPlayerNum 9 +GreyStar= +Separator= +NumPadPeriod=Duck +GreySlash= +F13= +F14= +F15= +F16= +F17= +F18= +F19= +F20= +F21= +F22= +F23= +F24= +NumLock= +ScrollLock= +LShift= +RShift= +LControl= +RControl= +Semicolon=ThrowWeapon +Tilde= +SingleQuote=Strafe +Attn= +CrSel= +ExSel= +ErEof= +Play= +Zoom= +NoName= +PA1= +OemClear= +MouseZ= +MouseWheelDown=NextWeapon +MouseWheelUp=PrevWeapon +Joy1=Fire +Joy2=Jump +Joy3=AltFire +Joy4=Duck +Joy5=NextWeapon +Joy6=SwitchWeapon 2 +Joy7=SwitchWeapon 3 +Joy8=SwitchWeapon 4 +Joy9=SwitchWeapon 9 +Joy10=SwitchWeapon 0 +Joy11=InventoryPrevious +Joy12=InventoryActivate +Joy13=InventoryNext +Joy14= +Joy15= +Joy16= +JoyX=Axis astrafe speed=2 +JoyY=Axis aBaseY speed=2 +JoyZ= +JoyR= +JoyU=Axis aturn speed=5.9 +JoyV=Axis aLookUp speed=-3 +JoyPovRight=SwitchWeapon 6 +JoyPovLeft=SwitchWeapon 7 +JoyPovUp=SwitchWeapon 8 +JoyPovDown=SwitchWeapon 5 + +[Engine.PlayerPawn] +WeaponPriority[0]=Translocator +WeaponPriority[1]=ChainSaw +WeaponPriority[2]=ImpactHammer +WeaponPriority[3]=enforcer +WeaponPriority[4]=doubleenforcer +WeaponPriority[5]=ShockRifle +WeaponPriority[6]=ut_biorifle +WeaponPriority[7]=PulseGun +WeaponPriority[8]=SniperRifle +WeaponPriority[9]=ripper +WeaponPriority[10]=minigun2 +WeaponPriority[11]=UT_FlakCannon +WeaponPriority[12]=UT_Eightball +WeaponPriority[13]=WarheadLauncher +WeaponPriority[14]=None +WeaponPriority[15]=None +WeaponPriority[16]=None +WeaponPriority[17]=None +WeaponPriority[18]=None +WeaponPriority[19]=None + +[Engine.HUD] +HudMode=0 +Crosshair=0 + +[Botpack.ChallengeHUD] +bUseTeamColor=true +FavoriteHUDColor=(R=0,G=0,B=16) +CrosshairColor=(R=0,G=16,B=0) +HudScale=+1.0 +Opacity=15 +StatusScale=1.0 +WeaponScale=0.8 +bHideAllWeapons=false +bHideStatus=false +bHideAmmo=false +bHideTeamInfo=false +bHideFrags=false +bHideHUD=false +bHideNoviceMessages=false +bHideFaces=false +CrosshairScale=1.0 +bAutoCrosshairScale=true + +[Botpack.ChallengeBotInfo] +BotFaces[0]=CommandoSkins.Blake +BotFaces[1]=SGirlSkins.Aryss +BotFaces[2]=SoldierSkins.Malcom +BotFaces[3]=CommandoSkins.Luthor +BotFaces[4]=FCommandoSkins.Cryss +BotFaces[5]=FCommandoSkins.Visse +BotFaces[6]=SoldierSkins.Kregore +BotFaces[7]=SGirlSkins.Cilia +BotFaces[8]=CommandoSkins.Kragoth +BotFaces[9]=FCommandoSkins.Tanya +BotFaces[10]=SoldierSkins.Johnson +BotFaces[11]=CommandoSkins.Boris +BotFaces[12]=SGirlSkins.Vixen +BotFaces[13]=SGirlSkins.Sara +BotFaces[14]=SoldierSkins.Othello +BotFaces[15]=FCommandoSkins.Kyla +BotFaces[16]=CommandoSkins.Gorn +BotFaces[17]=SGirlSkins.Annaka +BotFaces[18]=SoldierSkins.Riker +BotFaces[19]=FCommandoSkins.Malise +BotFaces[20]=CommandoSkins.Ramirez +BotFaces[21]=FCommandoSkins.Freylis +BotFaces[22]=SoldierSkins.Arkon +BotFaces[23]=SGirlSkins.Sarena +BotFaces[24]=CommandoSkins.Grail +BotFaces[25]=FCommandoSkins.Mariana +BotFaces[26]=SoldierSkins.Rankin +BotFaces[27]=SGirlSkins.Isis +BotFaces[28]=CommandoSkins.Graves +BotFaces[29]=SGirlSkins.Lauren +BotFaces[30]=SoldierSkins.Malcom +BotFaces[31]=FCommandoSkins.Jayce +bAdjustSkill=False +bRandomOrder=True +Difficulty=1 +BotNames[0]=Archon +BotNames[1]=Aryss +BotNames[2]=Alarik +BotNames[3]=Dessloch +BotNames[4]=Cryss +BotNames[5]=Nikita +BotNames[6]=Drimacus +BotNames[7]=Rhea +BotNames[8]=Raynor +BotNames[9]=Kira +BotNames[10]=Karag +BotNames[11]=Zenith +BotNames[12]=Cali +BotNames[13]=Alys +BotNames[14]=Kosak +BotNames[15]=Illana +BotNames[16]=Barak +BotNames[17]=Kara +BotNames[18]=Tamerlane +BotNames[19]=Arachne +BotNames[20]=Liche +BotNames[21]=Jared +BotNames[22]=Ichthys +BotNames[23]=Tamara +BotNames[24]=Loque +BotNames[25]=Athena +BotNames[26]=Cilia +BotNames[27]=Sarena +BotNames[28]=Malakai +BotNames[29]=Visse +BotNames[30]=Necroth +BotNames[31]=Kragoth +BotTeams[0]=255 +BotTeams[1]=0 +BotTeams[2]=255 +BotTeams[3]=1 +BotTeams[4]=255 +BotTeams[5]=2 +BotTeams[6]=255 +BotTeams[7]=3 +BotTeams[8]=255 +BotTeams[9]=0 +BotTeams[10]=255 +BotTeams[11]=1 +BotTeams[12]=255 +BotTeams[13]=2 +BotTeams[14]=255 +BotTeams[15]=3 +BotTeams[16]=255 +BotTeams[17]=0 +BotTeams[18]=255 +BotTeams[19]=1 +BotTeams[20]=255 +BotTeams[21]=2 +BotTeams[22]=255 +BotTeams[23]=3 +BotTeams[24]=255 +BotTeams[25]=0 +BotTeams[26]=255 +BotTeams[27]=1 +BotTeams[28]=255 +BotTeams[29]=2 +BotTeams[30]=255 +BotTeams[31]=3 +BotClasses[0]=BotPack.TMale1Bot +BotClasses[1]=BotPack.TFemale2Bot +BotClasses[2]=BotPack.TMale2Bot +BotClasses[3]=BotPack.TMale1Bot +BotClasses[4]=BotPack.TFemale1Bot +BotClasses[5]=BotPack.TFemale1Bot +BotClasses[6]=BotPack.TMale2Bot +BotClasses[7]=BotPack.TFemale2Bot +BotClasses[8]=BotPack.TMale1Bot +BotClasses[9]=BotPack.TFemale1Bot +BotClasses[10]=BotPack.TMale2Bot +BotClasses[11]=BotPack.TMale1Bot +BotClasses[12]=BotPack.TFemale2Bot +BotClasses[13]=BotPack.TFemale2Bot +BotClasses[14]=BotPack.TMale2Bot +BotClasses[15]=BotPack.TFemale1Bot +BotClasses[16]=BotPack.TMale1Bot +BotClasses[17]=BotPack.TFemale2Bot +BotClasses[18]=BotPack.TMale2Bot +BotClasses[19]=BotPack.TFemale1Bot +BotClasses[20]=BotPack.TMale1Bot +BotClasses[21]=BotPack.TFemale1Bot +BotClasses[22]=BotPack.TMale2Bot +BotClasses[23]=BotPack.TFemale2Bot +BotClasses[24]=BotPack.TMale1Bot +BotClasses[25]=BotPack.TFemale1Bot +BotClasses[26]=BotPack.TMale2Bot +BotClasses[27]=BotPack.TFemale2Bot +BotClasses[28]=BotPack.TMale1Bot +BotClasses[29]=BotPack.TFemale2Bot +BotClasses[30]=BotPack.TMale2Bot +BotClasses[31]=BotPack.TFemale1Bot +BotSkins[0]=CommandoSkins.cmdo +BotSkins[1]=SGirlSkins.fbth +BotSkins[2]=SoldierSkins.blkt +BotSkins[3]=CommandoSkins.daco +BotSkins[4]=FCommandoSkins.goth +BotSkins[5]=FCommandoSkins.goth +BotSkins[6]=SoldierSkins.RawS +BotSkins[7]=SGirlSkins.Venm +BotSkins[8]=CommandoSkins.goth +BotSkins[9]=FCommandoSkins.daco +BotSkins[10]=SoldierSkins.sldr +BotSkins[11]=CommandoSkins.daco +BotSkins[12]=SGirlSkins.Garf +BotSkins[13]=SGirlSkins.army +BotSkins[14]=SoldierSkins.blkt +BotSkins[15]=FCommandoSkins.daco +BotSkins[16]=CommandoSkins.cmdo +BotSkins[17]=SGirlSkins.fbth +BotSkins[18]=SoldierSkins.blkt +BotSkins[19]=FCommandoSkins.goth +BotSkins[20]=CommandoSkins.daco +BotSkins[21]=FCommandoSkins.goth +BotSkins[22]=SoldierSkins.RawS +BotSkins[23]=SGirlSkins.Venm +BotSkins[24]=CommandoSkins.goth +BotSkins[25]=FCommandoSkins.daco +BotSkins[26]=SoldierSkins.sldr +BotSkins[27]=SGirlSkins.Garf +BotSkins[28]=CommandoSkins.daco +BotSkins[29]=SGirlSkins.army +BotSkins[30]=SoldierSkins.blkt +BotSkins[31]=FCommandoSkins.daco diff --git a/System64/Default.ini b/System64/Default.ini new file mode 100644 index 0000000..f39f882 --- /dev/null +++ b/System64/Default.ini @@ -0,0 +1,508 @@ +[URL] +Protocol=unreal +ProtocolDescription=Unreal Protocol +Name=Player +Map=Index.unr +LocalMap=CityIntro.unr +Host= +Portal= +MapExt=unr +SaveExt=usa +Port=7777 +Class=Botpack.TMale1 + +[FirstRun] +FirstRun=0 + +[PackageRemap] +UnrealShare=UnrealI + +[Engine.Engine] +GameRenderDevice=OpenGLDrv.OpenGLRenderDevice +AudioDevice=ALAudio.ALAudioSubsystem +NetworkDevice=IpDrv.TcpNetDriver +DemoRecordingDevice=Engine.DemoRecDriver +Console=UTMenu.UTConsole +Language=int +GameEngine=Engine.GameEngine +EditorEngine=Editor.EditorEngine +WindowedRenderDevice=OpenGLDrv.OpenGLRenderDevice +RenderDevice=OpenGLDrv.OpenGLRenderDevice +DefaultGame=Botpack.DeathMatchPlus +DefaultServerGame=Botpack.DeathMatchPlus +ViewportManager=WinDrv.WindowsClient +Render=Render.Render +Input=Engine.Input +Canvas=Engine.Canvas +CdPath=G: + +[Core.System] +PurgeCacheDays=30 +SavePath=../Save +CachePath=../Cache +CacheExt=.uxx +Paths=../System/*.u +Paths=../Maps/*.unr +Paths=../Textures/*.utx +Paths=../Sounds/*.uax +Paths=../Music/*.umx +Suppress=DevLoad +Suppress=DevSave +Suppress=DevNetTraffic +Suppress=DevGarbage +Suppress=DevKill +Suppress=DevReplace +Suppress=DevSound +Suppress=DevCompile +Suppress=DevBind +Suppress=DevBsp +Suppress=DevMD5 +Suppress=DevAudio +Suppress=DevMusic + +[Engine.GameEngine] +CacheSizeMegs=16 +UseSound=True +MinClientVersion=432 +MD5PostJoinCheck=true +ServerActors=IpDrv.UdpBeacon +ServerActors=IpServer.UdpServerQuery +ServerActors=IpServer.UdpServerUplink MasterServerAddress=unreal.epicgames.com MasterServerPort=27900 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.mplayer.com MasterServerPort=27900 +ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.333networks.com MasterServerPort=27900 +ServerActors=UWeb.WebServer +ServerPackages=SoldierSkins +ServerPackages=CommandoSkins +ServerPackages=FCommandoSkins +ServerPackages=SGirlSkins +ServerPackages=BossSkins +ServerPackages=Botpack +ServerPackages=MultiMesh +ServerPackages=Relics +ServerPackages=EpicCustomModels +ServerPackages=TCowMeshSkins +ServerPackages=TNaliMeshSkins +ServerPackages=TSkMSkins +ServerPackages=De + +[WinDrv.WindowsClient] +WindowedViewportX=1024 +WindowedViewportY=768 +WindowedColorBits=32 +FullscreenViewportX=1024 +FullscreenViewportY=768 +FullscreenColorBits=32 +Brightness=0.500000 +MipFactor=1.000000 +UseDirectDraw=True +UseJoystick=False +CaptureMouse=True +StartupFullscreen=True +CurvedSurfaces=False +LowDetailTextures=False +ScreenFlashes=True +NoLighting=False +SlowVideoBuffering=True +DeadZoneXYZ=True +DeadZoneRUV=False +InvertVertical=False +ScaleXYZ=1000.0 +ScaleRUV=2000.0 +MinDesiredFrameRate=30.0 +Decals=True +NoDynamicLights=False + +[SDLDrv.SDLClient] +WindowedViewportX=1024 +WindowedViewportY=768 +WindowedColorBits=32 +FullscreenViewportX=1024 +FullscreenViewportY=768 +FullscreenColorBits=32 +Brightness=0.500000 +MipFactor=1.000000 +UseJoystick=False +CaptureMouse=True +StartupFullscreen=True +CurvedSurfaces=False +LowDetailTextures=False +ScreenFlashes=True +NoLighting=False +SlowVideoBuffering=True +DeadZoneXYZ=True +DeadZoneRUV=False +InvertVertical=False +ScaleXYZ=1000.0 +ScaleRUV=2000.0 +MinDesiredFrameRate=30.0 +Decals=True +NoDynamicLights=False + +[Engine.Player] +ConfiguredInternetSpeed=10000 +ConfiguredLanSpeed=20000 + +[ALAudio.ALAudioSubsystem] +UseHRTF=Autodetect +ViewportVolumeIntensity=1.000000 +DetailStats=False +ReverbIntensity=1.000000 +UseReverb=True +OldReverbIntensity=1.000000 +EmulateOldReverb=True +MusicAmplify=0 +MusicStereoAngle=30 +MusicStereoMix=70 +MusicPanSeparation=50 +MusicDsp=DSP_ALL +MusicInterpolation=SPLINE +ProbeDevicesOnly=False +UseAutoSampleRate=False +OutputRate=44100Hz +DopplerFactor=0.100000 +bSoundAttenuate=True +AmbientFactor=0.700000 +UseDigitalMusic=True +EffectsChannels=64 +UseSpeechVolume=True +MusicVolume=0 +SpeechVolume=200 +SoundVolume=64 +SampleRate=44100Hz + +[Galaxy.GalaxyAudioSubsystem] +UseDirectSound=True +UseFilter=True +UseSurround=False +UseStereo=True +UseCDMusic=False +UseDigitalMusic=True +UseSpatial=False +UseReverb=True +Use3dHardware=False +LowSoundQuality=False +ReverseStereo=False +Latency=40 +OutputRate=22050Hz +EffectsChannels=16 +DopplerSpeed=9000.000000 +MusicVolume=160 +SoundVolume=200 +AmbientFactor=0.700000 + +[IpDrv.TcpNetDriver] +AllowDownloads=True +ConnectionTimeout=15.0 +InitialConnectTimeout=150.0 +AckTimeout=1.0 +KeepAliveTime=0.2 +MaxClientRate=20000 +SimLatency=0 +RelevantTimeout=5.0 +SpawnPrioritySeconds=1.0 +ServerTravelPause=4.0 +NetServerMaxTickRate=50 +LanServerMaxTickRate=50 +DownloadManagers=IpDrv.HTTPDownload +DownloadManagers=Engine.ChannelDownload +MaxConnPerIPPerMinute=5 +LogMaxConnPerIPPerMin=False +AllowPlayerPortUnreach=True +LogPortUnreach=False +MaxFileDownloadRate=-1 + +[IpDrv.HTTPDownload] +RedirectToURL= +ProxyServerHost= +ProxyServerPort=3128 +UseCompression=True + +[Engine.DemoRecDriver] +DemoSpectatorClass=Botpack.CHSpectator +MaxClientRate=25000 +ConnectionTimeout=15.0 +InitialConnectTimeout=500.0 +AckTimeout=1.0 +KeepAliveTime=1.0 +SimLatency=0 +RelevantTimeout=5.0 +SpawnPrioritySeconds=1.0 +ServerTravelPause=4.0 +NetServerMaxTickRate=60 +LanServerMaxTickRate=60 + +[Engine.GameReplicationInfo] +ServerName=Another UT Server +ShortName=UT Server + +[IpDrv.TcpipConnection] +SimPacketLoss=0 +SimLatency=0 + +[IpServer.UdpServerQuery] +GameName=ut + +[IpDrv.UdpBeacon] +DoBeacon=True +BeaconTime=0.50 +BeaconTimeout=5.0 +BeaconProduct=ut + +[SoftDrv.SoftwareRenderDevice] +Translucency=True +VolumetricLighting=True +ShinySurfaces=False +Coronas=False +HighDetailActors=False +HighResTextureSmooth=True +LowResTextureSmooth=False +FastTranslucency=True + +[GlideDrv.GlideRenderDevice] +Translucency=True +VolumetricLighting=True +ShinySurfaces=True +Coronas=True +HighDetailActors=True +DetailBias=-1.500000 +RefreshRate=60Hz +DetailTextures=True +FastUglyRefresh=False +ScreenSmoothing=True +Resolution=Default + +[MetalDrv.MetalRenderDevice] +Translucency=True +VolumetricLighting=True +ShinySurfaces=True +Coronas=True +HighDetailActors=True +DetailTextures=False + +[OpenGLDrv.OpenGLRenderDevice] +Translucency=True +VolumetricLighting=False +ShinySurfaces=True +Coronas=True +HighDetailActors=True +DetailTextures=True + +[D3DDrv.D3DRenderDevice] +Translucency=True +VolumetricLighting=False +ShinySurfaces=True +Coronas=True +HighDetailActors=True +UseMipmapping=True +UseTrilinear=False +UseMultitexture=True +UsePageFlipping=True +UsePalettes=True +UseFullscreen=True +UseGammaCorrection=True +DetailTextures=False +Use3dfx=False +UseTripleBuffering=True +UsePrecache=True +Use32BitTextures=False + +[SglDrv.SglRenderDevice] +Translucency=True +VolumetricLighting=False +ShinySurfaces=False +Coronas=True +HighDetailActors=False +ColorDepth=16 +DetailTextures=False +FastUglyRefresh=False +TextureDetailBias=Near +VertexLighting=False + +[Editor.EditorEngine] +UseSound=True +CacheSizeMegs=6 +GridEnabled=True +SnapVertices=True +SnapDistance=10.000000 +GridSize=(X=16.000000,Y=16.000000,Z=16.000000) +RotGridEnabled=True +RotGridSize=(Pitch=1024,Yaw=1024,Roll=1024) +GameCommandLine=-log +FovAngleDegrees=90.000000 +GodMode=True +AutoSave=False +AutoSaveTimeMinutes=5 +AutoSaveIndex=6 +C_WorldBox=(R=0,G=0,B=107,A=255) +C_GroundPlane=(R=0,G=0,B=63,A=255) +C_GroundHighlight=(R=0,G=0,B=127,A=255) +C_BrushWire=(R=255,G=63,B=63,A=255) +C_Pivot=(R=0,G=255,B=0,A=255) +C_Select=(R=0,G=0,B=127,A=255) +C_AddWire=(R=127,G=127,B=255,A=255) +C_SubtractWire=(R=255,G=192,B=63,A=255) +C_GreyWire=(R=163,G=163,B=163,A=255) +C_Invalid=(R=163,G=163,B=163,A=255) +C_ActorWire=(R=127,G=63,B=0,A=255) +C_ActorHiWire=(R=255,G=127,B=0,A=255) +C_White=(R=255,G=255,B=255,A=255) +C_SemiSolidWire=(R=127,G=255,B=0,A=255) +C_NonSolidWire=(R=63,G=192,B=32,A=255) +C_WireGridAxis=(R=119,G=119,B=119,A=255) +C_ActorArrow=(R=163,G=0,B=0,A=255) +C_ScaleBox=(R=151,G=67,B=11,A=255) +C_ScaleBoxHi=(R=223,G=149,B=157,A=255) +C_Mover=(R=255,G=0,B=255,A=255) +C_OrthoBackground=(R=163,G=163,B=163,A=255) +C_Current=(R=0,G=0,B=0,A=255) +C_BrushVertex=(R=0,G=0,B=0,A=255) +C_BrushSnap=(R=0,G=0,B=0,A=255) +C_Black=(R=0,G=0,B=0,A=255) +C_Mask=(R=0,G=0,B=0,A=255) +C_WireBackground=(R=0,G=0,B=0,A=255) +C_ZoneWire=(R=0,G=0,B=0,A=255) +EditPackages=Core +EditPackages=Engine +EditPackages=Editor +EditPackages=UWindow +EditPackages=Fire +EditPackages=IpDrv +EditPackages=UWeb +EditPackages=UBrowser +EditPackages=UnrealShare +EditPackages=UnrealI +EditPackages=UMenu +EditPackages=Botpack +EditPackages=IpServer +EditPackages=UTServerAdmin +EditPackages=UTMenu +EditPackages=UTBrowser + +[UMenu.UnrealConsole] +RootWindow=UMenu.UMenuRootWindow +UWindowKey=IK_Esc +ShowDesktop=True + +[UMenu.UMenuMenuBar] +ShowHelp=True +GameUMenuDefault=UTMenu.UTGameMenu +MultiplayerUMenuDefault=UTMenu.UTMultiplayerMenu +OptionsUMenuDefault=UTMenu.UTOptionsMenu + +[Botpack.ChallengeBotInfo] +Difficulty=1 + +[Botpack.DeathMatchPlus] +bNoviceMode=True +bHardCoreMode=True +bUseTranslocator=False +bCoopWeaponMode=False + +[Botpack.CTFGame] +bUseTranslocator=True +bCoopWeaponMode=True +GoalTeamScore=3 + +[Botpack.Domination] +bDumbDown=True +bUseTranslocator=True +bCoopWeaponMode=True +GoalTeamScore=100 + +[Botpack.Assault] +bUseTranslocator=False +bCoopWeaponMode=True + +[Botpack.TeamGamePlus] +bBalanceTeams=True +GoalTeamScore=30 +bPlayersBalanceTeams=True + +[Engine.GameInfo] +bLowGore=False +bVeryLowGore=False +AdminPassword= +GamePassword= + +[UnrealShare.UnrealGameOptionsMenu] +bCanModifyGore=True + +[UBrowser.UBrowserMainClientWindow] +LANTabName=UBrowserLAN +ServerListNames[0]=UBrowserUT +ServerListNames[1]=UBrowserLAN +ServerListNames[2]=UBrowserPopulated +ServerListNames[3]=UBrowserDeathmatch +ServerListNames[4]=UBrowserTeamGames +ServerListNames[5]=UBrowserCTF +ServerListNames[6]=UBrowserDOM +ServerListNames[7]=UBrowserAS +ServerListNames[8]=UBrowserLMS +ServerListNames[9]=UBrowserAll +ServerListNames[10]=None +ServerListNames[11]=None +ServerListNames[12]=None +ServerListNames[13]=None +ServerListNames[14]=None +ServerListNames[15]=None +ServerListNames[16]=None +ServerListNames[17]=None +ServerListNames[18]=None +ServerListNames[19]=None + +[UBrowserUT] +ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,bCompatibleServersOnly=True + +[UBrowserLAN] +ListFactories[0]=UBrowser.UBrowserLocalFact,BeaconProduct=ut +URLAppend=?LAN +AutoRefreshTime=10 +bNoAutoSort=True + +[UBrowserPopulated] +ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,MinPlayers=1,bCompatibleServersOnly=True + +[UBrowserDeathmatch] +ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,GameType=DeathMatchPlus,bCompatibleServersOnly=True + +[UBrowserTeamGames] +ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,GameType=TeamGamePlus,bCompatibleServersOnly=True + +[UBrowserCTF] +ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,GameType=CTFGame,bCompatibleServersOnly=True + +[UBrowserDOM] +ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,GameType=Domination,bCompatibleServersOnly=True + +[UBrowserAS] +ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,GameType=Assault,bCompatibleServersOnly=True + +[UBrowserLMS] +ListFactories[0]=UBrowser.UBrowserSubsetFact,SupersetTag=UBrowserAll,GameType=LastManStanding,bCompatibleServersOnly=True + +[UBrowserAll] +ListFactories[0]=UBrowser.UBrowserGSpyFact,MasterServerAddress=unreal.epicgames.com,MasterServerTCPPort=28900,Region=0,GameName=ut +ListFactories[1]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.mplayer.com,MasterServerTCPPort=28900,Region=0,GameName=ut +ListFactories[2]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master.333networks.com,MasterServerTCPPort=2890 +bHidden=True +bFallbackFactories=True + +[UTMenu.UTLadder] +bGOTY=true + +[UWeb.WebServer] +Applications[0]=UTServerAdmin.UTServerAdmin +ApplicationPaths[0]=/ServerAdmin +Applications[1]=UTServerAdmin.UTImageServer +ApplicationPaths[1]=/images +DefaultApplication=0 +bEnabled=False + +[UBrowser.UBrowserHTTPClient] +ProxyServerAddress= +ProxyServerPort= + +[UTServerAdmin.UTServerAdmin] +AdminUsername=admin +AdminPassword=admin + diff --git a/System64/Editor.so b/System64/Editor.so new file mode 100644 index 0000000..b1838d6 Binary files /dev/null and b/System64/Editor.so differ diff --git a/System64/Engine.so b/System64/Engine.so new file mode 100644 index 0000000..f2d0db0 Binary files /dev/null and b/System64/Engine.so differ diff --git a/System64/Fire.so b/System64/Fire.so new file mode 100644 index 0000000..c136305 Binary files /dev/null and b/System64/Fire.so differ diff --git a/System64/Fonts/CourierPrime.ttf b/System64/Fonts/CourierPrime.ttf new file mode 100644 index 0000000..db4e6c1 Binary files /dev/null and b/System64/Fonts/CourierPrime.ttf differ diff --git a/System64/Fonts/OpenSans-Regular.ttf b/System64/Fonts/OpenSans-Regular.ttf new file mode 100644 index 0000000..29bfd35 Binary files /dev/null and b/System64/Fonts/OpenSans-Regular.ttf differ diff --git a/System64/Fonts/Tinos-Regular.ttf b/System64/Fonts/Tinos-Regular.ttf new file mode 100644 index 0000000..ae5030d Binary files /dev/null and b/System64/Fonts/Tinos-Regular.ttf differ diff --git a/System64/IpDrv.so b/System64/IpDrv.so new file mode 100644 index 0000000..e88457e Binary files /dev/null and b/System64/IpDrv.so differ diff --git a/System64/OpenGLDrv.so b/System64/OpenGLDrv.so new file mode 100644 index 0000000..2bb26ed Binary files /dev/null and b/System64/OpenGLDrv.so differ diff --git a/System64/Packages.md5 b/System64/Packages.md5 new file mode 100644 index 0000000..7a6d997 Binary files /dev/null and b/System64/Packages.md5 differ diff --git a/System64/Render.so b/System64/Render.so new file mode 100644 index 0000000..c46290a Binary files /dev/null and b/System64/Render.so differ diff --git a/System64/SDLDrv.so b/System64/SDLDrv.so new file mode 100644 index 0000000..b3dca55 Binary files /dev/null and b/System64/SDLDrv.so differ diff --git a/System64/UWeb.so b/System64/UWeb.so new file mode 100644 index 0000000..cf23da1 Binary files /dev/null and b/System64/UWeb.so differ diff --git a/System64/XOpenGLDrv.so b/System64/XOpenGLDrv.so new file mode 100644 index 0000000..594ef46 Binary files /dev/null and b/System64/XOpenGLDrv.so differ diff --git a/System64/libSDL2-2.0.so.0 b/System64/libSDL2-2.0.so.0 new file mode 100644 index 0000000..a9d52b2 Binary files /dev/null and b/System64/libSDL2-2.0.so.0 differ diff --git a/System64/libfmod.so.13 b/System64/libfmod.so.13 new file mode 100644 index 0000000..815356e Binary files /dev/null and b/System64/libfmod.so.13 differ diff --git a/System64/libmpg123.so b/System64/libmpg123.so new file mode 100644 index 0000000..30aca51 Binary files /dev/null and b/System64/libmpg123.so differ diff --git a/System64/libopenal.so.1 b/System64/libopenal.so.1 new file mode 100644 index 0000000..fa260ef Binary files /dev/null and b/System64/libopenal.so.1 differ diff --git a/System64/libxmp.so.4 b/System64/libxmp.so.4 new file mode 100644 index 0000000..45e5901 Binary files /dev/null and b/System64/libxmp.so.4 differ diff --git a/System64/ucc-bin b/System64/ucc-bin new file mode 100644 index 0000000..b232114 Binary files /dev/null and b/System64/ucc-bin differ diff --git a/System64/ucc-bin-amd64 b/System64/ucc-bin-amd64 new file mode 100644 index 0000000..b232114 Binary files /dev/null and b/System64/ucc-bin-amd64 differ diff --git a/System64/udemo.so b/System64/udemo.so new file mode 100644 index 0000000..2f91200 Binary files /dev/null and b/System64/udemo.so differ diff --git a/System64/ut-bin b/System64/ut-bin new file mode 100644 index 0000000..1627e00 Binary files /dev/null and b/System64/ut-bin differ diff --git a/System64/ut-bin-amd64 b/System64/ut-bin-amd64 new file mode 100644 index 0000000..1627e00 Binary files /dev/null and b/System64/ut-bin-amd64 differ diff --git a/System64/xopengl/DrawComplexSinglePass.frag b/System64/xopengl/DrawComplexSinglePass.frag new file mode 100644 index 0000000..c089542 --- /dev/null +++ b/System64/xopengl/DrawComplexSinglePass.frag @@ -0,0 +1,871 @@ +/*============================================================================= + Fragmentshader for DrawComplexSurface, single pass. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +// DrawComplex TexCoords Indices +const uint IDX_DIFFUSE_COORDS = 0u; +const uint IDX_LIGHTMAP_COORDS = 1u; +const uint IDX_FOGMAP_COORDS = 2u; +const uint IDX_DETAIL_COORDS = 3u; +const uint IDX_MACRO_COORDS = 4u; +const uint IDX_ENVIROMAP_COORDS = 5u; +const uint IDX_DIFFUSE_INFO = 6u; +const uint IDX_MACRO_INFO = 7u; +const uint IDX_BUMPMAP_INFO = 8u; +const uint IDX_HEIGHTMAP_INFO = 9u; +const uint IDX_X_AXIS = 10u; +const uint IDX_Y_AXIS = 11u; +const uint IDX_Z_AXIS = 12u; +const uint IDX_DRAWCOLOR = 13u; +const uint IDX_DISTANCE_FOG_COLOR = 14u; +const uint IDX_DISTANCE_FOG_INFO = 15u; + +#if BINDLESSTEXTURES +layout(std140) uniform TextureHandles +{ + layout(bindless_sampler) sampler2D Textures[NUMTEXTURES]; +}; +#endif + +uniform sampler2D Texture0; //Base Texture +uniform sampler2D Texture1; //Lightmap +uniform sampler2D Texture2; //Fogmap +uniform sampler2D Texture3; //Detail Texture +uniform sampler2D Texture4; //Macro Texture +uniform sampler2D Texture5; //BumpMap +uniform sampler2D Texture6; //EnvironmentMap +uniform sampler2D Texture7; //HeightMap + +in vec3 vCoords; +#if EDITOR +flat in vec3 vSurfaceNormal; +#endif +#if ENGINE_VERSION==227 || BUMPMAPS +in vec4 vEyeSpacePos; +flat in mat3 vTBNMat; +#endif + +in vec2 vTexCoords; +in vec2 vLightMapCoords; +in vec2 vFogMapCoords; +in vec3 vTangentViewPos; +in vec3 vTangentFragPos; + +#if DETAILTEXTURES +in vec2 vDetailTexCoords; +#endif +#if MACROTEXTURES +in vec2 vMacroTexCoords; +#endif +#if BUMPMAPS +in vec2 vBumpTexCoords; +#endif +#if ENGINE_VERSION==227 +in vec2 vEnvironmentTexCoords; +#endif + +#ifdef GL_ES +layout ( location = 0 ) out vec4 FragColor; +# if SIMULATEMULTIPASS +layout ( location = 1 ) out vec4 FragColor1; +#endif +#else +# if SIMULATEMULTIPASS +layout ( location = 0, index = 1) out vec4 FragColor1; +#endif +layout ( location = 0, index = 0) out vec4 FragColor; +#endif + +#if SHADERDRAWPARAMETERS +flat in uint vTexNum; +flat in uint vLightMapTexNum; +flat in uint vFogMapTexNum; +flat in uint vDetailTexNum; +flat in uint vMacroTexNum; +flat in uint vBumpMapTexNum; +flat in uint vEnviroMapTexNum; +flat in uint vHeightMapTexNum; +flat in uint vDrawFlags; +flat in uint vTextureFormat; +flat in uint vPolyFlags; +flat in float vBaseDiffuse; +flat in float vBaseAlpha; +flat in float vParallaxScale; +flat in float vGamma; +flat in float vBumpMapSpecular; +# if EDITOR +flat in uint vHitTesting; +flat in uint vRendMap; +flat in vec4 vDrawColor; +# endif +flat in vec4 vDistanceFogColor; +flat in vec4 vDistanceFogInfo; +#else +float vBumpMapSpecular; +uniform vec4 TexCoords[16]; +uniform uint TexNum[16]; +uniform uint DrawFlags[4]; +#endif + +vec3 rgb2hsv(vec3 c) +{ + // some nice stuff from http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); + vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 hsv2rgb(vec3 c) +{ + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + +#if ENGINE_VERSION==227 +vec2 ParallaxMapping(vec2 ptexCoords, vec3 viewDir, uint TexNum, out float parallaxHeight) +{ + +#if BASIC_PARALLAX + +// very basic implementation + float height = 0.f; + # if BINDLESSTEXTURES + if (TexNum > 0u) + height = texture(Textures[TexNum], ptexCoords).r; + else height = texture(Texture7, ptexCoords).r; + # else + height = texture(Texture7, ptexCoords).r; + # endif + + return ptexCoords - viewDir.xy * (height * 0.1); + +#endif // BASIC_PARALLAX + +#if OCCLUSION_PARALLAX + +// parallax occlusion mapping + #if !SHADERDRAWPARAMETERS + float vParallaxScale = TexCoords[IDX_HEIGHTMAP_INFO].z * 0.025; // arbitrary to get DrawScale into (for this purpose) sane regions. + float vTimeSeconds = TexCoords[IDX_HEIGHTMAP_INFO].w; // Surface.Level->TimeSeconds + #endif + + //vParallaxScale += 8.0f * sin(vTimeSeconds) + 4.0 * cos(2.3f * vTimeSeconds); + + // number of depth layers + const float minLayers = 8; + const float maxLayers = 32; + float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0.0, 0.0, 1.0), viewDir))); + // calculate the size of each layer + float layerDepth = 1.0 / numLayers; + // depth of current layer + float currentLayerDepth = 0.0; + // the amount to shift the texture coordinates per layer (from vector P) + vec2 P = viewDir.xy / viewDir.z * vParallaxScale; + vec2 deltaTexCoords = P / numLayers; + + // get initial values + vec2 currentTexCoords = ptexCoords; + float currentDepthMapValue = 0.0; + + # if BINDLESSTEXTURES + if (TexNum > 0u) + currentDepthMapValue = texture(Textures[TexNum], currentTexCoords).r; + else currentDepthMapValue = texture(Texture7, currentTexCoords).r; + # else + currentDepthMapValue = texture(Texture7, currentTexCoords).r; + # endif + + while(currentLayerDepth < currentDepthMapValue) + { + // shift texture coordinates along direction of P + currentTexCoords -= deltaTexCoords; + // get depthmap value at current texture coordinates + # if BINDLESSTEXTURES + if (TexNum > 0u) + currentDepthMapValue = texture(Textures[TexNum], currentTexCoords).r; + else currentDepthMapValue = texture(Texture7, currentTexCoords).r; + # else + currentDepthMapValue = texture(Texture7, currentTexCoords).r; + # endif + + // get depth of next layer + currentLayerDepth += layerDepth; + } + + // get texture coordinates before collision (reverse operations) + vec2 prevTexCoords = currentTexCoords + deltaTexCoords; + + // get depth after and before collision for linear interpolation + float afterDepth = currentDepthMapValue - currentLayerDepth; + + float beforeDepth = 0.0; + # if BINDLESSTEXTURES + if (TexNum > 0u) + beforeDepth = texture(Textures[TexNum], currentTexCoords).r - currentLayerDepth + layerDepth; + else beforeDepth = texture(Texture7, currentTexCoords).r - currentLayerDepth + layerDepth; + # else + beforeDepth = texture(Texture7, currentTexCoords).r - currentLayerDepth + layerDepth; + # endif + + // interpolation of texture coordinates + float weight = afterDepth / (afterDepth - beforeDepth); + vec2 finalTexCoords = prevTexCoords * weight + currentTexCoords * (1.0 - weight); + + return finalTexCoords; +#endif // OCCLUSION_PARALLAX + +#if RELIEF_PARALLAX + +// Relief Parallax Mapping + + // determine required number of layers + const float minLayers = 10.0; + const float maxLayers = 15.0; + float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0, 0, 1), viewDir))); + + #if !SHADERDRAWPARAMETERS + float vParallaxScale = TexCoords[IDX_HEIGHTMAP_INFO].z * 0.025; // arbitrary to get DrawScale into (for this purpose) sane regions. + float vTimeSeconds = TexCoords[IDX_HEIGHTMAP_INFO].w; // Surface.Level->TimeSeconds + #endif + + // height of each layer + float layerHeight = 1.0 / numLayers; + // depth of current layer + float currentLayerHeight = 0.0; + // shift of texture coordinates for each iteration + vec2 dtex = vParallaxScale * viewDir.xy / viewDir.z / numLayers; + + // current texture coordinates + vec2 currentTexCoords = ptexCoords; + + // depth from heightmap + float heightFromTexture = 0.0; + # if BINDLESSTEXTURES + if (TexNum > 0u) + heightFromTexture = texture(Textures[TexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif + + // while point is above surface + while(heightFromTexture > currentLayerHeight) + { + // go to the next layer + currentLayerHeight += layerHeight; + + // shift texture coordinates along V + currentTexCoords -= dtex; + + // new depth from heightmap + # if BINDLESSTEXTURES + if (TexNum > 0u) + heightFromTexture = texture(Textures[TexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif + } + + /////////////////////////////////////////////////////////// + // Start of Relief Parallax Mapping + + // decrease shift and height of layer by half + vec2 deltaTexCoord = dtex / 2.0; + float deltaHeight = layerHeight / 2.0; + + // return to the mid point of previous layer + currentTexCoords += deltaTexCoord; + currentLayerHeight -= deltaHeight; + + // binary search to increase precision of Steep Paralax Mapping + const int numSearches = 5; + for(int i=0; i 0u) + heightFromTexture = texture(Textures[TexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif + + // shift along or agains vector V + if(heightFromTexture > currentLayerHeight) // below the surface + { + currentTexCoords -= deltaTexCoord; + currentLayerHeight += deltaHeight; + } + else // above the surface + { + currentTexCoords += deltaTexCoord; + currentLayerHeight -= deltaHeight; + } + } + + // return results + parallaxHeight = currentLayerHeight; + return currentTexCoords; + +#endif // RELIEF_PARALLAX + return ptexCoords; +} + + +// unused. Maybe later. +/* +float parallaxSoftShadowMultiplier(in vec3 L, in vec2 initialTexCoord, in float initialHeight) +{ + float shadowMultiplier = 1; + + const float minLayers = 15; + const float maxLayers = 30; + + #if !SHADERDRAWPARAMETERS + float vParallaxScale = TexCoords[IDX_MACRO_INFO].w * 0.025; // arbitrary to get DrawScale into (for this purpose) sane regions. + #endif + + // calculate lighting only for surface oriented to the light source + if(dot(vec3(0, 0, 1), L) > 0) + { + // calculate initial parameters + float numSamplesUnderSurface = 0; + shadowMultiplier = 0; + float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0, 0, 1), L))); + float layerHeight = initialHeight / numLayers; + vec2 texStep = vParallaxScale * L.xy / L.z / numLayers; + + // current parameters + float currentLayerHeight = initialHeight - layerHeight; + vec2 currentTexCoords = initialTexCoord + texStep; + float heightFromTexture = 0.0; + # if BINDLESSTEXTURES + if (vMacroTexNum > 0u) + heightFromTexture = texture(Textures[vMacroTexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif + + int stepIndex = 1; + + // while point is below depth 0.0 ) + while(currentLayerHeight > 0) + { + // if point is under the surface + if(heightFromTexture < currentLayerHeight) + { + // calculate partial shadowing factor + numSamplesUnderSurface += 1; + float newShadowMultiplier = (currentLayerHeight - heightFromTexture) * + (1.0 - stepIndex / numLayers); + shadowMultiplier = max(shadowMultiplier, newShadowMultiplier); + } + + // offset to the next layer + stepIndex += 1; + currentLayerHeight -= layerHeight; + currentTexCoords += texStep; + # if BINDLESSTEXTURES + if (vMacroTexNum > 0u) + heightFromTexture = texture(Textures[vMacroTexNum], currentTexCoords).r; + else heightFromTexture = texture(Texture7, currentTexCoords).r; + # else + heightFromTexture = texture(Texture7, currentTexCoords).r; + # endif + } + + // Shadowing factor should be 1 if there were no points under the surface + if(numSamplesUnderSurface < 1) + { + shadowMultiplier = 1; + } + else + { + shadowMultiplier = 1.0 - shadowMultiplier; + } + } + return shadowMultiplier; +} +*/ +#endif + +#if 1 +void main (void) +{ + mat3 InFrameCoords = mat3(FrameCoords[1].xyz, FrameCoords[2].xyz, FrameCoords[3].xyz); // TransformPointBy... + mat3 InFrameUncoords = mat3(FrameUncoords[1].xyz, FrameUncoords[2].xyz, FrameUncoords[3].xyz); + + vec4 TotalColor = vec4(1.0); + vec2 texCoords = vTexCoords; + +#if !SHADERDRAWPARAMETERS + uint vDrawFlags = DrawFlags[0]; + uint vTextureFormat = DrawFlags[1]; + uint vPolyFlags = DrawFlags[2]; + uint vRendMap = DrawFlags[3]; + bool bHitTesting = bool(TexNum[12]); + float vBaseDiffuse = TexCoords[IDX_DIFFUSE_INFO].x; + float vBaseAlpha = TexCoords[IDX_DIFFUSE_INFO].z; + float vGamma = TexCoords[IDX_Z_AXIS].w; + vec4 vDrawColor = TexCoords[IDX_DRAWCOLOR]; + vec4 vBumpMapInfo = TexCoords[IDX_BUMPMAP_INFO]; + vec4 vDistanceFogColor = TexCoords[IDX_DISTANCE_FOG_COLOR]; + vec4 vDistanceFogInfo = TexCoords[IDX_DISTANCE_FOG_INFO]; + vec4 vHeightMapInfo = TexCoords[IDX_HEIGHTMAP_INFO]; +# if BINDLESSTEXTURES + uint vTexNum = TexNum[0]; + uint vLightMapTexNum = TexNum[1]; + uint vFogMapTexNum = TexNum[2]; + uint vDetailTexNum = TexNum[3]; + uint vMacroTexNum = TexNum[4]; + uint vBumpMapTexNum = TexNum[5]; + uint vEnviroMapTexNum = TexNum[6]; + uint vHeightMapTexNum = TexNum[7]; +#else + uint vMacroTexNum = 0u; //otherwise undefined if !BINDLESSTEXTURES + uint vHeightMapTexNum = 0u; +# endif +#else +# if EDITOR + bool bHitTesting = bool(vHitTesting); +# endif +#endif + +#if HARDWARELIGHTS || BUMPMAPS + vec3 TangentViewDir = normalize( vTangentViewPos - vTangentFragPos ); + int NumLights = int(LightData4[0].y); + float parallaxHeight = 1.0; + + #if !SHADERDRAWPARAMETERS + vBumpMapSpecular = TexCoords[IDX_BUMPMAP_INFO].y; + #endif + +#if BASIC_PARALLAX || OCCLUSION_PARALLAX || RELIEF_PARALLAX + // ParallaxMap + if ((vDrawFlags & DF_HeightMap) == DF_HeightMap) + { + // get new texture coordinates from Parallax Mapping + texCoords = ParallaxMapping(vTexCoords, TangentViewDir, vHeightMapTexNum, parallaxHeight); + + //if(texCoords.x > 1.0 || texCoords.y > 1.0 || texCoords.x < 0.0 || texCoords.y < 0.0) + // discard;// texCoords = vTexCoords; + } +#endif + +#endif + vec4 Color = vec4(1.0); +#if BINDLESSTEXTURES + if (vTexNum > 0u) + Color = texture(Textures[vTexNum], texCoords); + else Color = texture(Texture0, texCoords); +#else + Color = texture(Texture0, texCoords); +#endif + + #if SRGB + if((vPolyFlags & PF_Modulated)!=PF_Modulated) + { + Color.r=max(1.055 * pow(Color.r, 0.416666667) - 0.055, 0.0); + Color.g=max(1.055 * pow(Color.g, 0.416666667) - 0.055, 0.0); + Color.b=max(1.055 * pow(Color.b, 0.416666667) - 0.055, 0.0); + } + #endif + + if (vBaseDiffuse > 0.0) + Color *= vBaseDiffuse; // Diffuse factor. + + if (vBaseAlpha > 0.0) + Color.a *= vBaseAlpha; // Alpha. + + if (vTextureFormat == TEXF_BC5) //BC5 (GL_COMPRESSED_RG_RGTC2) compression + Color.b = sqrt(1.0 - Color.r*Color.r + Color.g*Color.g); + + // Handle PF_Masked. + if ( (vPolyFlags&PF_Masked) == PF_Masked ) + { + if(Color.a < 0.5) + discard; + else Color.rgb /= Color.a; + } + else if ( (vPolyFlags&PF_AlphaBlend) == PF_AlphaBlend && Color.a < 0.01 ) + discard; + +/* if ((vPolyFlags&PF_Mirrored) == PF_Mirrored) + { + //add mirror code here. + } +*/ + + TotalColor=Color; + + vec4 LightColor = vec4(1.0); +#if HARDWARELIGHTS + float LightAdd = 0.0f; + LightColor = vec4(0.0,0.0,0.0,0.0); + + for (int i=0; i < NumLights; i++) + { + float WorldLightRadius = LightData4[i].x; + float LightRadius = LightData2[i].w; + float RWorldLightRadius = WorldLightRadius*WorldLightRadius; + + vec3 InLightPos = ((LightPos[i].xyz - FrameCoords[0].xyz)*InFrameCoords); // Frame->Coords. + float dist = distance(vCoords, InLightPos); + + if (dist < RWorldLightRadius) + { + // Light color + vec4 CurrentLightColor = vec4(LightData1[i].x,LightData1[i].y,LightData1[i].z, 1.0); + + float MinLight = 0.05; + float b = WorldLightRadius / (RWorldLightRadius * MinLight); + float attenuation = WorldLightRadius / (dist+b*dist*dist); + + //float attenuation = 0.82*(1.0-smoothstep(LightRadius,24.0*LightRadius+0.50,dist)); + + LightColor += CurrentLightColor * attenuation; + } + } + TotalColor *= LightColor; +#else + // LightMap + if ((vDrawFlags & DF_LightMap) == DF_LightMap) + { +# if BINDLESSTEXTURES + if (vLightMapTexNum > 0u) + LightColor = texture(Textures[vLightMapTexNum], vLightMapCoords); + else + LightColor = texture(Texture1, vLightMapCoords); +# else + LightColor = texture(Texture1, vLightMapCoords); +# endif +# ifdef GL_ES + TotalColor*=vec4(LightColor.bgr,1.0); +# else + TotalColor*=vec4(LightColor.rgb,1.0); +# endif + TotalColor.rgb=clamp(TotalColor.rgb*2.0,0.0,1.0); //saturate. + } + +#endif + + // DetailTextures +#if DETAILTEXTURES + if (((vDrawFlags & DF_DetailTexture) == DF_DetailTexture)) + { + float NearZ = vCoords.z/512.0; + float DetailScale = 1.0; + float bNear; + vec4 DetailTexColor; + vec3 hsvDetailTex; + + for(int i=0; i < DetailMax; ++i) + { + if (i > 0) + { + NearZ *= 4.223f; + DetailScale *= 4.223f; + } + bNear = clamp(0.65-NearZ,0.0,1.0); + + if (bNear > 0.0) + { + # if BINDLESSTEXTURES + if (vDetailTexNum > 0u) + DetailTexColor = texture(Textures[vDetailTexNum], vDetailTexCoords * DetailScale); + else DetailTexColor = texture(Texture3, vDetailTexCoords * DetailScale); + # else + DetailTexColor = texture(Texture3, vDetailTexCoords * DetailScale); + # endif + + vec3 hsvDetailTex = rgb2hsv(DetailTexColor.rgb); // cool idea Han :) + hsvDetailTex.b += (DetailTexColor.r - 0.1); + hsvDetailTex = hsv2rgb(hsvDetailTex); + DetailTexColor=vec4(hsvDetailTex,0.0); + DetailTexColor = mix(vec4(1.0,1.0,1.0,1.0), DetailTexColor, bNear); //fading out. + + TotalColor.rgb*=DetailTexColor.rgb; + } + } + } +#endif + + // MacroTextures +#if MACROTEXTURES + if ((vDrawFlags & DF_MacroTexture) == DF_MacroTexture) + { + vec4 MacrotexColor; +# if BINDLESSTEXTURES + if (vMacroTexNum > 0u) + MacrotexColor = texture(Textures[vMacroTexNum], vMacroTexCoords); + else MacrotexColor = texture(Texture4, vMacroTexCoords); +# else + MacrotexColor = texture(Texture4, vMacroTexCoords); +# endif + + if ( (vPolyFlags&PF_Masked) == PF_Masked ) + { + if(MacrotexColor.a < 0.5) + discard; + else MacrotexColor.rgb /= MacrotexColor.a; + } + else if ( (vPolyFlags&PF_AlphaBlend) == PF_AlphaBlend && MacrotexColor.a < 0.01 ) + discard; + + vec3 hsvMacroTex = rgb2hsv(MacrotexColor.rgb); + hsvMacroTex.b += (MacrotexColor.r - 0.1); + hsvMacroTex = hsv2rgb(hsvMacroTex); + MacrotexColor=vec4(hsvMacroTex,1.0); + TotalColor*=MacrotexColor; + } +#endif + + // BumpMap (Normal Map) +#if BUMPMAPS + if ((vDrawFlags & DF_BumpMap) == DF_BumpMap) + { + //normal from normal map + vec3 TextureNormal; +# if BINDLESSTEXTURES + if (vBumpMapTexNum > 0u) + TextureNormal = normalize(texture(Textures[vBumpMapTexNum], texCoords).rgb * 2.0 - 1.0); // has to be texCoords instead of vBumpTexCoords, otherwise alignment won't work on bumps. + else TextureNormal = normalize(texture(Texture5, texCoords).rgb * 2.0 - 1.0); +# else + TextureNormal = normalize(texture(Texture5, texCoords).rgb * 2.0 - 1.0); +# endif + + vec3 BumpColor; + vec3 TotalBumpColor=vec3(0.0,0.0,0.0); + + for(int i=0; iCoords. + + float dist = distance(vCoords, InLightPos); + + float MinLight = 0.05; + float b = NormalLightRadius / (NormalLightRadius * NormalLightRadius * MinLight); + float attenuation = NormalLightRadius / (dist+b*dist*dist); + + if ( (vPolyFlags&PF_Unlit) == PF_Unlit) + InLightPos=vec3(1.0,1.0,1.0); //no idea whats best here. Arbitrary value based on some tests. + + if ( (NormalLightRadius == 0.0 || (dist > NormalLightRadius) || ( bZoneNormalLight && (LightData4[i].z != LightData4[i].w))) && !bSunlight)// Do not consider if not in range or in a different zone. + continue; + + vec3 TangentLightPos = vTBNMat * InLightPos; + vec3 TangentlightDir = normalize( TangentLightPos - vTangentFragPos ); + + // ambient + vec3 ambient = 0.1 * TotalColor.xyz; + + // diffuse + float diff = max(dot(TangentlightDir, TextureNormal), 0.0); + vec3 diffuse = diff * TotalColor.xyz; + + // specular + vec3 halfwayDir = normalize(TangentlightDir + TangentViewDir); + float spec = pow(max(dot(TextureNormal, halfwayDir), 0.0), 8.0); + vec3 specular = vec3(max(vBumpMapSpecular,0.1)) * spec * CurrentLightColor * LightBrightness; + + TotalBumpColor += (ambient + diffuse + specular) * attenuation; + } + TotalColor+=vec4(clamp(TotalBumpColor,0.0,1.0),1.0); + } +#endif + + // FogMap + vec4 FogColor = vec4(1.0); + if ((vDrawFlags & DF_FogMap) == DF_FogMap) + { +#if BINDLESSTEXTURES + if (vFogMapTexNum > 0u) + FogColor = texture(Textures[vFogMapTexNum], vFogMapCoords); + else + FogColor = texture(Texture2, vFogMapCoords); + +#else + FogColor = texture(Texture2, vFogMapCoords); +#endif + TotalColor.rgb = TotalColor.rgb * (1.0-FogColor.a) + FogColor.rgb; + TotalColor.a = FogColor.a; + } + + // EnvironmentMap +#if ENGINE_VERSION==227 + if ((vDrawFlags & DF_EnvironmentMap) == DF_EnvironmentMap) + { + vec4 EnvironmentColor; +# if BINDLESSTEXTURES + if (vEnviroMapTexNum > 0u) + EnvironmentColor = texture(Textures[vEnviroMapTexNum], vEnvironmentTexCoords); + else EnvironmentColor = texture(Texture6, vEnvironmentTexCoords); +# else + EnvironmentColor = texture(Texture6, vEnvironmentTexCoords); +# endif + if ( (vPolyFlags&PF_Masked) == PF_Masked ) + { + if(EnvironmentColor.a < 0.5) + discard; + else EnvironmentColor.rgb /= EnvironmentColor.a; + } + else if ( (vPolyFlags&PF_AlphaBlend) == PF_AlphaBlend && EnvironmentColor.a < 0.01 ) + discard; + + TotalColor*=vec4(EnvironmentColor.rgb,1.0); + } +#endif + + //TotalColor=clamp(TotalColor,0.0,1.0); //saturate. + + // Add DistanceFog +#if ENGINE_VERSION==227 + // stijn: Very slow! Went from 135 to 155FPS on CTF-BT-CallousV3 by just disabling this branch even tho 469 doesn't do distance fog + int FogMode = int(vDistanceFogInfo.w); + if (FogMode >= 0) + { + FogParameters DistanceFogParams; + DistanceFogParams.FogStart = vDistanceFogInfo.x; + DistanceFogParams.FogEnd = vDistanceFogInfo.y; + DistanceFogParams.FogDensity = vDistanceFogInfo.z; + DistanceFogParams.FogMode = FogMode; + + if ( (vPolyFlags&PF_Modulated) == PF_Modulated ) + DistanceFogParams.FogColor = vec4(0.5,0.5,0.5,0.0); + else if ( (vPolyFlags&PF_Translucent) == PF_Translucent && (vPolyFlags&PF_Environment) != PF_Environment) + DistanceFogParams.FogColor = vec4(0.0,0.0,0.0,0.0); + else DistanceFogParams.FogColor = vDistanceFogColor; + + DistanceFogParams.FogCoord = abs(vEyeSpacePos.z/vEyeSpacePos.w); + TotalColor = mix(TotalColor, DistanceFogParams.FogColor, getFogFactor(DistanceFogParams)); + } +#endif + + if((vPolyFlags & PF_Modulated)!=PF_Modulated) + { +#if EDITOR + // Gamma + float InGamma = vGamma*GammaMultiplierUED; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#else + // Gamma + float InGamma = vGamma*GammaMultiplier; // vGamma is a value from 0.1 to 1.0 + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#endif + } + +#if EDITOR + // Editor support. + if (vRendMap == REN_Zones || vRendMap == REN_PolyCuts || vRendMap == REN_Polys) + { + TotalColor +=0.5; + TotalColor *= vDrawColor; + } + else if ( vRendMap==REN_Normals ) //Thank you han! + { + // Dot. + float T = 0.5*dot(normalize(vCoords),vSurfaceNormal); + + // Selected. + if ( (vPolyFlags&PF_Selected)==PF_Selected ) + { + TotalColor = vec4(0.0,0.0,abs(T),1.0); + } + // Normal. + else + { + TotalColor = vec4(max(0.0,T),max(0.0,-T),0.0,1.0); + } + } + else if ( vRendMap==REN_PlainTex ) + { + TotalColor = Color; + } + + if ( (vRendMap!=REN_Normals) && ((vPolyFlags&PF_Selected) == PF_Selected) ) + { + TotalColor.r = (TotalColor.r*0.75); + TotalColor.g = (TotalColor.g*0.75); + TotalColor.b = (TotalColor.b*0.75) + 0.1; + TotalColor = clamp(TotalColor,0.0,1.0); + if(TotalColor.a < 0.5) + TotalColor.a = 0.51; + } + + // HitSelection, Zoneview etc. + if (bHitTesting) + TotalColor = vDrawColor; // Use ONLY DrawColor. + +#endif + +# if SIMULATEMULTIPASS + if((vPolyFlags & PF_Modulated) == PF_Modulated) + { + FragColor = TotalColor; + FragColor1 = (vec4(1.0,1.0,1.0,1.0)-TotalColor); + } + else + { + FragColor = TotalColor; + FragColor1 = (vec4(1.0,1.0,1.0,1.0)-TotalColor)*LightColor; + } +#else + FragColor = TotalColor; +#endif + + +} +#else +void main(void) +{ +# if BINDLESSTEXTURES + vec4 Color = texture(Textures[vBaseTexNum], vTexCoords); +# else + vec4 Color = texture(Texture0, vTexCoords); +# endif + FragColor = Color; +} +#endif + +/* +// +// EnviroMap. +// +// Simple GLSL implementation of the C++ code. Should be obsoleted by some fancy +// per pixel sphere mapping implementation. But for now, just use this approach +// as PF_Environment handling is the last missing peace on obsoleting RenderSubsurface. +// +vec2 EnviroMap( vec3 Point, vec3 Normal ) +{ + vec3 R = reflect(normalize(Point),Normal); + return vec2(0.5*dot(R,Uncoords_XAxis)+0.5,0.5*dot(R,Uncoords_YAxis)+0.5); +} +*/ diff --git a/System64/xopengl/DrawComplexSinglePass.vert b/System64/xopengl/DrawComplexSinglePass.vert new file mode 100644 index 0000000..dd634bc --- /dev/null +++ b/System64/xopengl/DrawComplexSinglePass.vert @@ -0,0 +1,285 @@ +/*============================================================================= + Vertexshader for DrawComplexSurface, single pass. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +// DrawComplex TexCoords Indices +const uint IDX_DIFFUSE_COORDS = 0u; +const uint IDX_LIGHTMAP_COORDS = 1u; +const uint IDX_FOGMAP_COORDS = 2u; +const uint IDX_DETAIL_COORDS = 3u; +const uint IDX_MACRO_COORDS = 4u; +const uint IDX_ENVIROMAP_COORDS = 5u; +const uint IDX_DIFFUSE_INFO = 6u; +const uint IDX_MACRO_INFO = 7u; +const uint IDX_BUMPMAP_INFO = 8u; +const uint IDX_HEIGHTMAP_INFO = 9u; +const uint IDX_X_AXIS = 10u; +const uint IDX_Y_AXIS = 11u; +const uint IDX_Z_AXIS = 12u; +const uint IDX_DRAWCOLOR = 13u; +const uint IDX_DISTANCE_FOG_COLOR = 14u; +const uint IDX_DISTANCE_FOG_INFO = 15u; + +layout (location = 0) in vec4 Coords; // == gl_Vertex +layout (location = 1) in vec4 Normal; // == gl_Vertex + +out vec3 vCoords; +out vec4 vEyeSpacePos; +out vec2 vTexCoords; +out vec2 vLightMapCoords; +out vec2 vFogMapCoords; +out vec3 vTangentViewPos; +out vec3 vTangentFragPos; +#if DETAILTEXTURES +out vec2 vDetailTexCoords; +#endif +#if MACROTEXTURES +out vec2 vMacroTexCoords; +#endif +#if BUMPMAPS +out vec2 vBumpTexCoords; +#endif +#if ENGINE_VERSION==227 +out vec2 vEnvironmentTexCoords; +#endif +#if EDITOR +flat out vec3 vSurfaceNormal; // f.e. Render normal view. +#endif +#if ENGINE_VERSION==227 || BUMPMAPS +flat out mat3 vTBNMat; +#endif + +#if SHADERDRAWPARAMETERS +struct DrawComplexShaderDrawParams +{ + vec4 DiffuseUV; // 0 + vec4 LightMapUV; // 1 + vec4 FogMapUV; // 2 + vec4 DetailUV; // 3 + vec4 MacroUV; // 4 + vec4 EnviroMapUV; // 5 + vec4 DiffuseInfo; // 6 + vec4 MacroInfo; // 7 + vec4 BumpMapInfo; // 8 + vec4 HeightMapInfo; // 9 + vec4 XAxis; // 10 + vec4 YAxis; // 11 + vec4 ZAxis; // 12 + vec4 DrawColor; // 13 + vec4 DistanceFogColor; // 14 + vec4 DistanceFogInfo; // 15 + uvec4 TexNum[4]; + uvec4 DrawFlags; +}; + +layout(std430, binding = 6) buffer AllDrawComplexShaderDrawParams +{ + DrawComplexShaderDrawParams DrawComplexParams[]; +}; + +flat out uint vTexNum; +flat out uint vLightMapTexNum; +flat out uint vFogMapTexNum; +flat out uint vDetailTexNum; +flat out uint vMacroTexNum; +flat out uint vBumpMapTexNum; +flat out uint vEnviroMapTexNum; +flat out uint vHeightMapTexNum; +flat out uint vHeightMapNum; +flat out uint vDrawFlags; +flat out uint vTextureFormat; +flat out uint vPolyFlags; +flat out float vBaseDiffuse; +flat out float vBaseAlpha; +flat out float vParallaxScale; +flat out float vGamma; +flat out float vBumpMapSpecular; +flat out float vTimeSeconds; +# if EDITOR +flat out uint vHitTesting; +flat out uint vRendMap; +flat out vec4 vDrawColor; +# endif +flat out vec4 vDistanceFogColor; +flat out vec4 vDistanceFogInfo; +#else +uniform vec4 TexCoords[16]; +uniform uint TexNum[16]; +uniform uint DrawFlags[4]; +#endif + +#ifndef GL_ES +out float gl_ClipDistance[MAX_CLIPPINGPLANES]; +#endif + +#if 1 +void main(void) +{ +#if SHADERDRAWPARAMETERS + vec4 XAxis = DrawComplexParams[gl_DrawID].XAxis; + vec4 YAxis = DrawComplexParams[gl_DrawID].YAxis; + vec4 ZAxis = DrawComplexParams[gl_DrawID].ZAxis; + vec4 DiffuseUV = DrawComplexParams[gl_DrawID].DiffuseUV; + vec4 LightMapUV = DrawComplexParams[gl_DrawID].LightMapUV; + vec4 FogMapUV = DrawComplexParams[gl_DrawID].FogMapUV; + vec4 DetailUV = DrawComplexParams[gl_DrawID].DetailUV; + vec4 MacroUV = DrawComplexParams[gl_DrawID].MacroUV; + vec4 EnviroMapUV = DrawComplexParams[gl_DrawID].EnviroMapUV; + + vDrawFlags = DrawComplexParams[gl_DrawID].DrawFlags[0]; + vTextureFormat = DrawComplexParams[gl_DrawID].DrawFlags[1]; + vPolyFlags = DrawComplexParams[gl_DrawID].DrawFlags[2]; +# if EDITOR + vRendMap = DrawComplexParams[gl_DrawID].DrawFlags[3]; + vHitTesting = DrawComplexParams[gl_DrawID].TexNum[3].x + vDrawColor = DrawComplexParams[gl_DrawID].DrawColor; +# endif + vTexNum = DrawComplexParams[gl_DrawID].TexNum[0].x; + vLightMapTexNum = DrawComplexParams[gl_DrawID].TexNum[0].y; + vFogMapTexNum = DrawComplexParams[gl_DrawID].TexNum[0].z; + vDetailTexNum = DrawComplexParams[gl_DrawID].TexNum[0].w; + vMacroTexNum = DrawComplexParams[gl_DrawID].TexNum[1].x; + vBumpMapTexNum = DrawComplexParams[gl_DrawID].TexNum[1].y; + vEnviroMapTexNum = DrawComplexParams[gl_DrawID].TexNum[1].z; + vHeightMapTexNum = DrawComplexParams[gl_DrawID].TexNum[1].w; + vBaseDiffuse = DrawComplexParams[gl_DrawID].DiffuseInfo.x; + vBaseAlpha = DrawComplexParams[gl_DrawID].DiffuseInfo.z; + vBumpMapSpecular = DrawComplexParams[gl_DrawID].BumpMapInfo.y; + vParallaxScale = DrawComplexParams[gl_DrawID].HeightMapInfo.z * 0.025; + vTimeSeconds = DrawComplexParams[gl_DrawID].HeightMapInfo.w; + vGamma = ZAxis.w; + vDistanceFogColor = DrawComplexParams[gl_DrawID].DistanceFogColor; + vDistanceFogInfo = DrawComplexParams[gl_DrawID].DistanceFogInfo; +#else + vec4 XAxis = TexCoords[IDX_X_AXIS]; + vec4 YAxis = TexCoords[IDX_Y_AXIS]; + vec4 ZAxis = TexCoords[IDX_Z_AXIS]; + vec4 DiffuseUV = TexCoords[IDX_DIFFUSE_COORDS]; + vec4 LightMapUV = TexCoords[IDX_LIGHTMAP_COORDS]; + vec4 FogMapUV = TexCoords[IDX_FOGMAP_COORDS]; + vec4 DetailUV = TexCoords[IDX_DETAIL_COORDS]; + vec4 MacroUV = TexCoords[IDX_MACRO_COORDS]; + vec4 EnviroMapUV = TexCoords[IDX_ENVIROMAP_COORDS]; + + uint vDrawFlags = DrawFlags[0]; +#endif + + // Point Coords + vCoords = Coords.xyz; + + // UDot/VDot calculation. + vec3 MapCoordsXAxis = XAxis.xyz; + vec3 MapCoordsYAxis = YAxis.xyz; +#if EDITOR || ENGINE_VERSION==227 || BUMPMAPS + vec3 MapCoordsZAxis = ZAxis.xyz; +#endif + + float UDot = XAxis.w; + float VDot = YAxis.w; + + float MapDotU = dot(MapCoordsXAxis, Coords.xyz) - UDot; + float MapDotV = dot(MapCoordsYAxis, Coords.xyz) - VDot; + vec2 MapDot = vec2(MapDotU, MapDotV); + + //Texture UV to fragment + vec2 TexMapMult = DiffuseUV.xy; + vec2 TexMapPan = DiffuseUV.zw; + vTexCoords = (MapDot - TexMapPan) * TexMapMult; + + //Texture UV Lightmap to fragment + if ((vDrawFlags & DF_LightMap) == DF_LightMap) + { + vec2 LightMapMult = LightMapUV.xy; + vec2 LightMapPan = LightMapUV.zw; + vLightMapCoords = (MapDot - LightMapPan) * LightMapMult; + } + + // Texture UV FogMap + if ((vDrawFlags & DF_FogMap) == DF_FogMap) + { + vec2 FogMapMult = FogMapUV.xy; + vec2 FogMapPan = FogMapUV.zw; + vFogMapCoords = (MapDot - FogMapPan) * FogMapMult; + } + + // Texture UV DetailTexture +#if DETAILTEXTURES + if ((vDrawFlags & DF_DetailTexture) == DF_DetailTexture) + { + vec2 DetailMult = DetailUV.xy; + vec2 DetailPan = DetailUV.zw; + vDetailTexCoords = (MapDot - DetailPan) * DetailMult; + } +#endif + + // Texture UV Macrotexture +#if MACROTEXTURES + if ((vDrawFlags & DF_MacroTexture) == DF_MacroTexture) + { + vec2 MacroMult = MacroUV.xy; + vec2 MacroPan = MacroUV.zw; + vMacroTexCoords = (MapDot - MacroPan) * MacroMult; + } +#endif + + // Texture UV EnvironmentMap +#if ENGINE_VERSION==227 + if ((vDrawFlags & DF_EnvironmentMap) == DF_EnvironmentMap) + { + vec2 EnvironmentMapMult = EnviroMapUV.xy; + vec2 EnvironmentMapPan = EnviroMapUV.zw; + vEnvironmentTexCoords = (MapDot - EnvironmentMapPan) * EnvironmentMapMult; + } +#endif + +#if ENGINE_VERSION==227 || BUMPMAPS + vEyeSpacePos = modelviewMat*vec4(Coords.xyz, 1.0); + vec3 EyeSpacePos = normalize(FrameCoords[0].xyz);// despite pretty perfect results (so far) this still seems somewhat wrong to me. + + if ((vDrawFlags & (DF_MacroTexture|DF_BumpMap)) != 0u) + { + vec3 T = normalize(vec3(MapCoordsXAxis.x,MapCoordsXAxis.y,MapCoordsXAxis.z)); + vec3 B = normalize(vec3(MapCoordsYAxis.x,MapCoordsYAxis.y,MapCoordsYAxis.z)); + vec3 N = normalize(vec3(MapCoordsZAxis.x,MapCoordsZAxis.y,MapCoordsZAxis.z)); //SurfNormals. + + // TBN must have right handed coord system. + //if (dot(cross(N, T), B) < 0.0) + // T = T * -1.0; + + vTBNMat = transpose(mat3(T, B, N)); + + vTangentViewPos = vTBNMat * EyeSpacePos.xyz; + vTangentFragPos = vTBNMat * Coords.xyz; + } +#endif + +#if EDITOR + vSurfaceNormal = MapCoordsZAxis; +#endif + + gl_Position = modelviewprojMat * vec4(Coords.xyz, 1.0); + +#if SUPPORTSCLIPDISTANCE + uint ClipIndex = uint(ClipParams.x); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,Coords.xyz); +#endif // SUPPORTSCLIPDISTANCE +} +#else +void main (void) +{ + + vEyeSpacePos = modelviewMat*vec4(Coords.xyz, 1.0); + + // Point Coords + vCoords = Coords.xyz; + + vTexCoords = vec2(0.0, 0.0); +#if BINDLESSTEXTURES +// BaseTexNum = uint(TexNums0.x); +#endif + gl_Position = modelviewprojMat * vec4(Coords.xyz, 1.0); + } +#endif diff --git a/System64/xopengl/DrawGouraud.frag b/System64/xopengl/DrawGouraud.frag new file mode 100644 index 0000000..9756cde --- /dev/null +++ b/System64/xopengl/DrawGouraud.frag @@ -0,0 +1,455 @@ +/*============================================================================= + Fragmentshader for DrawGouraudPolygon, in 227 also DrawGouraudPolygonList. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +#if BINDLESSTEXTURES +layout(std140) uniform TextureHandles +{ + sampler2D Textures[NUMTEXTURES]; +}; +#endif + +uniform sampler2D Texture0; // Base Texture +uniform sampler2D Texture1; // DetailTexture +uniform sampler2D Texture2; // BumpMap +uniform sampler2D Texture3; // MacroTex + +in vec3 gCoords; +in vec2 gTexCoords; // TexCoords +in vec2 gDetailTexCoords; +in vec2 gMacroTexCoords; +in vec4 gNormals; +in vec4 gEyeSpacePos; +in vec4 gLightColor; +in vec4 gFogColor; //VertexFog +flat in vec3 gTextureInfo; // diffuse, alpha, bumpmap specular +flat in uint gTexNum; +flat in uint gDetailTexNum; +flat in uint gBumpTexNum; +flat in uint gMacroTexNum; +flat in uint gDrawFlags; +flat in uint gTextureFormat; +flat in uint gPolyFlags; +flat in float gGamma; +flat in vec4 gDistanceFogColor; +flat in vec4 gDistanceFogInfo; +in vec3 gTangentViewPos; +in vec3 gTangentFragPos; +in mat3 gTBNMat; + +#if EDITOR +flat in vec4 gDrawColor; +flat in uint gRendMap; +flat in uint gHitTesting; +#endif + +#ifdef GL_ES +layout ( location = 0 ) out vec4 FragColor; +# if SIMULATEMULTIPASS +layout ( location = 1 ) out vec4 FragColor1; +#endif +#else +# if SIMULATEMULTIPASS +layout ( location = 0, index = 1) out vec4 FragColor1; +#endif +layout ( location = 0, index = 0) out vec4 FragColor; +#endif + +vec3 rgb2hsv(vec3 c) +{ + // some nice stuff from http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); + vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 hsv2rgb(vec3 c) +{ + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + +void main(void) +{ + mat3 InFrameCoords = mat3(FrameCoords[1].xyz, FrameCoords[2].xyz, FrameCoords[3].xyz); // TransformPointBy... + mat3 InFrameUncoords = mat3(FrameUncoords[1].xyz, FrameUncoords[2].xyz, FrameUncoords[3].xyz); + + vec4 TotalColor = vec4(0.0,0.0,0.0,0.0); + vec4 Color; + + int NumLights = int(LightData4[0].y); + +#if BINDLESSTEXTURES + if (uint(gTexNum) > 0u) + Color = texture(Textures[uint(gTexNum)], gTexCoords); + else Color = texture(Texture0, gTexCoords); +#else + Color = texture(Texture0, gTexCoords); +#endif + + #if SRGB + if((gPolyFlags & PF_Modulated)!=PF_Modulated) + { + Color.r=max(1.055 * pow(Color.r, 0.416666667) - 0.055, 0.0); + Color.g=max(1.055 * pow(Color.g, 0.416666667) - 0.055, 0.0); + Color.b=max(1.055 * pow(Color.b, 0.416666667) - 0.055, 0.0); + } + #endif + + if (gTextureInfo.x > 0.0) + Color *= gTextureInfo.x; // Diffuse factor. + + if (gTextureInfo.y > 0.0) + Color.a *= gTextureInfo.y; // Alpha. + + if (gTextureFormat == TEXF_BC5) //BC5 (GL_COMPRESSED_RG_RGTC2) compression + Color.b = sqrt(1.0 - Color.r*Color.r + Color.g*Color.g); + + // Handle PF_Masked. + if ( (gPolyFlags&PF_Masked) == PF_Masked ) + { + if(Color.a < 0.5) + discard; + else Color.rgb /= Color.a; + } + else if ( ((gPolyFlags&PF_AlphaBlend) == PF_AlphaBlend) && Color.a < 0.01 ) + discard; + + vec4 LightColor; + + #if HARDWARELIGHTS + float LightAdd = 0.0f; + vec4 TotalAdd = vec4(0.0,0.0,0.0,0.0); + + for (int i=0; i < NumLights; i++) + { + float WorldLightRadius = LightData4[i].x; + float LightRadius = LightData2[i].w; + float RWorldLightRadius = WorldLightRadius*WorldLightRadius; + + vec3 InLightPos = ((LightPos[i].xyz - FrameCoords[0].xyz)*InFrameCoords); // Frame->Coords. + float dist = distance(gCoords, InLightPos); + + if (dist < RWorldLightRadius) + { + // Light color + vec3 RGBColor = vec3(LightData1[i].x,LightData1[i].y,LightData1[i].z); + + float MinLight = 0.025; + float b = WorldLightRadius / (RWorldLightRadius * MinLight); + float attenuation = WorldLightRadius / (dist+b*dist*dist); + + //float attenuation = 0.82*(1.0-smoothstep(LightRadius,24.0*LightRadius+0.50,dist)); + + TotalAdd += (vec4(RGBColor,1.0) * attenuation); + } + } + LightColor = TotalAdd; + #else + LightColor = gLightColor; + #endif + + // Handle PF_RenderFog. + if ((gPolyFlags&PF_RenderFog) == PF_RenderFog) + { + // Handle PF_RenderFog|PF_Modulated. + if ( (gPolyFlags&PF_Modulated)== PF_Modulated ) + { + // Compute delta to modulation identity. + vec3 Delta = vec3(0.5) - Color.xyz; + + // Reduce delta by (squared) fog intensity. + //Delta *= 1.0 - sqrt(gFogColor.a); + Delta *= 1.0 - gFogColor.a; + Delta *= vec3(1.0) - gFogColor.rgb; + + TotalColor = vec4(vec3(0.5)-Delta,Color.a); + } + // Normal. + else + { + Color*=LightColor; + //TotalColor=mix(Color, vec4(gFogColor.xyz,1.0), gFogColor.w); + TotalColor.rgb = Color.rgb * (1.0-gFogColor.a) + gFogColor.rgb; + TotalColor.a = Color.a; + } + + } + // No Fog. + else if((gPolyFlags & PF_Modulated) == PF_Modulated) + { + TotalColor = Color; + } + else + { + TotalColor = Color * vec4(LightColor.rgb,1.0); + } + + +#if DETAILTEXTURES + if (((gDrawFlags & DF_DetailTexture) == DF_DetailTexture)) + { + float NearZ = gCoords.z/512.0; + float DetailScale = 1.0; + float bNear; + vec4 DetailTexColor; + vec3 hsvDetailTex; + + for(int i=0; i < DetailMax; ++i) + { + if (i > 0) + { + NearZ *= 4.223f; + DetailScale *= 4.223f; + } + bNear = clamp(0.65-NearZ,0.0,1.0); + + if (bNear > 0.0) + { + # if BINDLESSTEXTURES + if (gDetailTexNum > 0u) + DetailTexColor = texture(Textures[gDetailTexNum], gDetailTexCoords * DetailScale); + else DetailTexColor = texture(Texture1, gDetailTexCoords * DetailScale); + # else + DetailTexColor = texture(Texture1, gDetailTexCoords * DetailScale); + # endif + + vec3 hsvDetailTex = rgb2hsv(DetailTexColor.rgb); // cool idea Han :) + hsvDetailTex.b += (DetailTexColor.r - 0.1); + hsvDetailTex = hsv2rgb(hsvDetailTex); + DetailTexColor = vec4(hsvDetailTex,0.0); + DetailTexColor = mix(vec4(1.0,1.0,1.0,1.0), DetailTexColor, bNear); //fading out. + + TotalColor.rgb*=DetailTexColor.rgb; + } + } + } +#endif + + +#if MACROTEXTURES + if ((gDrawFlags & DF_MacroTexture) == DF_MacroTexture && (gDrawFlags & DF_BumpMap) != DF_BumpMap) + { + vec4 MacroTexColor; + #if BINDLESSTEXTURES + if (gMacroTexNum > 0u) + MacroTexColor = texture(Textures[gMacroTexNum], gMacroTexCoords); + else + MacroTexColor = texture(Texture3, gMacroTexCoords); // MacroTexture + #else + MacroTexColor = texture(Texture3, gMacroTexCoords); // MacroTexture + #endif + vec3 hsvMacroTex = rgb2hsv(MacroTexColor.rgb); + hsvMacroTex.b += (MacroTexColor.r - 0.1); + hsvMacroTex = hsv2rgb(hsvMacroTex); + MacroTexColor=vec4(hsvMacroTex,1.0); + TotalColor*=MacroTexColor; + } +#endif + + // BumpMap +#if BUMPMAPS + if ((gDrawFlags & DF_BumpMap) == DF_BumpMap) + { + vec3 TangentViewDir = normalize( gTangentViewPos - gTangentFragPos ); + + //normal from normal map + vec3 TextureNormal; +#if BINDLESSTEXTURES + if (gBumpTexNum > uint(0)) + TextureNormal = texture(Textures[gBumpTexNum], gTexCoords).rgb * 2.0 - 1.0; + else + TextureNormal = texture(Texture2, gTexCoords).rgb * 2.0 - 1.0; +#else + TextureNormal = texture(Texture2, gTexCoords).rgb * 2.0 - 1.0; +#endif + + vec3 BumpColor; + vec3 TotalBumpColor=vec3(0.0,0.0,0.0); + + for(int i=0; iCoords. + + float dist = distance(gCoords, InLightPos); + + float MinLight = 0.05; + float b = NormalLightRadius / (NormalLightRadius * NormalLightRadius * MinLight); + float attenuation = NormalLightRadius / (dist+b*dist*dist); + + if ( (gPolyFlags&PF_Unlit) == PF_Unlit) + InLightPos=vec3(1.0,1.0,1.0); //no idea whats best here. Arbitrary value based on some tests. + + if ( (NormalLightRadius == 0.0 || (dist > NormalLightRadius) || ( bZoneNormalLight && (LightData4[i].z != LightData4[i].w))) && !bSunlight)// Do not consider if not in range or in a different zone. + continue; + + vec3 TangentLightPos = gTBNMat * InLightPos; + vec3 TangentlightDir = normalize( TangentLightPos - gTangentFragPos ); + + // ambient + vec3 ambient = 0.1 * TotalColor.xyz; + + // diffuse + float diff = max(dot(TangentlightDir, TextureNormal), 0.0); + vec3 diffuse = diff * TotalColor.xyz; + + // specular + vec3 halfwayDir = normalize(TangentlightDir + TangentViewDir); + float spec = pow(max(dot(TextureNormal, halfwayDir), 0.0), 8.0); + vec3 specular = vec3(0.01) * spec * CurrentLightColor * LightBrightness; + + TotalBumpColor += (ambient + diffuse + specular) * attenuation; + + } + TotalColor+=vec4(clamp(TotalBumpColor,0.0,1.0),1.0); + } +#endif + + + // Add DistanceFog +#if ENGINE_VERSION==227 + if (gDistanceFogInfo.w >= 0.0) + { + FogParameters DistanceFogParams; + DistanceFogParams.FogStart = gDistanceFogInfo.x; + DistanceFogParams.FogEnd = gDistanceFogInfo.y; + DistanceFogParams.FogDensity = gDistanceFogInfo.z; + DistanceFogParams.FogMode = int(gDistanceFogInfo.w); + + if ( (gPolyFlags&PF_Modulated) == PF_Modulated ) + DistanceFogParams.FogColor = vec4(0.5,0.5,0.5,0.0); + else if ( (gPolyFlags&PF_Translucent) == PF_Translucent && (gPolyFlags&PF_Environment) != PF_Environment) + DistanceFogParams.FogColor = vec4(0.0,0.0,0.0,0.0); + else DistanceFogParams.FogColor = gDistanceFogColor; + + DistanceFogParams.FogCoord = abs(gEyeSpacePos.z/gEyeSpacePos.w); + TotalColor = mix(TotalColor, DistanceFogParams.FogColor, getFogFactor(DistanceFogParams)); + } +#endif + + if((gPolyFlags & PF_Modulated)!=PF_Modulated) + { +#if EDITOR + // Gamma + float InGamma = gGamma*GammaMultiplierUED; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#else + // Gamma + float InGamma = gGamma*GammaMultiplier; // gGamma is a value from 0.1 to 1.0 + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#endif + } + +#if EDITOR + // Editor support. + if (gRendMap == REN_Zones || gRendMap == REN_PolyCuts || gRendMap == REN_Polys || gRendMap==REN_PlainTex) + { + TotalColor = Color; + + if ( (gPolyFlags&PF_Selected) == PF_Selected ) + { + TotalColor.r = (TotalColor.r*0.75); + TotalColor.g = (TotalColor.g*0.75); + TotalColor.b = (TotalColor.b*0.75) + 0.1; + TotalColor = clamp(TotalColor,0.0,1.0); + if(TotalColor.a < 0.5) + TotalColor.a = 0.51; + } + } + else if ( gRendMap==REN_Normals ) + { + // Dot. + float T = 0.5*dot(normalize(gCoords),gNormals.xyz); + + // Selected. + if ( (gPolyFlags&PF_Selected)==PF_Selected ) + { + TotalColor = vec4(0.0,0.0,abs(T),1.0); + } + // Normal. + else + { + TotalColor = vec4(max(0.0,T),max(0.0,-T),0.0,1.0); + } + } + + // HitSelection, Zoneview etc. + if (bool(gHitTesting)) + TotalColor = gDrawColor; // Use DrawColor. + + // Texture.Alpha support. + if ( (gPolyFlags&PF_AlphaBlend) == PF_AlphaBlend && gDrawColor.a > 0.0 ) + TotalColor.a *= gDrawColor.a; +#endif + +# if SIMULATEMULTIPASS + if((gPolyFlags & PF_Modulated) == PF_Modulated) + { + FragColor = TotalColor; + FragColor1 = (vec4(1.0,1.0,1.0,1.0)-TotalColor); + } + else + { + FragColor = TotalColor; + FragColor1 = (vec4(1.0,1.0,1.0,1.0)-TotalColor)*LightColor; + } +#else + FragColor = TotalColor; +#endif + +} + +// Blending translation table +/* +//PF_Modulated +//glBlendFunc( GL_DST_COLOR, GL_SRC_COLOR ); +//pixel_color * gl_FragColor + +GL_ONE vec4(1.0) +GL_ZERO vec4(0.0) +GL_SRC_COLOR gl_FragColor +GL_SRC_ALPHA vec4(gl_FragColor.a) +GL_DST_COLOR pixel_color +GL_DST_ALPHA vec4(pixel_color.a) +GL_ONE_MINUS_SRC_COLOR vec4(1.0) - gl_FragColor +GL_ONE_MINUS_SRC_ALPHA vec4(1.0 - gl_FragColor.a) +GL_ONE_MINUS_DST_COLOR vec4(1.0) - pixel_color +GL_ONE_MINUS_DST_ALPHA vec4(1.0 - pixel_color.a) + +if (gPolyFlags & PF_Invisible) + glBlendFunc(GL_ZERO, GL_ONE); + +if (gPolyFlags & PF_Translucent) + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); + +if (gPolyFlags & PF_Modulated) + glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); + +if (gPolyFlags & PF_AlphaBlend) + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + +if (gPolyFlags & PF_Highlighted) + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); +*/ diff --git a/System64/xopengl/DrawGouraud.geo b/System64/xopengl/DrawGouraud.geo new file mode 100644 index 0000000..b746d46 --- /dev/null +++ b/System64/xopengl/DrawGouraud.geo @@ -0,0 +1,144 @@ +/*============================================================================= + Geometryshader for DrawGouraud + + For BumpMap (normal map), tangent and bitangent calculation. + Read https://wiki.delphigl.com/index.php/TBN_Matrix + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; + +flat in uint vTexNum[]; +flat in uint vDetailTexNum[]; +flat in uint vBumpTexNum[]; +flat in uint vMacroTexNum[]; +flat in uint vDrawFlags[]; +flat in uint vTextureFormat[]; +flat in uint vPolyFlags[]; +flat in float vGamma[]; + +flat in vec3 vTextureInfo[]; // diffuse, alpha, bumpmap specular +flat in vec4 vDistanceFogColor[]; +flat in vec4 vDistanceFogInfo[]; + +#if EDITOR +flat in vec4 vDrawColor[]; +flat in uint vRendMap[]; +flat in uint vHitTesting[]; +#endif + +in vec3 vCoords[]; +in vec4 vNormals[]; +in vec2 vTexCoords[]; +in vec2 vDetailTexCoords[]; +in vec2 vMacroTexCoords[]; +in vec4 vEyeSpacePos[]; +in vec4 vLightColor[]; +in vec4 vFogColor[]; + +flat out uint gTexNum; +flat out uint gDetailTexNum; +flat out uint gBumpTexNum; +flat out uint gMacroTexNum; +flat out uint gDrawFlags; +flat out uint gTextureFormat; +flat out uint gPolyFlags; +flat out float gGamma; + +out vec3 gCoords; +out vec4 gNormals; +out vec2 gTexCoords; +out vec2 gDetailTexCoords; +out vec2 gMacroTexCoords; +out vec4 gEyeSpacePos; +out vec4 gLightColor; +out vec4 gFogColor; + +out mat3 gTBNMat; +out vec3 gTangentViewPos; +out vec3 gTangentFragPos; + +flat out vec3 gTextureInfo; +flat out vec4 gDistanceFogColor; +flat out vec4 gDistanceFogInfo; +#if EDITOR +flat out vec4 gDrawColor; +flat out uint gRendMap; +flat out uint gHitTesting; +#endif + +out float gl_ClipDistance[MAX_CLIPPINGPLANES]; + +vec3 GetTangent(vec3 A, vec3 B, vec3 C, vec2 Auv, vec2 Buv, vec2 Cuv) +{ + float Bv_Cv = Buv.y - Cuv.y; + if(Bv_Cv == 0.0) + return (B-C)/(Buv.x-Cuv.x); + + float Quotient = (Auv.y - Cuv.y)/(Bv_Cv); + vec3 D = C + (B -C) * Quotient; + vec2 Duv = Cuv + (Buv-Cuv) * Quotient; + return (D-A)/(Duv.x - Auv.x); +} +vec3 GetBitangent(vec3 A, vec3 B, vec3 C, vec2 Auv, vec2 Buv, vec2 Cuv) +{ + return GetTangent(A, C, B, Auv.yx, Cuv.yx, Buv.yx); +} + +void main(void) +{ + mat3 InFrameCoords = mat3(FrameCoords[1].xyz, FrameCoords[2].xyz, FrameCoords[3].xyz); // TransformPointBy... + mat3 InFrameUncoords = mat3(FrameUncoords[1].xyz, FrameUncoords[2].xyz, FrameUncoords[3].xyz); + + vec3 Tangent = GetTangent(vCoords[0], vCoords[1], vCoords[2], vTexCoords[0], vTexCoords[1], vTexCoords[2]); + vec3 Bitangent = GetBitangent(vCoords[0], vCoords[1], vCoords[2], vTexCoords[0], vTexCoords[1], vTexCoords[2]); + uint ClipIndex = uint(ClipParams.x); + + for(int i=0; i<3; ++i) + { + vec3 T = normalize(vec3(modelMat * vec4(Tangent,0.0))); + vec3 B = normalize(vec3(modelMat * vec4(Bitangent,0.0))); + vec3 N = normalize(vec3(modelMat * vNormals[i])); + + // TBN must have right handed coord system. + //if (dot(cross(N, T), B) < 0.0) + // T = T * -1.0; + + gTBNMat = mat3(T, B, N); + + gEyeSpacePos = vEyeSpacePos[i]; + gLightColor = vLightColor[i]; + gFogColor = vFogColor[i]; + gNormals = vNormals[i]; + gTexCoords = vTexCoords[i]; + gDetailTexCoords = vDetailTexCoords[i]; + gMacroTexCoords = vMacroTexCoords[i]; + gCoords = vCoords[i]; + gTexNum = vTexNum[i]; + gDetailTexNum = vDetailTexNum[i]; + gBumpTexNum = vBumpTexNum[i]; + gMacroTexNum = vMacroTexNum[i]; + gTextureInfo = vTextureInfo[i]; + gDrawFlags = vDrawFlags[i]; + gPolyFlags = vPolyFlags[i]; + gGamma = vGamma[i]; + gTextureFormat = vTextureFormat[i]; + gDistanceFogColor = vDistanceFogColor[i]; + gDistanceFogInfo = vDistanceFogInfo[i]; + + gTangentViewPos = gTBNMat * normalize(FrameCoords[0].xyz); + gTangentFragPos = gTBNMat * gCoords.xyz; + +#if EDITOR + gDrawColor = vDrawColor[i]; + gRendMap = vRendMap[i]; + gHitTesting = vHitTesting[i]; +#endif + gl_Position = modelviewprojMat * gl_in[i].gl_Position; + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[i]); + EmitVertex(); + } +} diff --git a/System64/xopengl/DrawGouraud.vert b/System64/xopengl/DrawGouraud.vert new file mode 100644 index 0000000..2ae5757 --- /dev/null +++ b/System64/xopengl/DrawGouraud.vert @@ -0,0 +1,233 @@ +/*============================================================================= + Vertexshader for DrawGouraudPolygon, in 227 also DrawGouraudPolygonList. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +// DrawGouraud DrawData Indices +const uint IDX_DIFFUSE_INFO = 0u; +const uint IDX_DETAIL_MACRO_INFO = 1u; +const uint IDX_MISC_INFO = 2u; +const uint IDX_EDITOR_DRAWCOLOR = 3u; +const uint IDX_DISTANCE_FOG_COLOR = 4u; +const uint IDX_DISTANCE_FOG_INFO = 5u; + +layout (location = 0) in vec3 Coords; // == gl_Vertex +layout (location = 1) in vec3 Normals; // Normals +layout (location = 2) in vec2 TexCoords; // TexCoords +layout (location = 3) in vec4 LightColor; +layout (location = 4) in vec4 FogColor; + +#ifdef GL_ES +//No geometry shader in GL_ES. + +flat out uint gTexNum; +flat out uint gDetailTexNum; +flat out uint gBumpTexNum; +flat out uint gMacroTexNum; +flat out uint gDrawFlags; +flat out uint gTextureFormat; +flat out uint gPolyFlags; +flat out float gGamma; + +flat out vec3 gTextureInfo; // diffuse, alpha, bumpmap specular +flat out vec4 gDistanceFogColor; +flat out vec4 gDistanceFogInfo; + +out vec3 gCoords; +out vec4 gNormals; +out vec2 gTexCoords; +out vec2 gDetailTexCoords; +out vec2 gMacroTexCoords; +out vec4 gEyeSpacePos; +out vec4 gLightColor; +out vec4 gFogColor; +out mat3 gTBNMat; +out vec3 gTangentViewPos; +out vec3 gTangentFragPos; + +# if EDITOR +flat out vec4 gDrawColor; +flat out uint gRendMap; +flat out uint gHitTesting; +# endif + +uniform vec4 DrawData[6]; +uniform uint TexNum[4]; +uniform uint DrawFlags[4]; + +#else // GL_ES + +# if SHADERDRAWPARAMETERS +struct DrawGouraudShaderDrawParams +{ + vec4 DiffuseInfo; // 0 + vec4 DetailMacroInfo; // 1 + vec4 MiscInfo; // 2 + vec4 DrawColor; // 3 + vec4 DistanceFogColor; // 4 + vec4 DistanceFogInfo; // 5 + uvec4 TexNum; + uvec4 DrawFlags; +}; + +layout(std430, binding = 7) buffer AllDrawGouraudShaderDrawParams +{ + DrawGouraudShaderDrawParams DrawGouraudParams[]; +}; +# else +uniform vec4 DrawData[6]; +uniform uint TexNum[4]; +uniform uint DrawFlags[4]; +# endif + +flat out uint vTexNum; +flat out uint vDetailTexNum; +flat out uint vBumpTexNum; +flat out uint vMacroTexNum; +flat out uint vDrawFlags; +flat out uint vTextureFormat; +flat out uint vPolyFlags; +flat out float vGamma; + +flat out vec3 vTextureInfo; // diffuse, alpha, bumpmap specular +flat out vec4 vDistanceFogColor; +flat out vec4 vDistanceFogInfo; + +out vec3 vCoords; +out vec4 vNormals; +out vec2 vTexCoords; +out vec2 vDetailTexCoords; +out vec2 vMacroTexCoords; +out vec4 vEyeSpacePos; +out vec4 vLightColor; +out vec4 vFogColor; + +# if EDITOR +flat out vec4 vDrawColor; +flat out uint vRendMap; +flat out uint vHitTesting; +# endif + +#endif + +void main(void) +{ +#ifdef GL_ES + gEyeSpacePos = modelviewMat*vec4(Coords, 1.0); + + gCoords = Coords; + gNormals = vec4(Normals.xyz, 0); + gTexCoords = TexCoords * DrawData[IDX_DIFFUSE_INFO].xy; + gDetailTexCoords = TexCoords * DrawData[IDX_DETAIL_MACRO_INFO].xy; + gMacroTexCoords = TexCoords * DrawData[IDX_DETAIL_MACRO_INFO].zw; + gLightColor = LightColor; + gFogColor = FogColor; + + gTexNum = TexNum[0]; + gDetailTexNum = TexNum[1]; + gBumpTexNum = TexNum[2]; + gMacroTexNum = TexNum[3]; + + gDrawFlags = DrawFlags[0]; + gTextureFormat = uint(DrawData[IDX_MISC_INFO].w); + gPolyFlags = DrawFlags[2]; + gGamma = DrawData[IDX_MISC_INFO].y; + + gTextureInfo = vec3(DrawData[IDX_DIFFUSE_INFO].zw, DrawData[IDX_MISC_INFO].x); + gDistanceFogColor = DrawData[IDX_DISTANCE_FOG_COLOR]; + gDistanceFogInfo = DrawData[IDX_DISTANCE_FOG_INFO]; + +# if EDITOR + gHitTesting = DrawFlags[1]; + gRendMap = DrawFlags[3]; + gDrawColor = DrawData[IDX_EDITOR_DRAWCOLOR]; +# endif + + vec3 T = vec3(1.0,1.0,1.0); //Arbitrary. + vec3 B = vec3(1.0,1.0,1.0); //Replace with actual values extracted from mesh generation some day. + vec3 N = normalize(Normals.xyz); //Normals. + + // TBN must have right handed coord system. + //if (dot(cross(N, T), B) < 0.0) + // T = T * -1.0; + + gTBNMat = transpose(mat3(T, B, N)); + gTangentViewPos = gTBNMat * normalize(FrameCoords[0].xyz); + gTangentFragPos = gTBNMat * gCoords.xyz; + + gl_Position = modelviewprojMat * vec4(Coords, 1.0); + +#if SUPPORTSCLIPDISTANCE + uint ClipIndex = uint(ClipParams.x); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,gEyeSpacePos.xyz); +#endif // SUPPORTSCLIPDISTANCE + +#else + vEyeSpacePos = modelviewMat*vec4(Coords, 1.0); + + vCoords = Coords; + vNormals = vec4(Normals.xyz, 0); + vLightColor = LightColor; + vFogColor = FogColor; + +# if SHADERDRAWPARAMETERS + vTexCoords = TexCoords * DrawGouraudParams[gl_DrawID].DiffuseInfo.xy; + vDetailTexCoords = TexCoords * DrawGouraudParams[gl_DrawID].DetailMacroInfo.xy; + vMacroTexCoords = TexCoords * DrawGouraudParams[gl_DrawID].DetailMacroInfo.zw; + + vTexNum = DrawGouraudParams[gl_DrawID].TexNum[0]; + vDetailTexNum = DrawGouraudParams[gl_DrawID].TexNum[1]; + vBumpTexNum = DrawGouraudParams[gl_DrawID].TexNum[2]; + vMacroTexNum = DrawGouraudParams[gl_DrawID].TexNum[3]; + + vDrawFlags = DrawGouraudParams[gl_DrawID].DrawFlags[0]; + vTextureFormat = uint(DrawGouraudParams[gl_DrawID].MiscInfo.w); + vPolyFlags = DrawGouraudParams[gl_DrawID].DrawFlags[2]; + vGamma = DrawGouraudParams[gl_DrawID].MiscInfo.y; + + vTextureInfo = vec3( + DrawGouraudParams[gl_DrawID].DiffuseInfo.zw, + DrawGouraudParams[gl_DrawID].MiscInfo.x); + vDistanceFogColor = DrawGouraudParams[gl_DrawID].DistanceFogColor; + vDistanceFogInfo = DrawGouraudParams[gl_DrawID].DistanceFogInfo; + +# if EDITOR + vHitTesting = DrawGouraudParams[gl_DrawID].DrawFlags[1]; + vRendMap = DrawGouraudParams[gl_DrawID].DrawFlags[3]; + vDrawColor = DrawGouraudParams[gl_DrawID].DrawColor; +# endif + +# else // SHADERDRAWPARAMETERS + + vTexCoords = TexCoords * DrawData[IDX_DIFFUSE_INFO].xy; + vDetailTexCoords = TexCoords * DrawData[IDX_DETAIL_MACRO_INFO].xy; + vMacroTexCoords = TexCoords * DrawData[IDX_DETAIL_MACRO_INFO].zw; + + vTexNum = TexNum[0]; + vDetailTexNum = TexNum[1]; + vBumpTexNum = TexNum[2]; + vMacroTexNum = TexNum[3]; + + vDrawFlags = DrawFlags[0]; + vTextureFormat = uint(DrawData[IDX_MISC_INFO].w); + vPolyFlags = DrawFlags[2]; + vGamma = DrawData[IDX_MISC_INFO].y; + + vTextureInfo = vec3(DrawData[IDX_DIFFUSE_INFO].zw, DrawData[IDX_MISC_INFO].x); + vDistanceFogColor = DrawData[IDX_DISTANCE_FOG_COLOR]; + vDistanceFogInfo = DrawData[IDX_DISTANCE_FOG_INFO]; + +# if EDITOR + vHitTesting = DrawFlags[1]; + vRendMap = DrawFlags[3]; + vDrawColor = DrawData[IDX_EDITOR_DRAWCOLOR]; +# endif +# endif + + gl_Position = vec4(Coords, 1.0); + +#endif + +} diff --git a/System64/xopengl/DrawSimple.frag b/System64/xopengl/DrawSimple.frag new file mode 100644 index 0000000..9e207bd --- /dev/null +++ b/System64/xopengl/DrawSimple.frag @@ -0,0 +1,60 @@ +/*============================================================================= + Fragmentshader for DrawSimple, line drawing. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +uniform vec4 DrawColor; +uniform uint LineFlags; +uniform bool bHitTesting; +uniform float Gamma; + +in float texCoord; + +// LineFlags +const uint LINE_None = 0x00u; +const uint LINE_Transparent = 0x01u; +const uint LINE_DepthCued = 0x02u; + +#ifdef GL_ES +layout ( location = 0 ) out vec4 FragColor; +# if SIMULATEMULTIPASS +layout ( location = 1 ) out vec4 FragColor1; +#endif +#else +# if SIMULATEMULTIPASS +layout ( location = 0, index = 1) out vec4 FragColor1; +#endif +layout ( location = 0, index = 0) out vec4 FragColor; +#endif + +void main(void) +{ + vec4 TotalColor = DrawColor; + + if ( (LineFlags&LINE_Transparent)==LINE_Transparent ) + { + } +#if EDITOR + if (!bHitTesting) + { + // Gamma + float InGamma = Gamma*GammaMultiplierUED; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); + } +#else + // Gamma + float InGamma = Gamma*GammaMultiplier; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#endif + +# if SIMULATEMULTIPASS + FragColor1 = vec4(1.0,1.0,1.0,1.0)-TotalColor; +#endif + FragColor = TotalColor; +} diff --git a/System64/xopengl/DrawSimple.geo b/System64/xopengl/DrawSimple.geo new file mode 100644 index 0000000..c4ff6b5 --- /dev/null +++ b/System64/xopengl/DrawSimple.geo @@ -0,0 +1,22 @@ +layout(lines) in; +layout(line_strip, max_vertices = 2) out; + +noperspective out float texCoord; + +void main() +{ + mat4 modelviewMat = modelMat * viewMat; + vec2 winPos1 = vec2(512,384) * gl_in[0].gl_Position.xy / gl_in[0].gl_Position.w; + vec2 winPos2 = vec2(512,384) * gl_in[1].gl_Position.xy / gl_in[1].gl_Position.w; + + // Line Start + gl_Position = modelviewprojMat * (gl_in[0].gl_Position); + texCoord = 0.0; + EmitVertex(); + + // Line End + gl_Position = modelviewprojMat * (gl_in[1].gl_Position); + texCoord = length( winPos2 - winPos1 ); + EmitVertex(); + EndPrimitive(); +} diff --git a/System64/xopengl/DrawSimple.vert b/System64/xopengl/DrawSimple.vert new file mode 100644 index 0000000..bbe025c --- /dev/null +++ b/System64/xopengl/DrawSimple.vert @@ -0,0 +1,24 @@ +/*============================================================================= + Vertexshader for DrawSimple, Line drawing. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +layout (location = 0) in vec3 Coords; // == gl_Vertex + +#ifndef GL_ES +out float gl_ClipDistance[MAX_CLIPPINGPLANES]; +#endif + +void main(void) +{ + vec4 vEyeSpacePos = modelviewMat*vec4(Coords, 1.0); + + gl_Position = modelviewprojMat * vec4(Coords, 1.0); + +#ifndef GL_ES + uint ClipIndex = uint(ClipParams.x); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,Coords); +#endif +} diff --git a/System64/xopengl/DrawTile.frag b/System64/xopengl/DrawTile.frag new file mode 100644 index 0000000..abb2aa1 --- /dev/null +++ b/System64/xopengl/DrawTile.frag @@ -0,0 +1,108 @@ +/*============================================================================= + Fragmentshader for DrawTile. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +uniform uint PolyFlags; +uniform bool bHitTesting; +uniform float Gamma; +uniform vec4 HitDrawColor; + +in vec2 gTexCoords; +flat in vec4 gDrawColor; +flat in uint gTexNum; + +#if BINDLESSTEXTURES +layout(std140) uniform TextureHandles +{ + sampler2D Textures[NUMTEXTURES]; +}; +#endif + +uniform sampler2D Texture0; + +#ifdef GL_ES +layout ( location = 0 ) out vec4 FragColor; +# if SIMULATEMULTIPASS +layout ( location = 1 ) out vec4 FragColor1; +#endif +#else +# if SIMULATEMULTIPASS +layout ( location = 0, index = 1) out vec4 FragColor1; +#endif +layout ( location = 0, index = 0) out vec4 FragColor; +#endif + +void main(void) +{ + vec4 TotalColor; + vec4 Color; + + #if BINDLESSTEXTURES + if (gTexNum > 0u) + Color = texture(Textures[gTexNum], gTexCoords); + else Color = texture(Texture0, gTexCoords); + #else + Color = texture(Texture0, gTexCoords); + #endif + + #if SRGB + if((PolyFlags & PF_Modulated)!=PF_Modulated) + { + Color.r=max(1.055 * pow(Color.r, 0.416666667) - 0.055, 0.0); + Color.g=max(1.055 * pow(Color.g, 0.416666667) - 0.055, 0.0); + Color.b=max(1.055 * pow(Color.b, 0.416666667) - 0.055, 0.0); + } + #endif + + // Handle PF_Masked. + if ( (PolyFlags&PF_Masked) == PF_Masked ) + { + if(Color.a < 0.5) + discard; + else Color.rgb /= Color.a; + } + else if ( (PolyFlags&PF_AlphaBlend) == PF_AlphaBlend && Color.a < 0.01 ) + discard; + + TotalColor = Color * gDrawColor; // Add DrawColor. + + if((PolyFlags & PF_Modulated)!=PF_Modulated) + { +#if EDITOR + // Gamma + float InGamma = Gamma*GammaMultiplierUED; + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#else + // Gamma + float InGamma = Gamma*GammaMultiplier; // Gamma is a value from 0.1 to 1.0 + TotalColor.r=pow(TotalColor.r,1.0/InGamma); + TotalColor.g=pow(TotalColor.g,1.0/InGamma); + TotalColor.b=pow(TotalColor.b,1.0/InGamma); +#endif + } + +#if EDITOR + // Editor support. + if ( (PolyFlags&PF_Selected) == PF_Selected ) + { + TotalColor.g = TotalColor.g - 0.04; + TotalColor = clamp(TotalColor,0.0,1.0); + } + + // HitSelection, Zoneview etc. + if (bHitTesting) + TotalColor = HitDrawColor; // Use HitDrawColor. +#endif + +# if SIMULATEMULTIPASS + FragColor = TotalColor; + FragColor1 = vec4(1.0,1.0,1.0,1.0)-TotalColor; +#else + FragColor = TotalColor; +#endif +} diff --git a/System64/xopengl/DrawTile.geo b/System64/xopengl/DrawTile.geo new file mode 100644 index 0000000..2222610 --- /dev/null +++ b/System64/xopengl/DrawTile.geo @@ -0,0 +1,127 @@ +/*============================================================================= + Geoshader for DrawTile. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +layout(triangles) in; +layout(triangle_strip, max_vertices = 6) out; + +flat in uint vTexNum[]; +in vec4 vTexCoords0[]; +in vec4 vTexCoords1[]; +in vec4 vTexCoords2[]; +flat in vec4 vDrawColor[]; +in vec4 vEyeSpacePos[]; +in vec3 vCoords[]; + +out vec2 gTexCoords; +flat out vec4 gDrawColor; +flat out uint gTexNum; +out float gl_ClipDistance[MAX_CLIPPINGPLANES]; + + +void main() +{ + uint ClipIndex = uint(ClipParams.x); + + gTexNum = vTexNum[0]; + + float RFX2=vTexCoords0[0].x; + float RFY2=vTexCoords0[0].y; + float FX2=vTexCoords0[0].z; + float FY2=vTexCoords0[0].w; + + float U=vTexCoords1[0].x; + float V=vTexCoords1[0].y; + float UL=vTexCoords1[0].z; + float VL=vTexCoords1[0].w; + + float XL=vTexCoords2[0].x; + float YL=vTexCoords2[0].y; + float UMult=vTexCoords2[0].z; + float VMult=vTexCoords2[0].w; + + float X = gl_in[0].gl_Position.x; + float Y = gl_in[0].gl_Position.y; + float Z = gl_in[0].gl_Position.z; + + vec3 Position; + + // 0 + Position.x = RFX2*Z*( X - FX2); + Position.y = RFY2*Z*( Y - FY2); + Position.z = Z; + gTexCoords.x = (U)*UMult; + gTexCoords.y = (V)*VMult; + + gDrawColor=vDrawColor[0]; + + gl_Position = modelviewprojMat * vec4(Position, 1.0); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[0]); + EmitVertex(); + + // 1 + Position.x = RFX2*Z*(X + XL - FX2); + Position.y = RFY2*Z*(Y - FY2); + Position.z = Z; + gTexCoords.x = (U + UL)*UMult; + gTexCoords.y = (V)*VMult; + gDrawColor=vDrawColor[0]; + + gl_Position = modelviewprojMat * vec4(Position, 1.0); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[1]); + EmitVertex(); + + // 2 + Position.x = RFX2*Z*(X + XL - FX2); + Position.y = RFY2*Z*(Y + YL - FY2); + Position.z = Z; + gTexCoords.x = (U + UL)*UMult; + gTexCoords.y = (V + VL)*VMult; + gDrawColor=vDrawColor[0]; + + gl_Position = modelviewprojMat * vec4(Position, 1.0); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[2]); + EmitVertex(); + EndPrimitive(); + + // 0 + Position.x = RFX2*Z*( X - FX2); + Position.y = RFY2*Z*( Y - FY2); + Position.z = Z; + gTexCoords.x = (U)*UMult; + gTexCoords.y = (V)*VMult; + gDrawColor=vDrawColor[0]; + + gl_Position = modelviewprojMat * vec4(Position, 1.0); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[0]); + EmitVertex(); + + // 2 + Position.x = RFX2*Z*(X + XL - FX2); + Position.y = RFY2*Z*(Y + YL - FY2); + Position.z = Z; + gTexCoords.x = (U + UL)*UMult; + gTexCoords.y = (V + VL)*VMult; + gDrawColor=vDrawColor[0]; + + gl_Position = modelviewprojMat * vec4(Position, 1.0); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[1]); + EmitVertex(); + + // 3 + Position.x = RFX2*Z*(X - FX2); + Position.y = RFY2*Z*(Y + YL - FY2); + Position.z = Z; + gTexCoords.x = (U)*UMult; + gTexCoords.y = (V + VL)*VMult; + gDrawColor=vDrawColor[0]; + + gl_Position = modelviewprojMat * vec4(Position, 1.0); + gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[2]); + EmitVertex(); + + EndPrimitive(); +} diff --git a/System64/xopengl/DrawTile.vert b/System64/xopengl/DrawTile.vert new file mode 100644 index 0000000..814e467 --- /dev/null +++ b/System64/xopengl/DrawTile.vert @@ -0,0 +1,84 @@ +/*============================================================================= + Vertexshader for DrawTile. + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +layout (location = 0) in vec3 Coords; // == gl_Vertex +layout (location = 7) in vec4 DrawColor; +layout (location = 8) in float TexNum; + +#ifdef GL_ES +//No geometry shader in GL_ES. +layout (location = 2) in vec2 TexCoords; + +out vec2 gTexCoords; +flat out vec4 gDrawColor; +flat out uint gTexNum; + +#else +layout (location = 2) in vec4 TexCoords0; +layout (location = 9) in vec4 TexCoords1; +layout (location = 10) in vec4 TexCoords2; + +out vec3 vCoords; +out vec4 vTexCoords0; +out vec4 vTexCoords1; +out vec4 vTexCoords2; +flat out vec4 vDrawColor; +flat out uint vTexNum; +out vec4 vEyeSpacePos; + +#endif + +/* +#if SHADERDRAWPARAMETERS +struct DrawTileShaderDrawParams +{ + vec4 FrameCoords; // (RFX2, RFY2, FX2, FY2) + vec4 TextureInfo; // (UMult, VMult, TexNum, Gamma) + vec4 DrawColor; // Color for the tile + vec4 HitDrawColor; // Selection color for UEd + uvec4 DrawParams; // (PolyFlags, bHitTesting, unused, unused) +}; + +layout(std430, binding = 6) buffer AllDrawTileShaderDrawParams +{ + DrawTileShaderDrawParams DrawTileParams[]; +}; + +flat out uint vTexNum; +flat out uint vPolyFlags; +flat out float vGamma; +# if EDITOR +flat out bool vHitTesting; +flat out vec4 vHitDrawColor; +# endif +#endif +*/ + +void main(void) +{ +#ifdef GL_ES + vec4 gEyeSpacePos = modelviewMat*vec4(Coords, 1.0); + + gTexNum = uint(TexNum); + gTexCoords = TexCoords; + gDrawColor = DrawColor; + + gl_Position = modelviewprojMat * vec4(Coords, 1.0); +#else + vEyeSpacePos = modelviewMat*vec4(Coords, 1.0); + vCoords = Coords; + + vTexNum = uint(TexNum); + vTexCoords0 = TexCoords0; + vTexCoords1 = TexCoords1; + vTexCoords2 = TexCoords2; + vDrawColor = DrawColor; + + gl_Position = vec4(Coords, 1.0); +#endif +} + diff --git a/System64/xopengl/Extensions.incl b/System64/xopengl/Extensions.incl new file mode 100644 index 0000000..7bf7a23 --- /dev/null +++ b/System64/xopengl/Extensions.incl @@ -0,0 +1,26 @@ +/*============================================================================= + Extension.incl, GL shader extensions to be loaded. + This data is added before any other shader data. + + Revision history: + * Created by Smirftsch +=============================================================================*/ +#if BINDLESSTEXTURES +#extension GL_ARB_bindless_texture : require +#extension GL_ARB_gpu_shader_int64 : enable // we store bindless textures in interface blocks. This only works if we support int64s in GLSL +#extension GL_ARB_shading_language_420pack : enable +#endif + +#if SHADERDRAWPARAMETERS +#extension GL_ARB_shader_draw_parameters : require +#endif + +#ifdef GL_ES +// The following extension appears not to be available on RaspberryPi4 at the moment. +#extension GL_EXT_clip_cull_distance : enable +precision mediump float; +precision mediump int; +#endif + +// The following directive resets the line number to 1 to have the correct output logging for a possible error within the shader files. +#line 1 diff --git a/System64/xopengl/Globals.incl b/System64/xopengl/Globals.incl new file mode 100644 index 0000000..505f6f2 --- /dev/null +++ b/System64/xopengl/Globals.incl @@ -0,0 +1,346 @@ +/*============================================================================= + Globals.incl, shader globals. + This data is added after loading extensions. + Note that #version is internally added before, depending on + if GL or GLES is being used: + + if Core: + GL #version 330 core + or if UsingBindlessTextures || UsingPersistentBuffers + GL #version 450 core + + if ES: + GLES #version 300 es + + UsingBindlessTextures also sets #define BINDLESSTEXTURES + + To see invalid or unused shader vars comment Suppress=Dev in game ini + or set UseOpenGLDebug=True and a DebugLevel>=2 (GL_DEBUG_SEVERITY_LOW) + + Geometry shaders are only available in Core profile + Use #ifdef GL_ES in such cases + + Using UED adds #define EDITOR + + Revision history: + * Created by Smirftsch +=============================================================================*/ + +//Unreal 227 / UT PolyFlags. May require edits for other UE1 games. +const uint PF_None = 0x00000000u; // None. +const uint PF_Invisible = 0x00000001u; // Poly is invisible. +const uint PF_Masked = 0x00000002u; // Poly should be drawn masked. +const uint PF_Translucent = 0x00000004u; // Poly is transparent. +const uint PF_NotSolid = 0x00000008u; // Poly is not solid; doesn't block. +const uint PF_Environment = 0x00000010u; // Poly should be drawn environment mapped. +const uint PF_Semisolid = 0x00000020u; // Poly is semi-solid = collision solid; Csg nonsolid. +const uint PF_Modulated = 0x00000040u; // Modulation transparency. +const uint PF_FakeBackdrop = 0x00000080u; // Poly looks exactly like backdrop. +const uint PF_TwoSided = 0x00000100u; // Poly is visible from both sides. +const uint PF_AutoUPan = 0x00000200u; // Automatically pans in U direction. +const uint PF_AutoVPan = 0x00000400u; // Automatically pans in V direction. +const uint PF_NoSmooth = 0x00000800u; // Don't smooth textures. +const uint PF_BigWavy = 0x00001000u; // Poly has a big wavy pattern in it. +const uint PF_SpecialPoly = 0x00001000u; // Game-specific poly-level render control (reuse BigWavy flag) +const uint PF_HeightMap = 0x00001000u; // Use Macrotexture as HeightMap +const uint PF_SmallWavy = 0x00002000u; // Small wavy pattern (for water/enviro reflection). +const uint PF_Flat = 0x00004000u; // Flat Mesh. +const uint PF_WaterWavy = 0x00004000u; // WaterWavy Surface flag (reuse Flat flag). +const uint PF_ForceViewZone = 0x00004000u; // Force current iViewZone in OccludeBSP (reuse Flat flag) +const uint PF_LowShadowDetail = 0x00008000u; // Low detail shadows. +const uint PF_NoMerge = 0x00010000u; // Don't merge poly's nodes before lighting when rendering. +const uint PF_AlphaBlend = 0x00020000u; // This poly should be alpha blended. In UT PF_CloudWavy, but of little use without DXT3/DXT5 texture flags. +const uint PF_DirtyShadows = 0x00040000u; // Dirty shadows. +const uint PF_BrightCorners = 0x00080000u; // Brighten convex corners. +const uint PF_SpecialLit = 0x00100000u; // Only special lit lights apply to this poly. +const uint PF_Gouraud = 0x00200000u; // Gouraud shaded. +const uint PF_NoBoundRejection = 0x00200000u; // Disable bound rejection in OccludeBSP (reuse Gouraud flag) +const uint PF_Unlit = 0x00400000u; // Unlit. +const uint PF_HighShadowDetail = 0x00800000u; // High detail shadows. +const uint PF_Portal = 0x04000000u; // Portal between iZones. +const uint PF_Mirrored = 0x08000000u; // Reflective surface. + +// Editor flags. +const uint PF_Memorized = 0x01000000u; // Editor: Poly is remembered. +const uint PF_Selected = 0x02000000u; // Editor: Poly is selected. +const uint PF_Highlighted = 0x10000000u; // Editor: Poly is highlighted. +const uint PF_FlatShaded = 0x40000000u; // FPoly has been split by SplitPolyWithPlane. + +// Internal. +const uint PF_EdProcessed = 0x40000000u; // FPoly was already processed in editorBuildFPolys. +const uint PF_EdCut = 0x80000000u; // FPoly has been split by SplitPolyWithPlane. +const uint PF_RenderFog = 0x40000000u; // Render with fog mapping. +const uint PF_Occlude = 0x80000000u; // Occludes even if PF_NoOcclude. +const uint PF_RenderHint = 0x01000000u; // Rendering optimization hint. + +#if EDITOR +// enum ERenderType +const uint REN_None = 0u; // Hide completely. +const uint REN_Wire = 1u; // Wireframe of EdPolys. +const uint REN_Zones = 2u; // Show zones and zone portals. +const uint REN_Polys = 3u; // Flat-shaded Bsp. +const uint REN_PolyCuts = 4u; // Flat-shaded Bsp with normals displayed. +const uint REN_DynLight = 5u; // Illuminated texture mapping. +const uint REN_PlainTex = 6u; // Plain texture mapping. +const uint REN_OrthXY = 13u; // Orthogonal overhead (XY) view. +const uint REN_OrthXZ = 14u; // Orthogonal XZ view. +const uint REN_OrthYZ = 15u; // Orthogonal YZ view. +const uint REN_TexView = 16u; // Viewing a texture (no actor). +const uint REN_TexBrowser = 17u; // Viewing a texture browser (no actor). +const uint REN_MeshView = 18u; // Viewing a mesh. +const uint REN_LightingOnly = 19u; // Render only lights on plain white texture. +const uint REN_Normals = 20u; // Render normals only. +const uint REN_MAX = 21u; +#endif + +// Spatial Lighting +const uint LE_None=0u; +const uint LE_TorchWaver=1u; +const uint LE_FireWaver=2u; +const uint LE_WateryShimmer=3u; +const uint LE_Searchlight=4u; +const uint LE_SlowWave=5u; +const uint LE_FastWave=6u; +const uint LE_CloudCast=7u; +const uint LE_StaticSpot=8u; +const uint LE_Shock=9u; +const uint LE_Disco=10u; +const uint LE_Warp=11u; +const uint LE_Spotlight=12u; +const uint LE_NonIncidence=13u; +const uint LE_Shell=14u; +const uint LE_OmniBumpMap=15u; +const uint LE_Interference=16u; +const uint LE_Cylinder=17u; +const uint LE_Rotor=18u; +const uint LE_Sunlight=19u; +const uint LE_MAX=20u; + +// Light modulation +const uint LT_None=0u; +const uint LT_Steady=1u; +const uint LT_Pulse=2u; +const uint LT_Blink=3u; +const uint LT_Flicker=4u; +const uint LT_Strobe=5u; +const uint LT_BackdropLight=6u; +const uint LT_SubtlePulse=7u; +const uint LT_TexturePaletteOnce=8u; +const uint LT_TexturePaletteLoop=9u; +const uint LT_RandomPulse=10u; //using random LightPeriod. +const uint LT_RandomSubtlePulse=11u; //using random LightPeriod. + +// Texture Formats +const uint TEXF_P8 = 0x00u; +const uint TEXF_BGRA8_LM = 0x01u; +const uint TEXF_R5G6B5 = 0x02u; +const uint TEXF_BC1 = 0x03u; +const uint TEXF_RGB8 = 0x04u; +const uint TEXF_BGRA8 = 0x05u; +const uint TEXF_BC2 = 0x06u; +const uint TEXF_BC3 = 0x07u; +const uint TEXF_BC4 = 0x08u; +const uint TEXF_BC4_S = 0x09u; +const uint TEXF_BC5 = 0x0au; +const uint TEXF_BC5_S = 0x0bu; +const uint TEXF_BC7 = 0x0cu; +const uint TEXF_BC6H_S = 0x0du; +const uint TEXF_BC6H = 0x0eu; +const uint TEXF_RGBA16 = 0x0fu; +const uint TEXF_RGBA16_S = 0x10u; +const uint TEXF_RGBA32 = 0x11u; +const uint TEXF_RGBA32_S = 0x12u; +const uint TEXF_MONO = 0x13u; +const uint TEXF_UNCOMPRESSED = 0x14u; +const uint TEXF_UNCOMPRESSED_LOW = 0x15u; +const uint TEXF_UNCOMPRESSED_HIGH = 0x16u; +const uint TEXF_COMPRESSED = 0x17u; +const uint TEXF_COMPRESSED_LOW = 0x18u; +const uint TEXF_COMPRESSED_HIGH = 0x19u; +const uint TEXF_BC1_PA = 0x1au; +const uint TEXF_R8 = 0x1bu; +const uint TEXF_R8_S = 0x1cu; +const uint TEXF_R16 = 0x1du; +const uint TEXF_R16_S = 0x1eu; +const uint TEXF_R32 = 0x1fu; +const uint TEXF_R32_S = 0x20u; +const uint TEXF_RG8 = 0x21u; +const uint TEXF_RG8_S = 0x22u; +const uint TEXF_RG16 = 0x23u; +const uint TEXF_RG16_S = 0x24u; +const uint TEXF_RG32 = 0x25u; +const uint TEXF_RG32_S = 0x26u; +const uint TEXF_RGB8_S = 0x27u; +const uint TEXF_RGB16_ = 0x28u; +const uint TEXF_RGB16_S = 0x29u; +const uint TEXF_RGB32 = 0x2au; +const uint TEXF_RGB32_S = 0x2bu; +const uint TEXF_RGBA8_ = 0x2cu; +const uint TEXF_RGBA8_S = 0x2du; +const uint TEXF_R16_F = 0x2eu; +const uint TEXF_R32_F = 0x2fu; +const uint TEXF_RG16_F = 0x30u; +const uint TEXF_RG32_F = 0x31u; +const uint TEXF_RGB16_F = 0x32u; +const uint TEXF_RGB32_F = 0x33u; +const uint TEXF_RGBA16_F = 0x34u; +const uint TEXF_RGBA32_F = 0x35u; +const uint TEXF_ETC1 = 0x36u; +const uint TEXF_ETC2 = 0x37u; +const uint TEXF_ETC2_PA = 0x38u; +const uint TEXF_ETC2_RGB_EAC_A = 0x39u; +const uint TEXF_EAC_R = 0x40u; +const uint TEXF_EAC_R_S = 0x41u; +const uint TEXF_EAC_RG = 0x42u; +const uint TEXF_EAC_RG_S = 0x43u; +const uint TEXF_ASTC_4x4 = 0x44u; +const uint TEXF_ASTC_5x4 = 0x45u; +const uint TEXF_ASTC_5x5 = 0x46u; +const uint TEXF_ASTC_6x5 = 0x47u; +const uint TEXF_ASTC_6x6 = 0x48u; +const uint TEXF_ASTC_8x5 = 0x49u; +const uint TEXF_ASTC_8x6 = 0x4au; +const uint TEXF_ASTC_8x8 = 0x4bu; +const uint TEXF_ASTC_10x5 = 0x4cu; +const uint TEXF_ASTC_10x6 = 0x4du; +const uint TEXF_ASTC_10x8 = 0x4eu; +const uint TEXF_ASTC_10x10 = 0x4fu; +const uint TEXF_ASTC_12x10 = 0x50u; +const uint TEXF_ASTC_12x12 = 0x51u; +const uint TEXF_ASTC_3x3x3 = 0x52u; +const uint TEXF_ASTC_4x3x3 = 0x53u; +const uint TEXF_ASTC_4x4x3 = 0x54u; +const uint TEXF_ASTC_4x4x4 = 0x55u; +const uint TEXF_ASTC_5x4x4 = 0x56u; +const uint TEXF_ASTC_5x5x4 = 0x57u; +const uint TEXF_ASTC_5x5x5 = 0x58u; +const uint TEXF_ASTC_6x5x5 = 0x59u; +const uint TEXF_ASTC_6x6x5 = 0x60u; +const uint TEXF_ASTC_6x6x6 = 0x6au; +const uint TEXF_PVRTC1_2BPP = 0x6bu; +const uint TEXF_PVRTC1_4BPP = 0x6cu; +const uint TEXF_PVRTC2_2BPP = 0x6du; +const uint TEXF_PVRTC2_4BPP = 0x6eu; +const uint TEXF_R8_UI = 0x6fu; +const uint TEXF_R8_I = 0x70u; +const uint TEXF_R16_UI = 0x71u; +const uint TEXF_R16_I = 0x72u; +const uint TEXF_R32_UI = 0x73u; +const uint TEXF_R32_I = 0x74u; +const uint TEXF_RG8_UI = 0x75u; +const uint TEXF_RG8_I = 0x76u; +const uint TEXF_RG16_UI = 0x77u; +const uint TEXF_RG16_I = 0x78u; +const uint TEXF_RG32_UI = 0x79u; +const uint TEXF_RG32_I = 0x7au; +const uint TEXF_RGB8_UI = 0x7bu; +const uint TEXF_RGB8_I = 0x7cu; +const uint TEXF_RGB16_UI = 0x7du; +const uint TEXF_RGB16_I = 0x7eu; +const uint TEXF_RGB32_UI = 0x7fu; +const uint TEXF_RGB32_I = 0x80u; +const uint TEXF_RGBA8_UI = 0x81u; +const uint TEXF_RGBA8_I = 0x82u; +const uint TEXF_RGBA16_UI = 0x83u; +const uint TEXF_RGBA16_I = 0x84u; +const uint TEXF_RGBA32_UI = 0x85u; +const uint TEXF_RGBA32_I = 0x86u; +const uint TEXF_ARGB8 = 0x87u; +const uint TEXF_ABGR8 = 0x88u; +const uint TEXF_RGB10A2 = 0x89u; +const uint TEXF_RGB10A2_UI = 0x8au; +const uint TEXF_RGB10A2_LM = 0x8bu; +const uint TEXF_RGB9E5 = 0x8cu; +const uint TEXF_P8_RGB9E5 = 0x8du; +const uint TEXF_R1 = 0x8eu; +const uint TEXF_NODATA = 0xfeu; +const uint TEXF_MAX = 0xffu; + +// DrawFlags +const uint DF_DiffuseTexture = 0x00000001u; +const uint DF_LightMap = 0x00000002u; +const uint DF_FogMap = 0x00000004u; +const uint DF_DetailTexture = 0x00000008u; +const uint DF_MacroTexture = 0x00000010u; +const uint DF_BumpMap = 0x00000020u; +const uint DF_EnvironmentMap = 0x00000040u; +const uint DF_HeightMap = 0x00000080u; + +layout(std140) uniform GlobalMatrices +{ + mat4 modelMat; + mat4 viewMat; + mat4 modelviewMat; + mat4 modelviewprojMat; + mat4 lightSpaceMat; +}; + +layout(std140) uniform ClipPlaneParams +{ + vec4 ClipParams; // Clipping params, ClipIndex,0,0,0 + vec4 ClipPlane; // Clipping planes. Plane.X, Plane.Y, Plane.Z, Plane.W +}; + +// Light information. +layout(std140) uniform StaticLightInfo +{ + vec4 LightPos[MAX_LIGHTS]; + vec4 LightData1[MAX_LIGHTS]; // LightBrightness, LightHue, LightSaturation, LightCone + vec4 LightData2[MAX_LIGHTS]; // LightEffect, LightPeriod, LightPhase, LightRadius + vec4 LightData3[MAX_LIGHTS]; // LightType, VolumeBrightness, VolumeFog, VolumeRadius + vec4 LightData4[MAX_LIGHTS]; // WorldLightRadius, NumLights, ZoneNumber, CameraRegion->ZoneNumber + vec4 LightData5[MAX_LIGHTS]; // NormalLightRadius, bZoneNormalLight, unused, unused +}; + +layout(std140) uniform DistanceFogParams +{ + vec4 DistanceFogColor; // Fog color + vec4 DistanceFogValues; +}; + +layout(std140) uniform GlobalCoords +{ + mat4 FrameCoords; + mat4 FrameUncoords; +}; + +//DistanceFog +struct FogParameters +{ + vec4 FogColor; // Fog color + float FogStart; // Only for linear fog + float FogEnd; // Only for linear fog + float FogDensity; // For exp and exp2 equation + float FogCoord; + int FogMode; // 0 = linear, 1 = exp, 2 = exp2 +}; + +float getFogFactor(FogParameters DistanceFog) +{ + + // DistanceFogValues.x = FogStart + // DistanceFogValues.y = FogEnd + // DistanceFogValues.z = FogDensity + // DistanceFogValues.w = FogMode + //FogResult = (Values.y-FogCoord)/(Values.y-Values.x); + + float FogResult = 1.0; + if(DistanceFog.FogMode == 0 ) + FogResult = ((DistanceFog.FogEnd-DistanceFog.FogCoord)/(DistanceFog.FogEnd-DistanceFog.FogStart)); + else if(DistanceFog.FogMode == 1) + FogResult = exp(-DistanceFog.FogDensity*DistanceFog.FogCoord); + else if(DistanceFog.FogMode == 2) + FogResult = exp(-pow(DistanceFog.FogDensity*DistanceFog.FogCoord, 2.0)); + + FogResult = 1.0-clamp(FogResult, 0.0, 1.0); + + return FogResult; +} + +float PlaneDot( vec4 Plane, vec3 Point ) +{ + return dot(Plane.xyz,Point)-Plane.w; +} + +// The following directive resets the line number to 1 to have the correct output logging for a possible error within the shader files. +#line 1 diff --git a/Textures/LadderFonts.utx b/Textures/LadderFonts.utx index fb78f0b..5e67b44 100644 Binary files a/Textures/LadderFonts.utx and b/Textures/LadderFonts.utx differ diff --git a/Textures/UWindowFonts.utx b/Textures/UWindowFonts.utx index 51b6551..aada828 100644 Binary files a/Textures/UWindowFonts.utx and b/Textures/UWindowFonts.utx differ diff --git a/Web/current.uhtm b/Web/current.uhtm index a40bce5..e3c3bc5 100644 --- a/Web/current.uhtm +++ b/Web/current.uhtm @@ -1,14 +1,59 @@ + -%Title% - + + + + + - - - - - - -<body bgcolor="#FFFFFF"> -</body> + +
+
+ diff --git a/Web/current_console.uhtm b/Web/current_console.uhtm index 3b4cdda..004525e 100644 --- a/Web/current_console.uhtm +++ b/Web/current_console.uhtm @@ -1,14 +1,21 @@ - - -Untitled Document - - - - - - - -<body bgcolor="#FFFFFF"> - -</body> - + + + + + + + + \ No newline at end of file diff --git a/Web/current_console_log.uhtm b/Web/current_console_log.uhtm index cd3300b..d05fcd3 100644 --- a/Web/current_console_log.uhtm +++ b/Web/current_console_log.uhtm @@ -1,6 +1,13 @@ - + + %LogText% - diff --git a/Web/current_console_send.uhtm b/Web/current_console_send.uhtm index 3f3e78a..7fd6beb 100644 --- a/Web/current_console_send.uhtm +++ b/Web/current_console_send.uhtm @@ -1,10 +1,19 @@ -
- - - - - -
+ + + +
+ diff --git a/Web/current_game.uhtm b/Web/current_game.uhtm index d5eedd7..d1ea19a 100644 --- a/Web/current_game.uhtm +++ b/Web/current_game.uhtm @@ -1,18 +1,10 @@
- - - - - - - - - -
Switch Game Type:%GameTypeSelect%%GameTypeButton%
Switch Map:%MapButton%
+
+ %GameTypeSelect% %GameTypeButton%
+
+ %MapButton%
diff --git a/Web/current_menu.uhtm b/Web/current_menu.uhtm index 54b34c2..e0b65b0 100644 --- a/Web/current_menu.uhtm +++ b/Web/current_menu.uhtm @@ -1,14 +1,10 @@ - - - » Current Game
- » Player List
- » Server Console
- » Mutators
-
- » Restart Level
-
- + + » Current Game
+ » Player List
+ » Server Console
+ » Mutators
+ diff --git a/Web/current_mutators.uhtm b/Web/current_mutators.uhtm index ac1653a..d3e92ec 100644 --- a/Web/current_mutators.uhtm +++ b/Web/current_mutators.uhtm @@ -1,34 +1,25 @@
- - - - - - - - - - - -
Mutators not Used Mutators Used
- - -

-
-
-  
-
-
-

-
- -
+
+ Mutators not Used
+ +
+
+
+
+  
+
+
+
+
+ Mutators Used
+ +
diff --git a/Web/current_players.uhtm b/Web/current_players.uhtm index 680547f..a0dea6a 100644 --- a/Web/current_players.uhtm +++ b/Web/current_players.uhtm @@ -1,33 +1,54 @@ +
- - - - - - -
- - -
Minimum players:   - - -
-
- - - - - - - - - - + +
+ Minimum players: + + + +
+ + +
KickBanIPName:Team:Ping:Score:IP:
+ + + + + + + + + %PlayerList% -
KickBanIPNameTeamPingScoreIP
- + +
+ diff --git a/Web/defaults.uhtm b/Web/defaults.uhtm index 810853d..73e87f3 100644 --- a/Web/defaults.uhtm +++ b/Web/defaults.uhtm @@ -1,14 +1 @@ - - -%Title% - - - - - - - - -<body bgcolor="#FFFFFF"> -</body> - + diff --git a/Web/defaults_bots.uhtm b/Web/defaults_bots.uhtm index 91d4df2..41f2600 100644 --- a/Web/defaults_bots.uhtm +++ b/Web/defaults_bots.uhtm @@ -3,40 +3,40 @@
- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + %BalanceSubst% %DumbDownSubst% - - - + + +
Base Skill:
Minimum Total Players:
Auto Adjust Skill
Random Order
Base Skill:
Minimum Total Players:
Auto Adjust Skill
Random Order
 
-
- -
-
+
+ +
+
diff --git a/Web/defaults_ippolicy-d.uhtm b/Web/defaults_ippolicy-d.uhtm index 8645d72..1a949a6 100644 --- a/Web/defaults_ippolicy-d.uhtm +++ b/Web/defaults_ippolicy-d.uhtm @@ -1,17 +1,15 @@
- Accept
- Deny + Accept
+ Deny - + - - - - +
+
diff --git a/Web/defaults_ippolicy-f.uhtm b/Web/defaults_ippolicy-f.uhtm index 9cf7127..7905cde 100644 --- a/Web/defaults_ippolicy-f.uhtm +++ b/Web/defaults_ippolicy-f.uhtm @@ -1,14 +1,14 @@
- - Accept
- Deny + + Accept
+ Deny - + - +
diff --git a/Web/defaults_ippolicy-h.uhtm b/Web/defaults_ippolicy-h.uhtm index 8c786b9..a170caa 100644 --- a/Web/defaults_ippolicy-h.uhtm +++ b/Web/defaults_ippolicy-h.uhtm @@ -1,26 +1,6 @@ - - - - -
IP Bans/Accepts
- - - - - -
Defaults«Bugs?»
- - - - - - - - - - + + + + + Game Type: 
+ + +
+ » Map List
+ » Rules
+ » Settings
+ » Bots
+
+ » Server
+ » IP Bans/Accepts
+ » MD5 Ignore
+ diff --git a/Web/defaults_rules.uhtm b/Web/defaults_rules.uhtm index cd68ddb..4353fec 100644 --- a/Web/defaults_rules.uhtm +++ b/Web/defaults_rules.uhtm @@ -5,32 +5,32 @@
- - - + +
Accept/DenyIP Address Mask
+ + diff --git a/Web/defaults_maps.uhtm b/Web/defaults_maps.uhtm index 466f58b..daba7b0 100644 --- a/Web/defaults_maps.uhtm +++ b/Web/defaults_maps.uhtm @@ -1,52 +1,36 @@ - - -
Accept
Deny
IP Address Mask
- - - - - - - - - - - - - - - - - - -
Use Map List:    - - -
Maps not in Cycle Maps in Cycle
- - -

-
-
 
-
-
-

-
- -
   - - - -
+ + + + +
+ +
+ Maps not in Cycle
+ +
+
+
+
+  
+
+
+
+
+ Maps in Cycle
+
+ + + +
diff --git a/Web/defaults_menu.uhtm b/Web/defaults_menu.uhtm index 0708d8c..b1ec3ac 100644 --- a/Web/defaults_menu.uhtm +++ b/Web/defaults_menu.uhtm @@ -1,23 +1,21 @@ -
- -
- - Game Type: 
- -

- » Map List
- » Rules
- » Settings
- » Bots
-
- » Server
- » IP Bans/Accepts
- » MD5 Ignore
-
- » Restart Level
- -

%FragSubst% %TimeLimitSubst% - - - - - - - - + + + + + + + + %BalanceSubst% %TeamSubst% %ForceRespawnSubst% - - - - - - - - + + + + + + + + %FriendlyFireSubst% - +
Max Connections
Max Spectators
Max Connections
Max Spectators
Weapons Stay
Tournament -
- -
-
Weapons Stay
Tournament +
+ +
+
 
diff --git a/Web/defaults_server.uhtm b/Web/defaults_server.uhtm index 4d183f2..017c9f8 100644 --- a/Web/defaults_server.uhtm +++ b/Web/defaults_server.uhtm @@ -1,32 +1,42 @@ +
- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
Server Name
Admin Name
Admin Email
MOTD Line 1
MOTD Line 2
MOTD Line 3
MOTD Line 4
Game Password
Admin Password
Advertise Server
ngWorldStats Logging
  
AdminLogin Delay seconds
Maximum Allowed Login Attempts
Bad Login Action -
Enable admin tracking
Server Name
Admin Name
Admin Email
MOTD Line 1
MOTD Line 2
MOTD Line 3
MOTD Line 4
Game Password
Admin Password
Advertise Server
ngWorldStats Logging
 
AdminLogin Delay seconds
Maximum Allowed
Login Attempts
Bad Login Action +
Enable admin tracking
diff --git a/Web/defaults_settings.uhtm b/Web/defaults_settings.uhtm index cd193a0..fb100c3 100644 --- a/Web/defaults_settings.uhtm +++ b/Web/defaults_settings.uhtm @@ -3,40 +3,40 @@
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - + + +
Game Style: - -
Game Speed: [0-100]%% - -
Air Control: [0-100]%% - -
Use Translocator: - -
Game Style: + +
Game Speed: [0-100]%% + +
Air Control: [0-100]%% + +
Use Translocator: + +
 
- -
+ +
diff --git a/Web/inc/content_footer_tables.inc b/Web/inc/content_footer_tables.inc index 1456bf7..03c4b39 100644 --- a/Web/inc/content_footer_tables.inc +++ b/Web/inc/content_footer_tables.inc @@ -1,25 +1,3 @@ - -

- - - - - - - - - - - - - - - - - - - -
 Thanks to Mod Central for this design
- - - + +

Thanks to Mod Central for this design
+ diff --git a/Web/inc/content_header_tables.inc b/Web/inc/content_header_tables.inc index 5773777..d133b95 100644 --- a/Web/inc/content_header_tables.inc +++ b/Web/inc/content_header_tables.inc @@ -1,35 +1,128 @@ - - - - - - - - - - - - -
%Section%
- - - - - - - - -
%Area%«Bugs?»
- - - - - - - - - - - - - - - - - - - - -
+ + +
%Section%
+ +
+
%Area%
+
«Bugs?»
+
+ +
+
\ No newline at end of file diff --git a/Web/inc/header.inc b/Web/inc/header.inc index 759425d..e65e704 100644 --- a/Web/inc/header.inc +++ b/Web/inc/header.inc @@ -1,7 +1,9 @@ + -%Title%  - + + +%Title%%Section% diff --git a/Web/inc/menu_footer.inc b/Web/inc/menu_footer.inc index eab285b..5076361 100644 --- a/Web/inc/menu_footer.inc +++ b/Web/inc/menu_footer.inc @@ -1,11 +1,11 @@ -
- - +
+
+ »  +
+ + + + + diff --git a/Web/inc/menu_header.inc b/Web/inc/menu_header.inc index 66bfe21..afdd065 100644 --- a/Web/inc/menu_header.inc +++ b/Web/inc/menu_header.inc @@ -1,19 +1,31 @@ - - - -
- - - diff --git a/Web/plaintext/defaults_ippolicy-f.uhtm b/Web/plaintext/defaults_ippolicy-f.uhtm index 024be53..347ecd6 100644 --- a/Web/plaintext/defaults_ippolicy-f.uhtm +++ b/Web/plaintext/defaults_ippolicy-f.uhtm @@ -1,14 +1,14 @@ diff --git a/Web/plaintext/defaults_ippolicy-h.uhtm b/Web/plaintext/defaults_ippolicy-h.uhtm index 436c6b8..a52c7e5 100644 --- a/Web/plaintext/defaults_ippolicy-h.uhtm +++ b/Web/plaintext/defaults_ippolicy-h.uhtm @@ -1,3 +1,3 @@
- - - - - - - - - - - - + + +
%Area%
+
diff --git a/Web/menu.uhtm b/Web/menu.uhtm index fbcc58e..b0fca9e 100644 --- a/Web/menu.uhtm +++ b/Web/menu.uhtm @@ -1,11 +1,80 @@ - -
- + +
+ + + +
Remote Server Admin
+ +
diff --git a/Web/message.uhtm b/Web/message.uhtm index ab7c467..abdd8da 100644 --- a/Web/message.uhtm +++ b/Web/message.uhtm @@ -1,6 +1,23 @@ - -%Message% +
%Message%
+
+
Please wait... 10
+ diff --git a/Web/plaintext/current.uhtm b/Web/plaintext/current.uhtm index ba45f3e..a01d8b7 100644 --- a/Web/plaintext/current.uhtm +++ b/Web/plaintext/current.uhtm @@ -1,7 +1,9 @@ + -%Title% - + + +%Title%  diff --git a/Web/plaintext/current_console.uhtm b/Web/plaintext/current_console.uhtm index 96c9bb4..3e9c040 100644 --- a/Web/plaintext/current_console.uhtm +++ b/Web/plaintext/current_console.uhtm @@ -1,7 +1,9 @@ + -Untitled Document - + + +%Title%  diff --git a/Web/plaintext/current_console_send.uhtm b/Web/plaintext/current_console_send.uhtm index 3f3e78a..04d95cf 100644 --- a/Web/plaintext/current_console_send.uhtm +++ b/Web/plaintext/current_console_send.uhtm @@ -1,10 +1,10 @@
%Area%
- Choose Your Options: -
- Current «
- Defaults «
- -
- - - - + + + +
diff --git a/Web/plaintext/current_game.uhtm b/Web/plaintext/current_game.uhtm index 0a11847..3541ba6 100644 --- a/Web/plaintext/current_game.uhtm +++ b/Web/plaintext/current_game.uhtm @@ -1,16 +1,16 @@
- - - - - - + + + + + - - + + +
Switch Game Type:%GameTypeSelect%%GameTypeButton%
Switch Map:
Switch Game Type:%GameTypeSelect%%GameTypeButton%
Switch Map:%MapButton%
%MapButton%
diff --git a/Web/plaintext/current_mutators.uhtm b/Web/plaintext/current_mutators.uhtm index 3497d87..25ffc39 100644 --- a/Web/plaintext/current_mutators.uhtm +++ b/Web/plaintext/current_mutators.uhtm @@ -1,32 +1,32 @@
- - - - - - - + + + + + + - - + + - + + +
Mutators not Used Mutators Used
-
Mutators not Used Mutators Used
+ - -

-
-
-  
-
-
-

-
- + +

+
+
+  
+
+
+

+
+ -
diff --git a/Web/plaintext/current_players.uhtm b/Web/plaintext/current_players.uhtm index 53132dc..7f2479b 100644 --- a/Web/plaintext/current_players.uhtm +++ b/Web/plaintext/current_players.uhtm @@ -2,28 +2,28 @@
- - - - + + + +
- - -
Minimum players:   - - -
-
+ + +
Minimum players:   + + +
+
- - - - - - - - - + + + + + + + + + %PlayerList%
KickBanIPName:Team:Ping:Score:IP:
KickBanIPName:Team:Ping:Score:IP:
diff --git a/Web/plaintext/defaults.uhtm b/Web/plaintext/defaults.uhtm index ba45f3e..a01d8b7 100644 --- a/Web/plaintext/defaults.uhtm +++ b/Web/plaintext/defaults.uhtm @@ -1,7 +1,9 @@ + -%Title% - + + +%Title%  diff --git a/Web/plaintext/defaults_bots.uhtm b/Web/plaintext/defaults_bots.uhtm index 13a92b1..98ae867 100644 --- a/Web/plaintext/defaults_bots.uhtm +++ b/Web/plaintext/defaults_bots.uhtm @@ -2,40 +2,40 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + %BalanceSubst% %DumbDownSubst% - - - + + +
Base Skill:
Minimum Total Players:
Auto Adjust Skill
Random Order
Base Skill:
Minimum Total Players:
Auto Adjust Skill
Random Order
 
-
- -
-
+
+ +
+
diff --git a/Web/plaintext/defaults_ippolicy-d.uhtm b/Web/plaintext/defaults_ippolicy-d.uhtm index 8645d72..d6abcba 100644 --- a/Web/plaintext/defaults_ippolicy-d.uhtm +++ b/Web/plaintext/defaults_ippolicy-d.uhtm @@ -1,17 +1,17 @@
- Accept
- Deny + Accept
+ Deny
- + - - - - + + + +
- Accept
- Deny + Accept
+ Deny
- + - +
- + diff --git a/Web/plaintext/defaults_maps.uhtm b/Web/plaintext/defaults_maps.uhtm index 743a697..434be20 100644 --- a/Web/plaintext/defaults_maps.uhtm +++ b/Web/plaintext/defaults_maps.uhtm @@ -3,49 +3,49 @@
Accept/DenyIP Address Mask
Accept/DenyIP Address Mask
- - + - - - - - - - - + + + + + + + + - - + + - - - - - - + + + + + + + +
Use Map List:    -
Use Map List:    + - -
Maps not in Cycle Maps in Cycle
- + +
Maps not in Cycle Maps in Cycle
+ - -

-
-
-  
-
-
-

-
- + +

+
+
+  
+
+
+

+
+ -
   - - - -
   + + + +
diff --git a/Web/plaintext/defaults_menu.uhtm b/Web/plaintext/defaults_menu.uhtm index 35ebd70..5e9dcc8 100644 --- a/Web/plaintext/defaults_menu.uhtm +++ b/Web/plaintext/defaults_menu.uhtm @@ -3,17 +3,17 @@ - - - - - - - - - - - + + + + + + + + + + +
Game Type:
Map List
Rules
Settings
Bots
 
Server
IP Bans/Accepts
 
Restart Level
Game Type:
Map List
Rules
Settings
Bots
 
Server
IP Bans/Accepts
 
Restart Level
diff --git a/Web/plaintext/defaults_rules.uhtm b/Web/plaintext/defaults_rules.uhtm index 58e0491..20dc4eb 100644 --- a/Web/plaintext/defaults_rules.uhtm +++ b/Web/plaintext/defaults_rules.uhtm @@ -4,32 +4,32 @@ %FragSubst% %TimeLimitSubst% - - - - - - - - + + + + + + + + %BalanceSubst% %TeamSubst% %ForceRespawnSubst% - - - - - - - - + + + + + + + + %FriendlyFireSubst% - +
Max Connections
Max Spectators
Max Connections
Max Spectators
Weapons Stay
Tournament -
- -
-
Weapons Stay
Tournament +
+ +
+
 
diff --git a/Web/plaintext/defaults_server.uhtm b/Web/plaintext/defaults_server.uhtm index 942c9d1..6566fa0 100644 --- a/Web/plaintext/defaults_server.uhtm +++ b/Web/plaintext/defaults_server.uhtm @@ -1,31 +1,31 @@
- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
Server Name
Admin Name
Admin Email
MOTD Line 1
MOTD Line 2
MOTD Line 3
MOTD Line 4
Game Password
Admin Password
Advertise Server
ngWorldStats Logging
  
AdminLogin Delay seconds
Maximum Allowed Login Attempts
Bad Login Action -
Enable admin tracking
Server Name
Admin Name
Admin Email
MOTD Line 1
MOTD Line 2
MOTD Line 3
MOTD Line 4
Game Password
Admin Password
Advertise Server
ngWorldStats Logging
  
AdminLogin Delay seconds
Maximum Allowed Login Attempts
Bad Login Action +
Enable admin tracking
diff --git a/Web/plaintext/defaults_settings.uhtm b/Web/plaintext/defaults_settings.uhtm index aed3421..3444fed 100644 --- a/Web/plaintext/defaults_settings.uhtm +++ b/Web/plaintext/defaults_settings.uhtm @@ -2,40 +2,40 @@
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - + + +
Game Style: - -
Game Speed: [0-100]%% - -
Air Control: [0-100]%% - -
Use Translocator: - -
Game Style: + +
Game Speed: [0-100]%% + +
Air Control: [0-100]%% + +
Use Translocator: + +
 
- -
+ +
diff --git a/Web/plaintext/inc/header.inc b/Web/plaintext/inc/header.inc index 9226eaa..12e889a 100644 --- a/Web/plaintext/inc/header.inc +++ b/Web/plaintext/inc/header.inc @@ -1,7 +1,9 @@ + + + %Title%  -

%Area%

diff --git a/Web/plaintext/inc/whiteheader.inc b/Web/plaintext/inc/whiteheader.inc index 18d8a9f..2320717 100644 --- a/Web/plaintext/inc/whiteheader.inc +++ b/Web/plaintext/inc/whiteheader.inc @@ -1,7 +1,9 @@ + + + %Title%  -

%Area%

diff --git a/Web/plaintext/menu.uhtm b/Web/plaintext/menu.uhtm index d8884da..b58f504 100644 --- a/Web/plaintext/menu.uhtm +++ b/Web/plaintext/menu.uhtm @@ -1,11 +1,11 @@ - - + + - +
Unreal Tournament - Remote Server AdminCurrentUnreal Tournament - Remote Server AdminCurrent
DefaultsDefaults
diff --git a/Web/plaintext/root.uhtm b/Web/plaintext/root.uhtm index 120b58a..347e10c 100644 --- a/Web/plaintext/root.uhtm +++ b/Web/plaintext/root.uhtm @@ -1,7 +1,9 @@ + -%Title% - + + +%Title%  diff --git a/Web/root.uhtm b/Web/root.uhtm index 7cc41d2..fa31b38 100644 --- a/Web/root.uhtm +++ b/Web/root.uhtm @@ -1,12 +1,20 @@ + -%Title% - + + + + - + <body bgcolor="#FFFFFF">