|
@@ -287,6 +287,7 @@ class PLYLoader extends Loader {
|
|
uvs: [],
|
|
uvs: [],
|
|
faceVertexUvs: [],
|
|
faceVertexUvs: [],
|
|
colors: [],
|
|
colors: [],
|
|
|
|
+ faceVertexColors: []
|
|
};
|
|
};
|
|
|
|
|
|
for ( const customProperty of Object.keys( scope.customPropertyMapping ) ) {
|
|
for ( const customProperty of Object.keys( scope.customPropertyMapping ) ) {
|
|
@@ -407,16 +408,12 @@ class PLYLoader extends Loader {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if ( buffer.colors.length > 0 ) {
|
|
|
|
-
|
|
|
|
- geometry.setAttribute( 'color', new Float32BufferAttribute( buffer.colors, 3 ) );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if ( buffer.faceVertexUvs.length > 0 ) {
|
|
|
|
|
|
+ if ( buffer.faceVertexUvs.length > 0 || buffer.faceVertexColors.length > 0 ) {
|
|
|
|
|
|
geometry = geometry.toNonIndexed();
|
|
geometry = geometry.toNonIndexed();
|
|
- geometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.faceVertexUvs, 2 ) );
|
|
|
|
|
|
+
|
|
|
|
+ if ( buffer.faceVertexUvs.length > 0 ) geometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.faceVertexUvs, 2 ) );
|
|
|
|
+ if ( buffer.faceVertexColors.length > 0 ) geometry.setAttribute( 'color', new Float32BufferAttribute( buffer.faceVertexColors, 3 ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -508,6 +505,21 @@ class PLYLoader extends Loader {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // face colors
|
|
|
|
+
|
|
|
|
+ if ( cacheEntry.attrR !== null && cacheEntry.attrG !== null && cacheEntry.attrB !== null ) {
|
|
|
|
+
|
|
|
|
+ _color.setRGB(
|
|
|
|
+ element[ cacheEntry.attrR ] / 255.0,
|
|
|
|
+ element[ cacheEntry.attrG ] / 255.0,
|
|
|
|
+ element[ cacheEntry.attrB ] / 255.0
|
|
|
|
+ ).convertSRGBToLinear();
|
|
|
|
+ buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
|
|
+ buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
|
|
+ buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|