@s25studio/sinth 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +92 -0
- package/README.md +111 -0
- package/THIRD-PARTY-NOTICES.md +127 -0
- package/dist/esm/BufferGeometryUtils-DBNyVaoE.js +99 -0
- package/dist/esm/createTextGeometry-C1mQrq4Z.js +8095 -0
- package/dist/esm/customAssetGeometry-MXHVov4w.js +1720 -0
- package/dist/esm/instanceTypes-zqDi1nZx.js +63 -0
- package/dist/esm/sinth.js +4069 -0
- package/dist/esm/svgAssetGeometry-CSnPWwR1.js +903 -0
- package/dist/sinth-1.0.0.min.js +677 -0
- package/dist/sinth.min.js +677 -0
- package/dist/three-1.0.0.min.js +4132 -0
- package/dist/three.min.js +4132 -0
- package/package.json +49 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Sinth License Agreement
|
|
2
|
+
|
|
3
|
+
**Copyright © 2026 S25 Studio. All rights reserved.**
|
|
4
|
+
|
|
5
|
+
Sinth is commercial software. It is published to a public registry and a public
|
|
6
|
+
CDN so that it can be *loaded* by the pages that use it — not so that it can be
|
|
7
|
+
copied, modified or redistributed. Publication is not permission.
|
|
8
|
+
|
|
9
|
+
This agreement covers the Sinth runtime: the files distributed as
|
|
10
|
+
`@s25studio/sinth`, served from `unpkg.com`, `app.sinth.space` or the Sinth CDN,
|
|
11
|
+
or otherwise obtained from S25 Studio ("the Software"). Third-party components
|
|
12
|
+
bundled into the Software are licensed separately — see
|
|
13
|
+
[THIRD-PARTY-NOTICES.md](./THIRD-PARTY-NOTICES.md).
|
|
14
|
+
|
|
15
|
+
## 1. Grant
|
|
16
|
+
|
|
17
|
+
Subject to your compliance with this agreement, S25 Studio grants you a
|
|
18
|
+
worldwide, non-exclusive, non-transferable, revocable licence to:
|
|
19
|
+
|
|
20
|
+
- **load and execute** unmodified copies of the Software in a web browser or
|
|
21
|
+
application, in order to display scenes created with Sinth;
|
|
22
|
+
- **host** unmodified copies of the Software on infrastructure you control, or
|
|
23
|
+
load it from a Sinth-operated CDN;
|
|
24
|
+
- do so on any number of websites or applications that you own or operate, or
|
|
25
|
+
that you build and deliver to a client as that client's own site.
|
|
26
|
+
|
|
27
|
+
No fee is charged for this licence. Access to the Sinth editor and to project
|
|
28
|
+
features is licensed separately under the terms you agreed to when you created
|
|
29
|
+
your Sinth account.
|
|
30
|
+
|
|
31
|
+
## 2. Restrictions
|
|
32
|
+
|
|
33
|
+
You may not:
|
|
34
|
+
|
|
35
|
+
- **modify, adapt, or create derivative works of** the Software, or incorporate
|
|
36
|
+
any part of it into other software;
|
|
37
|
+
- **reverse engineer, decompile, disassemble, deobfuscate, or otherwise attempt
|
|
38
|
+
to reconstruct the source code** of the Software, its algorithms or its data
|
|
39
|
+
formats, except to the extent this restriction is prohibited by applicable
|
|
40
|
+
law;
|
|
41
|
+
- **redistribute, republish, sublicense, rent, sell or otherwise make the
|
|
42
|
+
Software available** to third parties as a file, a package, a library, or as
|
|
43
|
+
a component of a template, theme, plugin, toolkit or SDK;
|
|
44
|
+
- use the Software, or anything derived from studying it, to **build or assist
|
|
45
|
+
in building a competing product**;
|
|
46
|
+
- **remove, obscure or alter** any copyright, version or licence notice in the
|
|
47
|
+
Software, including the header comment on each distributed file;
|
|
48
|
+
- circumvent or disable any licensing, attribution or usage-reporting mechanism
|
|
49
|
+
in the Software.
|
|
50
|
+
|
|
51
|
+
## 3. Ownership
|
|
52
|
+
|
|
53
|
+
The Software is licensed, not sold. S25 Studio and its licensors retain all
|
|
54
|
+
right, title and interest in and to the Software, including all intellectual
|
|
55
|
+
property rights. All rights not expressly granted in Section 1 are reserved.
|
|
56
|
+
|
|
57
|
+
Scenes, configurations and other content you create with Sinth are yours. This
|
|
58
|
+
agreement places no claim on them.
|
|
59
|
+
|
|
60
|
+
## 4. Third-party components
|
|
61
|
+
|
|
62
|
+
The Software bundles open-source components that remain under their own
|
|
63
|
+
licences, which take precedence over this agreement for those components. The
|
|
64
|
+
complete list, with copyright notices and licence texts, is in
|
|
65
|
+
[THIRD-PARTY-NOTICES.md](./THIRD-PARTY-NOTICES.md).
|
|
66
|
+
|
|
67
|
+
## 5. Term and termination
|
|
68
|
+
|
|
69
|
+
This licence takes effect when you first load or copy the Software and
|
|
70
|
+
continues until terminated. It terminates automatically and immediately if you
|
|
71
|
+
breach any of Section 2. On termination you must stop distributing the Software
|
|
72
|
+
and remove hosted copies from infrastructure you control. Sections 3, 6 and 7
|
|
73
|
+
survive termination.
|
|
74
|
+
|
|
75
|
+
## 6. No warranty
|
|
76
|
+
|
|
77
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
78
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
79
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
|
|
80
|
+
|
|
81
|
+
## 7. Limitation of liability
|
|
82
|
+
|
|
83
|
+
IN NO EVENT SHALL S25 STUDIO BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
84
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
85
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
86
|
+
SOFTWARE.
|
|
87
|
+
|
|
88
|
+
## 8. Contact
|
|
89
|
+
|
|
90
|
+
Questions about this licence, or requests for terms it does not cover
|
|
91
|
+
(redistribution, white-labelling, self-hosted enterprise use):
|
|
92
|
+
**hello@s25.studio**
|
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# @s25studio/sinth
|
|
2
|
+
|
|
3
|
+
Sinth 1.0.0 — build snapshot `v48`.
|
|
4
|
+
|
|
5
|
+
Real-time 3D pattern engine for the web. Every release is published under a new
|
|
6
|
+
version, so a URL you pin today serves the same bytes forever.
|
|
7
|
+
|
|
8
|
+
Three.js is never bundled in. Sinth and Three are always loaded as two files,
|
|
9
|
+
so a page that already has Three does not download a second copy, and the two
|
|
10
|
+
can be cached and upgraded independently.
|
|
11
|
+
|
|
12
|
+
## Two script tags (Webflow, WordPress, Shopify, plain HTML)
|
|
13
|
+
|
|
14
|
+
Three first — `sinth.min.js` reads the global `THREE` that `three.min.js`
|
|
15
|
+
installs, and refuses to run with a console error if it is missing.
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<script src="https://unpkg.com/@s25studio/sinth@1.0.0/dist/three-1.0.0.min.js"></script>
|
|
19
|
+
<script src="https://unpkg.com/@s25studio/sinth@1.0.0/dist/sinth-1.0.0.min.js"></script>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`three.min.js` is our IIFE wrapper around three.js 0.184.0, not a file from
|
|
23
|
+
three's own package: three ships ES modules only since r150, so there is nothing
|
|
24
|
+
on unpkg that a plain `<script src>` can load. If your page can use modules,
|
|
25
|
+
prefer the import map below and take three straight from its own package.
|
|
26
|
+
|
|
27
|
+
## Modules (bundlers, import maps)
|
|
28
|
+
|
|
29
|
+
three.js is a **peer dependency** — this build imports it rather than bundling
|
|
30
|
+
it, so your project's own copy is the only copy.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm i @s25studio/sinth three@0.184.0
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import { createSinthEmbed } from '@s25studio/sinth';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
From a CDN with no build step, name three.js in an import map — it ships ESM
|
|
41
|
+
only, so this is the form a browser can resolve:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<script type="importmap">
|
|
45
|
+
{
|
|
46
|
+
"imports": {
|
|
47
|
+
"three": "https://unpkg.com/three@0.184.0/build/three.module.js"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
<script type="module">
|
|
52
|
+
import { createSinthEmbed } from 'https://unpkg.com/@s25studio/sinth@1.0.0/dist/esm/sinth.js';
|
|
53
|
+
|
|
54
|
+
createSinthEmbed({ container: document.querySelector('#hero'), preset: 'waves' });
|
|
55
|
+
</script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The import map must appear before the module script that uses it.
|
|
59
|
+
|
|
60
|
+
## Using it
|
|
61
|
+
|
|
62
|
+
The script builds expose `window.Sinth` and auto-mount any element carrying the
|
|
63
|
+
Sinth container class. To place one yourself:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const { createSinthEmbed, VERSION } = window.Sinth;
|
|
67
|
+
|
|
68
|
+
console.log(VERSION); // "1.0.0"
|
|
69
|
+
|
|
70
|
+
createSinthEmbed({
|
|
71
|
+
container: document.querySelector('#hero'),
|
|
72
|
+
preset: 'waves',
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Filenames carry the version
|
|
77
|
+
|
|
78
|
+
Each artifact ships twice: `sinth-1.0.0.min.js` names its build in the
|
|
79
|
+
filename itself, and `sinth.min.js` keeps floating URLs
|
|
80
|
+
(`@s25studio/sinth@^1.0/dist/sinth.min.js`)
|
|
81
|
+
working across upgrades. Identical bytes either way.
|
|
82
|
+
|
|
83
|
+
## Text geometry fonts
|
|
84
|
+
|
|
85
|
+
The text primitive loads its twelve library typefaces from the Sinth CDN on
|
|
86
|
+
demand — nothing to host, nothing in this package. To serve them yourself
|
|
87
|
+
(offline, a locked-down CSP, your own mirror), copy them anywhere and say so
|
|
88
|
+
before the first text object is built:
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
window.Sinth.setFontBaseUrl('/assets/sinth-fonts/');
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Or set `window.SINTH_FONT_BASE` before the script tag. `Sinth.fontBaseUrl()`
|
|
95
|
+
reports the one in force.
|
|
96
|
+
|
|
97
|
+
The typefaces are OFL 1.1 and Apache 2.0; `OFL.txt` and `APACHE-2.0.txt` sit
|
|
98
|
+
next to them in that CDN directory.
|
|
99
|
+
|
|
100
|
+
## Licence
|
|
101
|
+
|
|
102
|
+
Sinth is commercial software, licensed — not sold — under
|
|
103
|
+
[LICENSE.md](./LICENSE.md). You may load and host unmodified copies to display
|
|
104
|
+
your own scenes, on any site you own or build for a client. You may not modify
|
|
105
|
+
it, reverse engineer it, or redistribute it as a file, package or template.
|
|
106
|
+
|
|
107
|
+
Bundled open-source components (three.js, opentype.js) keep their own licences:
|
|
108
|
+
[THIRD-PARTY-NOTICES.md](./THIRD-PARTY-NOTICES.md).
|
|
109
|
+
|
|
110
|
+
Terms this does not cover — redistribution, white-labelling, enterprise
|
|
111
|
+
self-hosting — are available: **hello@s25.studio**
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Sinth bundles and serves the open-source components below. Each remains under
|
|
4
|
+
its own licence, which takes precedence over
|
|
5
|
+
[LICENSE.md](./LICENSE.md) for that component.
|
|
6
|
+
|
|
7
|
+
Every copyright and licence statement here was read from the shipped artifact
|
|
8
|
+
itself — the library's own `LICENSE` file, or the font's internal `name` table —
|
|
9
|
+
rather than transcribed from a website.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## three.js 0.184.0
|
|
14
|
+
|
|
15
|
+
Bundled whole into `dist/three.min.js`. `dist/sinth.min.js` and the `dist/esm/`
|
|
16
|
+
modules do not contain three.js core — they read it from `window.THREE` and
|
|
17
|
+
from the `three` peer dependency respectively — but both bundle its
|
|
18
|
+
`examples/jsm` addons (TextGeometry, FontLoader, TTFLoader, OBJLoader,
|
|
19
|
+
SVGLoader, BufferGeometryUtils), which are covered by the same licence.
|
|
20
|
+
|
|
21
|
+
https://threejs.org · https://github.com/mrdoob/three.js
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
The MIT License
|
|
25
|
+
|
|
26
|
+
Copyright © 2010-2026 three.js authors
|
|
27
|
+
|
|
28
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
29
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
30
|
+
in the Software without restriction, including without limitation the rights
|
|
31
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
32
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
33
|
+
furnished to do so, subject to the following conditions:
|
|
34
|
+
|
|
35
|
+
The above copyright notice and this permission notice shall be included in
|
|
36
|
+
all copies or substantial portions of the Software.
|
|
37
|
+
|
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
39
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
40
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
41
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
42
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
43
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
44
|
+
THE SOFTWARE.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## opentype.js 1.3.4
|
|
50
|
+
|
|
51
|
+
Bundled via three.js's `examples/jsm/libs/opentype.module.js`, used by
|
|
52
|
+
`TTFLoader` to parse the text primitive's typefaces. Includes tiny-inflate by
|
|
53
|
+
Devon Govett and the `String.prototype.codePointAt` polyfill by Mathias Bynens,
|
|
54
|
+
both MIT.
|
|
55
|
+
|
|
56
|
+
https://opentype.js.org
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Copyright © Frederik De Bleser and other contributors
|
|
60
|
+
|
|
61
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
62
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
63
|
+
in the Software without restriction, including without limitation the rights
|
|
64
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
65
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
66
|
+
furnished to do so, subject to the following conditions:
|
|
67
|
+
|
|
68
|
+
The above copyright notice and this permission notice shall be included in
|
|
69
|
+
all copies or substantial portions of the Software.
|
|
70
|
+
|
|
71
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
72
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
73
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
74
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
75
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
76
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
77
|
+
THE SOFTWARE.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Typefaces
|
|
83
|
+
|
|
84
|
+
The twelve typefaces offered by the text primitive are **not** bundled into any
|
|
85
|
+
Sinth artifact. They are served as individual files from the Sinth CDN:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
https://<project>.supabase.co/storage/v1/object/public/sinth/fonts/text/<face>.ttf
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The applicable licence text sits next to them in that directory — `OFL.txt` and
|
|
92
|
+
`APACHE-2.0.txt` — and in `engine/fonts/` in this repository.
|
|
93
|
+
|
|
94
|
+
### SIL Open Font License 1.1
|
|
95
|
+
|
|
96
|
+
Full text: `OFL.txt`, alongside the fonts. https://openfontlicense.org
|
|
97
|
+
|
|
98
|
+
| Typeface | File | Copyright |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| Bebas Neue | `bebas-neue.ttf` | Copyright 2019 The Bebas Neue Project Authors (https://github.com/dharmatype/Bebas-Neue) |
|
|
101
|
+
| Caveat | `caveat.ttf` | Copyright 2014 The Caveat Project Authors (https://github.com/googlefonts/caveat) |
|
|
102
|
+
| Inter | `inter.ttf` | Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) |
|
|
103
|
+
| Oswald | `oswald.ttf` | Copyright 2016 The Oswald Project Authors (https://github.com/googlefonts/OswaldFont) |
|
|
104
|
+
| Pacifico | `pacifico.ttf` | Copyright 2018 The Pacifico Project Authors (https://github.com/googlefonts/Pacifico) |
|
|
105
|
+
| Playfair Display | `playfair.ttf` | Copyright 2017 The Playfair Display Project Authors (https://github.com/clauseggers/Playfair-Display) |
|
|
106
|
+
| Roboto | `roboto.ttf` | Copyright 2011 The Roboto Project Authors (https://github.com/googlefonts/roboto-classic) |
|
|
107
|
+
| Roboto Mono | `roboto-mono.ttf` | Copyright 2015 The Roboto Mono Project Authors (https://github.com/googlefonts/robotomono) |
|
|
108
|
+
| Source Serif 4 | `source-serif-4.ttf` | Copyright 2014–2021 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name “Source” |
|
|
109
|
+
| Space Mono | `space-mono.ttf` | Copyright 2016 The Space Mono Project Authors (https://github.com/googlefonts/spacemono) |
|
|
110
|
+
| Zilla Slab | `zilla-slab.ttf` | Copyright 2017 The Mozilla Foundation |
|
|
111
|
+
|
|
112
|
+
### Apache License 2.0
|
|
113
|
+
|
|
114
|
+
Full text: `APACHE-2.0.txt`, alongside the fonts.
|
|
115
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
116
|
+
|
|
117
|
+
| Typeface | File | Copyright |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
| Roboto Slab | `roboto-slab.ttf` | Copyright 2018 The Roboto Slab Project Authors (https://github.com/googlefonts/robotoslab) |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Not bundled
|
|
124
|
+
|
|
125
|
+
`lil-gui` (MIT) is used by the Sinth **editor** only. It is absent from every
|
|
126
|
+
distributed runtime artifact — verified against the built files, not assumed
|
|
127
|
+
from the dependency list.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { BufferAttribute as e, BufferGeometry as t, TriangleFanDrawMode as n, TriangleStripDrawMode as r, TrianglesDrawMode as i } from "three";
|
|
2
|
+
//#region node_modules/three/examples/jsm/utils/BufferGeometryUtils.js
|
|
3
|
+
function a(e, n = !1) {
|
|
4
|
+
let r = e[0].index !== null, i = new Set(Object.keys(e[0].attributes)), a = new Set(Object.keys(e[0].morphAttributes)), s = {}, c = {}, l = e[0].morphTargetsRelative, u = new t(), d = 0;
|
|
5
|
+
for (let t = 0; t < e.length; ++t) {
|
|
6
|
+
let o = e[t], f = 0;
|
|
7
|
+
if (r !== (o.index !== null)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
|
|
8
|
+
for (let e in o.attributes) {
|
|
9
|
+
if (!i.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". All geometries must have compatible attributes; make sure \"" + e + "\" attribute exists among all geometries, or in none of them."), null;
|
|
10
|
+
s[e] === void 0 && (s[e] = []), s[e].push(o.attributes[e]), f++;
|
|
11
|
+
}
|
|
12
|
+
if (f !== i.size) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". Make sure all geometries have the same number of attributes."), null;
|
|
13
|
+
if (l !== o.morphTargetsRelative) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
|
|
14
|
+
for (let e in o.morphAttributes) {
|
|
15
|
+
if (!a.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". .morphAttributes must be consistent throughout all geometries."), null;
|
|
16
|
+
c[e] === void 0 && (c[e] = []), c[e].push(o.morphAttributes[e]);
|
|
17
|
+
}
|
|
18
|
+
if (n) {
|
|
19
|
+
let e;
|
|
20
|
+
if (r) e = o.index.count;
|
|
21
|
+
else if (o.attributes.position !== void 0) e = o.attributes.position.count;
|
|
22
|
+
else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". The geometry must have either an index or a position attribute"), null;
|
|
23
|
+
u.addGroup(d, e, t), d += e;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (r) {
|
|
27
|
+
let t = 0, n = [];
|
|
28
|
+
for (let r = 0; r < e.length; ++r) {
|
|
29
|
+
let i = e[r].index;
|
|
30
|
+
for (let e = 0; e < i.count; ++e) n.push(i.getX(e) + t);
|
|
31
|
+
t += e[r].attributes.position.count;
|
|
32
|
+
}
|
|
33
|
+
u.setIndex(n);
|
|
34
|
+
}
|
|
35
|
+
for (let e in s) {
|
|
36
|
+
let t = o(s[e]);
|
|
37
|
+
if (!t) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + e + " attribute."), null;
|
|
38
|
+
u.setAttribute(e, t);
|
|
39
|
+
}
|
|
40
|
+
for (let e in c) {
|
|
41
|
+
let t = c[e][0].length;
|
|
42
|
+
if (t !== 0) {
|
|
43
|
+
u.morphAttributes = u.morphAttributes || {}, u.morphAttributes[e] = [];
|
|
44
|
+
for (let n = 0; n < t; ++n) {
|
|
45
|
+
let t = [];
|
|
46
|
+
for (let r = 0; r < c[e].length; ++r) t.push(c[e][r][n]);
|
|
47
|
+
let r = o(t);
|
|
48
|
+
if (!r) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + e + " morphAttribute."), null;
|
|
49
|
+
u.morphAttributes[e].push(r);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return u;
|
|
54
|
+
}
|
|
55
|
+
function o(t) {
|
|
56
|
+
let n, r, i, a = -1, o = 0;
|
|
57
|
+
for (let e = 0; e < t.length; ++e) {
|
|
58
|
+
let s = t[e];
|
|
59
|
+
if (n === void 0 && (n = s.array.constructor), n !== s.array.constructor) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."), null;
|
|
60
|
+
if (r === void 0 && (r = s.itemSize), r !== s.itemSize) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."), null;
|
|
61
|
+
if (i === void 0 && (i = s.normalized), i !== s.normalized) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."), null;
|
|
62
|
+
if (a === -1 && (a = s.gpuType), a !== s.gpuType) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null;
|
|
63
|
+
o += s.count * r;
|
|
64
|
+
}
|
|
65
|
+
let s = new n(o), c = new e(s, r, i), l = 0;
|
|
66
|
+
for (let e = 0; e < t.length; ++e) {
|
|
67
|
+
let n = t[e];
|
|
68
|
+
if (n.isInterleavedBufferAttribute) {
|
|
69
|
+
let e = l / r;
|
|
70
|
+
for (let t = 0, i = n.count; t < i; t++) for (let i = 0; i < r; i++) {
|
|
71
|
+
let r = n.getComponent(t, i);
|
|
72
|
+
c.setComponent(t + e, i, r);
|
|
73
|
+
}
|
|
74
|
+
} else s.set(n.array, l);
|
|
75
|
+
l += n.count * r;
|
|
76
|
+
}
|
|
77
|
+
return a !== void 0 && (c.gpuType = a), c;
|
|
78
|
+
}
|
|
79
|
+
function s(e, t) {
|
|
80
|
+
if (t === i) return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), e;
|
|
81
|
+
if (t === n || t === r) {
|
|
82
|
+
let r = e.getIndex();
|
|
83
|
+
if (r === null) {
|
|
84
|
+
let t = [], n = e.getAttribute("position");
|
|
85
|
+
if (n !== void 0) {
|
|
86
|
+
for (let e = 0; e < n.count; e++) t.push(e);
|
|
87
|
+
e.setIndex(t), r = e.getIndex();
|
|
88
|
+
} else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), e;
|
|
89
|
+
}
|
|
90
|
+
let i = r.count - 2, a = [];
|
|
91
|
+
if (t === n) for (let e = 1; e <= i; e++) a.push(r.getX(0)), a.push(r.getX(e)), a.push(r.getX(e + 1));
|
|
92
|
+
else for (let e = 0; e < i; e++) e % 2 == 0 ? (a.push(r.getX(e)), a.push(r.getX(e + 1)), a.push(r.getX(e + 2))) : (a.push(r.getX(e + 2)), a.push(r.getX(e + 1)), a.push(r.getX(e)));
|
|
93
|
+
a.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
94
|
+
let o = e.clone();
|
|
95
|
+
return o.setIndex(a), o.clearGroups(), o;
|
|
96
|
+
} else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), e;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { s as n, a as t };
|