Merge branch 'master' of github.com:Faerbit/swp

This commit is contained in:
Steffen Fündgens 2015-03-04 18:11:38 +01:00
commit 6af54ab02f
12 changed files with 14988 additions and 1227 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -81,6 +81,23 @@
</light>
</composition>
<!-- switchtorch -->
<composition>
<typeID>81</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>torch.obj</modelPath>
<xOffset>0.0</xOffset>
<yOffset>0.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<scale>1.0</scale>
<mass>0.0</mass>
</object>
</composition>
<!-- Lightsource -->
<composition>
<typeID>85</typeID>
@ -458,6 +475,42 @@
</object>
</composition>
<!-- Brazier -->
<composition>
<typeID>245</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>brazier.obj</modelPath>
<xOffset>0.0</xOffset>
<yOffset>2</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<scale>3.0</scale>
<mass>0.0</mass>
</object>
</composition>
<!-- Hint -->
<composition>
<typeID>250</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>hint.obj</modelPath>
<xOffset>0.0</xOffset>
<yOffset>0.1</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<scale>1.5</scale>
<mass>0.0</mass>
</object>
</composition>
@ -511,7 +564,7 @@
<objectData>
<modelPath>torch.obj</modelPath>
<texturePath>torchTexture.png</texturePath>
<texturePath>torchTexture2.png</texturePath>
<ambientFactor>0.1</ambientFactor>
<diffuseFactor>0.3</diffuseFactor>
<specularFactor>0.7</specularFactor>
@ -580,9 +633,9 @@
</objectData>
<objectData>
<modelPath>gate.obj</modelPath>
<texturePath>gateTexture.png</texturePath>
<ambientFactor>0.1</ambientFactor>
<modelPath>gate.obj</modelPath>
<texturePath>gateTexture.png</texturePath>
<ambientFactor>0.1</ambientFactor>
<diffuseFactor>0.6</diffuseFactor>
<specularFactor>0.4</specularFactor>
<shininess>2.0</shininess>
@ -596,9 +649,9 @@
</objectData>
<objectData>
<modelPath>movableBlock.obj</modelPath>
<texturePath>movableBlockTexture.png</texturePath>
<ambientFactor>0.1</ambientFactor>
<modelPath>movableBlock.obj</modelPath>
<texturePath>movableBlockTexture.png</texturePath>
<ambientFactor>0.1</ambientFactor>
<diffuseFactor>0.6</diffuseFactor>
<specularFactor>0.4</specularFactor>
<shininess>2.0</shininess>
@ -610,3 +663,29 @@
<dampningA>0.5</dampningA>
<renderable>true</renderable>
</objectData>
<objectData>
<modelPath>brazier.obj</modelPath>
<texturePath>brazierTexture.png</texturePath>
<ambientFactor>0.1</ambientFactor>
<diffuseFactor>0.6</diffuseFactor>
<specularFactor>0.4</specularFactor>
<shininess>2.0</shininess>
<physicType>TriangleMesh</physicType>
<dampningL>0.555</dampningL>
<dampningA>0.5</dampningA>
<renderable>true</renderable>
</objectData>
<objectData>
<modelPath>hint.obj</modelPath>
<texturePath>hintTexture.png</texturePath>
<ambientFactor>0.1</ambientFactor>
<diffuseFactor>0.6</diffuseFactor>
<specularFactor>0.4</specularFactor>
<shininess>2.0</shininess>
<physicType>TriangleMesh</physicType>
<dampningL>0.555</dampningL>
<dampningA>0.5</dampningA>
<renderable>true</renderable>
</objectData>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

View File

