react-three-renderer
Advanced tools
Comparing version 0.0.18-alpha to 0.0.19-alpha
@@ -69,4 +69,8 @@ 'use strict'; | ||
type: _ReactPropTypes2.default.oneOfType([(0, _propTypeInstanceOf2.default)(_three2.default.Color), _ReactPropTypes2.default.number, _ReactPropTypes2.default.string]), | ||
default: 0 | ||
default: 0x000000 | ||
}, | ||
clearAlpha: { | ||
type: _ReactPropTypes2.default.number, | ||
default: undefined | ||
}, | ||
shadowMapEnabled: { | ||
@@ -73,0 +77,0 @@ type: _ReactPropTypes2.default.bool, |
@@ -168,4 +168,23 @@ 'use strict'; | ||
if (parameters.hasOwnProperty('clearColor')) { | ||
renderer.setClearColor(parameters.clearColor); | ||
var hasClearColor = parameters.hasOwnProperty('clearColor'); | ||
var hasClearAlpha = parameters.hasOwnProperty('clearAlpha'); | ||
if (hasClearColor || hasClearAlpha) { | ||
var clearColor = undefined; | ||
if (hasClearColor) { | ||
clearColor = parameters.clearColor; | ||
} else { | ||
clearColor = new _three2.default.Color(0x000000); // default clear color | ||
} | ||
if (hasClearAlpha) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
(0, _warning2.default)(parameters.alpha === true, 'The `clearAlpha` property' + ' requires the `alpha` property to be `true`.'); | ||
} | ||
renderer.setClearColor(clearColor, parameters.clearAlpha); | ||
} else { | ||
renderer.setClearColor(clearColor); | ||
} | ||
} | ||
@@ -632,5 +651,38 @@ | ||
this._renderer.setClearColor(clearColor); | ||
if (this._parameters.hasOwnProperty('clearAlpha')) { | ||
this._renderer.setClearColor(clearColor, this._parameters.clearAlpha); | ||
} else { | ||
this._renderer.setClearColor(clearColor); | ||
} | ||
} | ||
}, { | ||
key: 'updateClearAlpha', | ||
value: function updateClearAlpha(clearAlpha) { | ||
var parameters = this._parameters; | ||
if (clearAlpha === undefined) { | ||
delete parameters.clearAlpha; | ||
} else { | ||
parameters.clearAlpha = clearAlpha; | ||
} | ||
if (!this._renderer) { | ||
return; | ||
} | ||
var clearColor = undefined; | ||
if (parameters.hasOwnProperty('clearColor')) { | ||
clearColor = parameters.clearColor; | ||
} else { | ||
clearColor = new _three2.default.Color(0x000000); // default clear color | ||
} | ||
if (clearAlpha !== undefined) { | ||
this._renderer.setClearColor(clearColor, clearAlpha); | ||
} else { | ||
this._renderer.setClearColor(clearColor); | ||
} | ||
} | ||
}, { | ||
key: 'refreshRenderer', | ||
@@ -646,2 +698,7 @@ value: function refreshRenderer() { | ||
this.userData.events.removeListener('animate', this._callOnAnimate); | ||
this.userData.events.removeAllListeners(); | ||
cancelAnimationFrame(this._renderRequest); | ||
if (contextLossExtension && this._canvas) { | ||
@@ -648,0 +705,0 @@ this._canvas.addEventListener('webglcontextlost', function () { |
{ | ||
"name": "react-three-renderer", | ||
"version": "0.0.18-alpha", | ||
"version": "0.0.19-alpha", | ||
"description": "Render into a three.js canvas using React.", | ||
@@ -9,3 +9,3 @@ "main": "./lib/React3.js", | ||
"prepublish": "not-in-install && npm run compile || in-install", | ||
"test": "eslint ./src/**/*.js && cd ./tests && npm test", | ||
"test": "eslint ./src/ && eslint ./docs/src/ && cd ./tests && npm test", | ||
"tdd": "cd ./tests && npm run tdd" | ||
@@ -12,0 +12,0 @@ }, |
@@ -47,4 +47,8 @@ import React3DInstance from '../React3Instance'; | ||
]), | ||
default: 0, | ||
default: 0x000000, | ||
}, | ||
clearAlpha: { | ||
type: PropTypes.number, | ||
default: undefined, | ||
}, | ||
shadowMapEnabled: { | ||
@@ -93,3 +97,3 @@ type: PropTypes.bool, | ||
'mediump', | ||
'lowp' | ||
'lowp', | ||
]), | ||
@@ -100,7 +104,7 @@ default: 'highp', | ||
type: PropTypes.bool, | ||
default: false | ||
default: false, | ||
}, | ||
premultipliedAlpha: { | ||
type: PropTypes.bool, | ||
default: true | ||
default: true, | ||
}, | ||
@@ -116,16 +120,16 @@ antialias: { | ||
type: PropTypes.bool, | ||
default: true | ||
default: true, | ||
}, | ||
preserveDrawingBuffer: { | ||
type: PropTypes.bool, | ||
default: false | ||
default: false, | ||
}, | ||
depth: { | ||
type: PropTypes.bool, | ||
default: true | ||
default: true, | ||
}, | ||
logarithmicDepthBuffer: { | ||
type: PropTypes.bool, | ||
default: false | ||
} | ||
default: false, | ||
}, | ||
}; | ||
@@ -132,0 +136,0 @@ |
@@ -24,3 +24,3 @@ import THREE from 'three'; | ||
onRecreateCanvas, | ||
} = props; | ||
} = props; | ||
@@ -129,4 +129,24 @@ this._parameters = { ...props }; | ||
if (parameters.hasOwnProperty('clearColor')) { | ||
renderer.setClearColor(parameters.clearColor); | ||
const hasClearColor = parameters.hasOwnProperty('clearColor'); | ||
const hasClearAlpha = parameters.hasOwnProperty('clearAlpha'); | ||
if (hasClearColor || hasClearAlpha) { | ||
let clearColor; | ||
if (hasClearColor) { | ||
clearColor = parameters.clearColor; | ||
} else { | ||
clearColor = new THREE.Color(0x000000); // default clear color | ||
} | ||
if (hasClearAlpha) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
warning(parameters.alpha === true, 'The `clearAlpha` property' + | ||
' requires the `alpha` property to be `true`.'); | ||
} | ||
renderer.setClearColor(clearColor, parameters.clearAlpha); | ||
} else { | ||
renderer.setClearColor(clearColor); | ||
} | ||
} | ||
@@ -652,5 +672,37 @@ | ||
this._renderer.setClearColor(clearColor); | ||
if (this._parameters.hasOwnProperty('clearAlpha')) { | ||
this._renderer.setClearColor(clearColor, this._parameters.clearAlpha); | ||
} else { | ||
this._renderer.setClearColor(clearColor); | ||
} | ||
} | ||
updateClearAlpha(clearAlpha) { | ||
const parameters = this._parameters; | ||
if (clearAlpha === undefined) { | ||
delete parameters.clearAlpha; | ||
} else { | ||
parameters.clearAlpha = clearAlpha; | ||
} | ||
if (!this._renderer) { | ||
return; | ||
} | ||
let clearColor; | ||
if (parameters.hasOwnProperty('clearColor')) { | ||
clearColor = parameters.clearColor; | ||
} else { | ||
clearColor = new THREE.Color(0x000000); // default clear color | ||
} | ||
if (clearAlpha !== undefined) { | ||
this._renderer.setClearColor(clearColor, clearAlpha); | ||
} else { | ||
this._renderer.setClearColor(clearColor); | ||
} | ||
} | ||
refreshRenderer() { | ||
@@ -663,2 +715,7 @@ this.disposeResourcesAndRenderer(); | ||
this.userData.events.removeListener('animate', this._callOnAnimate); | ||
this.userData.events.removeAllListeners(); | ||
cancelAnimationFrame(this._renderRequest); | ||
if (contextLossExtension && this._canvas) { | ||
@@ -665,0 +722,0 @@ this._canvas.addEventListener('webglcontextlost', () => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
775383
15706
162