소스 검색

added colorAdd auto-shader

ncannasse 11 년 전
부모
커밋
350365de2f
1개의 변경된 파일23개의 추가작업 그리고 0개의 파일을 삭제
  1. 23 0
      h2d/Drawable.hx

+ 23 - 0
h2d/Drawable.hx

@@ -9,6 +9,7 @@ class Drawable extends Sprite {
 	public var tileWrap : Bool;
 	public var tileWrap : Bool;
 	public var colorKey(default, set) : Null<Int>;
 	public var colorKey(default, set) : Null<Int>;
 	public var colorMatrix(get, set) : Null<h3d.Matrix>;
 	public var colorMatrix(get, set) : Null<h3d.Matrix>;
+	public var colorAdd(get, set) : Null<h3d.Vector>;
 
 
 	var shaders : hxsl.ShaderList;
 	var shaders : hxsl.ShaderList;
 
 
@@ -18,6 +19,28 @@ class Drawable extends Sprite {
 		color = new h3d.Vector(1, 1, 1, 1);
 		color = new h3d.Vector(1, 1, 1, 1);
 	}
 	}
 
 
+
+	function get_colorAdd() {
+		var s = getShader(h3d.shader.ColorAdd);
+		return s == null ? null : s.color;
+	}
+
+	function set_colorAdd( c : h3d.Vector ) {
+		var s = getShader(h3d.shader.ColorAdd);
+		if( s == null ) {
+			if( c != null ) {
+				s = addShader(new h3d.shader.ColorAdd());
+				s.color = c;
+			}
+		} else {
+			if( c == null )
+				removeShader(s);
+			else
+				s.color = c;
+		}
+		return c;
+	}
+
 	function set_colorKey(v:Null<Int>) {
 	function set_colorKey(v:Null<Int>) {
 		var s = getShader(h3d.shader.ColorKey);
 		var s = getShader(h3d.shader.ColorKey);
 		if( s == null ) {
 		if( s == null ) {