BVH and rays complete
This commit is contained in:
@@ -10,18 +10,20 @@ scene.addCamera("Cam", camera);
|
||||
|
||||
let falloff = V(0.0,0.0,0.0);
|
||||
let light = Light(P(6.0,6.0,6.0), V(0.4,0.4,0.4), falloff);
|
||||
light.active(false);
|
||||
light.active(true);
|
||||
scene.addLight("white", light);
|
||||
let light = Light(P(2.0,0.0,0.0), V(0.0,1.0,0.0), V(0.1, 0.01, 0.001));
|
||||
let light = Light(P(2.0,0.0,0.0), V(1.0,1.0,0.0), falloff);
|
||||
light.active(false);
|
||||
scene.addLight("green", light);
|
||||
let light = Light(P(-2.0,0.0,0.0), V(1.0,0.0,0.0), V(0.1, 0.01, 0.001));
|
||||
let light = Light(P(-2.0,0.0,0.0), V(1.0,0.0,0.0), falloff);
|
||||
light.active(false);
|
||||
scene.addLight("red", light);
|
||||
|
||||
let light = Ambient(V(0.3,0.3,0.3));
|
||||
light.active(false);
|
||||
scene.addLight("ambient", light);
|
||||
|
||||
|
||||
let tri = TriangleUnit();
|
||||
let tri_node = Node(tri, material);
|
||||
tri_node.active(false);
|
||||
@@ -39,7 +41,7 @@ scene.addNode("cone", cone_node);
|
||||
|
||||
let torus = Torus(0.5, 1.5);
|
||||
let torus_node = Node(torus, material);
|
||||
torus_node.active(true);
|
||||
torus_node.active(false);
|
||||
scene.addNode("torus", torus_node);
|
||||
|
||||
|
||||
@@ -59,7 +61,8 @@ scene.addNode("ground", ground_node);
|
||||
|
||||
let mesh = Mesh("obj/cat.obj");
|
||||
let mesh_node = Node(mesh, material);
|
||||
mesh_node.active(false);
|
||||
mesh_node.active(true);
|
||||
mesh_node.rotate(0.0,90.0,90.0);
|
||||
scene.addNode("mesh", mesh_node);
|
||||
|
||||
|
||||
|
||||
@@ -16,46 +16,46 @@ scene.addCamera("-X Cam", camera);
|
||||
|
||||
let material = Material(V(0.2,0.9,0.8), V(0.3, 0.8, 0.8), 10.0);
|
||||
scene.addMaterial("bluegreen", material);
|
||||
let material2 = Material(V(0.2,0.9,0.8), V(0.3, 0.8, 0.8), 25.0);
|
||||
scene.addMaterial("bluegreen2", material);
|
||||
|
||||
|
||||
let light = Light(P(0.0,7.0,0.0), V(0.0,0.0,1.0), V(0.1, 0.01, 0.001));
|
||||
light.active(false);
|
||||
scene.addLight("blue", light);
|
||||
|
||||
// let light = Light( P(2.0,7.0,0.0), V(0.0,1.0,0.0), V(0.1, 0.01, 0.001));
|
||||
// light.active(false);
|
||||
// scene.addLight("green", light);
|
||||
let light = Light( P(2.0,7.0,0.0), V(0.0,1.0,0.0), V(0.1, 0.01, 0.001));
|
||||
light.active(false);
|
||||
scene.addLight("green", light);
|
||||
|
||||
// let light = Light( P(2.0,7.0,2.0), V(1.0,0.5,0.5), V(0.0, 0.00, 0.001));
|
||||
// scene.addLight("red", light);
|
||||
let light = Light( P(2.0,7.0,2.0), V(1.0,0.5,0.5), V(0.0, 0.00, 0.001));
|
||||
scene.addLight("red", light);
|
||||
|
||||
let light = Ambient(V(0.1,0.1,0.1));
|
||||
let light = Ambient(V(0.5,0.5,0.5));
|
||||
scene.addLight("ambient", light);
|
||||
|
||||
|
||||
// let sphere = Sphere(P(0.0,0.0,0.0), 1.0 );
|
||||
// let sphere_node = Node( sphere, material);
|
||||
// scene.addNode("sphere",sphere_node);
|
||||
let sphere = Sphere(P(0.0,-10.0,0.0), 10.0 );
|
||||
let sphere_node = Node( sphere, material);
|
||||
scene.addNode("sphere",sphere_node);
|
||||
|
||||
//let mesh = Mesh("obj/cow.obj" );
|
||||
//let mesh_node = Node(mesh);
|
||||
//scene.addNode("mesh", mesh_node);
|
||||
|
||||
for i in 0..6 {
|
||||
let sphere = Sphere(P(0.0,0.0,0.0), 2.0 );
|
||||
let sphere_node = Node( sphere, material);
|
||||
sphere_node.translate(4.0*cos(i.to_float()), -4.0, 4.0*sin(i.to_float()));
|
||||
scene.addNode(i.to_string(), sphere_node);
|
||||
}
|
||||
|
||||
// let child = sphere_node.child(sphere);
|
||||
// child.translate(V(1.0,1.0,1.0));
|
||||
//scene.addNode(child);
|
||||
|
||||
let cube = CubeUnit();
|
||||
let cube_node = Node( cube, material);
|
||||
let cube_node = Node( cube, material2);
|
||||
cube_node.rotate(0.1,0.1,45.0);
|
||||
cube_node.translate(0.0,1.0,0.0);
|
||||
scene.addNode("cube", cube_node);
|
||||
|
||||
//let gnonom = Gnonom();
|
||||
//let gnonom_node = Node(gnonom);
|
||||
//let gnonom_node = Node(gnonom, material);
|
||||
//scene.addNode("gnonom", gnonom_node);
|
||||
|
||||
//let cylinder = Cylinder(2.0,1.0 );
|
||||
|
||||
Reference in New Issue
Block a user