-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added default css, update worker imports to support vite module…
… worker bundling
- Loading branch information
Showing
5 changed files
with
91 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,55 @@ | ||
/* Base CSS Reset */ | ||
html, | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
html { | ||
scroll-behavior: smooth; | ||
font-size: 100%; /* Adjust this if needed */ | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
body { | ||
line-height: 1.5; | ||
min-height: 100vh; | ||
} | ||
|
||
img, | ||
picture, | ||
video, | ||
canvas, | ||
svg { | ||
display: block; | ||
max-width: 100%; | ||
} | ||
|
||
input, | ||
button, | ||
textarea, | ||
select { | ||
font: inherit; /* Use the same font as the rest of the app */ | ||
} | ||
|
||
a { | ||
text-decoration: none; | ||
color: inherit; | ||
} | ||
|
||
ul, | ||
ol { | ||
list-style: none; | ||
} | ||
|
||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0; | ||
} | ||
|
||
:root { | ||
--border-radius: 4px; /* Example base radius for customization */ | ||
--transition-duration: 0.3s; /* Example transition duration */ | ||
} |
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 |
---|---|---|
@@ -1,42 +1,34 @@ | ||
import { Attribute } from '@bananagl/models/attribute'; | ||
import { Buffer } from '@bananagl/models/buffer'; | ||
import { Attribute } from "@bananagl/models/attribute"; | ||
import { Buffer } from "@bananagl/models/buffer"; | ||
|
||
import { TriangleBVHBuilder } from './builder'; | ||
import { BuilderOutput, TriangleBuildInput, getTrasferables, toTransferable } from './transform'; | ||
import { TriangleBVHBuilder } from "./builder"; | ||
import { BuilderOutput, TriangleBuildInput, getTrasferables, toTransferable } from "./transform"; | ||
|
||
self.onmessage = (e) => { | ||
const data = e.data as TriangleBuildInput; | ||
const { position, attrs } = toAttributes(data); | ||
const builder = new TriangleBVHBuilder(position, attrs); | ||
const returnedAttrs = toTransferable(position, attrs); | ||
const transferables = getTrasferables(returnedAttrs); | ||
const result: BuilderOutput = { | ||
data: returnedAttrs, | ||
rootNode: builder.root, | ||
}; | ||
(self as any).postMessage(result, transferables); | ||
const data = e.data as TriangleBuildInput; | ||
const { position, attrs } = toAttributes(data); | ||
const builder = new TriangleBVHBuilder(position, attrs); | ||
const returnedAttrs = toTransferable(position, attrs); | ||
const transferables = getTrasferables(returnedAttrs); | ||
const result: BuilderOutput = { | ||
data: returnedAttrs, | ||
rootNode: builder.root, | ||
}; | ||
(self as any).postMessage(result, transferables); | ||
}; | ||
|
||
function toAttributes(data: TriangleBuildInput) { | ||
return { | ||
position: new Attribute( | ||
data.position.name, | ||
new Buffer(data.position.buffer.data), | ||
data.position.size, | ||
data.position.normalized, | ||
data.position.stride, | ||
data.position.offset | ||
), | ||
attrs: data.attrs.map( | ||
(a) => | ||
new Attribute( | ||
a.name, | ||
new Buffer(a.buffer.data), | ||
a.size, | ||
a.normalized, | ||
a.stride, | ||
a.offset | ||
) | ||
), | ||
}; | ||
return { | ||
position: new Attribute( | ||
data.position.name, | ||
new Buffer(data.position.buffer.data), | ||
data.position.size, | ||
data.position.normalized, | ||
data.position.stride, | ||
data.position.offset | ||
), | ||
attrs: data.attrs.map( | ||
(a) => new Attribute(a.name, new Buffer(a.buffer.data), a.size, a.normalized, a.stride, a.offset) | ||
), | ||
}; | ||
} |
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