Merge branch 'master' of github.com:Faerbit/swp
This commit is contained in:
commit
6af54ab02f
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -81,6 +81,23 @@
|
|||||||
</light>
|
</light>
|
||||||
</composition>
|
</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 -->
|
<!-- Lightsource -->
|
||||||
<composition>
|
<composition>
|
||||||
<typeID>85</typeID>
|
<typeID>85</typeID>
|
||||||
@ -458,6 +475,42 @@
|
|||||||
</object>
|
</object>
|
||||||
</composition>
|
</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>
|
<objectData>
|
||||||
<modelPath>torch.obj</modelPath>
|
<modelPath>torch.obj</modelPath>
|
||||||
<texturePath>torchTexture.png</texturePath>
|
<texturePath>torchTexture2.png</texturePath>
|
||||||
<ambientFactor>0.1</ambientFactor>
|
<ambientFactor>0.1</ambientFactor>
|
||||||
<diffuseFactor>0.3</diffuseFactor>
|
<diffuseFactor>0.3</diffuseFactor>
|
||||||
<specularFactor>0.7</specularFactor>
|
<specularFactor>0.7</specularFactor>
|
||||||
@ -580,9 +633,9 @@
|
|||||||
</objectData>
|
</objectData>
|
||||||
|
|
||||||
<objectData>
|
<objectData>
|
||||||
<modelPath>gate.obj</modelPath>
|
<modelPath>gate.obj</modelPath>
|
||||||
<texturePath>gateTexture.png</texturePath>
|
<texturePath>gateTexture.png</texturePath>
|
||||||
<ambientFactor>0.1</ambientFactor>
|
<ambientFactor>0.1</ambientFactor>
|
||||||
<diffuseFactor>0.6</diffuseFactor>
|
<diffuseFactor>0.6</diffuseFactor>
|
||||||
<specularFactor>0.4</specularFactor>
|
<specularFactor>0.4</specularFactor>
|
||||||
<shininess>2.0</shininess>
|
<shininess>2.0</shininess>
|
||||||
@ -596,9 +649,9 @@
|
|||||||
</objectData>
|
</objectData>
|
||||||
|
|
||||||
<objectData>
|
<objectData>
|
||||||
<modelPath>movableBlock.obj</modelPath>
|
<modelPath>movableBlock.obj</modelPath>
|
||||||
<texturePath>movableBlockTexture.png</texturePath>
|
<texturePath>movableBlockTexture.png</texturePath>
|
||||||
<ambientFactor>0.1</ambientFactor>
|
<ambientFactor>0.1</ambientFactor>
|
||||||
<diffuseFactor>0.6</diffuseFactor>
|
<diffuseFactor>0.6</diffuseFactor>
|
||||||
<specularFactor>0.4</specularFactor>
|
<specularFactor>0.4</specularFactor>
|
||||||
<shininess>2.0</shininess>
|
<shininess>2.0</shininess>
|
||||||
@ -610,3 +663,29 @@
|
|||||||
<dampningA>0.5</dampningA>
|
<dampningA>0.5</dampningA>
|
||||||
<renderable>true</renderable>
|
<renderable>true</renderable>
|
||||||
</objectData>
|
</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.
@ -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>
|
<composition>
|
||||||
<scale>1.0</scale>
|
<scale>1.0</scale>
|
||||||
<xRot>0.0</xRot>
|
<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.
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
in vec2 vTexCoord;
|
in vec2 vTexCoord;
|
||||||
in vec4 fragPosition;
|
in vec4 fragPosition;
|
||||||
|
in vec4 sunPosition;
|
||||||
|
|
||||||
out vec4 oColor;
|
out vec4 oColor;
|
||||||
|
|
||||||
@ -9,10 +10,21 @@ uniform sampler2D uTexture;
|
|||||||
uniform float farPlane;
|
uniform float farPlane;
|
||||||
uniform vec4 fogColor;
|
uniform vec4 fogColor;
|
||||||
uniform vec3 cameraCenter;
|
uniform vec3 cameraCenter;
|
||||||
|
uniform vec3 sunColor;
|
||||||
|
|
||||||
|
const float sunSize = 40.0;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
float distanceToSun = length(sunPosition - fragPosition);
|
||||||
float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition));
|
float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition));
|
||||||
float fogFactor = clamp((1.0 - ((farPlane - 35.0) -distanceCameraCenter)/30.0), 0.0, 1.0);
|
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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,17 @@ in vec2 aTexCoord;
|
|||||||
|
|
||||||
uniform mat4 modelMatrix;
|
uniform mat4 modelMatrix;
|
||||||
uniform mat4 modelViewProjectionMatrix;
|
uniform mat4 modelViewProjectionMatrix;
|
||||||
|
uniform float skydomeSize;
|
||||||
|
uniform vec3 directionalVector;
|
||||||
|
uniform vec3 cameraCenter;
|
||||||
|
|
||||||
out vec2 vTexCoord;
|
out vec2 vTexCoord;
|
||||||
out vec4 fragPosition;
|
out vec4 fragPosition;
|
||||||
|
out vec4 sunPosition;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
fragPosition = modelMatrix * vec4(aPosition, 1.0);
|
fragPosition = modelMatrix * vec4(aPosition, 1.0);
|
||||||
vTexCoord = aTexCoord;
|
vTexCoord = aTexCoord;
|
||||||
|
sunPosition = (normalize(vec4(directionalVector, 0.0)) * skydomeSize) + vec4(cameraCenter, 1.0);
|
||||||
gl_Position = modelViewProjectionMatrix * vec4(aPosition, 1.0);
|
gl_Position = modelViewProjectionMatrix * vec4(aPosition, 1.0);
|
||||||
}
|
}
|
||||||
|
@ -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 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)};
|
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();
|
framebuffer_cube->bind();
|
||||||
for (unsigned int i_pointlight = 0; i_pointlight<closestLights.size() && i_pointlight < maxShadowRenderCount; i_pointlight++) {
|
for (unsigned int i_pointlight = 0; i_pointlight<closestLights.size() && i_pointlight < maxShadowRenderCount; i_pointlight++) {
|
||||||
// render each side of the cube
|
// render each side of the cube
|
||||||
@ -203,6 +204,7 @@ void Graphics::render(double time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// render depth textures for sun
|
// render depth textures for sun
|
||||||
depthShader->use();
|
depthShader->use();
|
||||||
glViewport(0, 0, windowSize.x, windowSize.y);
|
glViewport(0, 0, windowSize.x, windowSize.y);
|
||||||
@ -244,8 +246,11 @@ void Graphics::render(double time)
|
|||||||
skydomeShader->use();
|
skydomeShader->use();
|
||||||
// set fog Parameters
|
// set fog Parameters
|
||||||
skydomeShader->setUniform("farPlane", farPlane);
|
skydomeShader->setUniform("farPlane", farPlane);
|
||||||
|
skydomeShader->setUniform("skydomeSize", level->getSkydomeSize());
|
||||||
skydomeShader->setUniform("fogColor", level->getFogColour());
|
skydomeShader->setUniform("fogColor", level->getFogColour());
|
||||||
skydomeShader->setUniform("cameraCenter", level->getCameraCenter()->getPosition());
|
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);
|
level->getSkydome()->render(skydomeShader, false, true, &lightingViewProjectionMatrix);
|
||||||
|
|
||||||
lightingShader->use();
|
lightingShader->use();
|
||||||
|
Loading…
Reference in New Issue
Block a user