Commit 21cb9d48 authored by 魔大农's avatar 魔大农

Fixed installation

parent 2d2493b1
#!/bin/sh
cd `dirname $0`;
if [ ! -d Urho3D ]
then
git clone https://github.com/Urho3D/Urho3D
cd Urho3D
else
cd Urho3D
git checkout master
git pull
fi
./cmake_clean.sh
./cmake_generic.sh . \
-DURHO3D_ANGELSCRIPT=0 -DURHO3D_LUA=0 -DURHO3D_URHO2D=0 \
-DURHO3D_SAMPLES=0 -DURHO3D_TOOLS=0
make
cd ..
File mode changed from 100644 to 100755
#!/bin/sh
sudo apt-get install \
libx11-dev libxrandr-dev libasound2-dev \
git make cmake build-essential
sudo apt-get install libx11-dev libxrandr-dev libasound2-dev git cmake make
cd `dirname $0`
if [ ! -e Urho3D ]
then
cd ..
if [ ! -d Urho3D ]
then
git clone https://github.com/Urho3D/Urho3D
fi
cd `dirname $0`
ln -s ../Urho3D
fi
cd Urho3D
git pull
./cmake_generic.sh . -URHO3D_ANGELSCRIPT=0 -URHO3D_NAVIGATION=0 -URHO3D_URHO2D=0 -URHO3D_SAMPLES=0 -URHO3D_TOOLS=0
make
cd `dirname $0`
git pull
qmake Quatter.pro
make
sudo make uninstall
sudo make install
sudo update-icon-caches ~/.local/share/icons/
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -5,8 +5,6 @@ LIBS += ../Quatter/Urho3D/lib/libUrho3D.a \
-ldl \
-lGL
DEFINES += URHO3D_COMPILE_QT
QMAKE_CXXFLAGS += -std=c++1y
INCLUDEPATH += \
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
#include "Uniforms.hlsl"
#include "Transform.hlsl"
#include "Samplers.hlsl"
#include "ScreenPos.hlsl"
#include "PostProcess.hlsl"
#ifndef D3D11
// D3D9 uniforms
uniform float cBloomHDRThreshold;
uniform float2 cBloomHDRBlurDir;
uniform float cBloomHDRBlurRadius;
uniform float cBloomHDRBlurSigma;
uniform float2 cBloomHDRMix;
uniform float2 cBright2Offsets;
uniform float2 cBright4Offsets;
uniform float2 cBright8Offsets;
uniform float2 cBright16Offsets;
uniform float2 cBright2InvSize;
uniform float2 cBright4InvSize;
uniform float2 cBright8InvSize;
uniform float2 cBright16InvSize;
#else
// D3D11 constant buffers
#ifdef COMPILEVS
cbuffer CustomVS : register(b6)
{
float2 cBright2Offsets;
float2 cBright4Offsets;
float2 cBright8Offsets;
float2 cBright16Offsets;
}
#else
cbuffer CustomPS : register(b6)
{
float cBloomHDRThreshold;
float2 cBloomHDRBlurDir;
float cBloomHDRBlurRadius;
float cBloomHDRBlurSigma;
float2 cBloomHDRMix;
float2 cBright2InvSize;
float2 cBright4InvSize;
float2 cBright8InvSize;
float2 cBright16InvSize;
}
#endif
#endif
static const int BlurKernelSize = 5;
void VS(float4 iPos : POSITION,
out float2 oTexCoord : TEXCOORD0,
out float2 oScreenPos : TEXCOORD1,
out float4 oPos : OUTPOSITION)
{
float4x3 modelMatrix = iModelMatrix;
float3 worldPos = GetWorldPos(modelMatrix);
oPos = GetClipPos(worldPos);
oTexCoord = GetQuadTexCoord(oPos);
#ifdef BLUR2
oTexCoord = GetQuadTexCoord(oPos) + cBright2Offsets;
#endif
#ifdef BLUR4
oTexCoord = GetQuadTexCoord(oPos) + cBright4Offsets;
#endif
#ifdef BLUR8
oTexCoord = GetQuadTexCoord(oPos) + cBright8Offsets;
#endif
#ifdef BLUR16
oTexCoord = GetQuadTexCoord(oPos) + cBright16Offsets;
#endif
#ifdef COMBINE2
oTexCoord = GetQuadTexCoord(oPos) + cBright2Offsets;
#endif
#ifdef COMBINE4
oTexCoord = GetQuadTexCoord(oPos) + cBright4Offsets;
#endif
#ifdef COMBINE8
oTexCoord = GetQuadTexCoord(oPos) + cBright8Offsets;
#endif
#ifdef COMBINE16
oTexCoord = GetQuadTexCoord(oPos) + cBright16Offsets;
#endif
oScreenPos = GetScreenPosPreDiv(oPos);
}
void PS(float2 iTexCoord : TEXCOORD0,
float2 iScreenPos : TEXCOORD1,
out float4 oColor : OUTCOLOR0)
{
#ifdef BRIGHT
float3 color = Sample2D(DiffMap, iScreenPos).rgb;
oColor = float4(max(color - cBloomHDRThreshold, 0.0), 1.0);
#endif
#ifndef D3D11
#ifdef BLUR16
oColor = GaussianBlur(BlurKernelSize, cBloomHDRBlurDir, cBright16InvSize * cBloomHDRBlurRadius, cBloomHDRBlurSigma, sDiffMap, iTexCoord);
#endif
#ifdef BLUR8
oColor = GaussianBlur(BlurKernelSize, cBloomHDRBlurDir, cBright8InvSize * cBloomHDRBlurRadius, cBloomHDRBlurSigma, sDiffMap, iTexCoord);
#endif
#ifdef BLUR4
oColor = GaussianBlur(BlurKernelSize, cBloomHDRBlurDir, cBright4InvSize * cBloomHDRBlurRadius, cBloomHDRBlurSigma, sDiffMap, iTexCoord);
#endif
#ifdef BLUR2
oColor = GaussianBlur(BlurKernelSize, cBloomHDRBlurDir, cBright2InvSize * cBloomHDRBlurRadius, cBloomHDRBlurSigma, sDiffMap, iTexCoord);
#endif
#else
#ifdef BLUR16
oColor = GaussianBlur(BlurKernelSize, cBloomHDRBlurDir, cBright16InvSize * cBloomHDRBlurRadius, cBloomHDRBlurSigma, tDiffMap, sDiffMap, iTexCoord);
#endif
#ifdef BLUR8
oColor = GaussianBlur(BlurKernelSize, cBloomHDRBlurDir, cBright8InvSize * cBloomHDRBlurRadius, cBloomHDRBlurSigma, tDiffMap, sDiffMap, iTexCoord);
#endif
#ifdef BLUR4
oColor = GaussianBlur(BlurKernelSize, cBloomHDRBlurDir, cBright4InvSize * cBloomHDRBlurRadius, cBloomHDRBlurSigma, tDiffMap, sDiffMap, iTexCoord);
#endif
#ifdef BLUR2
oColor = GaussianBlur(BlurKernelSize, cBloomHDRBlurDir, cBright2InvSize * cBloomHDRBlurRadius, cBloomHDRBlurSigma, tDiffMap, sDiffMap, iTexCoord);
#endif
#endif
#ifdef COMBINE16
oColor = Sample2D(DiffMap, iScreenPos) + Sample2D(NormalMap, iTexCoord);
#endif
#ifdef COMBINE8
oColor = Sample2D(DiffMap, iScreenPos) + Sample2D(NormalMap, iTexCoord);
#endif
#ifdef COMBINE4
oColor = Sample2D(DiffMap, iScreenPos) + Sample2D(NormalMap, iTexCoord);
#endif
#ifdef COMBINE2
float3 color = Sample2D(DiffMap, iScreenPos).rgb * cBloomHDRMix.x;
float3 bloom = Sample2D(NormalMap, iTexCoord).rgb * cBloomHDRMix.y;
oColor = float4(color + bloom, 1.0);
#endif
}
#include "Uniforms.hlsl"
#include "Samplers.hlsl"
#include "Transform.hlsl"
#include "ScreenPos.hlsl"
void VS(float4 iPos : POSITION,
out float2 oScreenPos : TEXCOORD0,
out float4 oPos : OUTPOSITION)
{
float4x3 modelMatrix = iModelMatrix;
float3 worldPos = GetWorldPos(modelMatrix);
oPos = GetClipPos(worldPos);
oScreenPos = GetScreenPosPreDiv(oPos);
}
void PS(float2 iScreenPos : TEXCOORD0,
out float4 oColor : OUTCOLOR0)
{
oColor = Sample2D(DiffMap, iScreenPos);
}
This diff is collapsed.
#ifdef COMPILEPS
float3 GetFog(float3 color, float fogFactor)
{
return lerp(cFogColor, color, fogFactor);
}
float3 GetLitFog(float3 color, float fogFactor)
{
return color * fogFactor;
}
float GetFogFactor(float depth)
{
return saturate((cFogParams.x - depth) * cFogParams.y);
}
float GetHeightFogFactor(float depth, float height)
{
float fogFactor = GetFogFactor(depth);
float heightFogFactor = (height - cFogParams.z) * cFogParams.w;
heightFogFactor = 1.0 - saturate(exp(-(heightFogFactor * heightFogFactor)));
return min(heightFogFactor, fogFactor);
}
#endif
This diff is collapsed.
This diff is collapsed.
static const float PI = 3.14159265;
float2 Noise(float2 coord)
{
float noiseX = clamp(frac(sin(dot(coord, float2(12.9898, 78.233))) * 43758.5453), 0.0, 1.0);
float noiseY = clamp(frac(sin(dot(coord, float2(12.9898, 78.233) * 2.0)) * 43758.5453), 0.0, 1.0);
return float2(noiseX, noiseY);
}
// Adapted: http://callumhay.blogspot.com/2010/09/gaussian-blur-shader-glsl.html
#ifndef D3D11
float4 GaussianBlur(int blurKernelSize, float2 blurDir, float2 blurRadius, float sigma, sampler2D texSampler, float2 texCoord)
#else
float4 GaussianBlur(int blurKernelSize, float2 blurDir, float2 blurRadius, float sigma, Texture2D tex, SamplerState texSampler, float2 texCoord)
#endif
{
const int blurKernelHalfSize = blurKernelSize / 2;
// Incremental Gaussian Coefficent Calculation (See GPU Gems 3 pp. 877 - 889)
float3 gaussCoeff;
gaussCoeff.x = 1.0 / (sqrt(2.0 * PI) * sigma);
gaussCoeff.y = exp(-0.5 / (sigma * sigma));
gaussCoeff.z = gaussCoeff.y * gaussCoeff.y;
float2 blurVec = blurRadius * blurDir;
float4 avgValue = float4(0.0, 0.0, 0.0, 0.0);
float gaussCoeffSum = 0.0;
#ifndef D3D11
avgValue += tex2D(texSampler, texCoord) * gaussCoeff.x;
#else
avgValue += tex.Sample(texSampler, texCoord) * gaussCoeff.x;
#endif
gaussCoeffSum += gaussCoeff.x;
gaussCoeff.xy *= gaussCoeff.yz;
for (int i = 1; i <= blurKernelHalfSize; i++)
{
#ifndef D3D11
avgValue += tex2D(texSampler, texCoord - i * blurVec) * gaussCoeff.x;
avgValue += tex2D(texSampler, texCoord + i * blurVec) * gaussCoeff.x;
#else
avgValue += tex.Sample(texSampler, texCoord - i * blurVec) * gaussCoeff.x;
avgValue += tex.Sample(texSampler, texCoord + i * blurVec) * gaussCoeff.x;
#endif
gaussCoeffSum += 2.0 * gaussCoeff.x;
gaussCoeff.xy *= gaussCoeff.yz;
}
return avgValue / gaussCoeffSum;
}
static const float3 LumWeights = float3(0.2126, 0.7152, 0.0722);
float3 ReinhardEq3Tonemap(float3 x)
{
return x / (x + 1.0);
}
float3 ReinhardEq4Tonemap(float3 x, float white)
{
return x * (1.0 + x / white) / (1.0 + x);
}
// Unchared2 tone mapping (See http://filmicgames.com)
static const float A = 0.15;
static const float B = 0.50;
static const float C = 0.10;
static const float D = 0.20;
static const float E = 0.02;
static const float F = 0.30;
float3 Uncharted2Tonemap(float3 x)
{
return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;
}
#ifndef D3D11
float3 ColorCorrection(float3 color, sampler3D lut)
#else
float3 ColorCorrection(float3 color, Texture3D lut, SamplerState lutSampler)
#endif
{
float lutSize = 16.0;
float scale = (lutSize - 1.0) / lutSize;
float offset = 1.0 / (2.0 * lutSize);
#ifndef D3D11
return tex3D(lut, clamp(color, 0.0, 1.0) * scale + offset).rgb;
#else
return lut.Sample(lutSampler, clamp(color, 0.0, 1.0) * scale + offset).rgb;
#endif
}
static const float Gamma = 2.2;
static const float InverseGamma = 1.0 / 2.2;
float3 ToGamma(float3 color)
{
return float3(pow(color, Gamma));
}
float3 ToInverseGamma(float3 color)
{
return float3(pow(color, InverseGamma));
}
#ifdef D3D11
// Make sampling macros also available for VS on D3D11
#define Sample2D(tex, uv) t##tex.Sample(s##tex, uv)
#define Sample2DProj(tex, uv) t##tex.Sample(s##tex, uv.xy / uv.w)
#define Sample2DLod0(tex, uv) t##tex.SampleLevel(s##tex, uv, 0.0)
#define SampleCube(tex, uv) t##tex.Sample(s##tex, uv)
#define SampleCubeLOD(tex, uv) t##tex.SampleLevel(s##tex, uv.xyz, uv.w)
#define SampleShadow(tex, uv) t##tex.SampleCmpLevelZero(s##tex, uv.xy, uv.z)
#endif
#ifdef COMPILEPS
#ifndef D3D11
// D3D9 samplers
sampler2D sDiffMap : register(s0);
samplerCUBE sDiffCubeMap : register(s0);
sampler2D sAlbedoBuffer : register(s0);
sampler2D sNormalMap : register(s1);
sampler2D sNormalBuffer : register(s1);
sampler2D sSpecMap : register(s2);
sampler2D sRoughMetalFresnel : register(s2); //R: Roughness, G: Metal
sampler2D sEmissiveMap : register(s3);
sampler2D sEnvMap : register(s4);
sampler3D sVolumeMap : register(s5);
samplerCUBE sEnvCubeMap : register(s4);
sampler2D sLightRampMap : register(s8);
sampler2D sLightSpotMap : register(s9);
samplerCUBE sLightCubeMap : register(s9);
sampler2D sShadowMap : register(s10);
samplerCUBE sFaceSelectCubeMap : register(s11);
samplerCUBE sIndirectionCubeMap : register(s12);
sampler2D sDepthBuffer : register(s13);
sampler2D sLightBuffer : register(s14);
samplerCUBE sZoneCubeMap : register(s15);
sampler3D sZoneVolumeMap : register(s15);
#define Sample2D(tex, uv) tex2D(s##tex, uv)
#define Sample2DProj(tex, uv) tex2Dproj(s##tex, uv)
#define Sample2DLod0(tex, uv) tex2Dlod(s##tex, float4(uv, 0.0, 0.0))
#define SampleCube(tex, uv) texCUBE(s##tex, uv)
#define SampleCubeLOD(tex, uv) texCUBElod(s##tex, uv)
#define SampleShadow(tex, uv) tex2Dproj(s##tex, uv)
#else
// D3D11 textures and samplers
Texture2D tDiffMap : register(t0);
TextureCube tDiffCubeMap : register(t0);
Texture2D tAlbedoBuffer : register(t0);
Texture2D tNormalMap : register(t1);
Texture2D tNormalBuffer : register(t1);
Texture2D tSpecMap : register(t2);
Texture2D tRoughMetalFresnel : register(t2); //R: Roughness, G: Metal
Texture2D tEmissiveMap : register(t3);
Texture2D tEnvMap : register(t4);
Texture3D tVolumeMap : register(t5);
TextureCube tEnvCubeMap : register(t4);
Texture2D tLightRampMap : register(t8);
Texture2D tLightSpotMap : register(t9);
TextureCube tLightCubeMap : register(t9);
Texture2D tShadowMap : register(t10);
TextureCube tFaceSelectCubeMap : register(t11);
TextureCube tIndirectionCubeMap : register(t12);
Texture2D tDepthBuffer : register(t13);
Texture2D tLightBuffer : register(t14);
TextureCube tZoneCubeMap : register(t15);
Texture3D tZoneVolumeMap : register(t15);
SamplerState sDiffMap : register(s0);
SamplerState sDiffCubeMap : register(s0);
SamplerState sAlbedoBuffer : register(s0);
SamplerState sNormalMap : register(s1);
SamplerState sNormalBuffer : register(s1);
SamplerState sSpecMap : register(s2);
SamplerState sRoughMetalFresnel : register(s2); //R: Roughness, G: Metal
SamplerState sEmissiveMap : register(s3);
SamplerState sEnvMap : register(s4);
SamplerState sVolumeMap : register(s5);
SamplerState sEnvCubeMap : register(s4);
SamplerState sLightRampMap : register(s8);
SamplerState sLightSpotMap : register(s9);
SamplerState sLightCubeMap : register(s9);
#ifdef VSM_SHADOW
SamplerState sShadowMap : register(s10);
#else
SamplerComparisonState sShadowMap : register(s10);
#endif
SamplerState sFaceSelectCubeMap : register(s11);
SamplerState sIndirectionCubeMap : register(s12);
SamplerState sDepthBuffer : register(s13);
SamplerState sLightBuffer : register(s14);
SamplerState sZoneCubeMap : register(s15);
SamplerState sZoneVolumeMap : register(s15);
#endif
float3 DecodeNormal(float4 normalInput)
{
#ifdef PACKEDNORMAL
float3 normal;
normal.xy = normalInput.ag * 2.0 - 1.0;
normal.z = sqrt(max(1.0 - dot(normal.xy, normal.xy), 0.0));
return normal;
#else
return normalInput.rgb * 2.0 - 1.0;
#endif
}
float ReconstructDepth(float hwDepth)
{
return dot(float2(hwDepth, cDepthReconstruct.y / (hwDepth - cDepthReconstruct.x)), cDepthReconstruct.zw);
}
#endif
#ifdef COMPILEVS
float3x3 GetCameraRot()
{
return float3x3(cViewInv[0][0], cViewInv[0][1], cViewInv[0][2],
cViewInv[1][0], cViewInv[1][1], cViewInv[1][2],
cViewInv[2][0], cViewInv[2][1], cViewInv[2][2]);
}
float4 GetScreenPos(float4 clipPos)
{
return float4(
clipPos.x * cGBufferOffsets.z + cGBufferOffsets.x * clipPos.w,
-clipPos.y * cGBufferOffsets.w + cGBufferOffsets.y * clipPos.w,
0.0,
clipPos.w);
}
float2 GetScreenPosPreDiv(float4 clipPos)
{
return float2(
clipPos.x / clipPos.w * cGBufferOffsets.z + cGBufferOffsets.x,
-clipPos.y / clipPos.w * cGBufferOffsets.w + cGBufferOffsets.y);
}
float2 GetQuadTexCoord(float4 clipPos)
{
return float2(
clipPos.x / clipPos.w * 0.5 + 0.5,
-clipPos.y / clipPos.w * 0.5 + 0.5);
}
float2 GetQuadTexCoordNoFlip(float3 worldPos)
{
return float2(
worldPos.x * 0.5 + 0.5,
-worldPos.y * 0.5 + 0.5);
}
float3 GetFarRay(float4 clipPos)
{
float3 viewRay = float3(
clipPos.x / clipPos.w * cFrustumSize.x,
clipPos.y / clipPos.w * cFrustumSize.y,
cFrustumSize.z);
return mul(viewRay, GetCameraRot());
}
float3 GetNearRay(float4 clipPos)
{
float3 viewRay = float3(
clipPos.x / clipPos.w * cFrustumSize.x,
clipPos.y / clipPos.w * cFrustumSize.y,
0.0);
return mul(viewRay, GetCameraRot()) * cDepthMode.z;
}
#endif
#include "Uniforms.hlsl"
#include "Samplers.hlsl"
#include "Transform.hlsl"
void VS(float4 iPos : POSITION,
#ifndef NOUV
float2 iTexCoord : TEXCOORD0,
#endif
#ifdef SKINNED
float4 iBlendWeights : BLENDWEIGHT,
int4 iBlendIndices : BLENDINDICES,
#endif
#ifdef INSTANCED
float4x3 iModelInstance : TEXCOORD4,
#endif
#if defined(BILLBOARD) || defined(DIRBILLBOARD)
float2 iSize : TEXCOORD1,
#endif
#ifdef VSM_SHADOW
out float4 oTexCoord : TEXCOORD0,
#else
out float2 oTexCoord : TEXCOORD0,
#endif
out float4 oPos : OUTPOSITION)
{
// Define a 0,0 UV coord if not expected from the vertex data
#ifdef NOUV
float2 iTexCoord = float2(0.0, 0.0);
#endif
float4x3 modelMatrix = iModelMatrix;
float3 worldPos = GetWorldPos(modelMatrix);
oPos = GetClipPos(worldPos);
#ifdef VSM_SHADOW
oTexCoord = float4(GetTexCoord(iTexCoord), oPos.z, oPos.w);
#else
oTexCoord = GetTexCoord(iTexCoord);
#endif
}
void PS(
#ifdef VSM_SHADOW
float4 iTexCoord : TEXCOORD0,
#else
float2 iTexCoord : TEXCOORD0,
#endif
out float4 oColor : OUTCOLOR0)
{
#ifdef ALPHAMASK
float alpha = Sample2D(DiffMap, iTexCoord.xy).a;
if (alpha < 0.5)
discard;
#endif
#ifdef VSM_SHADOW
float depth = iTexCoord.z / iTexCoord.w;
oColor = float4(depth, depth * depth, 1.0, 1.0);