Fix T44565 World background artifacts when world shader is void (or
compilation fails).
This commit is contained in:
parent
94d80c8ca4
commit
28ea3f5b94
Notes:
blender-bot
2023-02-14 09:10:55 +01:00
Referenced by issue #44577, write_customdata error: layer '':7 - can't be written to file Referenced by issue #44565, World Background in 3D viewport - draw error
|
@ -2940,21 +2940,41 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
|
|||
if (glsl) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
GPUMaterial *gpumat = GPU_material_world(scene, scene->world);
|
||||
bool material_not_bound;
|
||||
|
||||
/* calculate full shader for background */
|
||||
GPU_material_bind(gpumat, 1, 1, 1.0, false, rv3d->viewmat, rv3d->viewinv, rv3d->viewcamtexcofac, (v3d->scenelock != 0));
|
||||
|
||||
material_not_bound = !GPU_material_bound(gpumat);
|
||||
|
||||
if (material_not_bound) {
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glBegin(GL_QUADS);
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glVertex3f(-1.0, -1.0, 1.0);
|
||||
glVertex3f(1.0, -1.0, 1.0);
|
||||
glVertex3f(1.0, 1.0, 1.0);
|
||||
glVertex3f(-1.0, 1.0, 1.0);
|
||||
glVertex3f(1.0, 1.0, 1.0);
|
||||
glEnd();
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
if (material_not_bound) {
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
GPU_material_unbind(gpumat);
|
||||
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
|
|
@ -186,7 +186,7 @@ bool GPU_lamp_override_visible(GPULamp *lamp, struct SceneRenderLayer *srl, stru
|
|||
void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap, float viewmat[4][4], float viewinv[4][4], float cameraborder[4], bool scenelock);
|
||||
void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[4][4], float obcol[4], float autobumpscale);
|
||||
void GPU_material_unbind(GPUMaterial *material);
|
||||
int GPU_material_bound(GPUMaterial *material);
|
||||
bool GPU_material_bound(GPUMaterial *material);
|
||||
struct Scene *GPU_material_scene(GPUMaterial *material);
|
||||
GPUMatType GPU_Material_get_type(GPUMaterial *material);
|
||||
|
||||
|
|
|
@ -102,7 +102,6 @@ struct GPUMaterial {
|
|||
/* for binding the material */
|
||||
GPUPass *pass;
|
||||
GPUVertexAttribs attribs;
|
||||
int bound;
|
||||
int builtins;
|
||||
int alpha, obcolalpha;
|
||||
int dynproperty;
|
||||
|
@ -114,6 +113,7 @@ struct GPUMaterial {
|
|||
int cameratexcofacloc;
|
||||
|
||||
ListBase lamps;
|
||||
bool bound;
|
||||
};
|
||||
|
||||
struct GPULamp {
|
||||
|
@ -400,7 +400,7 @@ void GPU_material_unbind(GPUMaterial *material)
|
|||
}
|
||||
}
|
||||
|
||||
int GPU_material_bound(GPUMaterial *material)
|
||||
bool GPU_material_bound(GPUMaterial *material)
|
||||
{
|
||||
return material->bound;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue