Bläddra i källkod

WebGLRenderer: added getPhysicalSize()

WestLangley 8 år sedan
förälder
incheckning
902fddb7ce
2 ändrade filer med 13 tillägg och 1 borttagningar
  1. 4 1
      docs/api/renderers/WebGLRenderer.html
  2. 9 0
      src/renderers/WebGLRenderer.js

+ 4 - 1
docs/api/renderers/WebGLRenderer.html

@@ -348,6 +348,9 @@
 		<h3>[method:Number getMaxAnisotropy]()</h3>
 		<div>This returns the anisotropy level of the textures.</div>
 
+		<h3>[method:Object getPhysicalSize]()</h3>
+		<div>Returns an object containing the width and height of the renderer's drawing buffer, in pixels.</div>
+
 		<h3>[method:number getPixelRatio]()</h3>
 		<div>Returns current device pixel ratio used.</div>
 
@@ -355,7 +358,7 @@
 		<div>This gets the precision used by the shaders. It returns "highp","mediump" or "lowp".</div>
 
 		<h3>[method:Object getSize]()</h3>
-		<div>Returns an object containing the width and height of the renderer's output canvas, in pixels.</div>
+		<div>Returns an object containing the logical width and height of the renderer's output canvas, in pixels.</div>
 
 		<h3>[method:null resetGLState]( )</h3>
 		<div>Reset the GL state to default. Called internally if the WebGL context is lost.</div>

+ 9 - 0
src/renderers/WebGLRenderer.js

@@ -415,6 +415,15 @@ function WebGLRenderer( parameters ) {
 
 	};
 
+	this.getPhysicalSize = function () {
+
+		return {
+			width: _canvas.width,
+			height: _canvas.height
+		};
+
+	};
+
 	this.setSize = function ( width, height, updateStyle ) {
 
 		_width = width;