<commit_before>package com.haxademic.demo.render.joons;

import com.haxademic.core.app.P;
import com.haxademic.core.app.PAppletHax;
import com.haxademic.core.constants.AppSettings;
import com.haxademic.core.draw.context.DrawUtil;
import com.haxademic.core.draw.shapes.PShapeUtil;
import com.haxademic.core.file.FileUtil;
import com.haxademic.core.render.JoonsWrapper;

import processing.core.PShape;

public class JoonsPShapeRenderSVG
extends PAppletHax {
	public static void main(String args[]) { PAppletHax.main(Thread.currentThread().getStackTrace()[1].getClassName()); }

	protected PShape obj;
	protected float objHeight;
	protected float frames = 60;
	
	protected void overridePropsFile() {
		p.appConfig.setProperty( AppSettings.SUNFLOW, true );
		p.appConfig.setProperty( AppSettings.SUNFLOW_ACTIVE, true );
		p.appConfig.setProperty( AppSettings.SUNFLOW_QUALITY, AppSettings.SUNFLOW_QUALITY_HIGH );

		p.appConfig.setProperty( AppSettings.WIDTH, 960 );
		p.appConfig.setProperty( AppSettings.HEIGHT, 720 );
		p.appConfig.setProperty( AppSettings.RENDERING_IMAGE_SEQUENCE, false );
		p.appConfig.setProperty( AppSettings.RENDERING_IMAGE_SEQUENCE_START_FRAME, 3 );
		p.appConfig.setProperty( AppSettings.RENDERING_IMAGE_SEQUENCE_STOP_FRAME, 3 + (int) frames - 1 );
	}

	public void setup() {
		super.setup();
		
		// load & repair tesselated shape
		obj = p.loadShape( FileUtil.getFile("svg/cacheflowe-logotype-new.svg")).getTessellation();
		PShapeUtil.repairMissingSVGVertex(obj);
			
		// create extrusion
		obj = PShapeUtil.createExtrudedShape( obj, 5 );
		PShapeUtil.centerShape(obj);
		objHeight = p.height * 0.4f; // PShapeUtil.getObjHeight(obj);
		PShapeUtil.scaleShapeToExtent(obj, objHeight);
	}


	public void drawApp() {
		if(p.appConfig.getBoolean(AppSettings.SUNFLOW_ACTIVE, false) == false) {
			p.background(0);
			p.lights();
			p.noStroke();
		}
//		joons.jr.background(JoonsWrapper.BACKGROUND_GI);
		joons.jr.background(JoonsWrapper.BACKGROUND_AO);
		p.translate(0, 0, -width);
		
		// progress
		float progress = (p.frameCount % frames) / frames;

		// draw environment
		p.pushMatrix();
		setUpRoom();
		p.popMatrix();

		// rotate room
//		p.rotateZ(P.PI);
		p.rotateY(-0.3f + P.sin(progress * P.TWO_PI) * 0.03f);

		// draw shape
		p.pushMatrix();
		joons.jr.fill(JoonsWrapper.MATERIAL_PHONG, 217, 37, 34);		p.fill( 217, 37, 34 );
		PShapeUtil.drawTrianglesJoons(p, obj, 1);
		p.popMatrix();

		// draw floor
		p.pushMatrix();
		DrawUtil.setDrawCenter(p);
		p.translate(0, objHeight);
		joons.jr.fill(JoonsWrapper.MATERIAL_PHONG, 110, 130, 110);		p.fill( 110, 130, 110 );
		p.box(p.height * 4, 2, p.height * 4);
		p.popMatrix();
		
		// draw back wall
		p.pushMatrix();
		DrawUtil.setDrawCenter(p);
		p.translate(0, 0, -5);
		joons.jr.fill(JoonsWrapper.MATERIAL_PHONG, 110, 130, 110);		p.fill( 110, 130, 110 );
		p.box(p.height * 4, p.height * 4, 2);
		p.popMatrix();
	}

	protected void setUpRoom() {
		pushMatrix();
		translate(0, 0, 0);
		float radiance = 10;
		int samples = 16;
		joons.jr.background(JoonsWrapper.CORNELL_BOX, 
				4000, 3000, 5000,						// width, height, depth
				radiance, radiance, radiance, samples,  // radiance rgb & samples
				40, 40, 40, 							// left rgb
				40, 40, 40, 							// right rgb
				0, 0, 0,	 							// back rgb
				60, 60, 60, 							// top rgb
				60, 60, 60  							// bottom rgb
		); 
		popMatrix();		
	}
	
}<commit_msg>Update demo - fix responsive height<commit_after>package com.haxademic.demo.render.joons;

