soft shadows done
This commit is contained in:
@@ -42,7 +42,7 @@ RendererBase::RendererBase(QGLView * view_)
|
||||
textures_manager = new TextureManager(view);
|
||||
maps_size = QSize(1024, 1024);
|
||||
maps_hash = 0;
|
||||
tex_coeff[0] = tex_coeff[1] = 0;
|
||||
tex_coeff[0] = tex_coeff[1] = tex_coeff[2] = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -400,6 +400,7 @@ void RendererBase::initCoeffTextures() {
|
||||
}
|
||||
}
|
||||
createCoeffTexture(tex_coeff[0], data.constData(), size, 2);
|
||||
createNoiseTexture(tex_coeff[2]);
|
||||
}
|
||||
|
||||
|
||||
@@ -428,3 +429,17 @@ void RendererBase::createCoeffTexture(GLuint & id, const void * data, int size,
|
||||
}
|
||||
f->glTexImage2D(GL_TEXTURE_2D, 0, iformat, size, size, 0, format, GL_FLOAT, data);
|
||||
}
|
||||
|
||||
|
||||
void RendererBase::createNoiseTexture(GLuint & id) {
|
||||
QOpenGLExtraFunctions * f = view;
|
||||
deleteGLTexture(f, id);
|
||||
f->glGenTextures(1, &id);
|
||||
f->glBindTexture(GL_TEXTURE_2D, id);
|
||||
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
QImage im = generateNoise(QSize(noise_size, noise_size));
|
||||
f->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, im.width(), im.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, im.bits());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user