<commit_before>import hxd.Math;
import h3d.pass.ScalableAO;
import hxd.Key in K;

class CustomRenderer extends h3d.scene.DefaultRenderer {

	public var sao : h3d.pass.ScalableAO;
	public var saoBlur : h3d.pass.Blur;
	public var mode = 0;
	public var hasMRT : Bool;
	var out : h3d.mat.Texture;

	public var bench = new h3d.impl.Benchmark();

	public function new() {
		super();
		sao = new h3d.pass.ScalableAO();
		// TODO : use a special Blur that prevents bluring across depths
		saoBlur = new h3d.pass.Blur(3, 3, 2);
		sao.shader.sampleRadius	= 0.2;
		hasMRT = h3d.Engine.getCurrent().driver.hasFeature(MultipleRenderTargets);
		if( hasMRT ) {
			allPasses.remove(defaultPass);
			defaultPass = new h3d.pass.MRT([Value("output.color"), PackFloat(Value("output.depth")), PackNormal(Value("output.normal"))], 0, true);
			allPasses.push(defaultPass);
		}
	}

	override function renderPass(p:h3d.pass.Base, passes) {
		bench.measure(p.name);
		return super.renderPass(p, passes);
	}

	override function render() {
		super.render();
		if(mode != 1) {
			bench.measure("sao");
			var saoTarget = allocTarget("sao",0,false);
			setTarget(saoTarget);
			if( hasMRT )
				sao.apply(defaultPass.getTexture(1), defaultPass.getTexture(2), ctx.camera);
			else
				sao.apply(depth.getTexture(), normal.getTexture(), ctx.camera);
			resetTarget();
			bench.measure("saoBlur");
			saoBlur.apply(saoTarget, allocTarget("saoBlurTmp", 0, false));
			bench.measure("saoBlend");
			if( hasMRT ) h3d.pass.Copy.run(def.getTexture(0), null);
			copy(saoTarget, null, mode == 0 ? Multiply : null);
		} else if( hasMRT )
			copy(defaultPass.getTexture(0), null);
	}

}

class Sao extends SampleApp {<commit_msg>fixed sao compilation (still buggy with mrt)<commit_after>import hxd.Math;
import h3d.pass.ScalableAO;
import hxd.Key in K;

class CustomRenderer extends h3d.scene.DefaultRenderer {

	public var sao : h3d.pass.ScalableAO;
	public var saoBlur : h3d.pass.Blur;
	public var mode = 0;
	public var hasMRT : Bool;
	var out : h3d.mat.Texture;
	var mrt : h3d.pass.MRT;

	public var bench = new h3d.impl.Benchmark();

	public function new() {
		super();
		sao = new h3d.pass.ScalableAO();
		// TODO : use a special Blur that prevents bluring across depths
		saoBlur = new h3d.pass.Blur(3, 3, 2);
		sao.shader.sampleRadius	= 0.2;
		hasMRT = h3d.Engine.getCurrent().driver.hasFeature(MultipleRenderTargets);
		if( hasMRT ) {
			allPasses.remove(defaultPass);
			defaultPass = mrt = new h3d.pass.MRT([Value("output.color"), PackFloat(Value("output.depth")), PackNormal(Value("output.normal"))], 0, true);
			allPasses.push(defaultPass);
		}
	}

	override function renderPass(p:h3d.pass.Base, passes) {
		bench.measure(p.name);
		return super.renderPass(p, passes);
	}

	override function render() {
		super.render();
		if(mode != 1) {
			bench.measure("sao");
			var saoTarget = allocTarget("sao",0,false);
			setTarget(saoTarget);
			if( hasMRT )
				sao.apply(mrt.getTexture(1), mrt.getTexture(2), ctx.camera);
			else
				sao.apply(ctx.textures.get(0), ctx.textures.get(1), ctx.camera);
			resetTarget();
			bench.measure("saoBlur");
			saoBlur.apply(saoTarget, allocTarget("saoBlurTmp", 0, false));
			bench.measure("saoBlend");
			if( hasMRT ) h3d.pass.Copy.run(mrt.getTexture(0), null);
			copy(saoTarget, null, mode == 0 ? Multiply : null);
		} else if( hasMRT )
			copy(mrt.getTexture(0), null);
	}

}

class Sao extends SampleApp {
{'fraction_non_alphanumeric': 0.15013169446883232, 'fraction_numerical': 0.016681299385425813, 'mean_word_length': 4.242331288343558, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2795363', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1281, 'n_words': 264}