 	 */
 	public class QuadBatch2D extends DisplayObject2D
 	{
+		//-----------------------------------------------------------------------------------------
+		// Constants
+		//-----------------------------------------------------------------------------------------
+		
 		private static const QUAD_PROGRAM_NAME:String = "QB_q";
+		
+		
+		//-----------------------------------------------------------------------------------------
+		// Properties
+		//-----------------------------------------------------------------------------------------
 		
 		private var _numQuads:int;
 		private var _syncRequired:Boolean;


			return quadBatchID;
		}


		// properties
		public function get numQuads():int
		{
			return _numQuads;
		}


		public function get tinted():Boolean
		{
			return _tinted;
		}


		public function get texture():Texture2D
		{
			return _texture;
		}


		public function get smoothing():String
		{
			return _smoothing;
		}


		private function get capacity():int
		{
			return _vertexData.numVertices / 4;
		}


		// program management
		private static function registerPrograms():void
		{
			var target:Render2D = Render2D.current;
			if (target.hasProgram(QUAD_PROGRAM_NAME)) return;
			// already registered

			var assembler:AGALMiniAssembler = new AGALMiniAssembler();
			var vertexProgramCode:String;
			var fragmentProgramCode:String;

			// this is the input data we'll pass to the shaders:
			//


								if (format == Context3DTextureFormat.COMPRESSED)
									options.push("dxt1");
								else if (format == Context3DTextureFormat.COMPRESSED_ALPHA)
									options.push("dxt5");
								
								if (smoothing == TextureSmoothing2D.NONE)
									options.push("nearest", mipmap ? "mipnearest" : "mipnone");
								else if (smoothing == TextureSmoothing2D.BILINEAR)
									options.push("linear", mipmap ? "mipnearest" : "mipnone");
								else
									options.push("linear", mipmap ? "miplinear" : "mipnone");
								
								target.registerProgram(getImageProgramName(tinted, mipmap, repeat,
									format, smoothing), agal.assemble(Context3DProgramType.VERTEX,
										vertexASM), agal.assemble(Context3DProgramType.FRAGMENT,
										fragmentASM.replace("???", options.join())));
							}
						}
					}
				}
			}
		}
		
		
		/**
		 * @private
		 */
		private static function getImageProgramName(tinted:Boolean, mipMap:Boolean = true,
			repeat:Boolean = false, format:String = "bgra", smoothing:String = "bilinear"):String
		{
			var bitField:uint = 0;
			
			if (tinted) bitField |= 1;
			if (mipMap) bitField |= 1 << 1;
			if (repeat) bitField |= 1 << 2;
			
			if (smoothing == TextureSmoothing2D.NONE) bitField |= 1 << 3;
			else if (smoothing == TextureSmoothing2D.TRILINEAR) bitField |= 1 << 4;
			
			if (format == Context3DTextureFormat.COMPRESSED) bitField |= 1 << 5;
			else if (format == Context3DTextureFormat.COMPRESSED_ALPHA) bitField |= 1 << 6;
			
			var name:String = _programNameCache[bitField];
			if (name == null)
			{
				name = "QB_i." + bitField.toString(16);
				_programNameCache[bitField] = name;
			}
			
			return name;
		}
	}
