Loader →
A loader for the LDraw format.
[LDraw](https://ldraw.org/} (LEGO Draw) is an open format specification from 'three/addons/loaders/LDrawLoader.js';
Constructs a new LDraw loader.
| manager |
The loading manager. |
Initializes the loader with default materials.
Adds a single material to the loader's material library.
| material |
The material to add. |
Adds a list of materials to the loader's material library.
| materials |
The materials to add. |
Clears the loader's material library.
Returns the material for the edges main LDraw color.
null if no material has been found.Returns the Material for the main LDraw color.
For an already loaded LDraw asset, returns the Material associated with the main color code. This method can be useful to modify the main material of a model or part that exposes it.
The main color code is the standard way to color an LDraw part. It is '16' for triangles and '24' for edges. Usually a complete model will not expose the main color (that is, no part uses the code '16' at the top level, because they are assigned other specific colors) An LDraw part file on the other hand will expose the code '16' to be colored, and can have additional fixed colors.
null if no material has been found.Returns a material for the given color code.
| colorCode |
The color code. |
null if no material has been found.Starts loading from the given URL and passes the loaded LDraw asset
to the onLoad() callback.
| url |
The path/URL of the file to be loaded. This can also be a data URI. |
| onLoad |
Executed when the loading process has been finished. |
| onProgress |
Executed while the loading is in progress. |
| onError |
Executed when errors occur. |
Parses the given LDraw data and returns the resulting group.
| text |
The raw VRML data as a string. |
| onLoad |
Executed when the loading/parsing process has been finished. |
| onError |
Executed when errors occur. |
This async method preloads materials from a single LDraw file. In the official parts library there is a special file which is loaded always the first (LDConfig.ldr) and contains all the standard color codes. This method is intended to be used with not packed files, for example in an editor where materials are preloaded and parts are loaded on demand.
| url |
Path of the LDraw materials asset. |
Sets the conditional line material type which depends on the used renderer.
Use LDrawConditionalLineMaterial when using WebGLRenderer and
LDrawConditionalLineNodeMaterial when using WebGPURenderer.
| type |
The conditional line material type. |
Sets a map which maps referenced library filenames to new filenames. If a fileMap is not specified (the default), library parts will be accessed by trial and error in subfolders 'parts', 'p' and 'models'.
| fileMap |
The file map to set. |
Sets the loader's material library. This method clears existing material definitions.
| materials |
The materials to set. |
This method must be called prior to load() unless the model to load does not reference
library parts (usually it will be a model with all its parts packed in a single file).
| path |
Path to library parts files to load referenced parts from. This is different from Loader.setPath, which indicates the path to load the main asset from. |