Nicolas Cannasse 12 лет назад
Родитель
Сommit
bac14bb81e

+ 1 - 1
engine.hxproj

@@ -23,7 +23,7 @@
     <option flashStrict="True" />
     <option mainClass="Test" />
     <option enabledebug="False" />
-    <option additional="-lib hxsl&#xA;--macro include('h3d')&#xA;--macro include('h2d')" />
+    <option additional="-lib hxsl&#xA;-D h3d&#xA;--macro include('h3d')&#xA;--macro include('h2d')" />
   </build>
   <!-- haxelib libraries -->
   <haxelib>

+ 1 - 1
h2d/SpriteBatch.hx

@@ -1,6 +1,6 @@
 package h2d;
 
-private class BatchShader extends h3d.Shader {
+private class BatchShader extends hxsl.Shader {
 	static var SRC = {
 		var input : {
 			pos : Float2,

+ 4 - 4
h2d/Tools.hx

@@ -1,6 +1,6 @@
 package h2d;
 
-private class BitmapShader extends h3d.Shader {
+private class BitmapShader extends hxsl.Shader {
 	static var SRC = {
 		var input : {
 			pos : Float2,
@@ -22,7 +22,7 @@ private class BitmapShader extends h3d.Shader {
 	}
 }
 
-private class CachedBitmapShader extends h3d.Shader {
+private class CachedBitmapShader extends hxsl.Shader {
 	static var SRC = {
 		var input : {
 			pos : Float2,
@@ -53,7 +53,7 @@ private class CachedBitmapShader extends h3d.Shader {
 	}
 }
 
-private class TileShader extends h3d.Shader {
+private class TileShader extends hxsl.Shader {
 	static var SRC = {
 		var input : {
 			pos : Float2,
@@ -75,7 +75,7 @@ private class TileShader extends h3d.Shader {
 	}
 }
 
-private class TileColorShader extends h3d.Shader {
+private class TileColorShader extends hxsl.Shader {
 	static var SRC = {
 		var input : {
 			pos : Float2,

+ 1 - 1
h3d/CoreObject.hx

@@ -4,7 +4,7 @@ package h3d;
 	A core object is a rendering context but completely outside of the 3d scene.
 	It is meant to be able to share a rendering context between several similar physical objects.
  **/
-class CoreObject<S:h3d.Shader> {
+class CoreObject<S:hxsl.Shader> {
 
 	public var shader : S;
 	public var primitive : h3d.prim.Primitive;

+ 2 - 2
h3d/Engine.hx

@@ -21,7 +21,7 @@ class Engine {
 	public var fullScreen(default, set) : Bool;
 
 	var curMatBits : Int;
-	var curShader : Shader.ShaderInstance;
+	var curShader : hxsl.Shader.ShaderInstance;
 	var curBuffer : h3d.impl.MemoryManager.BigBuffer;
 	var curAttributes : Int;
 	var curTextures : Array<h3d.mat.Texture>;
@@ -84,7 +84,7 @@ class Engine {
 		return ctx != null;
 	}
 
-	public function selectShader( shader : Shader ) {
+	public function selectShader( shader : hxsl.Shader ) {
 		var s = shader.getInstance();
 		if( s.program == null ) {
 			s.program = ctx.createProgram();

+ 0 - 312
h3d/Shader.hx

@@ -1,312 +0,0 @@
-package h3d;
-import hxsl.Data.Tools;
-
-typedef FixedArray<T,Const> = Array<T>;
-
-class ShaderInstance {
-
-	public var bits : Int;
-	
-	public var program : flash.display3D.Program3D;
-
-	public var bufferFormat : Int;
-	public var stride : Int;
-
-	public var vertexVars : flash.Vector<Float>;
-	public var fragmentVars : flash.Vector<Float>;
-	public var textures : flash.Vector<h3d.mat.Texture>;
-
-	public var vertexMap : flash.Vector<Int>;
-	public var fragmentMap : flash.Vector<Int>;
-	public var textureMap : flash.Vector<Int>;
-	
-	public var vertexBytes : haxe.io.Bytes;
-	public var fragmentBytes : haxe.io.Bytes;
-	
-	public var varsChanged : Bool;
-	
-	public function new() {
-	}
-	
-	public function updateVars( allVars : flash.Vector<Float>, allTex : flash.Vector<h3d.mat.Texture> ) {
-		varsChanged = true;
-		for( i in 0...vertexMap.length )
-			vertexVars[i] = allVars[vertexMap[i]];
-		for( i in 0...fragmentMap.length )
-			fragmentVars[i] = allVars[fragmentMap[i]];
-		for( i in 0...textureMap.length )
-			textures[i] = allTex[textureMap[i]];
-	}
-	
-}
-
-class ShaderGlobals {
-	
-	var data : hxsl.Data;
-	var instances : IntHash<ShaderInstance>;
-	var hparams : IntHash<hxsl.Data.Variable>;
-	public var allSize : Int;
-	public var texSize : Int;
-	
-	public function new( hxStr : String ) {
-		this.data = hxsl.Unserialize.unserialize(hxStr);
-		
-		hparams = new IntHash();
-		allSize = 0;
-		for( v in Tools.getAllVars(data) )
-			switch( v.kind ) {
-			case VConst, VParam:
-				if( v.type != TBool ) {
-					v.index = allSize;
-					allSize += hxsl.Data.Tools.floatSize(v.type);
-					hparams.set(v.id, v);
-				}
-			case VTexture:
-				v.index = texSize++;
-				hparams.set(v.id, v);
-			default:
-			}
-		allSize++; // last 0
-		
-		instances = new IntHash();
-	}
-	
-	function build( code : hxsl.Data.Code ) {
-			
-		// init map
-		var nregs = 0;
-		var map = new flash.Vector();
-		for( v in code.args ) {
-			var realV = hparams.get(v.id);
-			if( v == null ) throw "assert " + v.name;
-			var size = Tools.floatSize(v.type);
-			for( i in 0...size )
-				map.push(realV.index + i);
-			var regs = Tools.regSize(v.type);
-			nregs += regs;
-			for( i in size...regs * 4 )
-				map.push(allSize - 1);
-		}
-		
-		// add consts
-		var pos = nregs * 4;
-		nregs += code.consts.length;
-		var consts = new flash.Vector(nregs * 4);
-		for( c in code.consts ) {
-			for( v in c )
-				consts[pos++] = v;
-			for( i in c.length...4 )
-				consts[pos++] = 1.;
-		}
-		
-		var agal = new hxsl.AgalCompiler().compile(code);
-		var o = new haxe.io.BytesOutput();
-		new format.agal.Writer(o).write(agal);
-		return { bytes : o.getBytes(), consts : consts, map : map };
-	}
-	
-	public function getInstance( bits : Int ) {
-		var i = instances.get(bits);
-		if( i != null )
-			return i;
-		var r = new hxsl.RuntimeCompiler();
-		var consts = { };
-		var constCount = 0;
-		for( v in Tools.getAllVars(data) )
-			if( v.kind == VConst ) {
-				if( bits & (1 << constCount) != 0 ) {
-					var c : Dynamic;
-					if( v.type == TBool ) c = true else c = 0;
-					Reflect.setField(consts, v.name, c);
-				}
-				constCount++;
-			}
-		
-		var data2 = r.compile(data, consts);
-		i = new ShaderInstance();
-		i.bits = bits;
-		
-		var v = build(data2.vertex);
-		i.vertexBytes = v.bytes;
-		i.vertexMap = v.map;
-		i.vertexVars = v.consts;
-		
-		var f = build(data2.fragment);
-		i.fragmentBytes = f.bytes;
-		i.fragmentMap = f.map;
-		i.fragmentVars = f.consts;
-				
-		i.textureMap = new flash.Vector();
-		for( v in data2.vertex.tex.concat(data2.fragment.tex) ) {
-			if( v.kind != VTexture ) throw "assert";
-			var realV = hparams.get(v.id);
-			i.textureMap.push(realV.index);
-		}
-		i.textures = new flash.Vector(i.textureMap.length);
-		
-		
-		i.bufferFormat = 0;
-		i.stride = 0;
-		for( v in data2.globals )
-			switch( v.kind ) {
-			case VInput:
-				var size = Tools.floatSize(v.type);
-				switch( v.type ) {
-				case TInt:
-					// 0
-				case TFloat, TFloat2, TFloat3, TFloat4:
-					i.bufferFormat |= Tools.floatSize(v.type) << (3 * v.index);
-				default:
-					throw "Type not supported in input " + Type.enumConstructor(v.type).substr(1);
-				}
-				i.stride += size;
-			case VVar:
-				// ignore
-			default:
-				throw "assert " + v.kind;
-			}
-
-
-		instances.set(bits, i);
-		
-		return i;
-	}
-	
-}
-
-
-@:autoBuild(h3d.impl.Macros.buildShader())
-class Shader {
-
-	var globals : ShaderGlobals;
-	var modified : Bool;
-	var constBits : Int;
-	var allParams : flash.Vector<Float>;
-	var allTextures : flash.Vector<h3d.mat.Texture>;
-	var instance : ShaderInstance;
-	
-	public function new() {
-		var c : { HXSL : String, GLOBALS : ShaderGlobals } = cast Type.getClass(this);
-		globals = c.GLOBALS;
-		if( globals == null ) {
-			globals = new ShaderGlobals(c.HXSL);
-			c.GLOBALS = globals;
-		}
-		allParams = new flash.Vector(globals.allSize);
-		allTextures = new flash.Vector(globals.texSize);
-	}
-	
-	function updateParams() {
-		throw "assert"; // will be overriden in subclass
-	}
-	
-	public function getInstance() : ShaderInstance {
-		if( instance == null || instance.bits != constBits )
-			instance = globals.getInstance(constBits);
-		if( modified )
-			updateParams();
-		instance.updateVars(allParams, allTextures);
-		return instance;
-	}
-	
-	inline function loadMatrixT( index : Int, r : Int, c : Int ) {
-		var m = new h3d.Matrix();
-		m.identity();
-		
-		var pos = index;
-		m._11 = allParams[pos++];
-		if( c > 1 ) m._21 = allParams[pos++];
-		if( c > 2 ) m._31 = allParams[pos++];
-		if( c > 3 ) m._41 = allParams[pos++];
-
-		if( r > 1 ) {
-			m._12 = allParams[pos++];
-			if( c > 1 ) m._22 = allParams[pos++];
-			if( c > 2 ) m._32 = allParams[pos++];
-			if( c > 3 ) m._42 = allParams[pos++];
-
-			if( r > 2 ) {
-				m._13 = allParams[pos++];
-				if( c > 1 ) m._23 = allParams[pos++];
-				if( c > 2 ) m._33 = allParams[pos++];
-				if( c > 3 ) m._43 = allParams[pos++];
-
-				if( r > 3 ) {
-					m._14 = allParams[pos++];
-					if( c > 1 ) m._24 = allParams[pos++];
-					if( c > 2 ) m._34 = allParams[pos++];
-					if( c > 3 ) m._44 = allParams[pos++];
-				}
-			}
-		}
-		
-		return m;
-	}
-	
-	inline function saveMatrixT( index : Int, m : h3d.Matrix, r : Int, c : Int ) {
-		var pos = index;
-		allParams[pos++] = m._11;
-		if( c > 1 ) allParams[pos++] = m._21;
-		if( c > 2 ) allParams[pos++] = m._31;
-		if( c > 3 ) allParams[pos++] = m._41;
-		
-		if( r > 1 ) {
-			allParams[pos++] = m._12;
-			if( c > 1 ) allParams[pos++] = m._22;
-			if( c > 2 ) allParams[pos++] = m._32;
-			if( c > 3 ) allParams[pos++] = m._42;
-
-			if( r > 2 ) {
-				allParams[pos++] = m._13;
-				if( c > 1 ) allParams[pos++] = m._23;
-				if( c > 2 ) allParams[pos++] = m._33;
-				if( c > 3 ) allParams[pos++] = m._43;
-
-				if( r > 3 ) {
-					allParams[pos++] = m._14;
-					if( c > 1 ) allParams[pos++] = m._24;
-					if( c > 2 ) allParams[pos++] = m._34;
-					if( c > 3 ) allParams[pos++] = m._44;
-				}
-			}
-		}
-	}
-	
-	inline function loadFloats( index : Int, n : Int ) {
-		var v = new h3d.Vector();
-		var pos = index;
-		v.x = allParams[pos++];
-		v.y = allParams[pos++];
-		if( n > 2 ) v.z = allParams[pos++];
-		if( n > 3 ) v.w = allParams[pos++];
-		return v;
-	}
-
-	inline function saveFloats( index : Int, v : h3d.Vector, n : Int ) {
-		allParams[index] = v.x;
-		allParams[index + 1] = v.y;
-		if( n > 2 ) allParams[index + 2] = v.z;
-		if( n > 3 ) allParams[index + 3] = v.w;
-		return v;
-	}
-	
-	inline function saveInt( index : Int, v : Int ) {
-		allParams[index] = ((v >> 16) & 0xFF) / 255;
-		allParams[index + 1] = ((v >> 8) & 0xFF) / 255;
-		allParams[index + 2] = (v & 0xFF) / 255;
-		allParams[index + 3] = (v >>> 24) / 255;
-	}
-	
-	inline function saveFloat( index : Int, v : Float ) {
-		allParams[index] = v;
-	}
-	
-	inline function setConstFlag( n : Int, v : Bool ) {
-		if( v ) constBits |= 1 << n else constBits &= ~(1 << n);
-	}
-	
-	public function toString() {
-		return Type.getClassName(Type.getClass(this));
-	}
-	
-}

+ 1 - 1
h3d/fx/Bitmap.hx

@@ -1,7 +1,7 @@
 package h3d.fx;
 import h3d.mat.Data;
 
-private class BitmapShader extends h3d.Shader {
+private class BitmapShader extends hxsl.Shader {
 	
 	static var SRC = {
 		var input : {

+ 1 - 1
h3d/fx/Skybox.hx

@@ -1,7 +1,7 @@
 package h3d.fx;
 import h3d.mat.Data;
 
-class Skybox extends h3d.Shader {
+class Skybox extends hxsl.Shader {
 	
 	static var SRC = {
 		var input : {

+ 0 - 290
h3d/impl/Macros.hx

@@ -1,290 +0,0 @@
-package h3d.impl;
-
-#if macro
-import haxe.macro.Context;
-import haxe.macro.Expr;
-import hxsl.Data;
-
-class Macros {
-
-	static function realType( t : VarType, p : Position ) : ComplexType {
-		return TPath(switch( t ) {
-		case TNull: throw "assert";
-		case TBool: { pack : [], name : "Bool", params : [], sub : null };
-		case TFloat: { pack : [], name : "Float", params : [], sub : null };
-		case TFloat2, TFloat3, TFloat4: { pack : ["h3d"], name : "Vector", params : [], sub : null };
-		case TInt: { pack : [], name : "Int", params : [], sub : null };
-		case TMatrix(_): { pack : ["h3d"], name: "Matrix", params : [], sub : null };
-		case TTexture(cube): { pack : ["h3d","mat"], name : "Texture", params : [], sub : null };
-		case TArray(t, size): { pack : ["h3d"], name : "Shader", sub : "FixedArray", params : [TPType(realType(t,p)), TPExpr( { expr : EConst(CInt(""+size)), pos : p } )] };
-		});
-	}
-
-	public static function buildShader() {
-		var fields = Context.getBuildFields();
-		var shaderCode = null;
-		for( f in fields )
-			if( f.name == "SRC" ) {
-				switch( f.kind ) {
-				case FVar(_, e):
-					shaderCode = e;
-				default:
-				}
-				fields.remove(f);
-				// remove even if error
-				haxe.macro.Compiler.removeField(Context.getLocalClass().toString(), "SRC", true);
-				break;
-			}
-		var cl = switch( Context.getLocalType() ) {
-		case TInst(c, _): c.get();
-		default: throw "assert";
-		}
-		if( shaderCode == null ) {
-			if( cl.meta.has(":skip") )
-				return null;
-			Context.error("Shader SRC not found", cl.pos);
-		}
-		
-		var p = new hxsl.Parser();
-		p.includeFile = function(file) {
-			var f = Context.resolvePath(file);
-			return Context.parse("{"+sys.io.File.getContent(f)+"}", Context.makePosition( { min : 0, max : 0, file : f } ));
-		};
-
-		var data = try p.parse(shaderCode) catch( e : hxsl.Data.Error ) haxe.macro.Context.error(e.message, e.pos);
-		var c = new hxsl.Compiler();
-		c.warn = Context.warning;
-		var data = try c.compile(data) catch( e : hxsl.Data.Error ) haxe.macro.Context.error(e.message, e.pos);
-
-		var pos = Context.currentPos();
-		
-		// store HXSL data for runtime compilation
-		fields.push( {
-			name : "HXSL",
-			kind : FVar(null,{ expr : EConst(CString(hxsl.Serialize.serialize(data))), pos : pos }),
-			access : [AStatic],
-			pos : pos,
-			meta : [ { name:":keep", params : [], pos : pos } ],
-		});
-		fields.push( {
-			name : "GLOBALS",
-			kind : FVar(macro : h3d.Shader.ShaderGlobals),
-			access : [AStatic],
-			pos : pos,
-			meta : [ { name:":keep", params : [], pos : pos } ],
-		});
-		
-		// create all the variables accessors
-		var allVars = Tools.getAllVars(data);
-		var constCount = 0, virtualIndex = 0, texCount = 0, updates = [];
-		
-		for( v in allVars ) {
-			var pos = v.pos;
-			switch( v.kind ) {
-			case VConst, VParam:
-				
-				v.index = virtualIndex;
-				if( v.type != TBool )
-					virtualIndex += Tools.floatSize(v.type);
-				
-				var t = realType(v.type, pos);
-				fields.push( {
-					name : v.name,
-					kind : FProp("get", "set", t),
-					pos : pos,
-					access : [APublic],
-				});
-				fields.push( {
-					name : v.name+"_",
-					kind : FVar(t),
-					pos : pos,
-					access : [],
-				});
-
-				var ev = { expr : EConst(CIdent("v")), pos : pos };
-				var evar = { expr : EConst(CIdent(v.name + "_")), pos : pos };
-				
-				var set = [
-					macro modified = true,
-					{ expr : EBinop(OpAssign,evar, ev), pos : pos },
-				];
-				if( v.name == "m2pos" )
-					trace(v.name+" "+v.kind);
-				if( v.kind == VConst ) {
-					if( constCount == 32 )
-						Context.error("Too many constants for this shader (max 32)", Context.currentPos());
-					var chk = v.type == TBool ? ev : { expr : EBinop(OpNotEq, ev, { expr : EConst(CIdent("null")), pos : pos } ), pos : pos };
-					var count = { expr : EConst(CInt(""+constCount)), pos : pos };
-					set.push(macro setConstFlag($count, $chk));
-					constCount++;
-				}
-				set.push(macro return v);
-				fields.push( {
-					name : "set_" + v.name,
-					kind : FFun( {
-						ret : t,
-						params : [],
-						args : [{ name : "v",  type : t, opt : false }],
-						expr : {
-							expr : EBlock(set),
-							pos : pos,
-						},
-					}),
-					pos : pos,
-					access : [],
-				});
-				
-				var get = [];
-				switch( v.type ) {
-				case TInt, TFloat, TBool: // no allocation required
-				default:
-					function loadType( t : VarType, eindex, rec = 0 ) {
-						var args = [{ expr : eindex, pos : pos }];
-						var name = switch( t ) {
-						case TBool, TNull, TTexture(_): throw "assert";
-						case TInt: "Int";
-						case TFloat: "Float";
-						case TFloat2, TFloat3, TFloat4:
-							args.push( { expr : EConst(CInt(Tools.floatSize(v.type) + "")), pos : pos } );
-							"Floats";
-						case TMatrix(r, c, t):
-							args.push( { expr : EConst(CInt(r + "")), pos : pos } );
-							args.push( { expr : EConst(CInt(c + "")), pos : pos } );
-							if( t.t ) "MatrixT" else "Matrix";
-						case TArray(t, size):
-							var vi = "i" + rec;
-							var ei = { expr : EConst(CIdent(vi)), pos : pos };
-							var esize = { expr : EConst(CInt(size + "")), pos : pos };
-							var stride = Tools.regSize(t);
-							var load = loadType(t, EBinop(OpAdd, { expr : eindex, pos : pos }, { expr : EBinop(OpMult, { expr : EConst(CIdent(vi)), pos : pos }, { expr : EConst(CInt(stride + "")), pos : pos } ), pos : pos } ), rec + 1);
-							return macro {
-								var a = [];
-								for( $ei in 0...$esize )
-									a.push($load);
-								a;
-							}
-						}
-						return { expr : ECall( { expr : EConst(CIdent("load" + name)), pos : pos }, args), pos : pos };
-					}
-					var load = loadType(v.type, EConst(CInt(v.index + "")));
-					get.push(macro if( $evar == null ) { $evar = $load; modified = true; });
-				}
-				get.push(macro return $evar);
-				
-				if( v.type != TBool ) {
-					function saveType( t : VarType, eindex, evar, rec = 0 ) {
-						var args = [{ expr : eindex, pos : pos }, evar];
-						var name = switch( t ) {
-						case TBool, TNull, TTexture(_): throw "assert";
-						case TInt: "Int";
-						case TFloat: "Float";
-						case TFloat2, TFloat3, TFloat4:
-							args.push( { expr : EConst(CInt(Tools.floatSize(v.type) + "")), pos : pos } );
-							"Floats";
-						case TMatrix(r, c, t):
-							args.push( { expr : EConst(CInt(r + "")), pos : pos } );
-							args.push( { expr : EConst(CInt(c + "")), pos : pos } );
-							if( t.t ) "MatrixT" else "Matrix";
-						case TArray(t, size):
-							var vi = "i" + rec, vk = "k" + rec;
-							var ei = { expr : EConst(CIdent(vi)), pos : pos };
-							var ek = { expr : EConst(CIdent(vk)), pos : pos };
-							var esize = { expr : EConst(CInt(size + "")), pos : pos };
-							var stride = Tools.regSize(t);
-							var save = saveType(
-								t,
-								EBinop(OpAdd, { expr : eindex, pos : pos }, { expr : EBinop(OpMult, { expr : EConst(CIdent(vi)), pos : pos }, { expr : EConst(CInt(stride + "")), pos : pos } ), pos : pos } ),
-								ek,
-								rec + 1
-							);
-							return macro {
-								for( $ei in 0...$esize ) {
-									var $vk = $evar[$ei];
-									if( $ek == null ) break;
-									$save;
-								}
-							}
-						}
-						return { expr : ECall( { expr : EConst(CIdent("save" + name)), pos : pos }, args), pos : pos };
-					}
-					var save = saveType(v.type, EConst(CInt(v.index + "")), evar);
-					switch( v.type ) {
-					case TFloat, TInt:
-						updates.push(save);
-					default:
-						updates.push(macro if( $evar != null ) { $save; $evar = null; });
-					}
-				}
-				
-				fields.push({
-					name : "get_" + v.name,
-					kind : FFun( {
-						ret : t,
-						params : [],
-						args : [],
-						expr : { expr : EBlock(get), pos : pos },
-					}),
-					pos : v.pos,
-					access : [],
-				});
-				
-			case VTexture:
-				var t = realType(v.type, pos);
-				var tid = { expr : EConst(CInt("" + texCount++)), pos : pos };
-				
-				fields.push( {
-					name : v.name,
-					kind : FProp("get","set",t),
-					pos : pos,
-					access : [APublic],
-				});
-				
-				fields.push({
-					name : "get_" + v.name,
-					kind : FFun( {
-						ret : t,
-						params : [],
-						args : [],
-						expr : macro return allTextures[$tid],
-					}),
-					pos : v.pos,
-					access : [AInline],
-				});
-
-				fields.push({
-					name : "set_" + v.name,
-					kind : FFun( {
-						ret : t,
-						params : [],
-						args : [{ name : "v", type : t, opt : false }],
-						expr : macro { allTextures[$tid] = v; return v; },
-					}),
-					pos : v.pos,
-					access : [AInline],
-				});
-			
-			case VInput, VVar, VOut:
-				// skip
-			default:
-				Context.warning(v.name, pos);
-				throw "assert";
-			}
-		}
-		
-		fields.push({
-			name : "updateParams",
-			kind : FFun( {
-				ret : null,
-				args : [],
-				params : [],
-				expr : { expr : EBlock(updates), pos : pos },
-			}),
-			access : [AOverride],
-			pos : pos,
-		});
-		
-		return fields;
-	}
-	
-}
-#end

+ 2 - 2
h3d/impl/Shaders.hx

@@ -1,6 +1,6 @@
 package h3d.impl;
 
-class PointShader extends Shader {
+class PointShader extends hxsl.Shader {
 
 	static var SRC = {
 		var input : {
@@ -21,7 +21,7 @@ class PointShader extends Shader {
 	
 }
 
-class LineShader extends Shader {
+class LineShader extends hxsl.Shader {
 
 	static var SRC = {
 		var input : {

+ 1 - 1
h3d/mat/Material.hx

@@ -10,7 +10,7 @@ class Material {
 	public var blendSrc(default,set) : Blend;
 	public var blendDst(default,set) : Blend;
 	public var colorMask(default,set) : Int;
-	public var shader : Shader;
+	public var shader : hxsl.Shader;
 	
 	public function new(shader) {
 		bits = 0;

+ 1 - 1
h3d/mat/MeshTexture.hx

@@ -1,6 +1,6 @@
 package h3d.mat;
 
-private class MeshShader extends h3d.Shader {
+private class MeshShader extends hxsl.Shader {
 	
 	static var SRC = {
 

+ 1 - 1
h3d/part/DefaultShader.hx

@@ -1,6 +1,6 @@
 package h3d.part;
 
-class DefaultShader extends h3d.Shader {
+class DefaultShader extends hxsl.Shader {
 	
 	static var SRC = {
 		var input : {

+ 2 - 2
samples/Test.hx

@@ -6,8 +6,8 @@ class Test {
 	var engine : h3d.Engine;
 	var time : Float;
 	var scene : Scene;
-	var obj1 : Mesh;
-	var obj2 : Mesh;
+	var obj1 : Mesh<h3d.mat.MeshTexture>;
+	var obj2 : Mesh<h3d.mat.MeshTexture>;
 	
 	function new(root) {
 		this.root = root;