PageRenderTime 391ms CodeModel.GetById 208ms app.highlight 2ms RepoModel.GetById 179ms app.codeStats 0ms

/src/away3d/materials/utils/ShaderRegisterElement.as

http://github.com/away3d/away3d-core-fp11
ActionScript | 60 lines | 34 code | 5 blank | 21 comment | 1 complexity | df2d7264374b21e5e4ab80b90efd47f7 MD5 | raw file
 1package away3d.materials.utils
 2{
 3	/**
 4	 * A single register element (an entire register or a single register's component) used by the RegisterPool.
 5	 */
 6	public class ShaderRegisterElement
 7	{
 8		private var _regName : String;
 9		private var _index : int;
10		private var _component : String;
11
12		/**
13		 * Creates a new ShaderRegisterElement object.
14		 * @param regName The name of the register.
15		 * @param index The index of the register.
16		 * @param component The register's component, if not the entire register is represented.
17		 */
18		public function ShaderRegisterElement(regName : String, index : int, component : String = null)
19		{
20			_regName = regName;
21			_index = index;
22			_component = component;
23		}
24
25		/**
26		 * Converts the register or the components AGAL string representation.
27		 */
28		public function toString() : String
29		{
30			if (_index >= 0)
31				return _regName + _index + (_component? "."+_component : "");
32			else
33				return _regName + (_component? "."+_component : "");
34		}
35
36		/**
37		 * The register's name.
38		 */
39		public function get regName() : String
40		{
41			return _regName;
42		}
43
44		/**
45		 * The register's index.
46		 */
47		public function get index() : int
48		{
49			return _index;
50		}
51
52		/**
53		 * The register's component, if not the entire register is represented.
54		 */
55		public function get component() : String
56		{
57			return _component;
58		}
59	}
60}