Skip to content

Commit 372bd07

Browse files
author
Mike Bond
committed
Rename PBR2 to OpenPBR
1 parent 5b2c879 commit 372bd07

14 files changed

+53
-53
lines changed

packages/dev/core/src/Materials/PBR/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export * from "./pbrBRDFConfiguration";
55
export * from "./pbrClearCoatConfiguration";
66
export * from "./pbrIridescenceConfiguration";
77
export * from "./pbrMaterial";
8-
export * from "./pbr2Material";
8+
export * from "./openPbrMaterial";
99
export * from "./pbrMetallicRoughnessMaterial";
1010
export * from "./pbrSpecularGlossinessMaterial";
1111
export * from "./pbrSheenConfiguration";
@@ -16,7 +16,7 @@ export * from "../../ShadersWGSL/pbr.vertex";
1616
export * from "../../ShadersWGSL/pbr.fragment";
1717
export * from "../../Shaders/pbr.vertex";
1818
export * from "../../Shaders/pbr.fragment";
19-
export * from "../../ShadersWGSL/pbr2.vertex";
20-
export * from "../../ShadersWGSL/pbr2.fragment";
21-
export * from "../../Shaders/pbr2.vertex";
22-
export * from "../../Shaders/pbr2.fragment";
19+
export * from "../../ShadersWGSL/openpbr.vertex";
20+
export * from "../../ShadersWGSL/openpbr.fragment";
21+
export * from "../../Shaders/openpbr.vertex";
22+
export * from "../../Shaders/openpbr.fragment";

packages/dev/core/src/Materials/PBR/pbr2Material.ts renamed to packages/dev/core/src/Materials/PBR/openPbrMaterial.ts

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import type { IAnimatable } from "../../Animations/animatable.interface";
6767
const onCreatedEffectParameters = { effect: null as unknown as Effect, subMesh: null as unknown as Nullable<SubMesh> };
6868