import com.haxademic.core.app.P;
import com.haxademic.core.app.PAppletHax;
import com.haxademic.core.constants.AppSettings;
import com.haxademic.core.draw.context.DrawUtil;
import com.haxademic.core.draw.shapes.PShapeUtil;
import com.haxademic.core.file.FileUtil;
import com.haxademic.core.render.JoonsWrapper;

import processing.core.PShape;

public class JoonsPShapeRenderSVG
extends PAppletHax {
	public static void main(String args[]) { PAppletHax.main(Thread.currentThread().getStackTrace()[1].getClassName()); }

	protected PShape obj;
	protected float objHeight;
	protected float frames = 60;
	
	protected void overridePropsFile() {
		p.appConfig.setProperty( AppSettings.SUNFLOW, true );
		p.appConfig.setProperty( AppSettings.SUNFLOW_ACTIVE, true );
		p.appConfig.setProperty( AppSettings.SUNFLOW_QUALITY, AppSettings.SUNFLOW_QUALITY_HIGH );

		p.appConfig.setProperty( AppSettings.WIDTH, 960 );
		p.appConfig.setProperty( AppSettings.HEIGHT, 720 );
		p.appConfig.setProperty( AppSettings.RENDERING_IMAGE_SEQUENCE, false );
		p.appConfig.setProperty( AppSettings.RENDERING_IMAGE_SEQUENCE_START_FRAME, 3 );
		p.appConfig.setProperty( AppSettings.RENDERING_IMAGE_SEQUENCE_STOP_FRAME, 3 + (int) frames - 1 );
	}

	public void setup() {
		super.setup();
		
		// load & repair tesselated shape
		obj = p.loadShape( FileUtil.getFile("svg/diamond.svg")).getTessellation();
		PShapeUtil.repairMissingSVGVertex(obj);
			
		// create extrusion
		obj = PShapeUtil.createExtrudedShape( obj, 45 );
		PShapeUtil.centerShape(obj);
		objHeight = p.height * 0.35f; // PShapeUtil.getObjHeight(obj);
		PShapeUtil.scaleShapeToHeight(obj, objHeight);
	}


	public void drawApp() {
		if(p.appConfig.getBoolean(AppSettings.SUNFLOW_ACTIVE, false) == false) {
			p.background(0);
			p.lights();
			p.noStroke();
		}
		joons.jr.background(JoonsWrapper.BACKGROUND_AO);
		p.translate(0, 0, -width);
		
		// progress
		float progress = (p.frameCount % frames) / frames;

		// draw environment
		p.pushMatrix();
		setUpRoom();
		p.popMatrix();

		// rotate room
//		p.rotateZ(P.PI);
//		p.rotateY(-0.3f + P.sin(progress * P.TWO_PI) * 0.03f);

		// draw shape
		p.pushMatrix();
		joons.jr.fill(JoonsWrapper.MATERIAL_SHINY, 20, 20, 20, 0.7f);		p.fill( 20, 20, 20 );
		PShapeUtil.drawTrianglesJoons(p, obj, 1);
		p.popMatrix();

		// draw floor
		p.pushMatrix();
		DrawUtil.setDrawCenter(p);
//		float mult = P.map(p.mouseX, 0, p.width, 0, 1);
////		P.println("mult", mult);
		p.translate(0, objHeight);
		joons.jr.fill(JoonsWrapper.MATERIAL_SHINY, 255, 255, 255, 0.6f);		p.fill( 255, 255, 255 );
		p.box(p.height * 4, 2, p.height * 2f);
		p.popMatrix();
		
		// draw back wall
		p.pushMatrix();
		DrawUtil.setDrawCenter(p);
		p.translate(0, 0, -5);
		joons.jr.fill(JoonsWrapper.MATERIAL_PHONG, 255, 255, 255);		p.fill( 255, 255, 255 );
		p.box(p.height * 4, p.height * 4, 2);
		p.popMatrix();
	}

	protected void setUpRoom() {
		pushMatrix();
		translate(0, 0, 0);
		float radiance = 10;
		int samples = 16;
		joons.jr.background(JoonsWrapper.CORNELL_BOX, 
				4000, 3000, 5000,						// width, height, depth
				radiance, radiance, radiance, samples,  // radiance rgb & samples
				40, 40, 40, 							// left rgb
				40, 40, 40, 							// right rgb
				0, 0, 0,	 							// back rgb
				60, 60, 60, 							// top rgb
				60, 60, 60  							// bottom rgb
		); 
		popMatrix();		
	}
	
}
{'fraction_non_alphanumeric': 0.14294057526646226, 'fraction_numerical': 0.03898379325448971, 'mean_word_length': 3.675767918088737, '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': '4440080', 'n_tokens_mistral': 3102, 'n_tokens_neox': 2564, 'n_words': 486}