<!-- SOLIDIVISM · part 183 -->
x;
				akx = aoy; aky = aox; bkx = boy; bky = box; ckx = coy; cky = cox;

			}

		}

		// a zero direction has no maximal axis and cannot intersect

		if ( dkz === 0 ) return null;

		// shear constants that align the ray with the +kz axis

		const sx = dkx / dkz, sy = dky / dkz, sz = 1 / dkz;

		// sheared and scaled vertices

		const ax = akx - sx * akz, ay = aky - sy * akz;
		const bx = bkx - sx * bkz, by = bky - sy * bkz;
		const cx = ckx - sx * ckz, cy = cky - sy * ckz;

		// scaled barycentric coordinates (signed edge functions); the shear makes a
		// shared edge evaluate identically for both adjacent triangles, so the ray
		// can never fall between them

		const u = cx * by - cy * bx;
		const v = ax * cy - ay * cx;
		const w = bx * ay - by * ax;

		if ( backfaceCulling ) {

			if ( u < 0 || v < 0 || w < 0 ) return null;

		} else {

			if ( ( u < 0 || v < 0 || w < 0 ) && ( u > 0 || v > 0 || w > 0 ) ) return null;

		}

		const det = u + v + w;

		// ray is co-planar with the triangle

		if ( det === 0 ) return null;

		// scaled hit distance; t = tScaled / det must lie in front of the origin

		const tScaled = sz * ( u * akz + v * bkz + w * ckz );

		if ( det > 0 ? tScaled < 0 : tScaled > 0 ) return null;

		return this.at( tScaled / det, target );

	}

	/**
	 * Transforms this ray with the given 4x4 transformation matrix.
	 *
	 * @param {Matrix4} matrix4 - The transformation matrix.
	 * @return {Ray} A reference to this ray.
	 */
	applyMatrix4( matrix4 ) {

		this.origin.applyMatrix4( matrix4 );
		this.direction.transformDirection( matrix4 );

		return this;

	}

	/**
	 * Returns `true` if this ray is equal with the given one.
	 *
	 * @param {Ray} ray - The ray to test for equality.
	 * @return {boolean} Whether this ray is equal with the given one.
	 */
	equals( ray ) {

		return ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );

	}

	/**
	 * Returns a new ray with copied values from this instance.
	 *
	 * @return {Ray} A clone of this instance.
	 */
	clone() {

		return new this.constructor().copy( this );

	}

}

/**
 * A material for drawing geometries in a simple shaded (flat or wireframe) way.
 *
 * This material is not affected by lights.
 *
 * @augments Material
 * @demo scenes/material-browser.html#MeshBasicMaterial
 */
class MeshBasicMaterial extends Material {

	/**
	 * Constructs a new mesh basic material.
	 *
	 * @param {Object} [parameters] - An object with one or more properties
	 * defining the material's appearance. Any property of the material
	 * (including any property from inherited materials) can be passed
	 * in here. Color values can be passed any type of value accepted
	 * by {@link Color#set}.
	 */
	constructor( parameters ) {

		super();

		/**
		 * This flag can be used for type testing.
		 *
		 * @type {boolean}
		 * @readonly
		 * @default true
		 */
		this.isMeshBasicMaterial = true;

		this.type = 'MeshBasicMaterial';

		/**
		 * Color of the material.
		 *
		 * @type {Color}
		 * @default (1,1,1)
		 */
		this.color = new Color( 0xffffff ); // diffuse

		/**
		 * The color map. May optionally include an alpha channel, typically combined
		 * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
		 * color is modulated by the diffuse `color`.
		 *
		 * `map` represents color data, and the texture must be assigned a
		 * {@link Texture#colorSpace}. Most `map` textures set
		 * `texture.colorSpace = SRGBColorSpace`.
		 *
		 * @type {?Texture}
		 * @default null
		 */
		this.map = null;

		/**
		 * The light map. Requires a second set of UVs.
		 *
		 * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
		 * a {@link Texture#colorSpace}. Most `lightMap` textures set
		 * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
		 * such as `.exr` or `.hdr`.
		 *
		 * @type {?Texture}
		 * @default null
		 */
		this.lightMap = null;

		/**
		 * Intensity of the baked light.
		 *
		 * @type {number}
		 * @default 1
		 */
		this.lightMapIntensity = 1.0;

		/**
		 * The red channel of this texture is used as the ambient occlusion map.
		 * Requires a second set of UVs.
		 *
		 * `aoMap` represents non-color data. Any texture assigned must have
		 * `texture.colorSpace = NoColorSpace` (default).
		 *
		 * @type {?Texture}
		 * @default null
		 */
		this.aoMap = null;

		/**
		 * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`
		 * disables ambient occlusion. Where intensity is `1` and the AO map's
		 * red channel is also `1`, ambient light is fully occluded on a surface.
		 *
		 * @type {number}
		 * @default 1
		 */
		this.aoMapIntensity = 1.0;

		/**
		 * Specular map used by the material.
		 *
		 * `specularMap` represents color data, and the texture must be assigned a
		 * {@link Texture#colorSpace}. Most `specularMap` textures set
		 * `texture.colorSpace = SRGBColorSpace`.
		 *
		 * @type {?Texture}
		 * @default nul