mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Add Depth compare / shadow sampler support. Officially this is only supported in glsl3 shaders.
- Add Texture:setDepthSampleMode(comparemode). Only works on textures with depth pixel formats. A texture with the depth sample mode set will only work with a depth sampler. - Add DepthImage, DepthArrayImage, and DepthCubeImage sampler keywords to glsl3. --HG-- branch : minor
This commit is contained in:
@@ -380,6 +380,8 @@ void Image::replacePixels(love::image::ImageDataBase *d, int slice, int mipmap,
|
||||
if (w != oldd->getWidth() || h != oldd->getHeight())
|
||||
throw love::Exception("Dimensions must match the texture's dimensions for the specified mipmap level.");
|
||||
|
||||
Graphics::flushStreamDrawsGlobal();
|
||||
|
||||
d->retain();
|
||||
oldd->release();
|
||||
|
||||
@@ -397,6 +399,8 @@ void Image::replacePixels(love::image::ImageDataBase *d, int slice, int mipmap,
|
||||
|
||||
void Image::replacePixels(const void *data, size_t size, const Rect &rect, int slice, int mipmap, bool reloadmipmaps)
|
||||
{
|
||||
Graphics::flushStreamDrawsGlobal();
|
||||
|
||||
OpenGL::TempDebugGroup debuggroup("Image replace pixels");
|
||||
|
||||
gl.bindTextureToUnit(this, 0, false);
|
||||
@@ -422,6 +426,8 @@ void Image::setFilter(const Texture::Filter &f)
|
||||
throw love::Exception("Invalid texture filter.");
|
||||
}
|
||||
|
||||
Graphics::flushStreamDrawsGlobal();
|
||||
|
||||
filter = f;
|
||||
|
||||
if (!OpenGL::hasTextureFilteringSupport(getPixelFormat()))
|
||||
@@ -445,6 +451,8 @@ void Image::setFilter(const Texture::Filter &f)
|
||||
|
||||
bool Image::setWrap(const Texture::Wrap &w)
|
||||
{
|
||||
Graphics::flushStreamDrawsGlobal();
|
||||
|
||||
bool success = true;
|
||||
bool forceclamp = texType == TEXTURE_CUBE;
|
||||
wrap = w;
|
||||
@@ -483,6 +491,8 @@ bool Image::setMipmapSharpness(float sharpness)
|
||||
if (!GLAD_VERSION_1_4)
|
||||
return false;
|
||||
|
||||
Graphics::flushStreamDrawsGlobal();
|
||||
|
||||
// LOD bias has the range (-maxbias, maxbias)
|
||||
mipmapSharpness = std::min(std::max(sharpness, -maxMipmapSharpness + 0.01f), maxMipmapSharpness - 0.01f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user