propper multithreading

This commit is contained in:
STP
2023-12-03 22:12:46 -05:00
parent d8488f24f7
commit 0eff7fc694
10 changed files with 391 additions and 201 deletions

View File

@@ -3,41 +3,43 @@ let scene = Scene();
let distance = 10.0;
let camera = Camera( P(0.0,0.0,distance), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
scene.addCamera("+Z Cam", camera);
let camera = Camera( P(0.0,distance,0.1), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
scene.addCamera("+Y Cam", camera);
let camera = Camera( P(distance,0.0,0.0), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
scene.addCamera("+X Cam", camera);
let camera = Camera( P(0.0,0.0,-distance), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
scene.addCamera("-Z Cam", camera);
let camera = Camera( P(0.0,-distance,0.1), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
scene.addCamera("-Y Cam", camera);
let camera = Camera( P(-distance,0.0,0.0), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
scene.addCamera("-X Cam", camera);
// let camera = Camera( P(0.0,distance,0.1), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
// scene.addCamera("+Y Cam", camera);
// let camera = Camera( P(distance,0.0,0.0), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
// scene.addCamera("+X Cam", camera);
// let camera = Camera( P(0.0,0.0,-distance), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
// scene.addCamera("-Z Cam", camera);
// let camera = Camera( P(0.0,-distance,0.1), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
// scene.addCamera("-Y Cam", camera);
// let camera = Camera( P(-distance,0.0,0.0), P(0.0,0.0,0.0), V(0.0,1.0,0.0));
// 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);
scene.addMaterial("mat1", material);
let material2 = Material(V(0.2,0.9,0.8), V(0.3, 0.8, 0.8), 25.0);
scene.addMaterial("bluegreen2", material);
scene.addMaterial("mat2", 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);
light.active(true);
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));
// light.active(false);
// scene.addLight("red", light);
let light = Ambient(V(0.5,0.5,0.5));
scene.addLight("ambient", light);
// let light = Ambient(V(0.5,0.5,0.5));
// light.active(false);
// scene.addLight("ambient", light);
let sphere = Sphere(P(0.0,-10.0,0.0), 10.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);
@@ -48,11 +50,11 @@ scene.addNode("sphere",sphere_node);
// child.translate(V(1.0,1.0,1.0));
//scene.addNode(child);
let cube = CubeUnit();
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 sphere2= SphereUnit();
let sphere2_node = Node( sphere2, material2);
// sphere2_node.rotate(0.1,0.1,0.0);
// sphere2_node.translate(0.0,1.0,0.0);
scene.addNode("sphere", sphere2_node);
//let gnonom = Gnonom();
//let gnonom_node = Node(gnonom, material);

32
rhai/space.rhai Normal file
View File

@@ -0,0 +1,32 @@
let scene = Scene();
let falloff = V(0.0,0.0,0.0);
//CAMERAS
let camera = Camera( P(100.0,100.0,100.0), P(500.0,500.0,500.0), V(0.0,1.0,0.0));
scene.addCamera("Main Camera", camera);
//Light for the sun
let light = Light(P(800.0, 800.0, 250.0), V(1.0, 1.0, 0.929), falloff);
scene.addLight("Sun", light);
//Ball for the sun
let material = Material(V(1.0, 1.0, 0.9), V(0.9, 0.9, 0.9), 10.0);
scene.addMaterial("material_sun", material);
let sphere = Sphere(P(800.0, 800.0, 200.0), 50.0);
let sphere_node = Node(sphere, material);
scene.addNode("sphere", sphere_node);
//Ball for the planet
let material = Material(V(0.2,0.8,0.2), V(0.2, 0.8, 0.8), 10.0);
scene.addMaterial("material_planet", material);
let sphere = Sphere(P(500.0, 500.0, 500.0), 50.0);
let sphere_node = Node(sphere, material);
scene.addNode("sphere", sphere_node);
// let sphere = Steiner( material);
// let sphere_node = Node(sphere);
// scene.addNode("sphere", sphere_node);
scene