forked from bartvdbraak/blender
verify existence of dm
This commit is contained in:
parent
965c287630
commit
82b9e4d16f
@ -1156,11 +1156,14 @@ int GPU_enable_material(int nr, void *attribs)
|
||||
if(gattribs && GMS.gmatbuf[nr]) {
|
||||
/* bind glsl material and get attributes */
|
||||
Material *mat = GMS.gmatbuf[nr];
|
||||
float auto_bump_scale;
|
||||
|
||||
gpumat = GPU_material_from_blender(GMS.gscene, mat);
|
||||
GPU_material_vertex_attributes(gpumat, gattribs);
|
||||
GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT));
|
||||
GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gviewinv, GMS.gob->col, GMS.gob->derivedFinal->auto_bump_scale);
|
||||
|
||||
auto_bump_scale = GMS.gob->derivedFinal!=0 ? GMS.gob->derivedFinal->auto_bump_scale : 1.0f;
|
||||
GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gviewinv, GMS.gob->col, auto_bump_scale);
|
||||
GMS.gboundmat= mat;
|
||||
|
||||
/* for glsl use alpha blend mode, unless it's set to solid and
|
||||
|
@ -1960,13 +1960,16 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
|
||||
}
|
||||
|
||||
if(found_deriv_map) {
|
||||
float dBdu, dBdv, auto_bump;
|
||||
float dBdu, dBdv, auto_bump = 1.0f;
|
||||
float s = 1; // negate this if flipped texture coordinate
|
||||
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres);
|
||||
|
||||
auto_bump = shi->obr->ob->derivedFinal->auto_bump_scale;
|
||||
auto_bump /= sqrtf((float) (dimx*dimy));
|
||||
if(shi->obr->ob->derivedFinal)
|
||||
{
|
||||
auto_bump = shi->obr->ob->derivedFinal->auto_bump_scale;
|
||||
auto_bump /= sqrtf((float) (dimx*dimy));
|
||||
}
|
||||
|
||||
// this variant using a derivative map is described here
|
||||
// http://mmikkelsen3d.blogspot.com/2011/07/derivative-maps.html
|
||||
|
@ -147,7 +147,8 @@ void BL_BlenderShader::Update(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
|
||||
else
|
||||
obcol[0]= obcol[1]= obcol[2]= obcol[3]= 1.0f;
|
||||
|
||||
GPU_material_bind_uniforms(gpumat, obmat, viewmat, viewinvmat, obcol, ms.m_pDerivedMesh->auto_bump_scale);
|
||||
float auto_bump_scale = ms.m_pDerivedMesh!=0 ? ms.m_pDerivedMesh->auto_bump_scale : 1.0f;
|
||||
GPU_material_bind_uniforms(gpumat, obmat, viewmat, viewinvmat, obcol, auto_bump_scale);
|
||||
|
||||
mAlphaBlend = GPU_material_alpha_blend(gpumat, obcol);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user