Skip to content

Commit 16f3466

Browse files
Mugen87RuthySheffi
authored andcommitted
LDrawLoader: Improve docs. (mrdoob#31153)
1 parent ead7627 commit 16f3466

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

examples/jsm/loaders/LDrawLoader.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,15 +1948,27 @@ class LDrawLoader extends Loader {
19481948

19491949
}
19501950

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+
*/
19511958
setMaterials( materials ) {
19521959

19531960
this.clearMaterials();
1954-
this.addMaterials(materials);
1961+
this.addMaterials( materials );
19551962

19561963
return this;
19571964

19581965
}
19591966

1967+
/**
1968+
* Clears the loader's material library.
1969+
*
1970+
* @return {LDrawLoader} A reference to this loader.
1971+
*/
19601972
clearMaterials() {
19611973

19621974
this.materialLibrary = {};
@@ -1966,6 +1978,12 @@ class LDrawLoader extends Loader {
19661978

19671979
}
19681980

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+
*/
19691987
addMaterials( materials ) {
19701988

19711989
for ( let i = 0, l = materials.length; i < l; i ++ ) {
@@ -1978,6 +1996,11 @@ class LDrawLoader extends Loader {
19781996

19791997
}
19801998

1999+
/**
2000+
* Initializes the loader with default materials.
2001+
*
2002+
* @return {LDrawLoader} A reference to this loader.
2003+
*/
19812004
addDefaultMaterials() {
19822005

19832006
// 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 {
20042027

20052028
}
20062029

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+
*/
20072036
addMaterial( material ) {
20082037

20092038
// 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

Comments
 (0)