serializeImage function

dynamic serializeImage(
  1. dynamic image
)

Implementation

serializeImage( image ) {

	if ( image is ImageElement ) {

		// default images

		return ImageUtils.getDataURL( image );

	} else {

		if ( image.data != null ) {

			// images of DataTexture

			return {
				"data": image.data.sublist(0),
				"width": image.width,
				"height": image.height,
				"type": image.data.runtimeType.toString()
			};

		} else {

			print( 'THREE.Texture: Unable to serialize Texture.' );
			return {};

		}

	}

}