Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texture: Make some setters protected for properties not meant to be changed by end user #13101

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/dev/core/src/Materials/Textures/baseTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ export class BaseTexture extends ThinTexture implements IAnimatable {
@serialize()
public anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;

private _isCube = false;
/** @internal */
public _isCube = false;
/**
* Define if the texture is a cube texture or if false a 2d texture.
*/
Expand All @@ -224,7 +225,7 @@ export class BaseTexture extends ThinTexture implements IAnimatable {
return this._texture.isCube;
}

public set isCube(value: boolean) {
protected set isCube(value: boolean) {
if (!this._texture) {
this._isCube = value;
} else {
Expand All @@ -244,7 +245,7 @@ export class BaseTexture extends ThinTexture implements IAnimatable {
return this._texture.is3D;
}

public set is3D(value: boolean) {
protected set is3D(value: boolean) {
if (!this._texture) {
return;
}
Expand All @@ -264,7 +265,7 @@ export class BaseTexture extends ThinTexture implements IAnimatable {
return this._texture.is2DArray;
}

public set is2DArray(value: boolean) {
protected set is2DArray(value: boolean) {
if (!this._texture) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/dev/core/src/Materials/Textures/thinTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class ThinTexture {
return this._texture.isCube;
}

public set isCube(value: boolean) {
protected set isCube(value: boolean) {
if (!this._texture) {
return;
}
Expand All @@ -103,7 +103,7 @@ export class ThinTexture {
return this._texture.is3D;
}

public set is3D(value: boolean) {
protected set is3D(value: boolean) {
if (!this._texture) {
return;
}
Expand All @@ -122,7 +122,7 @@ export class ThinTexture {
return this._texture.is2DArray;
}

public set is2DArray(value: boolean) {
protected set is2DArray(value: boolean) {
if (!this._texture) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/Misc/dds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ ThinEngine.prototype.createPrefilteredCubeTexture = function (

// Wrap in a base texture for easy binding.
const lodTexture = new BaseTexture(scene);
lodTexture.isCube = true;
lodTexture._isCube = true;
lodTexture._texture = glTextureFromLod;

glTextureFromLod.isReady = true;
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/Misc/environmentTextureTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ export function UploadLevelsAsync(texture: InternalTexture, imageData: ArrayBuff

// Wrap in a base texture for easy binding.
const lodTexture = new BaseTexture(null);
lodTexture.isCube = true;
lodTexture._isCube = true;
lodTexture._texture = glTextureFromLod;
lodTextures![mipmapIndex] = lodTexture;

Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/XR/features/WebXRLightEstimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export class WebXRLightEstimation extends WebXRAbstractFeature {
if (!this.options.disableCubeMapReflection) {
if (!this._reflectionCubeMap) {
this._reflectionCubeMap = new BaseTexture(this._xrSessionManager.scene);
this._reflectionCubeMap.isCube = true;
this._reflectionCubeMap._isCube = true;
this._reflectionCubeMap.coordinatesMode = Constants.TEXTURE_CUBIC_MODE;
if (this.options.setSceneEnvironmentTexture) {
this._xrSessionManager.scene.environmentTexture = this._reflectionCubeMap;
Expand Down