1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 16:55:22 +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.constructor = THREE.SpriteCanvasMaterial;
THREE.SpriteCanvasMaterial.prototype.clone = function () {
@ -58,12 +59,14 @@ THREE.CanvasRenderer = function ( parameters ) {
_viewportWidth = _canvasWidth,
_viewportHeight = _canvasHeight,
pixelRatio = 1,
_context = _canvas.getContext( '2d', {
alpha: parameters.alpha === true
} ),
_clearColor = new THREE.Color( 0x000000 ),
_clearAlpha = 0,
_clearAlpha = parameters.alpha === true ? 0 : 1,
_contextGlobalAlpha = 1,
_contextGlobalCompositeOperation = 0,
@ -122,12 +125,6 @@ THREE.CanvasRenderer = function ( parameters ) {
this.domElement = _canvas;
this.devicePixelRatio = parameters.devicePixelRatio !== undefined
? parameters.devicePixelRatio
: self.devicePixelRatio !== undefined
? self.devicePixelRatio
: 1;
this.autoClear = true;
this.sortObjects = true;
this.sortElements = true;
@ -148,10 +145,24 @@ THREE.CanvasRenderer = function ( parameters ) {
this.supportsVertexTextures = function () {};
this.setFaceCulling = function () {};
//
this.getPixelRatio = function () {
return pixelRatio;
};
this.setPixelRatio = function ( value ) {
pixelRatio = value;
};
this.setSize = function ( width, height, updateStyle ) {
_canvasWidth = width * this.devicePixelRatio;
_canvasHeight = height * this.devicePixelRatio;
_canvasWidth = width * pixelRatio;
_canvasHeight = height * pixelRatio;
_canvas.width = _canvasWidth;
_canvas.height = _canvasHeight;
@ -186,11 +197,11 @@ THREE.CanvasRenderer = function ( parameters ) {
this.setViewport = function ( x, y, width, height ) {
_viewportX = x * this.devicePixelRatio;
_viewportY = y * this.devicePixelRatio;
_viewportX = x * pixelRatio;
_viewportY = y * pixelRatio;
_viewportWidth = width * this.devicePixelRatio;
_viewportHeight = height * this.devicePixelRatio;
_viewportWidth = width * pixelRatio;
_viewportHeight = height * pixelRatio;
};
@ -240,17 +251,17 @@ THREE.CanvasRenderer = function ( parameters ) {
_clearBox.expandByScalar( 2 );
_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.y = - _clearBox.max.y + _canvasHeightHalf;
_clearBox.max.y = - _clearBox.max.y + _canvasHeightHalf; // lower y value !
if ( _clearAlpha < 1 ) {
_context.clearRect(
_clearBox.min.x | 0,
_clearBox.min.y | 0,
_clearBox.max.y | 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(
_clearBox.min.x | 0,
_clearBox.min.y | 0,
_clearBox.max.y | 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.mapping instanceof THREE.UVMapping ) {
var mapping = material.map.mapping;
if ( mapping === THREE.UVMapping ) {
_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 );
@ -713,7 +726,7 @@ THREE.CanvasRenderer = function ( parameters ) {
} 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 );
_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 );
} 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 {
_color.copy( material.color );