Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
fix crashes with voxels
Browse files Browse the repository at this point in the history
  • Loading branch information
e2002e committed Jul 17, 2024
1 parent e2f4750 commit c9c4666
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Sources/iron/RenderPath.hx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class RenderPath {
return 64;
#elseif (rp_voxelgi_resolution == 32)
return 32;
#elseif (rp_voxelgi_resolution == 16)
return 16;
#else
return 0;
#end
Expand Down Expand Up @@ -689,15 +691,17 @@ 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(1); // Allocate mipmaps
return img;
}
else { // 2D texture
if (t.is_image != null && t.is_image) { // Image
var img = Image.create(width, height,
t.format != null ? getTextureFormat(t.format) : TextureFormat.RGBA32);
if (t.mipmaps) img.generateMipmaps(1000); // Allocate mipmaps
return img;
if (t.mipmaps)
img.generateMipmaps(16); // Allocate mipmaps
return img;
}
else { // Render target
return Image.createRenderTarget(width, height,
Expand Down
2 changes: 1 addition & 1 deletion Sources/iron/object/LightObject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LightObject extends Object {
public var lightInAtlas = false;
public var culledLight = false;
public static var pointLightsData: kha.arrays.Float32Array = null;
public var shadowMapScale = 0.0;
public var shadowMapScale = 1.0;//when in forward, we drawMeshes() which will set this only after drawing shadowmap. This locks the drawing of the atlases so it's better to initialize it at 1.0
// Data used in uniforms
public var tileOffsetX: Array<Float> = [0.0];
public var tileOffsetY: Array<Float> = [0.0];
Expand Down

0 comments on commit c9c4666

Please sign in to comment.