File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
packages/dev/core/src/Materials Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 1+ import type { Nullable } from "core/types" ;
12import { DecalMapConfiguration } from "../material.decalMapConfiguration" ;
23import { PBRBaseMaterial } from "./pbrBaseMaterial" ;
34
45declare module "./pbrBaseMaterial" {
56 export interface PBRBaseMaterial {
67 /** @internal */
7- _decalMap : DecalMapConfiguration ;
8+ _decalMap : Nullable < DecalMapConfiguration > ;
89
910 /**
1011 * Defines the decal map parameters for the material.
1112 */
12- decalMap : DecalMapConfiguration ;
13+ decalMap : Nullable < DecalMapConfiguration > ;
1314 }
1415}
1516
1617Object . defineProperty ( PBRBaseMaterial . prototype , "decalMap" , {
1718 get : function ( this : PBRBaseMaterial ) {
1819 if ( ! this . _decalMap ) {
20+ if ( this . _uniformBufferLayoutBuilt ) {
21+ // Material already used to display a mesh, so it's invalid to add the decal map plugin at that point
22+ // Returns null instead of having new DecalMapConfiguration throws an exception
23+ return null ;
24+ }
25+
1926 this . _decalMap = new DecalMapConfiguration ( this ) ;
2027 }
2128 return this . _decalMap ;
Original file line number Diff line number Diff line change 1+ import type { Nullable } from "core/types" ;
12import { DecalMapConfiguration } from "./material.decalMapConfiguration" ;
23import { StandardMaterial } from "./standardMaterial" ;
34
45declare module "./standardMaterial" {
56 export interface StandardMaterial {
67 /** @internal */
7- _decalMap : DecalMapConfiguration ;
8+ _decalMap : Nullable < DecalMapConfiguration > ;
89
910 /**
1011 * Defines the decal map parameters for the material.
1112 */
12- decalMap : DecalMapConfiguration ;
13+ decalMap : Nullable < DecalMapConfiguration > ;
1314 }
1415}
1516
1617Object . defineProperty ( StandardMaterial . prototype , "decalMap" , {
1718 get : function ( this : StandardMaterial ) {
1819 if ( ! this . _decalMap ) {
20+ if ( this . _uniformBufferLayoutBuilt ) {
21+ // Material already used to display a mesh, so it's invalid to add the decal map plugin at that point
22+ // Returns null instead of having new DecalMapConfiguration throws an exception
23+ return null ;
24+ }
25+
1926 this . _decalMap = new DecalMapConfiguration ( this ) ;
2027 }
2128 return this . _decalMap ;
You can’t perform that action at this time.
0 commit comments