소스 검색

Vector2: Added width/height getters/setters. Seems simpler than creating Size2.

Mr.doob 9 년 전
부모
커밋
3e12ab145d
3개의 변경된 파일13개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 4
      src/lights/Light.js
  2. 8 0
      src/math/Vector2.js
  3. 1 1
      src/renderers/webgl/WebGLShadowMap.js

+ 4 - 4
src/lights/Light.js

@@ -116,18 +116,18 @@ Object.defineProperties( THREE.Light.prototype, {
 	},
 	shadowMapWidth: {
 		get: function () {
-			return this.shadow.mapSize.x;
+			return this.shadow.mapSize.width;
 		},
 		set: function ( value ) {
-			this.shadow.mapSize.x = value;
+			this.shadow.mapSize.width = value;
 		}
 	},
 	shadowMapHeight: {
 		get: function () {
-			return this.shadow.mapSize.y;
+			return this.shadow.mapSize.height;
 		},
 		set: function ( value ) {
-			this.shadow.mapSize.y = value;
+			this.shadow.mapSize.height = value;
 		}
 	},
 	shadowMatrix: {

+ 8 - 0
src/math/Vector2.js

@@ -16,6 +16,14 @@ THREE.Vector2.prototype = {
 
 	constructor: THREE.Vector2,
 
+	get width() { return this.x },
+	set width( value ) { this.x = value },
+
+	get height() { return this.y },
+	set height( value ) { this.y = value },
+
+	//
+
 	set: function ( x, y ) {
 
 		this.x = x;

+ 1 - 1
src/renderers/webgl/WebGLShadowMap.js

@@ -174,7 +174,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 				var pars = { minFilter: shadowFilter, magFilter: shadowFilter, format: THREE.RGBAFormat };
 
-				light.shadowMap = new THREE.WebGLRenderTarget( light.shadow.mapSize.x, light.shadow.mapSize.y, pars );
+				light.shadowMap = new THREE.WebGLRenderTarget( light.shadow.mapSize.width, light.shadow.mapSize.height, pars );
 
 				light.shadowMatrix = new THREE.Matrix4();