1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-25 17:25:16 +03:00

Bump three library to r70.

This commit is contained in:
Dominic Clifton 2015-10-02 21:35:16 +01:00
parent aa5fe105c4
commit 70903b7639
3 changed files with 505 additions and 510 deletions

View file

@ -16,6 +16,7 @@ THREE.SpriteCanvasMaterial = function ( parameters ) {
}; };
THREE.SpriteCanvasMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.SpriteCanvasMaterial.prototype = Object.create( THREE.Material.prototype );
THREE.SpriteCanvasMaterial.prototype.constructor = THREE.SpriteCanvasMaterial;
THREE.SpriteCanvasMaterial.prototype.clone = function () { THREE.SpriteCanvasMaterial.prototype.clone = function () {
@ -58,12 +59,14 @@ THREE.CanvasRenderer = function ( parameters ) {
_viewportWidth = _canvasWidth, _viewportWidth = _canvasWidth,
_viewportHeight = _canvasHeight, _viewportHeight = _canvasHeight,
pixelRatio = 1,
_context = _canvas.getContext( '2d', { _context = _canvas.getContext( '2d', {
alpha: parameters.alpha === true alpha: parameters.alpha === true
} ), } ),
_clearColor = new THREE.Color( 0x000000 ), _clearColor = new THREE.Color( 0x000000 ),
_clearAlpha = 0, _clearAlpha = parameters.alpha === true ? 0 : 1,
_contextGlobalAlpha = 1, _contextGlobalAlpha = 1,
_contextGlobalCompositeOperation = 0, _contextGlobalCompositeOperation = 0,
@ -122,12 +125,6 @@ THREE.CanvasRenderer = function ( parameters ) {
this.domElement = _canvas; this.domElement = _canvas;
this.devicePixelRatio = parameters.devicePixelRatio !== undefined
? parameters.devicePixelRatio
: self.devicePixelRatio !== undefined
? self.devicePixelRatio
: 1;
this.autoClear = true; this.autoClear = true;
this.sortObjects = true; this.sortObjects = true;
this.sortElements = true; this.sortElements = true;
@ -148,10 +145,24 @@ THREE.CanvasRenderer = function ( parameters ) {
this.supportsVertexTextures = function () {}; this.supportsVertexTextures = function () {};
this.setFaceCulling = function () {}; this.setFaceCulling = function () {};
//
this.getPixelRatio = function () {
return pixelRatio;
};
this.setPixelRatio = function ( value ) {
pixelRatio = value;
};
this.setSize = function ( width, height, updateStyle ) { this.setSize = function ( width, height, updateStyle ) {
_canvasWidth = width * this.devicePixelRatio; _canvasWidth = width * pixelRatio;
_canvasHeight = height * this.devicePixelRatio; _canvasHeight = height * pixelRatio;
_canvas.width = _canvasWidth; _canvas.width = _canvasWidth;
_canvas.height = _canvasHeight; _canvas.height = _canvasHeight;
@ -186,11 +197,11 @@ THREE.CanvasRenderer = function ( parameters ) {
this.setViewport = function ( x, y, width, height ) { this.setViewport = function ( x, y, width, height ) {
_viewportX = x * this.devicePixelRatio; _viewportX = x * pixelRatio;
_viewportY = y * this.devicePixelRatio; _viewportY = y * pixelRatio;
_viewportWidth = width * this.devicePixelRatio; _viewportWidth = width * pixelRatio;
_viewportHeight = height * this.devicePixelRatio; _viewportHeight = height * pixelRatio;
}; };
@ -240,17 +251,17 @@ THREE.CanvasRenderer = function ( parameters ) {
_clearBox.expandByScalar( 2 ); _clearBox.expandByScalar( 2 );
_clearBox.min.x = _clearBox.min.x + _canvasWidthHalf; _clearBox.min.x = _clearBox.min.x + _canvasWidthHalf;
_clearBox.min.y = - _clearBox.min.y + _canvasHeightHalf; _clearBox.min.y = - _clearBox.min.y + _canvasHeightHalf; // higher y value !
_clearBox.max.x = _clearBox.max.x + _canvasWidthHalf; _clearBox.max.x = _clearBox.max.x + _canvasWidthHalf;
_clearBox.max.y = - _clearBox.max.y + _canvasHeightHalf; _clearBox.max.y = - _clearBox.max.y + _canvasHeightHalf; // lower y value !
if ( _clearAlpha < 1 ) { if ( _clearAlpha < 1 ) {
_context.clearRect( _context.clearRect(
_clearBox.min.x | 0, _clearBox.min.x | 0,
_clearBox.min.y | 0, _clearBox.max.y | 0,
( _clearBox.max.x - _clearBox.min.x ) | 0, ( _clearBox.max.x - _clearBox.min.x ) | 0,
( _clearBox.max.y - _clearBox.min.y ) | 0 ( _clearBox.min.y - _clearBox.max.y ) | 0
); );
} }
@ -264,9 +275,9 @@ THREE.CanvasRenderer = function ( parameters ) {
_context.fillRect( _context.fillRect(
_clearBox.min.x | 0, _clearBox.min.x | 0,
_clearBox.min.y | 0, _clearBox.max.y | 0,
( _clearBox.max.x - _clearBox.min.x ) | 0, ( _clearBox.max.x - _clearBox.min.x ) | 0,
( _clearBox.max.y - _clearBox.min.y ) | 0 ( _clearBox.min.y - _clearBox.max.y ) | 0
); );
} }
@ -704,7 +715,9 @@ THREE.CanvasRenderer = function ( parameters ) {
if ( material.map !== null ) { if ( material.map !== null ) {
if ( material.map.mapping instanceof THREE.UVMapping ) { var mapping = material.map.mapping;
if ( mapping === THREE.UVMapping ) {
_uvs = element.uvs; _uvs = element.uvs;
patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uvs[ uv1 ].x, _uvs[ uv1 ].y, _uvs[ uv2 ].x, _uvs[ uv2 ].y, _uvs[ uv3 ].x, _uvs[ uv3 ].y, material.map ); patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uvs[ uv1 ].x, _uvs[ uv1 ].y, _uvs[ uv2 ].x, _uvs[ uv2 ].y, _uvs[ uv3 ].x, _uvs[ uv3 ].y, material.map );
@ -713,7 +726,7 @@ THREE.CanvasRenderer = function ( parameters ) {
} else if ( material.envMap !== null ) { } else if ( material.envMap !== null ) {
if ( material.envMap.mapping instanceof THREE.SphericalReflectionMapping ) { if ( material.envMap.mapping === THREE.SphericalReflectionMapping ) {
_normal.copy( element.vertexNormalsModel[ uv1 ] ).applyMatrix3( _normalViewMatrix ); _normal.copy( element.vertexNormalsModel[ uv1 ] ).applyMatrix3( _normalViewMatrix );
_uv1x = 0.5 * _normal.x + 0.5; _uv1x = 0.5 * _normal.x + 0.5;
@ -729,25 +742,8 @@ THREE.CanvasRenderer = function ( parameters ) {
patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap ); patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap );
} else if ( material.envMap.mapping instanceof THREE.SphericalRefractionMapping ) {
_normal.copy( element.vertexNormalsModel[ uv1 ] ).applyMatrix3( _normalViewMatrix );
_uv1x = - 0.5 * _normal.x + 0.5;
_uv1y = - 0.5 * _normal.y + 0.5;
_normal.copy( element.vertexNormalsModel[ uv2 ] ).applyMatrix3( _normalViewMatrix );
_uv2x = - 0.5 * _normal.x + 0.5;
_uv2y = - 0.5 * _normal.y + 0.5;
_normal.copy( element.vertexNormalsModel[ uv3 ] ).applyMatrix3( _normalViewMatrix );
_uv3x = - 0.5 * _normal.x + 0.5;
_uv3y = - 0.5 * _normal.y + 0.5;
patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap );
} }
} else { } else {
_color.copy( material.color ); _color.copy( material.color );

View file

@ -126,7 +126,7 @@ THREE.Projector = function () {
_clippedVertex1PositionScreen = new THREE.Vector4(), _clippedVertex1PositionScreen = new THREE.Vector4(),
_clippedVertex2PositionScreen = new THREE.Vector4(); _clippedVertex2PositionScreen = new THREE.Vector4();
// //
this.projectVector = function ( vector, camera ) { this.projectVector = function ( vector, camera ) {
@ -145,10 +145,10 @@ THREE.Projector = function () {
this.pickingRay = function ( vector, camera ) { this.pickingRay = function ( vector, camera ) {
console.error( 'THREE.Projector: .pickingRay() has been removed.' ); console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
}; };
// //
var RenderList = function () { var RenderList = function () {
@ -352,17 +352,9 @@ THREE.Projector = function () {
_object.id = object.id; _object.id = object.id;
_object.object = object; _object.object = object;
if ( object.renderDepth !== null ) { _vector3.setFromMatrixPosition( object.matrixWorld );
_vector3.applyProjection( _viewProjectionMatrix );
_object.z = object.renderDepth; _object.z = _vector3.z;
} else {
_vector3.setFromMatrixPosition( object.matrixWorld );
_vector3.applyProjection( _viewProjectionMatrix );
_object.z = _vector3.z;
}
_renderData.objects.push( _object ); _renderData.objects.push( _object );

File diff suppressed because one or more lines are too long