Cubemaps kinda functioning, still somthing wierd with the vectors.

This commit is contained in:
Tleety
2016-02-23 17:17:50 +01:00
parent 91b0ac5fbd
commit 8d23c531af
3 changed files with 8 additions and 5 deletions
+1 -1
Submodule assets updated: ba8e04f12b...89b4070731
+6 -3
View File
@@ -134,7 +134,8 @@ void main()
normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-position);
vec3 R = reflect(-viewVec.xyz, normal.xyz);
vec3 R = reflect(viewVec.xyz, normal.xyz);
R = vec3(P * vec4(R, 1.0));
vec4 reflectionColor = texture(CubeMap, R);
vec2 tilePos;
@@ -166,6 +167,8 @@ void main()
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0;
color_result = color_result * clamp(1/specularTexel, 0, 1) + reflectionColor * clamp(specularTexel, 0, 1);
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
@@ -174,8 +177,8 @@ void main()
if(pos <= FillPercentage) {
color_result += FillColor;
}
//sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
sceneColor = vec4(reflectionColor.xyz, 1);
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
//sceneColor = vec4(reflectionColor.xyz, 1);
color_result += glowTexel*GlowIntensity;
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), clamp(color_result.a, 0, 1));
+1 -1
View File
@@ -27,7 +27,7 @@ void CubeMapPass::GenerateCubeMapTexture()
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapTexture);
for (int i = 0; i < 6; i++) {
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA32F, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_CubeMapTestTextures[i]->Data);
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA32F, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_CubeMapTestTextures[i]->Data);
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);