Skip to content

Commit

Permalink
Remove static
Browse files Browse the repository at this point in the history
  • Loading branch information
Popov72 committed Apr 11, 2023
1 parent 6d8657a commit 2eb27db
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions packages/dev/core/src/Meshes/meshUVSpaceRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ import { Color4 } from "core/Maths/math.color";
import "../Shaders/meshUVSpaceRenderer.vertex";
import "../Shaders/meshUVSpaceRenderer.fragment";

declare module "../scene" {
export interface Scene {
/** @internal */
_meshUVSpaceRendererShader: Nullable<ShaderMaterial>;
}
}

/**
* Options for the MeshUVSpaceRenderer
* @since 5.49.1
Expand Down Expand Up @@ -55,7 +62,7 @@ export class MeshUVSpaceRenderer {
private _textureCreatedInternally = false;

private static _GetShader(scene: Scene): ShaderMaterial {
if (!MeshUVSpaceRenderer._Shader) {
if (!scene._meshUVSpaceRendererShader) {
const shader = new ShaderMaterial(
"meshUVSpaceRendererShader",
scene,
Expand All @@ -72,26 +79,16 @@ export class MeshUVSpaceRenderer {
shader.backFaceCulling = false;
shader.alphaMode = Constants.ALPHA_COMBINE;

MeshUVSpaceRenderer._Shader = shader;
scene._meshUVSpaceRendererShader = shader;
}

return MeshUVSpaceRenderer._Shader;
return scene._meshUVSpaceRendererShader;
}

private static _IsRenderTargetTexture(texture: ThinTexture | RenderTargetTexture): texture is RenderTargetTexture {
return (texture as RenderTargetTexture).renderList !== undefined;
}

/**
* Disposes of the global resources created by the MeshUVSpaceRenderer class
*/
public static Dispose(): void {
if (MeshUVSpaceRenderer._Shader) {
MeshUVSpaceRenderer._Shader.dispose();
MeshUVSpaceRenderer._Shader = null;
}
}

/**
* Clear color of the texture
*/
Expand Down

0 comments on commit 2eb27db

Please sign in to comment.