|
@@ -13352,12 +13352,6 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
_canvasWidth, _canvasHeight, _canvasWidthHalf, _canvasHeightHalf,
|
|
|
_context = _canvas.getContext( '2d' ),
|
|
|
|
|
|
- _devicePixelRatio = parameters.devicePixelRatio !== undefined
|
|
|
- ? parameters.devicePixelRatio
|
|
|
- : window.devicePixelRatio !== undefined
|
|
|
- ? window.devicePixelRatio
|
|
|
- : 1,
|
|
|
-
|
|
|
_clearColor = new THREE.Color( 0x000000 ),
|
|
|
_clearOpacity = 0,
|
|
|
|
|
@@ -13428,6 +13422,12 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
this.domElement = _canvas;
|
|
|
|
|
|
+ this.devicePixelRatio = parameters.devicePixelRatio !== undefined
|
|
|
+ ? parameters.devicePixelRatio
|
|
|
+ : window.devicePixelRatio !== undefined
|
|
|
+ ? window.devicePixelRatio
|
|
|
+ : 1;
|
|
|
+
|
|
|
this.autoClear = true;
|
|
|
this.sortObjects = true;
|
|
|
this.sortElements = true;
|
|
@@ -13445,8 +13445,8 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
this.setSize = function ( width, height ) {
|
|
|
|
|
|
- _canvasWidth = width * _devicePixelRatio;
|
|
|
- _canvasHeight = height * _devicePixelRatio;
|
|
|
+ _canvasWidth = width * this.devicePixelRatio;
|
|
|
+ _canvasHeight = height * this.devicePixelRatio;
|
|
|
|
|
|
_canvasWidthHalf = Math.floor( _canvasWidth / 2 );
|
|
|
_canvasHeightHalf = Math.floor( _canvasHeight / 2 );
|
|
@@ -17123,11 +17123,6 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
|
|
|
_stencil = parameters.stencil !== undefined ? parameters.stencil : true,
|
|
|
_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,
|
|
|
- _devicePixelRatio = parameters.devicePixelRatio !== undefined
|
|
|
- ? parameters.devicePixelRatio
|
|
|
- : window.devicePixelRatio !== undefined
|
|
|
- ? window.devicePixelRatio
|
|
|
- : 1,
|
|
|
|
|
|
_clearColor = parameters.clearColor !== undefined ? new THREE.Color( parameters.clearColor ) : new THREE.Color( 0x000000 ),
|
|
|
_clearAlpha = parameters.clearAlpha !== undefined ? parameters.clearAlpha : 0;
|
|
@@ -17136,6 +17131,11 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
this.domElement = _canvas;
|
|
|
this.context = null;
|
|
|
+ this.devicePixelRatio = parameters.devicePixelRatio !== undefined
|
|
|
+ ? parameters.devicePixelRatio
|
|
|
+ : window.devicePixelRatio !== undefined
|
|
|
+ ? window.devicePixelRatio
|
|
|
+ : 1;
|
|
|
|
|
|
// clearing
|
|
|
|
|
@@ -17374,8 +17374,8 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
this.setSize = function ( width, height ) {
|
|
|
|
|
|
- _canvas.width = width * _devicePixelRatio;
|
|
|
- _canvas.height = height * _devicePixelRatio;
|
|
|
+ _canvas.width = width * this.devicePixelRatio;
|
|
|
+ _canvas.height = height * this.devicePixelRatio;
|
|
|
|
|
|
_canvas.style.width = width + 'px';
|
|
|
_canvas.style.height = height + 'px';
|
|
@@ -35893,22 +35893,28 @@ THREE.SpritePlugin = function ( ) {
|
|
|
|
|
|
_gl.uniform1f( uniforms.alphaTest, material.alphaTest );
|
|
|
|
|
|
- if ( material.useScreenCoordinates ) {
|
|
|
+ if ( material.useScreenCoordinates === true ) {
|
|
|
|
|
|
_gl.uniform1i( uniforms.useScreenCoordinates, 1 );
|
|
|
_gl.uniform3f(
|
|
|
uniforms.screenPosition,
|
|
|
- ( sprite.position.x - halfViewportWidth ) / halfViewportWidth,
|
|
|
- ( halfViewportHeight - sprite.position.y ) / halfViewportHeight,
|
|
|
+ ( ( sprite.position.x * _renderer.devicePixelRatio ) - halfViewportWidth ) / halfViewportWidth,
|
|
|
+ ( halfViewportHeight - ( sprite.position.y * _renderer.devicePixelRatio ) ) / halfViewportHeight,
|
|
|
Math.max( 0, Math.min( 1, sprite.position.z ) )
|
|
|
);
|
|
|
|
|
|
+ scale[ 0 ] = _renderer.devicePixelRatio;
|
|
|
+ scale[ 1 ] = _renderer.devicePixelRatio;
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
_gl.uniform1i( uniforms.useScreenCoordinates, 0 );
|
|
|
_gl.uniform1i( uniforms.sizeAttenuation, material.sizeAttenuation ? 1 : 0 );
|
|
|
_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, sprite._modelViewMatrix.elements );
|
|
|
|
|
|
+ scale[ 0 ] = 1;
|
|
|
+ scale[ 1 ] = 1;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if ( scene.fog && material.fog ) {
|
|
@@ -35930,8 +35936,8 @@ THREE.SpritePlugin = function ( ) {
|
|
|
|
|
|
size = 1 / ( material.scaleByViewport ? viewportHeight : 1 );
|
|
|
|
|
|
- scale[ 0 ] = size * invAspect * sprite.scale.x;
|
|
|
- scale[ 1 ] = size * sprite.scale.y;
|
|
|
+ scale[ 0 ] *= size * invAspect * sprite.scale.x
|
|
|
+ scale[ 1 ] *= size * sprite.scale.y;
|
|
|
|
|
|
_gl.uniform2f( uniforms.uvScale, material.uvScale.x, material.uvScale.y );
|
|
|
_gl.uniform2f( uniforms.uvOffset, material.uvOffset.x, material.uvOffset.y );
|
|
@@ -35996,7 +36002,8 @@ THREE.SpritePlugin = function ( ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
-};/**
|
|
|
+};
|
|
|
+/**
|
|
|
* @author alteredq / http://alteredqualia.com/
|
|
|
*/
|
|
|
|