fixes to improve demos a bit
This commit is contained in:
@@ -1507,7 +1507,8 @@ void GLInstancingRenderer::renderSceneInternal(int renderMode)
|
||||
B3_PROFILE("init");
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
GLint err = glGetError();
|
||||
b3Assert(err==GL_NO_ERROR);
|
||||
|
||||
@@ -1519,6 +1520,9 @@ void GLInstancingRenderer::renderSceneInternal(int renderMode)
|
||||
// Compute the MVP matrix from the light's point of view
|
||||
if (renderMode==B3_CREATE_SHADOWMAP_RENDERMODE)
|
||||
{
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_FRONT);
|
||||
|
||||
if (!m_data->m_shadowMap)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
@@ -1557,7 +1561,12 @@ void GLInstancingRenderer::renderSceneInternal(int renderMode)
|
||||
|
||||
GLint err = glGetError();
|
||||
b3Assert(err==GL_NO_ERROR);
|
||||
}
|
||||
} else
|
||||
{
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
}
|
||||
static b3Vector3 lightPos = b3MakeVector3(-5.f,200,-40);//20,15,10);//-13,6,2);// = b3Vector3(0.5f,2,2);
|
||||
// lightPos.y+=0.1f;
|
||||
b3CreateOrtho(-shadowMapWorldSize,shadowMapWorldSize,-shadowMapWorldSize,shadowMapWorldSize,1,300,depthProjectionMatrix);//-14,14,-14,14,1,200, depthProjectionMatrix);
|
||||
|
||||
@@ -37,7 +37,7 @@ void main(void)
|
||||
|
||||
//float bias = 0.005f;
|
||||
|
||||
float bias = 0.005*tan(acos(intensity));
|
||||
float bias = 0.0001*tan(acos(intensity));
|
||||
bias = clamp(bias, 0,0.01);
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ static const char* useShadowMapInstancingFragmentShader= \
|
||||
" \n"
|
||||
" //float bias = 0.005f;\n"
|
||||
" \n"
|
||||
" float bias = 0.005*tan(acos(intensity));\n"
|
||||
" float bias = 0.0001*tan(acos(intensity));\n"
|
||||
" bias = clamp(bias, 0,0.01);\n"
|
||||
" float visibility = texture(shadowMap, vec3(ShadowCoord.xy,(ShadowCoord.z-bias)/ShadowCoord.w));\n"
|
||||
" \n"
|
||||
|
||||
@@ -200,10 +200,10 @@ static const float cube_vertices2[] =
|
||||
static const int cube_indices[]=
|
||||
{
|
||||
0,1,2,0,2,3,//ground face
|
||||
4,5,6,4,6,7,//top face
|
||||
8,9,10,8,10,11,
|
||||
6,5,4,7,6,4,//top face
|
||||
10,9,8,11,10,8,
|
||||
12,13,14,12,14,15,
|
||||
16,17,18,16,18,19,
|
||||
18,17,16,19,18,16,
|
||||
20,21,22,20,22,23
|
||||
};
|
||||
/*
|
||||
@@ -284,7 +284,7 @@ static const int pyramid_indices[]=
|
||||
|
||||
static const float tetra_vertices[] =
|
||||
{
|
||||
1.f, 1.f, 1.f, 0.5f, 0, 1,0, 0,0,
|
||||
0.f, 0.f, 1.f, 0.5f, 0, 1,0, 0,0,
|
||||
1.f, -1.f, -1.f, 0.5f, 0, 1,0, 1,0,
|
||||
-1.f, 1.f, -1.f, 0.5f, 0, 1,0, 1,1,
|
||||
-1.f, -1, 1.f, 0.5f, 0, 1,0, 0,1
|
||||
@@ -296,9 +296,9 @@ static const float tetra_vertices[] =
|
||||
static const int tetra_indices[]=
|
||||
{
|
||||
0,1,2,//ground face
|
||||
3,1,2,
|
||||
3,0,1,
|
||||
3,2,0
|
||||
2,1,3,
|
||||
1,0,3,
|
||||
0,2,3
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user