Skip to content

Commit

Permalink
Add Irradiance texture support in Env format (#16149)
Browse files Browse the repository at this point in the history
* move timer stats to thinEngine

* fix case

* PR Feedback

* Add Irradiance texture support in Env format
  • Loading branch information
sebavan authored Feb 6, 2025
1 parent 8006d50 commit 817f98e
Show file tree
Hide file tree
Showing 5 changed files with 331 additions and 107 deletions.
5 changes: 5 additions & 0 deletions packages/dev/core/src/Engines/Extensions/engine.rawTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ ThinEngine.prototype.createRawCubeTextureFromUrl = function (
};

const internalCallback = (data: any) => {
// If the texture has been disposed
if (!texture._hardwareTexture) {
return;
}

const width = texture.width;
const faceDataArrays = callback(data);

Expand Down
4 changes: 2 additions & 2 deletions packages/dev/core/src/Engines/nativeEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Tools } from "../Misc/tools";
import type { Observer } from "../Misc/observable";
import { Observable } from "../Misc/observable";
import type { EnvironmentTextureSpecularInfoV1 } from "../Misc/environmentTextureTools";
import { CreateImageDataArrayBufferViews, GetEnvInfo, UploadEnvSpherical } from "../Misc/environmentTextureTools";
import { CreateRadianceImageDataArrayBufferViews, GetEnvInfo, UploadEnvSpherical } from "../Misc/environmentTextureTools";
import type { Scene } from "../scene";
import type { RenderTargetCreationOptions, TextureSize, DepthTextureCreationOptions, InternalTextureCreationOptions } from "../Materials/Textures/textureCreationOptions";
import type { IPipelineContext } from "./IPipelineContext";
Expand Down Expand Up @@ -2127,7 +2127,7 @@ export class NativeEngine extends Engine {
}

texture._lodGenerationScale = specularInfo.lodGenerationScale;
const imageData = CreateImageDataArrayBufferViews(data, info);
const imageData = CreateRadianceImageDataArrayBufferViews(data, info);

texture.format = Constants.TEXTUREFORMAT_RGBA;
texture.type = Constants.TEXTURETYPE_UNSIGNED_BYTE;
Expand Down
Loading

0 comments on commit 817f98e

Please sign in to comment.