Skip to content

Instantly share code, notes, and snippets.

@billautomata
Created February 4, 2014 22:27
Show Gist options
  • Save billautomata/8813634 to your computer and use it in GitHub Desktop.
Save billautomata/8813634 to your computer and use it in GitHub Desktop.
hemesh2embree use
import wblut.hemesh.modifiers.*;
import wblut.geom.frame.*;
import wblut.hemesh.composite.*;
import wblut.core.processing.*;
import wblut.hemesh.tools.*;
import wblut.hemesh.simplifiers.*;
import wblut.hemesh.subdividors.*;
import wblut.geom.nurbs.*;
import wblut.core.random.*;
import wblut.geom.triangulate.*;
import wblut.hemesh.creators.*;
import wblut.geom.tree.*;
import wblut.hemesh.core.*;
import wblut.geom.grid.*;
import wblut.core.structures.*;
import wblut.core.math.*;
import wblut.geom.core.*;
HE_Mesh floorMesh;
HE_Mesh testBox, testBox2;
WB_Render render;
void setup(){
size(960,540,OPENGL);
floorMesh = new HE_Mesh(new HEC_Box().setDepth(1000.0).setHeight(1000.0).setWidth(1.0));
//testBox = new HE_Mesh(new HEC_Sphere().setRadius(20.0).setUFacets(6).setVFacets(6)).moveTo(150.0, 300.0, 0.0);
testBox = new HE_Mesh(new HEC_Box().setDepth(10.0).setHeight(10.0).setWidth(100.0)).moveTo(250.0, 0.0, 0.0);
testBox2 = new HE_Mesh(new HEC_Box().setDepth(300.0).setHeight(100.0).setWidth(100.0)).moveTo(50.0, 0.0, 0.0);
render = new WB_Render(this);
EMB_Scene scene = new EMB_Scene("test");
scene.AddMesh(new EMB_Mesh(floorMesh, new EMB_Material(MATTE)));
scene.AddMesh(new EMB_Mesh(testBox2, new EMB_Material(MATTE).setColor(0.8,0.8,0.9).setInternalETA(10.333).setExternalETA(3.3)));
scene.Export();
EMB_RenderSettings renderSettings = new EMB_RenderSettings().setAmbientLight(0.05);
renderSettings.AddLight(new EMB_Mesh(testBox, new EMB_Material(LIGHT).setColor(0.0, 0.0, 1000.0)));
renderSettings.Export("testScene", scene, new EMB_Camera());
exit();
}
void draw(){
background(0);
translate(width*0.5, height*0.5);
fill(255,0,0); noStroke();
rotateX(mouseY*0.01);
rotateY(mouseX*0.01);
render.drawFaces(floorMesh);
fill(0,255,0);
render.drawFaces(testBox);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment