-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add examples and example select form
- Loading branch information
Showing
8 changed files
with
108 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { ReactElement, useState } from "react"; | ||
import { Button } from "../Inputs/Button"; | ||
import { exampleNames } from "../io"; | ||
|
||
export const ExampleSelect = ({ | ||
id, | ||
selected, | ||
setSelected, | ||
}: { | ||
id: string; | ||
selected: string; | ||
setSelected: React.Dispatch<React.SetStateAction<string>>; | ||
}): ReactElement => { | ||
const options = exampleNames.map((name, index) => ( | ||
<option value={name} key={index}> | ||
{name} | ||
</option> | ||
)); | ||
return ( | ||
<select | ||
id={id} | ||
value={selected} | ||
onChange={(e) => setSelected(e.target.value)} | ||
> | ||
{options} | ||
</select> | ||
); | ||
}; | ||
|
||
export const ExampleForm = ({ handleExample }: { handleExample: any }) => { | ||
const [selectedExample, setSelectedExample] = useState("cornell"); | ||
|
||
return ( | ||
<> | ||
<label htmlFor="exampleSelect">select example:</label> | ||
<ExampleSelect | ||
id={"exampleSelect"} | ||
selected={selectedExample} | ||
setSelected={setSelectedExample} | ||
/> | ||
<label htmlFor="loadExampleButton">load example:</label> | ||
<Button | ||
id="loadExampleButton" | ||
handleClick={() => handleExample()} | ||
text="load" | ||
/> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"time_0":0,"time_1":1,"camera":{"look_from":[278,278,-800],"look_at":[278,278,0],"up":[0,1,0],"vertical_fov":40,"aperture":0,"focus_distance":10},"background_color":[0,0,0],"objects":[{"kind":"Quad","q":[555,0,0],"u":[0,0,555],"v":[0,555,0],"material":"green wall","comment":"green wall, left"},{"kind":"Quad","q":[0,0,555],"u":[0,0,-555],"v":[0,555,0],"material":"red wall","comment":"red wall, right"},{"kind":"Quad","q":[0,0,0],"u":[555,0,0],"v":[0,0,555],"material":"grey wall","comment":"floor"},{"kind":"Quad","q":[0,555,0],"u":[555,0,0],"v":[0,0,555],"material":"grey wall","comment":"ceiling"},{"kind":"Quad","q":[0,0,555],"u":[555,0,0],"v":[0,555,0],"material":"grey wall","comment":"back wall"},{"kind":"Quad","q":[113,554,127],"u":[330,0,0],"v":[0,0,305],"material":"lamp","comment":"big ceiling light","priority":true},{"kind":"Translate","offset":[265,0,295],"comment":"moved tall box","object":{"kind":"RotateY","angle":15,"comment":"rotated tall box","object":{"kind":"Boxy","corner_0":[0,0,0],"corner_1":[165,330,165],"material":"grey wall","comment":"tall box"}}},{"kind":"Sphere","center":[190,90,190],"radius":90,"material":"Dense flint glass SF10","comment":"glass sphere","priority":true}],"materials":[{"name":"Dense flint glass SF10","kind":"Dispersive","cauchy_a":1.728,"cauchy_b":0.01342},{"name":"lamp","kind":"DiffuseLight","emit":{"kind":"SolidColor","color":[7,7,7]}},{"name":"green wall","kind":"Lambertian","albedo":{"kind":"SolidColor","color":[0.12,0.45,0.15]}},{"name":"red wall","kind":"Lambertian","albedo":{"kind":"SolidColor","color":[0.65,0.05,0.05]}},{"name":"grey wall","kind":"Lambertian","albedo":{"kind":"SolidColor","color":[0.73,0.73,0.73]}}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "time_0": 0, "time_1": 1, "camera": { "look_from": [-600, 310, -400], "look_at": [0, 310, 0], "up": [0, 1, 0], "vertical_fov": 35, "aperture": 0, "focus_distance": 10 }, "background_color": [0, 0, 0], "objects": [ { "kind": "Quad", "q": [555, 0, 0], "u": [0, 0, 555], "v": [0, 555, 0], "material": "grey wall", "comment": "wall, left" }, { "kind": "Quad", "q": [113, 750, 127], "u": [330, 0, 0], "v": [0, 0, 305], "material": "big lamp", "comment": "big ceiling light", "priority": true }, { "kind": "Quad", "q": [277, 554, 140], "u": [10, 0, 0], "v": [0, 0, 278], "material": "narrow lamp", "comment": "narrow ceiling light", "priority": true }, { "kind": "STL", "center": [300, 350, 278], "scale": 20, "rotation": [0, 0, -30], "path": "stl/prism.stl", "material": "Dense flint glass SF10", "comment": "triangular prism", "priority": true } ], "materials": [ { "name": "dielectric glass", "kind": "Dielectric", "refractive_index": 1.5, "color": [1, 1, 1] }, { "name": "Fused silica", "kind": "Dispersive", "cauchy_a": 1.458, "cauchy_b": 0.00354 }, { "name": "Borosilicate glass BK7", "kind": "Dispersive", "cauchy_a": 1.5046, "cauchy_b": 0.0042 }, { "name": "Hard crown glass K5", "kind": "Dispersive", "cauchy_a": 1.522, "cauchy_b": 0.00459 }, { "name": "Barium crown glass BaK4", "kind": "Dispersive", "cauchy_a": 1.569, "cauchy_b": 0.00531 }, { "name": "Barium flint glass BaF10", "kind": "Dispersive", "cauchy_a": 1.67, "cauchy_b": 0.00743 }, { "name": "Dense flint glass SF10", "kind": "Dispersive", "cauchy_a": 1.728, "cauchy_b": 0.01342 }, { "name": "Super dispersive glass", "kind": "Dispersive", "cauchy_a": 1.8, "cauchy_b": 0.5 }, { "name": "big lamp", "kind": "DiffuseLight", "emit": { "kind": "SolidColor", "color": [2, 2, 2] } }, { "name": "narrow lamp", "kind": "ConeLight", "spread": 2.0, "emit": { "kind": "SolidColor", "color": [25, 25, 25] } }, { "name": "grey wall", "kind": "Lambertian", "albedo": { "kind": "SolidColor", "color": [0.73, 0.73, 0.73] } } ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters