Skip to content

Commit

Permalink
Also use blank texture if given texture is not renderable
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Mar 12, 2018
1 parent 3788617 commit b251a7f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -837,17 +837,21 @@ var Renderer = Base.extend(function () {
var uniformValue = getUniformValue(renderable, material, symbol);
var uniformType = uniform.type;

if (uniformValue == null && uniformType === 't') {
uniformValue = placeholderTexture;
if (uniformType === 't') {
if (!uniformValue || !uniformValue.isRenderable()) {
uniformValue = placeholderTexture;
}
}
// PENDING
// When binding two materials with the same shader
// Many uniforms will be be set twice even if they have the same value
// So add a evaluation to see if the uniform is really needed to be set
if (prevMaterial && sameProgram) {
var prevUniformValue = getUniformValue(prevRenderable, prevMaterial, symbol);
if (prevUniformValue == null && uniformType === 't') {
prevUniformValue = placeholderTexture;
if (uniformType === 't') {
if (!prevUniformValue || !prevUniformValue.isRenderable()) {
prevUniformValue = placeholderTexture;
}
}

if (prevUniformValue === uniformValue) {
Expand Down

0 comments on commit b251a7f

Please sign in to comment.