@@ -67,7 +67,7 @@ import type { IAnimatable } from "../../Animations/animatable.interface";
67
67
const onCreatedEffectParameters = { effect : null as unknown as Effect , subMesh : null as unknown as Nullable < SubMesh > } ;
68
68
69
69
/**
70
- * Defines a property for the PBR2Material .
70
+ * Defines a property for the OpenPBRMaterial .
71
71
*/
72
72
class Property < T > {
73
73
/**
@@ -110,12 +110,12 @@ class Sampler {
110
110
) { }
111
111
}
112
112
113
- class PBR2MaterialDefinesBase extends UVDefinesMixin ( MaterialDefines ) { }
113
+ class OpenPBRMaterialDefinesBase extends UVDefinesMixin ( MaterialDefines ) { }
114
114
/**
115
115
* Manages the defines for the PBR Material.
116
116
* @internal
117
117
*/
118
- export class PBR2MaterialDefines extends ImageProcessingDefinesMixin ( PBR2MaterialDefinesBase ) {
118
+ export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin ( OpenPBRMaterialDefinesBase ) {
119
119
public PBR = true ;
120
120
121
121
public NUM_SAMPLES = "0" ;
@@ -330,33 +330,32 @@ export class PBR2MaterialDefines extends ImageProcessingDefinesMixin(PBR2Materia
330
330
}
331
331
}
332
332
333
- class PBR2BaseMaterial extends ImageProcessingMixin ( PushMaterial ) { }
334
- // class PBR2MaterialBase extends ImageProcessingMixin(PBRBaseMaterial) {}
333
+ class OpenPBRMaterialBase extends ImageProcessingMixin ( PushMaterial ) { }
335
334
/**
336
335
* The Physically based material of BJS.
337
336
*
338
337
* This offers the main features of a standard PBR material.
339
338
* For more information, please refer to the documentation :
340
339
* https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR
341
340
*/
342
- export class PBR2Material extends PBR2BaseMaterial {
341
+ export class OpenPBRMaterial extends OpenPBRMaterialBase {
343
342
/**
344
- * PBR2MaterialTransparencyMode : No transparency mode, Alpha channel is not use.
343
+ * OpenPBRMaterialTransparencyMode : No transparency mode, Alpha channel is not use.
345
344
*/
346
345
public static readonly PBRMATERIAL_OPAQUE = PBRBaseMaterial . PBRMATERIAL_OPAQUE ;
347
346
348
347
/**
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.
350
349
*/
351
350
public static readonly PBRMATERIAL_ALPHATEST = PBRBaseMaterial . PBRMATERIAL_ALPHATEST ;
352
351
353
352
/**
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.
355
354
*/
356
355
public static readonly PBRMATERIAL_ALPHABLEND = PBRBaseMaterial . PBRMATERIAL_ALPHABLEND ;
357
356
358
357
/**
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.
360
359
* They are also discarded below the alpha cutoff threshold to improve performances.
361
360
*/
362
361
public static readonly PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial . PBRMATERIAL_ALPHATESTANDBLEND ;
@@ -470,7 +469,7 @@ export class PBR2Material extends PBR2BaseMaterial {
470
469
*/
471
470
@serialize ( )
472
471
@expandToProperty ( "_markAllSubMeshesAsTexturesDirty" )
473
- public ambientTextureImpactOnAnalyticalLights : number = PBR2Material . DEFAULT_AO_ON_ANALYTICAL_LIGHTS ;
472
+ public ambientTextureImpactOnAnalyticalLights : number = OpenPBRMaterial . DEFAULT_AO_ON_ANALYTICAL_LIGHTS ;
474
473
475
474
/**
476
475
* Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true.
@@ -1488,7 +1487,7 @@ export class PBR2Material extends PBR2BaseMaterial {
1488
1487
protected _cacheHasRenderTargetTextures = false ;
1489
1488
1490
1489
/**
1491
- * Instantiates a new PBR2Material instance.
1490
+ * Instantiates a new OpenPBRMaterial instance.
1492
1491
*
1493
1492
* @param name The material name
1494
1493
* @param scene The scene the material will be use in.
@@ -1540,7 +1539,7 @@ export class PBR2Material extends PBR2BaseMaterial {
1540
1539
* @returns the name of the material class.
1541
1540
*/
1542
1541
public override getClassName ( ) : string {
1543
- return "PBR2Material " ;
1542
+ return "OpenPBRMaterial " ;
1544
1543
}
1545
1544
1546
1545
/**
@@ -1604,8 +1603,8 @@ export class PBR2Material extends PBR2BaseMaterial {
1604
1603
* @param rootUrl defines the root URL to use to load textures
1605
1604
* @returns cloned material instance
1606
1605
*/
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 } ) ;
1609
1608
1610
1609
clone . id = name ;
1611
1610
clone . name = name ;
@@ -1623,7 +1622,7 @@ export class PBR2Material extends PBR2BaseMaterial {
1623
1622
*/
1624
1623
public override serialize ( ) : any {
1625
1624
const serializationObject = super . serialize ( ) ;
1626
- serializationObject . customType = "BABYLON.PBR2Material " ;
1625
+ serializationObject . customType = "BABYLON.OpenPBRMaterial " ;
1627
1626
1628
1627
return serializationObject ;
1629
1628
}
@@ -1634,10 +1633,10 @@ export class PBR2Material extends PBR2BaseMaterial {
1634
1633
* @param source - Serialized object.
1635
1634
* @param scene - BJS scene instance.
1636
1635
* @param rootUrl - url for the scene object
1637
- * @returns - PBR2Material
1636
+ * @returns - OpenPBRMaterial
1638
1637
*/
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 ) ;
1641
1640
1642
1641
if ( source . stencil ) {
1643
1642
material . stencil . parse ( source . stencil , scene , rootUrl ) ;
@@ -1670,7 +1669,7 @@ export class PBR2Material extends PBR2BaseMaterial {
1670
1669
if ( this . _breakShaderLoadedCheck ) {
1671
1670
return ;
1672
1671
}
1673
- const defines = new PBR2MaterialDefines ( this . _eventInfo . defineNames ) ;
1672
+ const defines = new OpenPBRMaterialDefines ( this . _eventInfo . defineNames ) ;
1674
1673
const effect = this . _prepareEffect ( mesh , defines , undefined , undefined , localOptions . useInstances , localOptions . clipPlane , mesh . hasThinInstances ) ! ;
1675
1674
if ( this . _onEffectCreatedObservable ) {
1676
1675
onCreatedEffectParameters . effect = effect ;
@@ -1714,10 +1713,10 @@ export class PBR2Material extends PBR2BaseMaterial {
1714
1713
1715
1714
if ( ! subMesh . materialDefines ) {
1716
1715
this . _callbackPluginEventGeneric ( MaterialPluginEvent . GetDefineNames , this . _eventInfo ) ;
1717
- subMesh . materialDefines = new PBR2MaterialDefines ( this . _eventInfo . defineNames ) ;
1716
+ subMesh . materialDefines = new OpenPBRMaterialDefines ( this . _eventInfo . defineNames ) ;
1718
1717
}
1719
1718
1720
- const defines = < PBR2MaterialDefines > subMesh . materialDefines ;
1719
+ const defines = < OpenPBRMaterialDefines > subMesh . materialDefines ;
1721
1720
if ( this . _isReadyForSubMesh ( subMesh ) ) {
1722
1721
return true ;
1723
1722
}
@@ -1861,7 +1860,7 @@ export class PBR2Material extends PBR2BaseMaterial {
1861
1860
1862
1861
if ( ! engine . getCaps ( ) . standardDerivatives && ! mesh . isVerticesDataPresent ( VertexBuffer . NormalKind ) ) {
1863
1862
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 ) ;
1865
1864
}
1866
1865
1867
1866
const previousEffect = subMesh . effect ;
@@ -1967,7 +1966,7 @@ export class PBR2Material extends PBR2BaseMaterial {
1967
1966
public override bindForSubMesh ( world : Matrix , mesh : Mesh , subMesh : SubMesh ) : void {
1968
1967
const scene = this . getScene ( ) ;
1969
1968
1970
- const defines = < PBR2MaterialDefines > subMesh . materialDefines ;
1969
+ const defines = < OpenPBRMaterialDefines > subMesh . materialDefines ;
1971
1970
if ( ! defines ) {
1972
1971
return ;
1973
1972
}
@@ -2522,7 +2521,7 @@ export class PBR2Material extends PBR2BaseMaterial {
2522
2521
2523
2522
private _prepareEffect (
2524
2523
mesh : AbstractMesh ,
2525
- defines : PBR2MaterialDefines ,
2524
+ defines : OpenPBRMaterialDefines ,
2526
2525
onCompiled : Nullable < ( effect : Effect ) => void > = null ,
2527
2526
onError : Nullable < ( effect : Effect , errors : string ) => void > = null ,
2528
2527
useInstances : Nullable < boolean > = null ,
@@ -2790,9 +2789,9 @@ export class PBR2Material extends PBR2BaseMaterial {
2790
2789
? undefined
2791
2790
: async ( ) => {
2792
2791
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" ) ] ) ;
2794
2793
} 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" ) ] ) ;
2796
2795
}
2797
2796
2798
2797
this . _shadersLoaded = true ;
@@ -2808,7 +2807,7 @@ export class PBR2Material extends PBR2BaseMaterial {
2808
2807
2809
2808
private _prepareDefines (
2810
2809
mesh : AbstractMesh ,
2811
- defines : PBR2MaterialDefines ,
2810
+ defines : OpenPBRMaterialDefines ,
2812
2811
useInstances : Nullable < boolean > = null ,
2813
2812
useClipPlane : Nullable < boolean > = null ,
2814
2813
useThinInstances : boolean = false
@@ -3088,4 +3087,4 @@ export class PBR2Material extends PBR2BaseMaterial {
3088
3087
}
3089
3088
}
3090
3089
3091
- RegisterClass ( "BABYLON.PBR2Material " , PBR2Material ) ;
3090
+ RegisterClass ( "BABYLON.OpenPBRMaterial " , OpenPBRMaterial ) ;
0 commit comments