PageRenderTime 31ms CodeModel.GetById 19ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/src/aerys/minko/scene/data/MeshVisibilityDataProvider.as

https://bitbucket.org/HopeSky/mars_nd2d
ActionScript | 92 lines | 79 code | 13 blank | 0 comment | 6 complexity | ffb592bece9daf30149d0e006c11224d MD5 | raw file
 1package aerys.minko.scene.data
 2{
 3	import aerys.minko.type.Signal;
 4	import aerys.minko.type.binding.IDataProvider;
 5	import aerys.minko.type.enum.DataProviderUsage;
 6	
 7	public final class MeshVisibilityDataProvider implements IDataProvider
 8	{
 9		private static const DATA_DESCRIPTOR	: Object	= {
10			'visible'			: 'visible',
11			'frustumCulling'	: 'frustumCulling',
12			'inFrustum'			: 'insideFrustum'
13		};
14		
15		private var _visible			: Boolean	= true;
16		private var _frustumCulling		: uint		= 0;
17		private var _inFrustum			: Boolean	= true;
18		
19		private var _changed			: Signal	= new Signal('MeshVisibilityDataProvider.changed');
20		private var _propertyChanged	: Signal	= new Signal('MeshVisibilityDataProvider.propertyChanged');
21		
22		public function get usage() : uint
23		{
24			return DataProviderUsage.EXCLUSIVE;
25		}
26		
27		public function get visible() : Boolean
28		{
29			return _visible;
30		}
31		public function set visible(value : Boolean) : void
32		{
33			if (_visible != value)
34			{
35				_visible = value;
36				_changed.execute(this, 'visible');
37			}
38		}
39		
40		public function get frustumCulling() : uint
41		{
42			return _frustumCulling;
43		}
44		public function set frustumCulling(value : uint) : void
45		{
46			if (_frustumCulling != value)
47			{
48				_frustumCulling = value;
49				_changed.execute(this, 'frustumCulling');
50			}
51		}
52		
53		public function get inFrustum() : Boolean
54		{
55			return _inFrustum;
56		}
57		public function set inFrustum(value : Boolean) : void
58		{
59			if (_inFrustum != value)
60			{
61				_inFrustum = value;
62				_changed.execute(this, 'inFrustum');
63			}
64		}
65		
66		public function get propertyChanged() : Signal
67		{
68			return _propertyChanged;
69		}
70		
71		public function get changed() : Signal
72		{
73			return _changed;
74		}
75		
76		public function get dataDescriptor() : Object
77		{
78			return DATA_DESCRIPTOR;
79		}
80		
81		public function clone() : IDataProvider
82		{
83			var clone : MeshVisibilityDataProvider = new MeshVisibilityDataProvider();
84			
85			clone.visible = visible;
86			clone.frustumCulling = frustumCulling;
87			clone.inFrustum = inFrustum;
88			
89			return clone;
90		}
91	}
92}