@@ -1948,15 +1948,27 @@ class LDrawLoader extends Loader {
1948
1948
1949
1949
}
1950
1950
1951
+ /**
1952
+ * Sets the loader's material library. This method clears existing
1953
+ * material definitions.
1954
+ *
1955
+ * @param {Array<Material> } materials - The materials to set.
1956
+ * @return {LDrawLoader } A reference to this loader.
1957
+ */
1951
1958
setMaterials ( materials ) {
1952
1959
1953
1960
this . clearMaterials ( ) ;
1954
- this . addMaterials ( materials ) ;
1961
+ this . addMaterials ( materials ) ;
1955
1962
1956
1963
return this ;
1957
1964
1958
1965
}
1959
1966
1967
+ /**
1968
+ * Clears the loader's material library.
1969
+ *
1970
+ * @return {LDrawLoader } A reference to this loader.
1971
+ */
1960
1972
clearMaterials ( ) {
1961
1973
1962
1974
this . materialLibrary = { } ;
@@ -1966,6 +1978,12 @@ class LDrawLoader extends Loader {
1966
1978
1967
1979
}
1968
1980
1981
+ /**
1982
+ * Adds a list of materials to the loader's material library.
1983
+ *
1984
+ * @param {Array<Material> } materials - The materials to add.
1985
+ * @return {LDrawLoader } A reference to this loader.
1986
+ */
1969
1987
addMaterials ( materials ) {
1970
1988
1971
1989
for ( let i = 0 , l = materials . length ; i < l ; i ++ ) {
@@ -1978,6 +1996,11 @@ class LDrawLoader extends Loader {
1978
1996
1979
1997
}
1980
1998
1999
+ /**
2000
+ * Initializes the loader with default materials.
2001
+ *
2002
+ * @return {LDrawLoader } A reference to this loader.
2003
+ */
1981
2004
addDefaultMaterials ( ) {
1982
2005
1983
2006
// Add default main triangle and line edge materials (used in pieces that can be colored with a main color)
@@ -2004,6 +2027,12 @@ class LDrawLoader extends Loader {
2004
2027
2005
2028
}
2006
2029
2030
+ /**
2031
+ * Adds a single material to the loader's material library.
2032
+ *
2033
+ * @param {Material } material - The material to add.
2034
+ * @return {LDrawLoader } A reference to this loader.
2035
+ */
2007
2036
addMaterial ( material ) {
2008
2037
2009
2038
// Adds a material to the material library which is on top of the parse scopes stack. And also to the materials array
0 commit comments