Skip to content

Commit

Permalink
Merge pull request #210 from e2002e/gi_clipmaps
Browse files Browse the repository at this point in the history
Gi clipmaps
  • Loading branch information
luboslenco committed Apr 23, 2024
2 parents 364e271 + 6dd8021 commit 99922de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Sources/iron/RenderPath.hx
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,7 @@ class RenderPath {
if (rt == null ||
rt.raw.width > 0 ||
rt.depthStencilFrom == "" ||
rt == depthToRenderTarget.get(rt.depthStencilFrom) ||
rt.raw.is_image == true) {
rt == depthToRenderTarget.get(rt.depthStencilFrom)) {
continue;
}

Expand Down Expand Up @@ -690,14 +689,15 @@ class RenderPath {
// Image only
var img = Image.create3D(width, height, depth,
t.format != null ? getTextureFormat(t.format) : TextureFormat.RGBA32);
if (t.mipmaps)
img.generateMipmaps(1000); // Allocate mipmaps
return img;
if (t.mipmaps) img.generateMipmaps(1000); // Allocate mipmaps
return img;
}
else { // 2D texture
if (t.is_image != null && t.is_image) { // Image
return Image.create(width, height,
var img = Image.create(width, height,
t.format != null ? getTextureFormat(t.format) : TextureFormat.RGBA32);
if (t.mipmaps) img.generateMipmaps(1000); // Allocate mipmaps
return img;
}
else { // Render target
return Image.createRenderTarget(width, height,
Expand Down
8 changes: 4 additions & 4 deletions Sources/iron/object/Uniforms.hx
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ class Uniforms {
if (isImage) {
// Multiple voxel volumes, always set params
g.setImageTexture(context.textureUnits[j], rt.image); // image2D/3D
if (rt.raw.depth <= 1) {
g.setTextureParameters(context.textureUnits[j], TextureAddressing.Clamp, TextureAddressing.Clamp, TextureFilter.LinearFilter, TextureFilter.LinearFilter, MipMapFilter.NoMipFilter);
if (rt.raw.name.startsWith("voxels_")) {
g.setTextureParameters(context.textureUnits[j], TextureAddressing.Clamp, TextureAddressing.Clamp, TextureFilter.LinearFilter, TextureFilter.LinearFilter, MipMapFilter.LinearMipFilter);
}
else {
g.setTexture3DParameters(context.textureUnits[j], TextureAddressing.Mirror, TextureAddressing.Mirror, TextureAddressing.Mirror, TextureFilter.LinearFilter, TextureFilter.LinearFilter, MipMapFilter.LinearMipFilter);
else if (rt.raw.name.startsWith("voxels")) {
g.setTexture3DParameters(context.textureUnits[j], TextureAddressing.Mirror, TextureAddressing.Mirror, TextureAddressing.Mirror, TextureFilter.LinearFilter, TextureFilter.PointFilter, MipMapFilter.NoMipFilter);
}
paramsSet = true;
}
Expand Down

0 comments on commit 99922de

Please sign in to comment.