fixed many memory leaks

added working shadows, using basic shadow mapping
This commit is contained in:
erwin coumans
2013-06-30 23:19:14 -07:00
parent f2cc840c31
commit 6d6ef5d3dc
28 changed files with 581 additions and 226 deletions

View File

@@ -1,7 +1,7 @@
//this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project
static const char* useShadowMapInstancingVertexShader= \
"#version 330 core\n"
"//precision highp float;\n"
"#version 330 \n"
"precision highp float;\n"
"\n"
"\n"
"layout (location = 0) in vec4 position;\n"
@@ -16,6 +16,7 @@ static const char* useShadowMapInstancingVertexShader= \
"uniform mat4 ModelViewMatrix;\n"
"uniform mat4 ProjectionMatrix;\n"
"uniform mat4 DepthBiasModelViewProjectionMatrix;\n"
"uniform mat4 MVP;\n"
"\n"
"out vec4 ShadowCoord;\n"
"\n"
@@ -68,16 +69,15 @@ static const char* useShadowMapInstancingVertexShader= \
" ambient = vec3(0.3,.3,0.3);\n"
" \n"
" \n"
" vec4 local_normal = (quatRotate3( vertexnormal,q));\n"
" vec3 light_pos = vec3(-0.3,0.1,0.1);\n"
" normal = local_normal.xyz;//normalize(ModelViewMatrix * local_normal).xyz;\n"
" vec4 worldNormal = (quatRotate3( vertexnormal,q));\n"
" vec3 light_pos = vec3(-5.f,100,-40);\n"
" normal = normalize(worldNormal).xyz;\n"
"\n"
" lightDir = normalize(light_pos);//gl_LightSource[0].position.xyz));\n"
"// lightDir = normalize(vec3(gl_LightSource[0].position));\n"
" \n"
" vec4 axis = vec4(1,1,1,0);\n"
" vec4 localcoord = quatRotate3( position.xyz*instance_scale,q);\n"
" vec4 vertexPos = ProjectionMatrix * ModelViewMatrix * vec4((instance_position+localcoord).xyz,1);\n"
" vec4 vertexPos = MVP* vec4((instance_position+localcoord).xyz,1);\n"
"\n"
" gl_Position = vertexPos;\n"
" ShadowCoord = DepthBiasModelViewProjectionMatrix * vec4((instance_position+localcoord).xyz,1);\n"