@geastack/native-webgl-angle 0.1.6
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 +202 -0
- package/README.md +184 -0
- package/geatsc-plugin-batched-probe.mjs +98 -0
- package/geatsc-plugin-instancing.mjs +160 -0
- package/geatsc-plugin-uniforms.mjs +1955 -0
- package/geatsc-plugin-uploads.mjs +29 -0
- package/geatsc-plugin.mjs +10275 -0
- package/native/angle_webgl_host.mm +2687 -0
- package/native/audio_host.mm +857 -0
- package/native/audio_uwp.h +116 -0
- package/package.json +70 -0
- package/src/gea-native-types.d.ts +4 -0
- package/src/nativeAudioHost.ts +296 -0
- package/src/nativeThreeUtils.ts +11 -0
- package/src/nativeWebGL.ts +1211 -0
- package/src/nativeWebGLAnimation.ts +13 -0
- package/src/nativeWebGLHost.ts +333 -0
- package/src/nativeWebXRManager.ts +48 -0
- package/src/text/atlas-sans.ts +195 -0
- package/src/text/atlas-serif-italic.ts +195 -0
- package/src/text/atlas-serif.ts +195 -0
- package/src/text/native-text-types.ts +17 -0
- package/src/text/native-text.ts +203 -0
- package/src/troika-three-text.ts +248 -0
- package/test/auto-instanced-render-scene.ts +66 -0
- package/test/batched-render-scene.ts +58 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// The host owns the physical upload format. The compiler only preserves the
|
|
2
|
+
// native carriers at these explicitly registered synchronous boundaries.
|
|
3
|
+
export const nativeUploadFunctions = [
|
|
4
|
+
['threeWebGLBufferData', 'gea_three_webgl_buffer_data_native', ['target', 'usage', 'typeCode'], 'gea_three_webgl_buffer_data_bytes', ['target', 'usage'], 'typeCode'],
|
|
5
|
+
['threeWebGLBufferSubData', 'gea_three_webgl_buffer_sub_data_native', ['target', 'offset', 'typeCode'], 'gea_three_webgl_buffer_sub_data_bytes', ['target', 'offset'], 'typeCode'],
|
|
6
|
+
['threeWebGLBufferSubDataRange', 'gea_three_webgl_buffer_sub_data_range_native', ['target', 'offset', 'typeCode'], 'gea_three_webgl_buffer_sub_data_bytes', ['target', 'offset'], 'typeCode', true],
|
|
7
|
+
['threeWebGLTexImage2D', 'gea_three_webgl_tex_image_2d_native', ['target', 'level', 'internalFormat', 'width', 'height', 'format', 'type'], 'gea_three_webgl_tex_image_2d_bytes', ['target', 'level', 'internalFormat', 'width', 'height', 'format', 'type'], '(type == 0x1403 ? 2 : type == 0x1405 ? 3 : type == 0x1401 ? 4 : 1)'],
|
|
8
|
+
['threeWebGLTexSubImage2D', 'gea_three_webgl_tex_sub_image_2d_native', ['target', 'level', 'xoffset', 'yoffset', 'width', 'height', 'format', 'type'], 'gea_three_webgl_tex_sub_image_2d_bytes', ['target', 'level', 'xoffset', 'yoffset', 'width', 'height', 'format', 'type'], '(type == 0x1403 ? 2 : type == 0x1405 ? 3 : type == 0x1401 ? 4 : 1)'],
|
|
9
|
+
].map(([name, binding, parameters, raw, rawParameters, kind, range]) => {
|
|
10
|
+
const declaration = `extern "C" void ${raw}(${rawParameters.map(p => `double ${p}`).join(', ')}, const void* bytes, double byteLength);
|
|
11
|
+
template <typename Source> inline void ${binding}(${parameters.map(p => `double ${p}`).join(', ')}, const Source& values${range ? ', double sourceOffset, double length' : ''}) {
|
|
12
|
+
const auto upload = [&]<typename Element>() {
|
|
13
|
+
const gea::detail::HostNumericArgument<Element> data(values);
|
|
14
|
+
const auto view = data.span()${range ? '.subspan(static_cast<std::size_t>(std::min(static_cast<double>(data.size()), std::max(0.0, sourceOffset))))' : ''};
|
|
15
|
+
const auto size = ${range ? 'static_cast<std::size_t>(std::min(static_cast<double>(view.size()), std::max(0.0, length)))' : 'view.size()'};
|
|
16
|
+
${raw}(${rawParameters.join(', ')}, size ? view.data() : nullptr, static_cast<double>(size * sizeof(Element)));
|
|
17
|
+
};
|
|
18
|
+
const int kind = static_cast<int>(${kind});
|
|
19
|
+
if (kind == 2) upload.template operator()<std::uint16_t>();
|
|
20
|
+
else if (kind == 3) upload.template operator()<std::uint32_t>();
|
|
21
|
+
else if (kind == 4) upload.template operator()<std::uint8_t>();
|
|
22
|
+
else if (kind == 5) upload.template operator()<std::int8_t>();
|
|
23
|
+
else if (kind == 6) upload.template operator()<std::int16_t>();
|
|
24
|
+
else if (kind == 7) upload.template operator()<std::int32_t>();
|
|
25
|
+
else if (kind == 8) upload.template operator()<double>();
|
|
26
|
+
else upload.template operator()<float>();
|
|
27
|
+
}`
|
|
28
|
+
return [name, binding, 'void', declaration]
|
|
29
|
+
})
|