Ver código fonte

added setTexture

bstouls 9 anos atrás
pai
commit
bf899a4828
3 arquivos alterados com 12 adições e 0 exclusões
  1. 4 0
      h3d/impl/TextureCache.hx
  2. 4 0
      h3d/pass/Base.hx
  3. 4 0
      h3d/pass/Default.hx

+ 4 - 0
h3d/impl/TextureCache.hx

@@ -19,6 +19,10 @@ class TextureCache {
 		return cache[index];
 	}
 
+	public function set( t, index ) {
+		cache[index] = t;
+	}
+
 	public function begin( ctx : h3d.impl.RenderContext ) {
 		if( frame != ctx.frame ) {
 			// dispose extra textures we didn't use

+ 4 - 0
h3d/pass/Base.hx

@@ -13,6 +13,10 @@ class Base {
 		return null;
 	}
 
+	public function setTexture( t : h3d.mat.Texture, index = 0 ) {
+		throw "Not implemented";
+	}
+
 	public function compileShader( p : h3d.mat.Pass ) : hxsl.RuntimeShader {
 		throw "Not implemented for this pass";
 		return null;

+ 4 - 0
h3d/pass/Default.hx

@@ -42,6 +42,10 @@ class Default extends Base {
 		return tcache.get(index);
 	}
 
+	override public function setTexture(t:h3d.mat.Texture, index = 0) {
+		tcache.set(t, index);
+	}
+
 	override function dispose() {
 		super.dispose();
 		tcache.dispose();