Capítulo 198 de 859

Chapter 198: PLYLoader

Core Idea

A loader for PLY the PLY format (known as the Polygon File Format or the Stanford Triangle Format).

Limitations:

  • ASCII decoding assumes file is UTF-8.

Code Examples

const loader = new PLYLoader();
const geometry = await loader.loadAsync( './models/ply/ascii/dolphins.ply' );
scene.add( new THREE.Mesh( geometry ) );
  • What it demonstrates: Typical usage of PLYLoader.

Reference Tables

Constructor

Signature
new PLYLoader( manager : LoadingManager )

Methods

MethodDescription
.load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback )Starts loading from the given URL and passes the loaded PLY asset to the onLoad() callback.
.parse( data : ArrayBuffer ) : BufferGeometryParses the given PLY data and returns the resulting geometry.
.setCustomPropertyNameMapping( mapping : Object )Custom properties outside of the defaults for position, uv, normal and color attributes can be added using the setCustomPropertyNameMapping method. For example, the following maps the element propert…
.setPropertyNameMapping( mapping : Object )Sets a property name mapping that maps default property names to custom ones. For example, the following maps the properties “diffuse_(red|green|blue)” in the file to standard color names.

Key Takeaways

  1. PLYLoader extends: Loader
  2. Key methods: load, parse, setCustomPropertyNameMapping, setPropertyNameMapping.

Connects To