6969
/**
70-
* Defines a property for the PBR2Material.
70+
* Defines a property for the OpenPBRMaterial.
7171
*/
7272
class Property<T> {
7373
/**
@@ -110,12 +110,12 @@ class Sampler {
110110
) {}
111111
}
112112

113-
class PBR2MaterialDefinesBase extends UVDefinesMixin(MaterialDefines) {}
113+
class OpenPBRMaterialDefinesBase extends UVDefinesMixin(MaterialDefines) {}
114114
/**
115115
* Manages the defines for the PBR Material.
116116
* @internal
117117
*/
118-
export class PBR2MaterialDefines extends ImageProcessingDefinesMixin(PBR2MaterialDefinesBase) {
118+
export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(OpenPBRMaterialDefinesBase) {
119119
public PBR = true;
120120

121121
public NUM_SAMPLES = "0";
@@ -330,33 +330,32 @@ export class PBR2MaterialDefines extends ImageProcessingDefinesMixin(PBR2Materia
330330
}
331331
}
332332

333-
class PBR2BaseMaterial extends ImageProcessingMixin(PushMaterial) {}
334-
// class PBR2MaterialBase extends ImageProcessingMixin(PBRBaseMaterial) {}
333+
class OpenPBRMaterialBase extends ImageProcessingMixin(PushMaterial) {}
335334
/**
336335
* The Physically based material of BJS.
337336
*
338337
* This offers the main features of a standard PBR material.
339338
* For more information, please refer to the documentation :
340339
* https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR
341340
*/
342-
export class PBR2Material extends PBR2BaseMaterial {
341+
export class OpenPBRMaterial extends OpenPBRMaterialBase {
343342
/**
344-
* PBR2MaterialTransparencyMode: No transparency mode, Alpha channel is not use.
343+
* OpenPBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.
345344
*/
346345
public static readonly PBRMATERIAL_OPAQUE = PBRBaseMaterial.PBRMATERIAL_OPAQUE;
347346

348347
/**
349-
* PBR2MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
348+
* OpenPBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
350349
*/
351350
public static readonly PBRMATERIAL_ALPHATEST = PBRBaseMaterial.PBRMATERIAL_ALPHATEST;
352351

353352
/**
354-
* PBR2MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
353+
* OpenPBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
355354
*/
356355
public static readonly PBRMATERIAL_ALPHABLEND = PBRBaseMaterial.PBRMATERIAL_ALPHABLEND;
357356

358357
/**
359-
* PBR2MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
358+
* OpenPBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
360359
* They are also discarded below the alpha cutoff threshold to improve performances.
361360
*/
362361
public static readonly PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND;
@@ -470,7 +469,7 @@ export class PBR2Material extends PBR2BaseMaterial {
470469
*/
471470
@serialize()
472471
@expandToProperty("_markAllSubMeshesAsTexturesDirty")
473-
public ambientTextureImpactOnAnalyticalLights: number = PBR2Material.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;
472+
public ambientTextureImpactOnAnalyticalLights: number = OpenPBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;
474473

475474
/**
476475
* Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true.
@@ -1488,7 +1487,7 @@ export class PBR2Material extends PBR2BaseMaterial {
14881487
protected _cacheHasRenderTargetTextures = false;
14891488

14901489
/**
1491-
* Instantiates a new PBR2Material instance.
1490+
* Instantiates a new OpenPBRMaterial instance.
14921491
*
14931492
* @param name The material name
14941493
* @param scene The scene the material will be use in.
@@ -1540,7 +1539,7 @@ export class PBR2Material extends PBR2BaseMaterial {
15401539
* @returns the name of the material class.
15411540
*/
15421541
public override getClassName(): string {
1543-
return "PBR2Material";
1542+
return "OpenPBRMaterial";
15441543
}
15451544

15461545
/**
@@ -1604,8 +1603,8 @@ export class PBR2Material extends PBR2BaseMaterial {
16041603
* @param rootUrl defines the root URL to use to load textures
16051604
* @returns cloned material instance
16061605
*/
1607-
public override clone(name: string, cloneTexturesOnlyOnce: boolean = true, rootUrl = ""): PBR2Material {
1608-
const clone = SerializationHelper.Clone(() => new PBR2Material(name, this.getScene()), this, { cloneTexturesOnlyOnce });
1606+
public override clone(name: string, cloneTexturesOnlyOnce: boolean = true, rootUrl = ""): OpenPBRMaterial {
1607+
const clone = SerializationHelper.Clone(() => new OpenPBRMaterial(name, this.getScene()), this, { cloneTexturesOnlyOnce });
16091608

16101609
clone.id = name;
16111610
clone.name = name;
@@ -1623,7 +1622,7 @@ export class PBR2Material extends PBR2BaseMaterial {
16231622
*/
16241623
public override serialize(): any {
16251624
const serializationObject = super.serialize();
1626-
serializationObject.customType = "BABYLON.PBR2Material";
1625+
serializationObject.customType = "BABYLON.OpenPBRMaterial";
16271626

16281627
return serializationObject;
16291628
}
@@ -1634,10 +1633,10 @@ export class PBR2Material extends PBR2BaseMaterial {
16341633
* @param source - Serialized object.
16351634
* @param scene - BJS scene instance.
16361635
* @param rootUrl - url for the scene object
1637-
* @returns - PBR2Material
1636+
* @returns - OpenPBRMaterial
16381637
*/
1639-
public static override Parse(source: any, scene: Scene, rootUrl: string): PBR2Material {
1640-
const material = SerializationHelper.Parse(() => new PBR2Material(source.name, scene), source, scene, rootUrl);
1638+
public static override Parse(source: any, scene: Scene, rootUrl: string): OpenPBRMaterial {
1639+
const material = SerializationHelper.Parse(() => new OpenPBRMaterial(source.name, scene), source, scene, rootUrl);
16411640

16421641
if (source.stencil) {
16431642
material.stencil.parse(source.stencil, scene, rootUrl);
@@ -1670,7 +1669,7 @@ export class PBR2Material extends PBR2BaseMaterial {
16701669
if (this._breakShaderLoadedCheck) {
16711670
return;
16721671
}
1673-
const defines = new PBR2MaterialDefines(this._eventInfo.defineNames);
1672+
const defines = new OpenPBRMaterialDefines(this._eventInfo.defineNames);
16741673
const effect = this._prepareEffect(mesh, defines, undefined, undefined, localOptions.useInstances, localOptions.clipPlane, mesh.hasThinInstances)!;
16751674
if (this._onEffectCreatedObservable) {
16761675
onCreatedEffectParameters.effect = effect;
@@ -1714,10 +1713,10 @@ export class PBR2Material extends PBR2BaseMaterial {
17141713

17151714
if (!subMesh.materialDefines) {
17161715
this._callbackPluginEventGeneric(MaterialPluginEvent.GetDefineNames, this._eventInfo);
1717-
subMesh.materialDefines = new PBR2MaterialDefines(this._eventInfo.defineNames);
1716+
subMesh.materialDefines = new OpenPBRMaterialDefines(this._eventInfo.defineNames);
17181717
}
17191718

1720-
const defines = <PBR2MaterialDefines>subMesh.materialDefines;
1719+
const defines = <OpenPBRMaterialDefines>subMesh.materialDefines;
17211720
if (this._isReadyForSubMesh(subMesh)) {
17221721
return true;
17231722
}
@@ -1861,7 +1860,7 @@ export class PBR2Material extends PBR2BaseMaterial {
18611860

18621861
if (!engine.getCaps().standardDerivatives && !mesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {
18631862
mesh.createNormals(true);
1864-
Logger.Warn("PBR2Material: Normals have been created for the mesh: " + mesh.name);
1863+
Logger.Warn("OpenPBRMaterial: Normals have been created for the mesh: " + mesh.name);
18651864
}
18661865

18671866
const previousEffect = subMesh.effect;
@@ -1967,7 +1966,7 @@ export class PBR2Material extends PBR2BaseMaterial {
19671966
public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {
19681967
const scene = this.getScene();
19691968

1970-
const defines = <PBR2MaterialDefines>subMesh.materialDefines;
1969+
const defines = <OpenPBRMaterialDefines>subMesh.materialDefines;
19711970
if (!defines) {
19721971
return;
19731972
}
@@ -2522,7 +2521,7 @@ export class PBR2Material extends PBR2BaseMaterial {
25222521

25232522
private _prepareEffect(
25242523
mesh: AbstractMesh,
2525-
defines: PBR2MaterialDefines,
2524+
defines: OpenPBRMaterialDefines,
25262525
onCompiled: Nullable<(effect: Effect) => void> = null,
25272526
onError: Nullable<(effect: Effect, errors: string) => void> = null,
25282527
useInstances: Nullable<boolean> = null,
@@ -2790,9 +2789,9 @@ export class PBR2Material extends PBR2BaseMaterial {
27902789
? undefined
27912790
: async () => {
27922791
if (this.shaderLanguage === ShaderLanguage.WGSL) {
2793-
await Promise.all([import("../../ShadersWGSL/pbr2.vertex"), import("../../ShadersWGSL/pbr2.fragment")]);
2792+
await Promise.all([import("../../ShadersWGSL/openpbr.vertex"), import("../../ShadersWGSL/openpbr.fragment")]);
27942793
} else {
2795-
await Promise.all([import("../../Shaders/pbr2.vertex"), import("../../Shaders/pbr2.fragment")]);
2794+
await Promise.all([import("../../Shaders/openpbr.vertex"), import("../../Shaders/openpbr.fragment")]);
27962795
}
27972796

27982797
this._shadersLoaded = true;
@@ -2808,7 +2807,7 @@ export class PBR2Material extends PBR2BaseMaterial {
28082807

28092808
private _prepareDefines(
28102809
mesh: AbstractMesh,
2811-
defines: PBR2MaterialDefines,
2810+
defines: OpenPBRMaterialDefines,
28122811
useInstances: Nullable<boolean> = null,
28132812
useClipPlane: Nullable<boolean> = null,
28142813
useThinInstances: boolean = false
@@ -3088,4 +3087,4 @@ export class PBR2Material extends PBR2BaseMaterial {
30883087
}
30893088
}
30903089

3091-
RegisterClass("BABYLON.PBR2Material", PBR2Material);
3090+
RegisterClass("BABYLON.OpenPBRMaterial", OpenPBRMaterial);

packages/dev/core/src/Shaders/pbr2.vertex.fx renamed to packages/dev/core/src/Shaders/openpbr.vertex.fx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ varying vec3 vPositionW;
9595
varying vec4 vColor;
9696
#endif
9797

98+
// This is just including TBN, if needed. "Bump" isn't really a great name.
9899
#include<bumpVertexDeclaration>
99100
#include<clipPlaneVertexDeclaration>
100101
#include<fogVertexDeclaration>

packages/dev/loaders/src/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Nullable } from "core/types";
22
import { PBRMaterial } from "core/Materials/PBR/pbrMaterial";
3-
import { PBR2Material } from "core/Materials/PBR/pbr2Material";
3+
import { OpenPBRMaterial } from "core/Materials/PBR/openPbrMaterial";
44
import type { Material } from "core/Materials/material";
55

66
import type { IMaterial } from "../glTFLoaderInterfaces";
@@ -75,7 +75,7 @@ export class EXT_materials_diffuse_roughness implements IGLTFLoaderExtension {
7575

7676
// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax
7777
private _loadDiffuseRoughnessPropertiesAsync(context: string, properties: IEXTMaterialsDiffuseRoughness, babylonMaterial: Material): Promise<void> {
78-
if (!(babylonMaterial instanceof PBRMaterial) && !(babylonMaterial instanceof PBR2Material)) {
78+
if (!(babylonMaterial instanceof PBRMaterial) && !(babylonMaterial instanceof OpenPBRMaterial)) {
7979
throw new Error(`${context}: Material type not supported`);
8080
}
8181

packages/dev/loaders/src/glTF/2.0/Extensions/KHR_materials_emissive_strength.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Nullable } from "core/types";
22
import { PBRMaterial } from "core/Materials/PBR/pbrMaterial";
3-
import { PBR2Material } from "core/Materials/PBR/pbr2Material";
3+
import { OpenPBRMaterial } from "core/Materials/PBR/openPbrMaterial";
44
import type { Material } from "core/Materials/material";
55

66
import type { IMaterial } from "../glTFLoaderInterfaces";
@@ -71,7 +71,7 @@ export class KHR_materials_emissive_strength implements IGLTFLoaderExtension {
7171
}
7272

7373
private _loadEmissiveProperties(context: string, properties: IKHRMaterialsEmissiveStrength, babylonMaterial: Material): void {
74-
if (!(babylonMaterial instanceof PBRMaterial) && !(babylonMaterial instanceof PBR2Material)) {
74+
if (!(babylonMaterial instanceof PBRMaterial) && !(babylonMaterial instanceof OpenPBRMaterial)) {
7575
throw new Error(`${context}: Material type not supported`);
7676
}
7777

packages/dev/loaders/src/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Nullable } from "core/types";
22
import { Color3 } from "core/Maths/math.color";
33
import { PBRMaterial } from "core/Materials/PBR/pbrMaterial";
4-
import { PBR2Material } from "core/Materials/PBR/pbr2Material";
4+
import { OpenPBRMaterial } from "core/Materials/PBR/openPbrMaterial";
55
import type { Material } from "core/Materials/material";
66

77
import type { IMaterial } from "../glTFLoaderInterfaces";
@@ -75,7 +75,7 @@ export class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension
7575

7676
// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax
7777
private _loadSpecularGlossinessPropertiesAsync(context: string, properties: IKHRMaterialsPbrSpecularGlossiness, babylonMaterial: Material): Promise<void> {
78-
if (!(babylonMaterial instanceof PBRMaterial) && !(babylonMaterial instanceof PBR2Material)) {
78+
if (!(babylonMaterial instanceof PBRMaterial) && !(babylonMaterial instanceof OpenPBRMaterial)) {
7979
throw new Error(`${context}: Material type not supported`);
8080
}
8181

packages/dev/loaders/src/glTF/2.0/Extensions/KHR_materials_specular.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Nullable } from "core/types";
22
import { PBRMaterial } from "core/Materials/PBR/pbrMaterial";
3-
import { PBR2Material } from "core/Materials/PBR/pbr2Material";
3+
import { OpenPBRMaterial } from "core/Materials/PBR/openPbrMaterial";
44
import type { Material } from "core/Materials/material";
55

66
import type { IMaterial, ITextureInfo } from "../glTFLoaderInterfaces";
@@ -84,7 +84,7 @@ export class KHR_materials_specular implements IGLTFLoaderExtension {
8484

8585
// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax
8686
private _loadSpecularPropertiesAsync(context: string, properties: IKHRMaterialsSpecular, babylonMaterial: Material): Promise<void> {
87-
if (!(babylonMaterial instanceof PBRMaterial) && !(babylonMaterial instanceof PBR2Material)) {
87+
if (!(babylonMaterial instanceof PBRMaterial) && !(babylonMaterial instanceof OpenPBRMaterial)) {
8888
throw new Error(`${context}: Material type not supported`);
8989
}
9090

0 commit comments

Comments
 (0)