@ -1,3 +1,148 @@
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<manualPos>false</manualPos>
<xPos>-91.500000</xPos>
<yOffset>0.0</yOffset>
<zPos>216.500000</zPos>
<idGreen>0</idGreen>
<idBlue>142</idBlue>
<typeID>250</typeID>
<trigger>
<name>-</name>
<xPosition>0</xPosition>
<yPosition>0</yPosition>
<zPosition>0</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>-</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<manualPos>false</manualPos>
<xPos>-6.500000</xPos>
<yOffset>0.0</yOffset>
<zPos>54.500000</zPos>
<idGreen>0</idGreen>
<idBlue>140</idBlue>
<typeID>81</typeID>
<trigger>
<name>-</name>
<xPosition>0</xPosition>
<yPosition>0</yPosition>
<zPosition>0</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>-</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<manualPos>false</manualPos>
<xPos>-6.500000</xPos>
<yOffset>0.0</yOffset>
<zPos>26.500000</zPos>
<idGreen>0</idGreen>
<idBlue>139</idBlue>
<typeID>81</typeID>
<trigger>
<name>-</name>
<xPosition>0</xPosition>
<yPosition>0</yPosition>
<zPosition>0</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>-</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<manualPos>false</manualPos>
<xPos>-53.500000</xPos>
<yOffset>0.0</yOffset>
<zPos>54.500000</zPos>
<idGreen>0</idGreen>
<idBlue>138</idBlue>
<typeID>81</typeID>
<trigger>
<name>-</name>
<xPosition>0</xPosition>
<yPosition>0</yPosition>
<zPosition>0</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>-</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<manualPos>false</manualPos>
<xPos>-53.500000</xPos>
<yOffset>0.0</yOffset>
<zPos>26.500000</zPos>
<idGreen>0</idGreen>
<idBlue>137</idBlue>
<typeID>81</typeID>
<trigger>
<name>-</name>
<xPosition>0</xPosition>
<yPosition>0</yPosition>
<zPosition>0</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>-</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

View File

@ -2,6 +2,7 @@
in vec2 vTexCoord;
in vec4 fragPosition;
in vec4 sunPosition;
out vec4 oColor;
@ -9,10 +10,21 @@ uniform sampler2D uTexture;
uniform float farPlane;
uniform vec4 fogColor;
uniform vec3 cameraCenter;
uniform vec3 sunColor;
const float sunSize = 40.0;
void main() {
float distanceToSun = length(sunPosition - fragPosition);
float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition));
float fogFactor = clamp((1.0 - ((farPlane - 35.0) -distanceCameraCenter)/30.0), 0.0, 1.0);
fogFactor *= clamp((1.0-((fragPosition.y-40.0)/30.0)), 0.0, 1.0);
oColor = mix(texture(uTexture, vTexCoord), fogColor, fogFactor);
if (distanceToSun < sunSize) {
float sunIntensity = clamp(0.3*exp(1/(distanceToSun/sunSize))-exp(1.0)*0.3, 0.0, 1.0);
vec4 color = mix(vec4(texture(uTexture, vTexCoord)), vec4(sunColor, sunIntensity), sunIntensity);
oColor = mix(color, fogColor, fogFactor);
}
else {
oColor = mix(texture(uTexture, vTexCoord), fogColor, fogFactor);
}
}

View File

@ -6,12 +6,17 @@ in vec2 aTexCoord;
uniform mat4 modelMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform float skydomeSize;
uniform vec3 directionalVector;
uniform vec3 cameraCenter;
out vec2 vTexCoord;
out vec4 fragPosition;
out vec4 sunPosition;
void main() {
fragPosition = modelMatrix * vec4(aPosition, 1.0);
vTexCoord = aTexCoord;
sunPosition = (normalize(vec4(directionalVector, 0.0)) * skydomeSize) + vec4(cameraCenter, 1.0);
gl_Position = modelViewProjectionMatrix * vec4(aPosition, 1.0);
}

View File

@ -186,6 +186,7 @@ void Graphics::render(double time)
glm::vec3 upvectors[6] = {glm::vec3(0.0f, -1.0f, 0.0f),glm::vec3(0.0f, -1.0f, 0.0f),glm::vec3(0.0f, 0.0f, -1.0f),
glm::vec3(0.0f, 0.0f, -1.0f),glm::vec3(0.0f, -1.0f, 0.0f),glm::vec3(0.0f, -1.0f, 0.0f)};
framebuffer_cube->bind();
for (unsigned int i_pointlight = 0; i_pointlight<closestLights.size() && i_pointlight < maxShadowRenderCount; i_pointlight++) {
// render each side of the cube
@ -203,6 +204,7 @@ void Graphics::render(double time)
}
}
}
// render depth textures for sun
depthShader->use();
glViewport(0, 0, windowSize.x, windowSize.y);
@ -244,8 +246,11 @@ void Graphics::render(double time)
skydomeShader->use();
// set fog Parameters
skydomeShader->setUniform("farPlane", farPlane);
skydomeShader->setUniform("skydomeSize", level->getSkydomeSize());
skydomeShader->setUniform("fogColor", level->getFogColour());
skydomeShader->setUniform("cameraCenter", level->getCameraCenter()->getPosition());
skydomeShader->setUniform("directionalVector", level->getDirectionalLight()->getPosition());
skydomeShader->setUniform("sunColor", level->getDirectionalLight()->getColour());
level->getSkydome()->render(skydomeShader, false, true, &lightingViewProjectionMatrix);
lightingShader->use();