Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 92 additions & 92 deletions build/three.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -13185,13 +13185,15 @@ class Object3D extends EventDispatcher {
object.uuid = this.uuid;
object.type = this.type;

if ( this.name !== '' ) object.name = this.name;
if ( this.castShadow === true ) object.castShadow = true;
if ( this.receiveShadow === true ) object.receiveShadow = true;
if ( this.visible === false ) object.visible = false;
if ( this.frustumCulled === false ) object.frustumCulled = false;
if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;
if ( this.static !== false ) object.static = this.static;
object.name = this.name;
object.castShadow = this.castShadow;
object.receiveShadow = this.receiveShadow;
object.visible = this.visible;
object.frustumCulled = this.frustumCulled;
object.renderOrder = this.renderOrder;
object.static = this.static;
object.matrixAutoUpdate = this.matrixAutoUpdate;

if ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;

object.layers = this.layers.mask;
Expand All @@ -13200,8 +13202,6 @@ class Object3D extends EventDispatcher {

if ( this.pivot !== null ) object.pivot = this.pivot.toArray();

if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;

if ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );
if ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();

Expand Down Expand Up @@ -15331,11 +15331,11 @@ class Scene extends Object3D {

if ( this.fog !== null ) data.object.fog = this.fog.toJSON();

if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
data.object.backgroundBlurriness = this.backgroundBlurriness;
data.object.backgroundIntensity = this.backgroundIntensity;
data.object.backgroundRotation = this.backgroundRotation.toArray();

if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
data.object.environmentIntensity = this.environmentIntensity;
data.object.environmentRotation = this.environmentRotation.toArray();

return data;
Expand Down Expand Up @@ -17560,9 +17560,9 @@ class BufferAttribute extends EventDispatcher {
normalized: this.normalized
};

if ( this.name !== '' ) data.name = this.name;
if ( this.usage !== StaticDrawUsage ) data.usage = this.usage;
if ( this.gpuType !== FloatType ) data.gpuType = this.gpuType;
data.name = this.name;
data.usage = this.usage;
data.gpuType = this.gpuType;

return data;

Expand Down Expand Up @@ -19578,7 +19578,7 @@ class BufferGeometry extends EventDispatcher {

data.uuid = this.uuid;
data.type = ( this.parameters !== undefined && this._transformed === true ) ? 'BufferGeometry' : this.type;
if ( this.name !== '' ) data.name = this.name;
data.name = this.name;
if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;

if ( this.parameters !== undefined && this._transformed !== true ) {
Expand Down Expand Up @@ -20097,7 +20097,7 @@ class InterleavedBuffer {
stride: this.stride
};

if ( this.usage !== StaticDrawUsage ) json.usage = this.usage;
json.usage = this.usage;

return json;

Expand Down Expand Up @@ -21663,10 +21663,61 @@ class Material extends EventDispatcher {
};

// standard Material serialization

data.uuid = this.uuid;
data.type = this.type;

if ( this.name !== '' ) data.name = this.name;
data.blending = this.blending;
data.side = this.side;
data.shadowSide = this.shadowSide;
data.vertexColors = this.vertexColors;

data.opacity = this.opacity;
data.transparent = this.transparent;

data.blendSrc = this.blendSrc;
data.blendDst = this.blendDst;
data.blendEquation = this.blendEquation;
data.blendSrcAlpha = this.blendSrcAlpha;
data.blendDstAlpha = this.blendDstAlpha;
data.blendEquationAlpha = this.blendEquationAlpha;
data.blendColor = this.blendColor.getHex();
data.blendAlpha = this.blendAlpha;

data.depthFunc = this.depthFunc;
data.depthTest = this.depthTest;
data.depthWrite = this.depthWrite;
data.colorWrite = this.colorWrite;

data.clipIntersection = this.clipIntersection;
data.clipShadows = this.clipShadows;

data.stencilWriteMask = this.stencilWriteMask;
data.stencilFunc = this.stencilFunc;
data.stencilRef = this.stencilRef;
data.stencilFuncMask = this.stencilFuncMask;
data.stencilFail = this.stencilFail;
data.stencilZFail = this.stencilZFail;
data.stencilZPass = this.stencilZPass;
data.stencilWrite = this.stencilWrite;

data.polygonOffset = this.polygonOffset;
data.polygonOffsetFactor = this.polygonOffsetFactor;
data.polygonOffsetUnits = this.polygonOffsetUnits;

data.dithering = this.dithering;

data.alphaTest = this.alphaTest;
data.alphaHash = this.alphaHash;
data.alphaToCoverage = this.alphaToCoverage;
data.premultipliedAlpha = this.premultipliedAlpha;
data.forceSinglePass = this.forceSinglePass;
data.allowOverride = this.allowOverride;

data.visible = this.visible;
data.toneMapped = this.toneMapped;

data.name = this.name;

if ( this.color && this.color.isColor ) data.color = this.color.getHex();

Expand All @@ -21677,7 +21728,7 @@ class Material extends EventDispatcher {
if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
if ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
if ( this.emissiveIntensity !== undefined ) data.emissiveIntensity = this.emissiveIntensity;

if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
Expand Down Expand Up @@ -21817,90 +21868,39 @@ class Material extends EventDispatcher {
if ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;
if ( this.thickness !== undefined ) data.thickness = this.thickness;
if ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;
if ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;
if ( this.attenuationDistance !== undefined ) data.attenuationDistance = this.attenuationDistance;
if ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();

if ( this.size !== undefined ) data.size = this.size;
if ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;
if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;

if ( this.blending !== NormalBlending ) data.blending = this.blending;
if ( this.side !== FrontSide ) data.side = this.side;
if ( this.vertexColors === true ) data.vertexColors = true;

if ( this.opacity < 1 ) data.opacity = this.opacity;
if ( this.transparent === true ) data.transparent = true;

if ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;
if ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;
if ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;
if ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;
if ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;
if ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;
if ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();
if ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;

if ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;
if ( this.depthTest === false ) data.depthTest = this.depthTest;
if ( this.depthWrite === false ) data.depthWrite = this.depthWrite;
if ( this.colorWrite === false ) data.colorWrite = this.colorWrite;

if ( Array.isArray( this.clippingPlanes ) && this.clippingPlanes.length > 0 ) {

data.clippingPlanes = this.clippingPlanes.map( plane => plane.toJSON() );

}

if ( this.clipIntersection === true ) data.clipIntersection = true;
if ( this.clipShadows === true ) data.clipShadows = true;

if ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;
if ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;
if ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;
if ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;
if ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;
if ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;
if ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;
if ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;

// rotation (SpriteMaterial)
if ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;
if ( this.rotation !== undefined ) data.rotation = this.rotation;

// depthPacking (MeshDepthMaterial)
if ( this.depthPacking !== undefined && this.depthPacking !== BasicDepthPacking ) data.depthPacking = this.depthPacking;
if ( this.depthPacking !== undefined ) data.depthPacking = this.depthPacking;

if ( this.polygonOffset === true ) data.polygonOffset = true;
if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;

if ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;
if ( this.linecap !== undefined && this.linecap !== 'round' ) data.linecap = this.linecap;
if ( this.linejoin !== undefined && this.linejoin !== 'round' ) data.linejoin = this.linejoin;
if ( this.linewidth !== undefined ) data.linewidth = this.linewidth;
if ( this.linecap !== undefined ) data.linecap = this.linecap;
if ( this.linejoin !== undefined ) data.linejoin = this.linejoin;
if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
if ( this.scale !== undefined ) data.scale = this.scale;

if ( this.dithering === true ) data.dithering = true;

if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
if ( this.alphaHash === true ) data.alphaHash = true;
if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
if ( this.forceSinglePass === true ) data.forceSinglePass = true;
if ( this.allowOverride === false ) data.allowOverride = false;

if ( this.wireframe === true ) data.wireframe = true;
if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;

if ( this.flatShading === true ) data.flatShading = true;

if ( this.visible === false ) data.visible = false;
if ( this.wireframe !== undefined ) data.wireframe = this.wireframe;
if ( this.wireframeLinewidth !== undefined ) data.wireframeLinewidth = this.wireframeLinewidth;
if ( this.wireframeLinecap !== undefined ) data.wireframeLinecap = this.wireframeLinecap;
if ( this.wireframeLinejoin !== undefined ) data.wireframeLinejoin = this.wireframeLinejoin;

if ( this.toneMapped === false ) data.toneMapped = false;
if ( this.flatShading !== undefined ) data.flatShading = this.flatShading;

if ( this.fog === false ) data.fog = false;
if ( this.fog !== undefined ) data.fog = this.fog;

if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;

Expand Down Expand Up @@ -22950,7 +22950,7 @@ class LOD extends Object3D {

const data = super.toJSON( meta );

if ( this.autoUpdate === false ) data.object.autoUpdate = false;
data.object.autoUpdate = this.autoUpdate;

data.object.levels = [];

Expand Down Expand Up @@ -29655,7 +29655,7 @@ class DepthTexture extends Texture {

const data = super.toJSON( meta );

if ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;
data.compareFunction = this.compareFunction;

return data;

Expand Down Expand Up @@ -46447,12 +46447,12 @@ class LightShadow {

const object = {};

if ( this.intensity !== 1 ) object.intensity = this.intensity;
if ( this.bias !== 0 ) object.bias = this.bias;
if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
if ( this.radius !== 1 ) object.radius = this.radius;
if ( this.blurSamples !== 8 ) object.blurSamples = this.blurSamples;
if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();
object.intensity = this.intensity;
object.bias = this.bias;
object.normalBias = this.normalBias;
object.radius = this.radius;
object.blurSamples = this.blurSamples;
object.mapSize = this.mapSize.toArray();

object.camera = this.camera.toJSON( false ).object;
delete object.camera.matrix;
Expand Down Expand Up @@ -47101,8 +47101,8 @@ class SpotLightShadow extends LightShadow {

const object = super.toJSON();

if ( this.focus !== 1 ) object.focus = this.focus;
if ( this.aspect !== 1 ) object.aspect = this.aspect;
object.focus = this.focus;
object.aspect = this.aspect;

return object;

Expand Down
32 changes: 26 additions & 6 deletions build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -2351,8 +2351,8 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {

const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );

if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
textureType !== FloatType && ! halfFloatSupportedByExt ) {
if ( textureType !== UnsignedByteType && textureType !== FloatType && ! halfFloatSupportedByExt &&
utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) ) { // Edge and Chrome Mac < 52 (#9513)

return false;

Expand Down Expand Up @@ -19000,6 +19000,23 @@ class WebGLRenderer {

};

function getReadableState( texture ) {

const textureProperties = properties.get( texture );

if ( textureProperties.__readFormat !== texture.format || textureProperties.__readType !== texture.type ) {

textureProperties.__readFormat = texture.format;
textureProperties.__readType = texture.type;
textureProperties.__formatReadable = capabilities.textureFormatReadable( texture.format );
textureProperties.__typeReadable = capabilities.textureTypeReadable( texture.type );

}

return textureProperties;

}

/**
* Reads the pixel data from the given render target into the given buffer.
*
Expand Down Expand Up @@ -19043,14 +19060,16 @@ class WebGLRenderer {

if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );

if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
const readableState = getReadableState( texture );

if ( readableState.__formatReadable === false ) {

error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
return;

}

if ( ! capabilities.textureTypeReadable( textureType ) ) {
if ( readableState.__typeReadable === false ) {

error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
return;
Expand Down Expand Up @@ -19125,14 +19144,15 @@ class WebGLRenderer {

if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );

const readableState = getReadableState( texture );

if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
if ( readableState.__formatReadable === false ) {

throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );

}

if ( ! capabilities.textureTypeReadable( textureType ) ) {
if ( readableState.__typeReadable === false ) {

throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );

Expand Down
Loading
Loading