-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
113 additions
and
49 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
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
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
24 changes: 0 additions & 24 deletions
24
packages/abstract-visuals-example/src/app/abstract-3d-example-react.tsx
This file was deleted.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
packages/abstract-visuals-example/src/app/abstract-3d-example.tsx
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,76 @@ | ||
import * as React from "react"; | ||
import FileSaver from "file-saver"; | ||
import * as A3D from "abstract-3d"; | ||
|
||
export function Abstract3DExample(): React.ReactNode { | ||
return ( | ||
<div style={{ display: "flex", flexDirection: "column", height: "100%" }}> | ||
<div style={{ display: "flex", height: "20px", background: "rgb(251, 251, 251)" }}> | ||
<button | ||
onClick={() => FileSaver.saveAs(new Blob([A3D.toDxf(scene, "front")], { type: "text/plain" }), `a3d.dxf`)} | ||
> | ||
DXF | ||
</button> | ||
<button onClick={() => FileSaver.saveAs(new Blob([A3D.toStl(scene)], { type: "text/plain" }), `a3d.stl`)}> | ||
STL | ||
</button> | ||
<button | ||
onClick={() => | ||
FileSaver.saveAs( | ||
new Blob([A3D.toSvg(scene, "front", 2, { size: 180, scaleByWidth: true }).image], { type: "text/plain" }), | ||
`a3d.svg` | ||
) | ||
} | ||
> | ||
SVG | ||
</button> | ||
</div> | ||
<div style={{ height: "calc(100% - 20px)" }}> | ||
<A3D.toReact scene={scene} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
const scene: A3D.Scene = { | ||
center: A3D.vec3Zero, | ||
size: A3D.vec3(40, 40, 40), | ||
groups: [ | ||
{ | ||
pos: A3D.vec3Zero, | ||
meshes: [ | ||
A3D.box( | ||
A3D.vec3(10, 2, 10), | ||
{ type: "Phong", hover: "rgb(50,50,50)", normal: "rgb(150,150,150)" }, | ||
A3D.vec3(0, -6, 0) | ||
), | ||
A3D.box( | ||
A3D.vec3(1, 10, 1), | ||
{ type: "Phong", hover: "rgb(50,50,50)", normal: "rgb(150,150,150)" }, | ||
A3D.vec3(-4.5, 0, 4.5) | ||
), | ||
A3D.box( | ||
A3D.vec3(1, 10, 1), | ||
{ type: "Phong", hover: "rgb(50,50,50)", normal: "rgb(150,150,150)" }, | ||
A3D.vec3(4.5, 0, 4.5) | ||
), | ||
A3D.box( | ||
A3D.vec3(1, 10, 1), | ||
{ type: "Phong", hover: "rgb(50,50,50)", normal: "rgb(150,150,150)" }, | ||
A3D.vec3(-4.5, 0, -4.5) | ||
), | ||
A3D.box( | ||
A3D.vec3(1, 10, 1), | ||
{ type: "Phong", hover: "rgb(50,50,50)", normal: "rgb(150,150,150)" }, | ||
A3D.vec3(4.5, 0, -4.5) | ||
), | ||
A3D.box( | ||
A3D.vec3(10, 2, 10), | ||
{ type: "Phong", hover: "rgb(50,50,50)", normal: "rgb(150,150,150)" }, | ||
A3D.vec3(0, 6, 0) | ||
), | ||
A3D.sphere(3, { type: "Phong", hover: "rgb(120,30,30)", normal: "rgb(150,50,50)" }, A3D.vec3(0, 0, 0)), | ||
], | ||
}, | ||
], | ||
}; |
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 |
---|---|---|
|
@@ -2213,6 +2213,11 @@ | |
"@types/qs" "*" | ||
"@types/serve-static" "*" | ||
|
||
"@types/file-saver@^2.0.7": | ||
version "2.0.7" | ||
resolved "https://registry.yarnpkg.com/@types/file-saver/-/file-saver-2.0.7.tgz#8dbb2f24bdc7486c54aa854eb414940bbd056f7d" | ||
integrity sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A== | ||
|
||
"@types/glob@^7.1.1": | ||
version "7.2.0" | ||
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" | ||
|
@@ -5973,6 +5978,11 @@ file-entry-cache@^6.0.1: | |
dependencies: | ||
flat-cache "^3.0.4" | ||
|
||
file-saver@^2.0.5: | ||
version "2.0.5" | ||
resolved "https://registry.yarnpkg.com/file-saver/-/file-saver-2.0.5.tgz#d61cfe2ce059f414d899e9dd6d4107ee25670c38" | ||
integrity sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA== | ||
|
||
[email protected]: | ||
version "2.3.0" | ||
resolved "https://registry.yarnpkg.com/file-system-cache/-/file-system-cache-2.3.0.tgz#201feaf4c8cd97b9d0d608e96861bb6005f46fe6" | ||
|