mirror of
				https://github.com/MapMakersAndProgrammers/alternativa3d-archive.git
				synced 2025-10-30 17:05:17 -07:00 
			
		
		
		
	Remove .svn folders
This commit is contained in:
		| @@ -1,53 +0,0 @@ | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 101 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials | ||||
| END | ||||
| DevMaterial.as | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 116 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials/DevMaterial.as | ||||
| END | ||||
| Material.as | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 113 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials/Material.as | ||||
| END | ||||
| TextureMaterial.as | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 120 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials/TextureMaterial.as | ||||
| END | ||||
| FillMaterial.as | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 117 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials/FillMaterial.as | ||||
| END | ||||
| WireMaterial.as | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 117 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials/WireMaterial.as | ||||
| END | ||||
| DrawPoint.as | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 114 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials/DrawPoint.as | ||||
| END | ||||
| SurfaceMaterial.as | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 120 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials/SurfaceMaterial.as | ||||
| END | ||||
| TextureMaterialPrecision.as | ||||
| K 25 | ||||
| svn:wc:ra_dav:version-url | ||||
| V 129 | ||||
| /!svn/ver/497/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials/TextureMaterialPrecision.as | ||||
| END | ||||
| @@ -1,124 +0,0 @@ | ||||
| 8 | ||||
|  | ||||
| dir | ||||
| 46043 | ||||
| http://svndev.alternativaplatform.com/platform/clients/fp10/libraries/Alternativa3D/tags/5.4.1/alternativa/engine3d/materials | ||||
| http://svndev.alternativaplatform.com | ||||
|  | ||||
|  | ||||
|  | ||||
| 2008-09-08T06:50:26.103978Z | ||||
| 468 | ||||
| mike | ||||
|  | ||||
|  | ||||
| svn:special svn:externals svn:needs-lock | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| d9e2387a-1f3e-40e2-b57f-9df5970a2fa5 | ||||
|  | ||||
| DevMaterial.as | ||||
| file | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 2010-10-28T04:31:16.000000Z | ||||
| 2c90564cfd20a00c9038a43690374794 | ||||
| 2008-08-25T13:44:47.077292Z | ||||
| 176 | ||||
| int | ||||
|  | ||||
| Material.as | ||||
| file | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 2010-10-28T04:31:16.000000Z | ||||
| 227c5a7229790ccabc0237cf44a202fc | ||||
| 2008-08-25T13:44:47.077292Z | ||||
| 176 | ||||
| int | ||||
|  | ||||
| TextureMaterial.as | ||||
| file | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 2010-10-28T04:31:16.000000Z | ||||
| 9b48ec3656ca2db5ff3e5cb5744363fb | ||||
| 2008-09-08T06:50:26.103978Z | ||||
| 468 | ||||
| mike | ||||
|  | ||||
| FillMaterial.as | ||||
| file | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 2010-10-28T04:31:16.000000Z | ||||
| e33f75e92d1bd21a114dd5a4293dc0f3 | ||||
| 2008-09-08T06:50:26.103978Z | ||||
| 468 | ||||
| mike | ||||
|  | ||||
| WireMaterial.as | ||||
| file | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 2010-10-28T04:31:16.000000Z | ||||
| 49716fd06e5cb181e0886a7d63f1cd0f | ||||
| 2008-09-08T06:50:26.103978Z | ||||
| 468 | ||||
| mike | ||||
|  | ||||
| DrawPoint.as | ||||
| file | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 2010-10-28T04:31:16.000000Z | ||||
| f110bd43b42437479c009f63140fd20a | ||||
| 2008-09-08T06:50:26.103978Z | ||||
| 468 | ||||
| mike | ||||
|  | ||||
| SurfaceMaterial.as | ||||
| file | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 2010-10-28T04:31:16.000000Z | ||||
| def3c3e365f98998e0c5ba0f10c3c5cf | ||||
| 2008-09-08T06:50:26.103978Z | ||||
| 468 | ||||
| mike | ||||
|  | ||||
| TextureMaterialPrecision.as | ||||
| file | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 2010-10-28T04:31:16.000000Z | ||||
| c0cfbffad39af9bef6a7441a8bca7ddb | ||||
| 2008-09-08T06:50:26.103978Z | ||||
| 468 | ||||
| mike | ||||
|  | ||||
| @@ -1 +0,0 @@ | ||||
| 8 | ||||
| @@ -1,198 +0,0 @@ | ||||
| package alternativa.engine3d.materials { | ||||
| 	import alternativa.engine3d.*; | ||||
| 	import alternativa.engine3d.core.Camera3D; | ||||
| 	import alternativa.engine3d.display.Skin; | ||||
| 	 | ||||
| 	import flash.display.BlendMode; | ||||
| 	import flash.display.Graphics; | ||||
| 	import alternativa.utils.ColorUtils; | ||||
| 	import alternativa.engine3d.core.PolyPrimitive; | ||||
| 	import alternativa.engine3d.core.BSPNode; | ||||
| 	 | ||||
| 	use namespace alternativa3d; | ||||
| 	 | ||||
| 	/** | ||||
| 	 * @private | ||||
| 	 * Материал, заполняющий грань сплошной заливкой цветом в соответствии с уровнем мобильности. Помимо заливки материал может рисовать границу | ||||
| 	 * полигона линией заданной толщины и цвета. | ||||
| 	 */	 | ||||
| 	public class DevMaterial extends SurfaceMaterial { | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Цвет | ||||
| 		 */ | ||||
| 		alternativa3d var _color:uint; | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Толщина линий обводки  | ||||
| 		 */ | ||||
| 		alternativa3d var _wireThickness:Number; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Цвет линий обводки  | ||||
| 		 */ | ||||
| 		alternativa3d var _wireColor:uint; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Создание экземпляра класса. | ||||
| 		 *  | ||||
| 		 * @param color цвет заливки | ||||
| 		 * @param alpha прозрачность | ||||
| 		 * @param blendMode режим наложения цвета | ||||
| 		 * @param wireThickness толщина линии обводки | ||||
| 		 * @param wireColor цвет линии обводки | ||||
| 		 */		 | ||||
| 		public function DevMaterial(color:uint = 0xFFFFFF, alpha:Number = 1, blendMode:String = BlendMode.NORMAL, wireThickness:Number = -1, wireColor:uint = 0) { | ||||
| 			super(alpha, blendMode); | ||||
| 			_color = color; | ||||
| 			_wireThickness = wireThickness; | ||||
| 			_wireColor = wireColor; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 *  | ||||
| 		 * @param camera | ||||
| 		 * @param skin | ||||
| 		 * @param length | ||||
| 		 * @param points | ||||
| 		 */		 | ||||
| 		override alternativa3d function draw(camera:Camera3D, skin:Skin, length:uint, points:Array):void { | ||||
| 			skin.alpha = _alpha; | ||||
| 			skin.blendMode = _blendMode; | ||||
|  | ||||
| 			var i:uint; | ||||
| 			var point:DrawPoint; | ||||
| 			var gfx:Graphics = skin.gfx; | ||||
| 			 | ||||
| 			/* | ||||
| 			//Мобильность | ||||
| 			var param:int = skin.primitive.mobility*10; | ||||
| 			*/ | ||||
| 			 | ||||
| 			/* | ||||
| 			// Уровень распиленности | ||||
| 			var param:int = 0; | ||||
| 			var prm:PolyPrimitive = skin.primitive; | ||||
| 			while (prm != null) { | ||||
| 				prm = prm.parent; | ||||
| 				param++; | ||||
| 			} | ||||
| 			param *= 10; | ||||
| 			*/ | ||||
|  | ||||
| 			// Уровень в BSP-дереве | ||||
| 			var param:int = 0; | ||||
| 			var node:BSPNode = skin.primitive.node; | ||||
| 			while (node != null) { | ||||
| 				node = node.parent; | ||||
| 				param++; | ||||
| 			} | ||||
| 			param *= 5; | ||||
| 			 | ||||
| 			var c:uint = ColorUtils.rgb(param, param, param); | ||||
| 			 | ||||
| 			if (camera._orthographic) { | ||||
| 				gfx.beginFill(c); | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					gfx.lineStyle(_wireThickness, _wireColor); | ||||
| 				} | ||||
| 				point = points[0]; | ||||
| 				gfx.moveTo(point.x, point.y); | ||||
| 				for (i = 1; i < length; i++) { | ||||
| 					point = points[i]; | ||||
| 					gfx.lineTo(point.x, point.y); | ||||
| 				} | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					point = points[0]; | ||||
| 					gfx.lineTo(point.x, point.y); | ||||
| 				} | ||||
| 			} else { | ||||
| 				gfx.beginFill(c); | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					gfx.lineStyle(_wireThickness, _wireColor); | ||||
| 				} | ||||
| 				point = points[0]; | ||||
| 				var perspective:Number = camera.focalLength/point.z; | ||||
| 				gfx.moveTo(point.x*perspective, point.y*perspective); | ||||
| 				for (i = 1; i < length; i++) { | ||||
| 					point = points[i]; | ||||
| 					perspective = camera.focalLength/point.z; | ||||
| 					gfx.lineTo(point.x*perspective, point.y*perspective); | ||||
| 				} | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					point = points[0]; | ||||
| 					perspective = camera.focalLength/point.z; | ||||
| 					gfx.lineTo(point.x*perspective, point.y*perspective); | ||||
| 				} | ||||
| 			}			 | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Цвет заливки. | ||||
| 		 */ | ||||
| 		public function get color():uint { | ||||
| 			return _color; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */ | ||||
| 		public function set color(value:uint):void { | ||||
| 			if (_color != value) { | ||||
| 				_color = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Толщина линии обводки. Если значение отрицательное, то отрисовка линии не выполняется. | ||||
| 		 */ | ||||
| 		public function get wireThickness():Number { | ||||
| 			return _wireThickness; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set wireThickness(value:Number):void { | ||||
| 			if (_wireThickness != value) { | ||||
| 				_wireThickness = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Цвет линии обводки. | ||||
| 		 */ | ||||
| 		public function get wireColor():uint { | ||||
| 			return _wireColor; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set wireColor(value:uint):void { | ||||
| 			if (_wireColor != value) { | ||||
| 				_wireColor = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @inheritDoc | ||||
| 		 */		 | ||||
| 		override public function clone():Material { | ||||
| 			var res:DevMaterial = new DevMaterial(_color, _alpha, _blendMode, _wireThickness, _wireColor);  | ||||
| 			return res; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -1,45 +0,0 @@ | ||||
| package alternativa.engine3d.materials { | ||||
| 	/** | ||||
| 	 * @private | ||||
| 	 * Точка, подготовленная к отрисовке. | ||||
| 	 */ | ||||
| 	public final class DrawPoint { | ||||
| 		/** | ||||
| 		 * Координата X в системе координат камеры. | ||||
| 		 */ | ||||
| 		public var x:Number; | ||||
| 		/** | ||||
| 		 * Координата Y в системе координат камеры. | ||||
| 		 */ | ||||
| 		public var y:Number; | ||||
| 		/** | ||||
| 		 * Координата Z в системе координат камеры. | ||||
| 		 */ | ||||
| 		public var z:Number; | ||||
| 		/** | ||||
| 		 * Координата U в текстурном пространстве. | ||||
| 		 */ | ||||
| 		public var u:Number; | ||||
| 		/** | ||||
| 		 * Координата V в текстурном пространстве. | ||||
| 		 */ | ||||
| 		public var v:Number; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Создаёт новый экземпляр класса. | ||||
| 		 *  | ||||
| 		 * @param x координата X в системе координат камеры | ||||
| 		 * @param y координата Y в системе координат камеры | ||||
| 		 * @param z координата Z в системе координат камеры | ||||
| 		 * @param u координата U в текстурном пространстве | ||||
| 		 * @param v координата V в текстурном пространстве | ||||
| 		 */ | ||||
| 		public function DrawPoint(x:Number, y:Number, z:Number, u:Number = 0, v:Number = 0) { | ||||
| 			this.x = x; | ||||
| 			this.y = y; | ||||
| 			this.z = z; | ||||
| 			this.u = u; | ||||
| 			this.v = v; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -1,163 +0,0 @@ | ||||
| package alternativa.engine3d.materials { | ||||
| 	import alternativa.engine3d.*; | ||||
| 	import alternativa.engine3d.core.Camera3D; | ||||
| 	import alternativa.engine3d.display.Skin; | ||||
| 	 | ||||
| 	import flash.display.BlendMode; | ||||
| 	import flash.display.Graphics; | ||||
| 	 | ||||
| 	use namespace alternativa3d; | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Материал, заполняющий грань сплошной одноцветной заливкой. Помимо заливки цветом, материал может рисовать границу | ||||
| 	 * грани линией заданной толщины и цвета. | ||||
| 	 */	 | ||||
| 	public class FillMaterial extends SurfaceMaterial { | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Цвет | ||||
| 		 */ | ||||
| 		alternativa3d var _color:uint; | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Толщина линий обводки  | ||||
| 		 */ | ||||
| 		alternativa3d var _wireThickness:Number; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Цвет линий обводки  | ||||
| 		 */ | ||||
| 		alternativa3d var _wireColor:uint; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Создание экземпляра класса. | ||||
| 		 *  | ||||
| 		 * @param color цвет заливки | ||||
| 		 * @param alpha коэффициент непрозрачности материала. Значение 1 соответствует полной непрозрачности, значение 0 соответствует полной прозрачности. | ||||
| 		 * @param blendMode режим наложения цвета | ||||
| 		 * @param wireThickness толщина линии обводки | ||||
| 		 * @param wireColor цвет линии обводки | ||||
| 		 */		 | ||||
| 		public function FillMaterial(color:uint, alpha:Number = 1, blendMode:String = BlendMode.NORMAL, wireThickness:Number = -1, wireColor:uint = 0) { | ||||
| 			super(alpha, blendMode); | ||||
| 			_color = color; | ||||
| 			_wireThickness = wireThickness; | ||||
| 			_wireColor = wireColor; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * @inheritDoc | ||||
| 		 */		 | ||||
| 		override alternativa3d function draw(camera:Camera3D, skin:Skin, length:uint, points:Array):void { | ||||
| 			skin.alpha = _alpha; | ||||
| 			skin.blendMode = _blendMode; | ||||
|  | ||||
| 			var i:uint; | ||||
| 			var point:DrawPoint; | ||||
| 			var gfx:Graphics = skin.gfx; | ||||
| 			 | ||||
| 			if (camera._orthographic) { | ||||
| 				gfx.beginFill(_color); | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					gfx.lineStyle(_wireThickness, _wireColor); | ||||
| 				} | ||||
| 				point = points[0]; | ||||
| 				gfx.moveTo(point.x, point.y); | ||||
| 				for (i = 1; i < length; i++) { | ||||
| 					point = points[i]; | ||||
| 					gfx.lineTo(point.x, point.y); | ||||
| 				} | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					point = points[0]; | ||||
| 					gfx.lineTo(point.x, point.y); | ||||
| 				} | ||||
| 			} else { | ||||
| 				gfx.beginFill(_color); | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					gfx.lineStyle(_wireThickness, _wireColor); | ||||
| 				} | ||||
| 				point = points[0]; | ||||
| 				var perspective:Number = camera.focalLength/point.z; | ||||
| 				gfx.moveTo(point.x*perspective, point.y*perspective); | ||||
| 				for (i = 1; i < length; i++) { | ||||
| 					point = points[i]; | ||||
| 					perspective = camera.focalLength/point.z; | ||||
| 					gfx.lineTo(point.x*perspective, point.y*perspective); | ||||
| 				} | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					point = points[0]; | ||||
| 					perspective = camera.focalLength/point.z; | ||||
| 					gfx.lineTo(point.x*perspective, point.y*perspective); | ||||
| 				} | ||||
| 			}			 | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Цвет заливки. | ||||
| 		 */ | ||||
| 		public function get color():uint { | ||||
| 			return _color; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */ | ||||
| 		public function set color(value:uint):void { | ||||
| 			if (_color != value) { | ||||
| 				_color = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Толщина линии обводки. Если значение отрицательное, то обводка не рисуется. | ||||
| 		 */ | ||||
| 		public function get wireThickness():Number { | ||||
| 			return _wireThickness; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set wireThickness(value:Number):void { | ||||
| 			if (_wireThickness != value) { | ||||
| 				_wireThickness = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Цвет линии обводки. | ||||
| 		 */ | ||||
| 		public function get wireColor():uint { | ||||
| 			return _wireColor; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set wireColor(value:uint):void { | ||||
| 			if (_wireColor != value) { | ||||
| 				_wireColor = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @inheritDoc | ||||
| 		 */		 | ||||
| 		override public function clone():Material { | ||||
| 			var res:FillMaterial = new FillMaterial(_color, _alpha, _blendMode, _wireThickness, _wireColor);  | ||||
| 			return res; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -1,20 +0,0 @@ | ||||
| package alternativa.engine3d.materials { | ||||
| 	import alternativa.engine3d.*; | ||||
|  | ||||
| 	use namespace alternativa3d; | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Базовый класс для материалов. | ||||
| 	 */	 | ||||
| 	public class Material { | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Создание клона материала. | ||||
| 		 *  | ||||
| 		 * @return клон материала | ||||
| 		 */ | ||||
| 		public function clone():Material { | ||||
| 			return new Material(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -1,197 +0,0 @@ | ||||
| package alternativa.engine3d.materials { | ||||
| 	import alternativa.engine3d.*; | ||||
| 	import alternativa.engine3d.core.Camera3D; | ||||
| 	import alternativa.engine3d.core.Mesh; | ||||
| 	import alternativa.engine3d.core.PolyPrimitive; | ||||
| 	import alternativa.engine3d.core.Scene3D; | ||||
| 	import alternativa.engine3d.core.Surface; | ||||
| 	import alternativa.engine3d.display.Skin; | ||||
| 	 | ||||
| 	import flash.display.BlendMode; | ||||
| 	 | ||||
| 	use namespace alternativa3d; | ||||
|  | ||||
| 	/** | ||||
| 	 * Базовый класс для материалов полигональных поверхностей. | ||||
| 	 */	 | ||||
| 	public class SurfaceMaterial extends Material { | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Поверхность | ||||
| 		 */ | ||||
| 		alternativa3d var _surface:Surface; | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Альфа | ||||
| 		 */ | ||||
| 		alternativa3d var _alpha:Number; | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Режим наложения цвета | ||||
| 		 */ | ||||
| 		alternativa3d var _blendMode:String = BlendMode.NORMAL; | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Материал использует информация об UV-координатах | ||||
| 		 */ | ||||
| 		alternativa3d var useUV:Boolean = false; | ||||
|  | ||||
| 		/** | ||||
| 		 * Создание экземпляра класса. | ||||
| 		 *  | ||||
| 		 * @param alpha коэффициент непрозрачности материала. Значение 1 соответствует полной непрозрачности, значение 0 соответствует полной прозрачности. | ||||
| 		 * @param blendMode режим наложения цвета | ||||
| 		 */ | ||||
| 		public function SurfaceMaterial(alpha:Number = 1, blendMode:String = BlendMode.NORMAL) { | ||||
| 			_alpha = alpha; | ||||
| 			_blendMode = blendMode; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Поверхность, которой назначен материал. | ||||
| 		 */ | ||||
| 		public function get surface():Surface { | ||||
| 			return _surface; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Добавление на сцену | ||||
| 		 *  | ||||
| 		 * @param scene | ||||
| 		 */		 | ||||
| 		alternativa3d function addToScene(scene:Scene3D):void {} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Удаление из сцены | ||||
| 		 *  | ||||
| 		 * @param scene | ||||
| 		 */ | ||||
| 		alternativa3d function removeFromScene(scene:Scene3D):void {} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Добавление к мешу | ||||
| 		 *  | ||||
| 		 * @param mesh | ||||
| 		 */ | ||||
| 		alternativa3d function addToMesh(mesh:Mesh):void {} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Удаление из меша | ||||
| 		 *  | ||||
| 		 * @param mesh | ||||
| 		 */ | ||||
| 		alternativa3d function removeFromMesh(mesh:Mesh):void {} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Добавление на поверхность | ||||
| 		 *  | ||||
| 		 * @param surface | ||||
| 		 */ | ||||
| 		alternativa3d function addToSurface(surface:Surface):void { | ||||
| 			// Сохраняем поверхность | ||||
| 			_surface = surface; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Удаление с поверхности | ||||
| 		 *  | ||||
| 		 * @param surface | ||||
| 		 */ | ||||
| 		alternativa3d function removeFromSurface(surface:Surface):void { | ||||
| 			// Удаляем ссылку на поверхность | ||||
| 			_surface = null; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Коэффициент непрозрачности материала. Значение 1 соответствует полной непрозрачности, значение 0 соответствует полной прозрачности. | ||||
| 		 */		 | ||||
| 		public function get alpha():Number { | ||||
| 			return _alpha; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set alpha(value:Number):void { | ||||
| 			if (_alpha != value) { | ||||
| 				_alpha = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Режим наложения цвета. | ||||
| 		 */		 | ||||
| 		public function get blendMode():String { | ||||
| 			return _blendMode; | ||||
| 		} | ||||
| 				 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set blendMode(value:String):void { | ||||
| 			if (_blendMode != value) { | ||||
| 				_blendMode = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Метод определяет, может ли материал нарисовать указанный примитив. Метод используется в системе отрисовки сцены и должен использоваться | ||||
| 		 * наследниками для указания видимости связанной с материалом поверхности или отдельного примитива. Реализация по умолчанию возвращает | ||||
| 		 * <code>true</code>. | ||||
| 		 *  | ||||
| 		 * @param primitive примитив для проверки | ||||
| 		 *  | ||||
| 		 * @return <code>true</code>, если материал может отрисовать указанный примитив, иначе <code>false</code> | ||||
| 		 */		 | ||||
| 		alternativa3d function canDraw(primitive:PolyPrimitive):Boolean { | ||||
| 			return true; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Метод очищает переданный скин (нарисованную графику, дочерние объекты и т.д.). | ||||
| 		 *  | ||||
| 		 * @param skin скин для очистки | ||||
| 		 */ | ||||
| 		alternativa3d function clear(skin:Skin):void { | ||||
| 			skin.gfx.clear(); | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Метод выполняет отрисовку в заданный скин. | ||||
| 		 *  | ||||
| 		 * @param camera камера, вызвавшая метод | ||||
| 		 * @param skin скин, в котором нужно рисовать | ||||
| 		 * @param length длина массива points | ||||
| 		 * @param points массив точек, определяющих отрисовываемый полигон. Каждый элемент массива является объектом класса | ||||
| 		 *   <code>alternativa.engine3d.materials.DrawPoint</code> | ||||
| 		 *  | ||||
| 		 * @see DrawPoint | ||||
| 		 */ | ||||
| 		alternativa3d function draw(camera:Camera3D, skin:Skin, length:uint, points:Array):void { | ||||
| 			skin.alpha = _alpha; | ||||
| 			skin.blendMode = _blendMode; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @inheritDoc | ||||
| 		 */		 | ||||
| 		override public function clone():Material { | ||||
| 			return new SurfaceMaterial(_alpha, _blendMode); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -1,370 +0,0 @@ | ||||
| package alternativa.engine3d.materials { | ||||
| 	import __AS3__.vec.Vector; | ||||
| 	 | ||||
| 	import alternativa.engine3d.*; | ||||
| 	import alternativa.engine3d.core.Camera3D; | ||||
| 	import alternativa.engine3d.core.Face; | ||||
| 	import alternativa.engine3d.core.PolyPrimitive; | ||||
| 	import alternativa.engine3d.display.Skin; | ||||
| 	import alternativa.types.*; | ||||
| 	 | ||||
| 	import flash.display.BlendMode; | ||||
| 	import flash.geom.Matrix; | ||||
| 	import flash.display.BitmapData; | ||||
| 	import flash.display.Graphics; | ||||
| 	 | ||||
| 	use namespace alternativa3d; | ||||
| 	use namespace alternativatypes; | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Материал, заполняющий грань текстурой. Помимо наложения текстуры, материал может рисовать границу грани линией | ||||
| 	 * заданной толщины и цвета. | ||||
| 	 */	 | ||||
| 	public class TextureMaterial extends SurfaceMaterial { | ||||
|  | ||||
| 		private static var stubBitmapData:BitmapData; | ||||
| 		private static var stubMatrix:Matrix; | ||||
| 		 | ||||
| 		private var gfx:Graphics; | ||||
| 		private var textureMatrix:Matrix = new Matrix(); | ||||
| 		private var focalLength:Number; | ||||
| 		private var distortion:Number; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Текстура | ||||
| 		 */		 | ||||
| 		alternativa3d var _texture:Texture; | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Повтор текстуры | ||||
| 		 */		 | ||||
| 		alternativa3d var _repeat:Boolean; | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Сглаженность текстуры | ||||
| 		 */		 | ||||
| 		alternativa3d var _smooth:Boolean; | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Точность перспективной коррекции | ||||
| 		 */		 | ||||
| 		alternativa3d var _precision:Number; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Толщина линий обводки  | ||||
| 		 */ | ||||
| 		alternativa3d var _wireThickness:Number; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Цвет линий обводки  | ||||
| 		 */ | ||||
| 		alternativa3d var _wireColor:uint; | ||||
|  | ||||
| 		/** | ||||
| 		 * Создание экземпляра текстурного материала. | ||||
| 		 *  | ||||
| 		 * @param texture текстура материала | ||||
| 		 * @param alpha коэффициент непрозрачности материала. Значение 1 соответствует полной непрозрачности, значение 0 соответствует полной прозрачности. | ||||
| 		 * @param repeat повтор текстуры при заполнении | ||||
| 		 * @param smooth сглаживание текстуры при увеличении масштаба | ||||
| 		 * @param blendMode режим наложения цвета | ||||
| 		 * @param wireThickness толщина линии обводки | ||||
| 		 * @param wireColor цвет линии обводки | ||||
| 		 * @param precision точность перспективной коррекции. Может быть задана одной из констант класса | ||||
| 		 *   <code>TextureMaterialPrecision</code> или числом типа Number. Во втором случае, чем ближе заданное значение к единице, тем более | ||||
| 		 *   качественная перспективная коррекция будет выполнена, и тем больше времени будет затрачено на расчёт кадра. | ||||
| 		 *  | ||||
| 		 * @see TextureMaterialPrecision | ||||
| 		 */ | ||||
| 		public function TextureMaterial(texture:Texture, alpha:Number = 1, repeat:Boolean = true, smooth:Boolean = false, blendMode:String = BlendMode.NORMAL, wireThickness:Number = -1, wireColor:uint = 0, precision:Number = TextureMaterialPrecision.MEDIUM) { | ||||
| 			super(alpha, blendMode); | ||||
| 			_texture = texture; | ||||
| 			_repeat = repeat; | ||||
| 			_smooth = smooth; | ||||
| 			_wireThickness = wireThickness; | ||||
| 			_wireColor = wireColor; | ||||
| 			_precision = precision; | ||||
| 			useUV = true; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Метод определяет, может ли материал нарисовать указанный примитив. Метод используется в системе отрисовки сцены и должен использоваться | ||||
| 		 * наследниками для указания видимости связанной с материалом поверхности или отдельного примитива. | ||||
| 		 *  | ||||
| 		 * @param primitive примитив для проверки | ||||
| 		 *  | ||||
| 		 * @return <code>true</code>, если материал может отрисовать указанный примитив, иначе <code>false</code> | ||||
| 		 */ | ||||
| 		override alternativa3d function canDraw(primitive:PolyPrimitive):Boolean { | ||||
| 			return _texture != null; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * @inheritDoc | ||||
| 		 */ | ||||
| 		override alternativa3d function draw(camera:Camera3D, skin:Skin, length:uint, points:Array):void { | ||||
| 			skin.alpha = _alpha; | ||||
| 			skin.blendMode = _blendMode; | ||||
| 			 | ||||
| 			var i:uint; | ||||
| 			var point:DrawPoint; | ||||
| 			gfx = skin.gfx; | ||||
| 			 | ||||
| 			// Проверка на нулевую UV-матрицу | ||||
| 			if (skin.primitive.face.uvMatrixBase == null) { | ||||
| 				if (stubBitmapData == null) { | ||||
| 					// Создание текстуры-заглушки | ||||
| 					stubBitmapData = new BitmapData(2, 2, false, 0); | ||||
| 					stubBitmapData.setPixel(0, 0, 0xFF00FF); | ||||
| 					stubBitmapData.setPixel(1, 1, 0xFF00FF); | ||||
| 					stubMatrix = new Matrix(10, 0, 0, 10, 0, 0); | ||||
| 				}				 | ||||
| 				gfx.beginBitmapFill(stubBitmapData, stubMatrix); | ||||
| 				if (camera._orthographic) { | ||||
| 					if (_wireThickness >= 0) { | ||||
| 						gfx.lineStyle(_wireThickness, _wireColor); | ||||
| 					} | ||||
| 					point = points[0]; | ||||
| 					gfx.moveTo(point.x, point.y); | ||||
| 					for (i = 1; i < length; i++) { | ||||
| 						point = points[i]; | ||||
| 						gfx.lineTo(point.x, point.y); | ||||
| 					} | ||||
| 					if (_wireThickness >= 0) { | ||||
| 						point = points[0]; | ||||
| 						gfx.lineTo(point.x, point.y); | ||||
| 					} | ||||
| 				} else { | ||||
| 					if (_wireThickness >= 0) { | ||||
| 						gfx.lineStyle(_wireThickness, _wireColor); | ||||
| 					} | ||||
| 					point = points[0]; | ||||
| 					var perspective:Number = camera.focalLength/point.z; | ||||
| 					gfx.moveTo(point.x*perspective, point.y*perspective); | ||||
| 					for (i = 1; i < length; i++) { | ||||
| 						point = points[i]; | ||||
| 						perspective = camera.focalLength/point.z; | ||||
| 						gfx.lineTo(point.x*perspective, point.y*perspective); | ||||
| 					} | ||||
| 					if (_wireThickness >= 0) { | ||||
| 						point = points[0]; | ||||
| 						perspective = camera.focalLength/point.z; | ||||
| 						gfx.lineTo(point.x*perspective, point.y*perspective); | ||||
| 					} | ||||
| 				} | ||||
| 				return; | ||||
| 			} | ||||
| 			 | ||||
| 			if (camera._orthographic) { | ||||
| 				// Расчитываем матрицу наложения текстуры | ||||
| 				var face:Face = skin.primitive.face; | ||||
| 				// Если матрица не расчитана, считаем | ||||
| 				if (!camera.uvMatricesCalculated[face]) { | ||||
| 					camera.calculateUVMatrix(face, _texture._width, _texture._height); | ||||
| 				} | ||||
| 				gfx.beginBitmapFill(_texture._bitmapData, face.uvMatrix, _repeat, _smooth); | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					gfx.lineStyle(_wireThickness, _wireColor); | ||||
| 				} | ||||
| 				point = points[0]; | ||||
| 				gfx.moveTo(point.x, point.y); | ||||
| 				for (i = 1; i < length; i++) { | ||||
| 					point = points[i]; | ||||
| 					gfx.lineTo(point.x, point.y); | ||||
| 				} | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					point = points[0]; | ||||
| 					gfx.lineTo(point.x, point.y); | ||||
| 				} | ||||
| 			} else { | ||||
| 				// Отрисовка | ||||
| 				focalLength = camera.focalLength; | ||||
| 				//distortion = camera.focalDistortion*_precision; | ||||
| 				 | ||||
| 				var front:int = 0; | ||||
| 				var back:int = length - 1; | ||||
|  | ||||
| 				var newFront:int = 1; | ||||
| 				var newBack:int = (back > 0) ? (back - 1) : (length - 1); | ||||
| 				var direction:Boolean = true; | ||||
| 				 | ||||
| 				var a:DrawPoint = points[back]; | ||||
| 				var b:DrawPoint; | ||||
| 				var c:DrawPoint = points[front]; | ||||
| 				 | ||||
| 				var drawVertices:Vector.<Number> = new Vector.<Number>(); | ||||
| 				var drawUVTs:Vector.<Number> = new Vector.<Number>(); | ||||
| 				 | ||||
| 				for (i = 0; i < length; i++) { | ||||
| 					var p:DrawPoint = points[i]; | ||||
| 					var t:Number = focalLength/p.z; | ||||
| 					drawVertices[i << 1] = p.x*t; | ||||
| 					drawVertices[(i << 1) + 1] = p.y*t; | ||||
| 					drawUVTs.push(p.u, 1 - p.v, t); | ||||
| 				} | ||||
| 				 | ||||
| 				var drawIndices:Vector.<int> = new Vector.<int>(); | ||||
|  | ||||
| 				while (front != newBack) { | ||||
| 					if (direction) { | ||||
| /* 						a = points[front]; | ||||
| 						b = points[newFront]; | ||||
| 						c = points[back]; | ||||
|  */ | ||||
| 						drawIndices.push(front, newFront, back); | ||||
|  | ||||
| 						front = newFront; | ||||
| 						newFront = (front < length - 1) ? (front + 1) : 0; | ||||
| 					} else { | ||||
| /* 						a = points[newBack]; | ||||
| 						b = points[back]; | ||||
| 						c = points[front]; | ||||
|  */ | ||||
| 						drawIndices.push(newBack, back, front); | ||||
|  | ||||
| 						back = newBack; | ||||
| 						newBack = (back > 0) ? (back - 1) : (length - 1); | ||||
| 					} | ||||
|  | ||||
| 					direction = !direction; | ||||
| 				} | ||||
| 				gfx.beginBitmapFill(_texture.bitmapData, null, _repeat, _smooth); | ||||
| 				if (_wireThickness >= 0) { | ||||
| 					gfx.lineStyle(_wireThickness, _wireColor); | ||||
| 				} | ||||
| 				gfx.drawTriangles(drawVertices, drawIndices, drawUVTs); | ||||
| 				 | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Текстура материала. Материал не выполняет никаких действий по отрисовке, если не задана текстура. | ||||
| 		 */ | ||||
| 		public function get texture():Texture { | ||||
| 			return _texture; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */ | ||||
| 		public function set texture(value:Texture):void { | ||||
| 			if (_texture != value) { | ||||
| 				_texture = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Повтор текстуры при заливке. Более подробную информацию можно найти в описании метода | ||||
| 		 * <code>flash.display.Graphics#beginBitmapFill()</code>. | ||||
| 		 */ | ||||
| 		public function get repeat():Boolean { | ||||
| 			return _repeat; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */ | ||||
| 		public function set repeat(value:Boolean):void { | ||||
| 			if (_repeat != value) { | ||||
| 				_repeat = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Сглаживание текстуры при увеличении масштаба. Более подробную информацию можно найти в описании метода | ||||
| 		 * <code>flash.display.Graphics#beginBitmapFill()</code>. | ||||
| 		 */ | ||||
| 		public function get smooth():Boolean { | ||||
| 			return _smooth; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set smooth(value:Boolean):void { | ||||
| 			if (_smooth != value) { | ||||
| 				_smooth = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Толщина линии обводки полигона. Если значение отрицательное, то обводка не рисуется. | ||||
| 		 */ | ||||
| 		public function get wireThickness():Number { | ||||
| 			return _wireThickness; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set wireThickness(value:Number):void { | ||||
| 			if (_wireThickness != value) { | ||||
| 				_wireThickness = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Цвет линии обводки полигона. | ||||
| 		 */ | ||||
| 		public function get wireColor():uint { | ||||
| 			return _wireColor; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set wireColor(value:uint):void { | ||||
| 			if (_wireColor != value) { | ||||
| 				_wireColor = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * Точность перспективной коррекции. | ||||
| 		 */ | ||||
| 		public function get precision():Number { | ||||
| 			return _precision; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */		 | ||||
| 		public function set precision(value:Number):void { | ||||
| 			if (_precision != value) { | ||||
| 				_precision = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @inheritDoc  | ||||
| 		 */ | ||||
| 		override public function clone():Material { | ||||
| 			var res:TextureMaterial = new TextureMaterial(_texture, _alpha, _repeat, _smooth, _blendMode, _wireThickness, _wireColor, _precision); | ||||
| 			return res; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -1,39 +0,0 @@ | ||||
| package alternativa.engine3d.materials { | ||||
|  | ||||
| 	/** | ||||
| 	 * Класс содержит константы точности перспективной коррекции текстурного материала. | ||||
| 	 *  | ||||
| 	 * @see TextureMaterial | ||||
| 	 */ | ||||
| 	public class TextureMaterialPrecision { | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Адаптивная триангуляция не будет выполняться, только простая триангуляция.  | ||||
| 		 */ | ||||
| 		public static const NONE:Number = -1; | ||||
| 		/** | ||||
| 		 * Очень низкое качество адаптивной триангуляции. | ||||
| 		 */ | ||||
| 		public static const VERY_LOW:Number = 50; | ||||
| 		/** | ||||
| 		 * Низкое качество адаптивной триангуляции. | ||||
| 		 */ | ||||
| 		public static const LOW:Number = 25; | ||||
| 		/** | ||||
| 		 * Среднее качество адаптивной триангуляции.  | ||||
| 		 */ | ||||
| 		public static const MEDIUM:Number = 10; | ||||
| 		/** | ||||
| 		 * Высокое качество адаптивной триангуляции. | ||||
| 		 */ | ||||
| 		public static const HIGH:Number = 6; | ||||
| 		/** | ||||
| 		 * Очень высокое качество адаптивной триангуляции. | ||||
| 		 */ | ||||
| 		public static const VERY_HIGH:Number = 3; | ||||
| 		/** | ||||
| 		 * Максимальное качество адаптивной триангуляции. | ||||
| 		 */ | ||||
| 		public static const BEST:Number = 1; | ||||
| 	} | ||||
| } | ||||
| @@ -1,128 +0,0 @@ | ||||
| package alternativa.engine3d.materials { | ||||
| 	import alternativa.engine3d.*; | ||||
| 	import alternativa.engine3d.core.Camera3D; | ||||
| 	import alternativa.engine3d.display.Skin; | ||||
| 	 | ||||
| 	import flash.display.BlendMode; | ||||
| 	import flash.display.Graphics; | ||||
| 	import alternativa.engine3d.core.PolyPrimitive; | ||||
| 	 | ||||
| 	use namespace alternativa3d; | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Материал для рисования рёбер граней. | ||||
| 	 */	 | ||||
| 	public class WireMaterial extends SurfaceMaterial { | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Цвет | ||||
| 		 */ | ||||
| 		alternativa3d var _color:uint; | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * Толщина линий | ||||
| 		 */ | ||||
| 		alternativa3d var _thickness:Number; | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Создание экземпляра класса. | ||||
| 		 *  | ||||
| 		 * @param thickness толщина линий | ||||
| 		 * @param color цвет линий | ||||
| 		 * @param alpha коэффициент непрозрачности линий. Значение 1 соответствует полной непрозрачности, значение 0 соответствует полной прозрачности. | ||||
| 		 * @param blendMode режим наложения цвета | ||||
| 		 */ | ||||
| 		public function WireMaterial(thickness:Number = 0, color:uint = 0, alpha:Number = 1, blendMode:String = BlendMode.NORMAL) { | ||||
| 			super(alpha, blendMode); | ||||
| 			_color = color; | ||||
| 			_thickness = thickness; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * @inheritDoc | ||||
| 		 */ | ||||
| 		override alternativa3d function canDraw(primitive:PolyPrimitive):Boolean { | ||||
| 			return _thickness >= 0; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 * @inheritDoc | ||||
| 		 */ | ||||
| 		override alternativa3d function draw(camera:Camera3D, skin:Skin, length:uint, points:Array):void { | ||||
| 			skin.alpha = _alpha; | ||||
| 			skin.blendMode = _blendMode; | ||||
| 			 | ||||
| 			var i:uint; | ||||
| 			var point:DrawPoint; | ||||
| 			var gfx:Graphics = skin.gfx; | ||||
|  | ||||
| 			if (camera._orthographic) { | ||||
| 				gfx.lineStyle(_thickness, _color); | ||||
| 				point = points[length - 1]; | ||||
| 				gfx.moveTo(point.x, point.y); | ||||
| 				for (i = 0; i < length; i++) { | ||||
| 					point = points[i]; | ||||
| 					gfx.lineTo(point.x, point.y); | ||||
| 				} | ||||
| 			} else { | ||||
| 				// Отрисовка | ||||
| 				gfx.lineStyle(_thickness, _color); | ||||
| 				point = points[length - 1]; | ||||
| 				var perspective:Number = camera.focalLength/point.z; | ||||
| 				gfx.moveTo(point.x*perspective, point.y*perspective); | ||||
| 				for (i = 0; i < length; i++) { | ||||
| 					point = points[i]; | ||||
| 					perspective = camera.focalLength/point.z; | ||||
| 					gfx.lineTo(point.x*perspective, point.y*perspective); | ||||
| 				} | ||||
| 			}			 | ||||
| 		} | ||||
|  		 | ||||
| 		/** | ||||
| 		 * Цвет линий. | ||||
| 		 */ | ||||
| 		public function get color():uint { | ||||
| 			return _color; | ||||
| 		} | ||||
|  | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */ | ||||
| 		public function set color(value:uint):void { | ||||
| 			if (_color != value) { | ||||
| 				_color = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * Толщина линий. Если толщина отрицательная, то отрисовка не выполняется. | ||||
| 		 */ | ||||
| 		public function get thickness():Number { | ||||
| 			return _thickness; | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @private | ||||
| 		 */ | ||||
| 		public function set thickness(value:Number):void { | ||||
| 			if (_thickness != value) { | ||||
| 				_thickness = value; | ||||
| 				if (_surface != null) { | ||||
| 					_surface.addMaterialChangedOperationToScene(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		/** | ||||
| 		 * @inheritDoc  | ||||
| 		 */		 | ||||
| 		override public function clone():Material { | ||||
| 			return new WireMaterial(_thickness, _color, _alpha, _blendMode); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Pyogenics
					Pyogenics