react-native-wgpu 0.1.3 → 0.1.5
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/ios/SurfaceUtils.mm +0 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts +0 -1
- package/lib/typescript/src/Canvas.d.ts +0 -2
- package/lib/typescript/src/Canvas.d.ts.map +1 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +0 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +0 -1
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/libs/ios/arm64_iphoneos/libwebgpu_dawn.a +0 -0
- package/libs/ios/arm64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/arm64_xros/libwebgpu_dawn.a +0 -0
- package/libs/ios/arm64_xros/libwebgpu_dawn_visionos.a +0 -0
- package/libs/ios/arm64_xrsimulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.xcframework/Info.plist +5 -5
- package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn_visionos.a +0 -0
- package/libs/ios/libwebgpu_dawn_visionos.xcframework/Info.plist +44 -0
- package/libs/ios/libwebgpu_dawn_visionos.xcframework/xros-arm64/libwebgpu_dawn_visionos.a +0 -0
- package/libs/ios/libwebgpu_dawn_visionos.xcframework/xros-arm64_x86_64-simulator/libwebgpu_dawn_visionos.a +0 -0
- package/libs/ios/x86_64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/x86_64_xrsimulator/libwebgpu_dawn.a +0 -0
- package/package.json +4 -21
- package/react-native-wgpu.podspec +5 -1
- package/src/index.tsx +1 -1
- package/lib/typescript/example/src/Triangle/triangle.d.ts +0 -3
- package/lib/typescript/example/src/Triangle/triangle.d.ts.map +0 -1
- package/lib/typescript/example/src/Wireframe/Shaders.d.ts +0 -3
- package/lib/typescript/example/src/Wireframe/Shaders.d.ts.map +0 -1
- package/lib/typescript/example/src/Wireframe/models.d.ts +0 -29
- package/lib/typescript/example/src/Wireframe/models.d.ts.map +0 -1
- package/lib/typescript/example/src/components/DrawingContext.d.ts +0 -13
- package/lib/typescript/example/src/components/DrawingContext.d.ts.map +0 -1
- package/lib/typescript/example/src/components/cube.d.ts +0 -7
- package/lib/typescript/example/src/components/cube.d.ts.map +0 -1
- package/lib/typescript/example/src/components/meshes/sphere.d.ts +0 -12
- package/lib/typescript/example/src/components/meshes/sphere.d.ts.map +0 -1
- package/lib/typescript/example/src/components/meshes/teapot.d.ts +0 -6
- package/lib/typescript/example/src/components/meshes/teapot.d.ts.map +0 -1
- package/lib/typescript/example/src/components/meshes/utils.d.ts +0 -10
- package/lib/typescript/example/src/components/meshes/utils.d.ts.map +0 -1
package/ios/SurfaceUtils.mm
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
size:(CGSize)size
|
|
11
11
|
contextId:(int)contextId {
|
|
12
12
|
std::shared_ptr<rnwgpu::RNWebGPUManager> manager = [WebGPUModule getManager];
|
|
13
|
-
CGFloat scaleFactor = [UIScreen mainScreen].scale;
|
|
14
13
|
void *nativeSurface = (__bridge void *)layer;
|
|
15
14
|
manager->surfacesRegistry.addSurface(contextId, nativeSurface, size.width,
|
|
16
15
|
size.height);
|
package/lib/commonjs/index.js
CHANGED
|
@@ -203,7 +203,7 @@ if (!navigator) {
|
|
|
203
203
|
navigator.gpu = RNWebGPU.gpu;
|
|
204
204
|
|
|
205
205
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
206
|
-
// @ts-
|
|
206
|
+
// @ts-ignore
|
|
207
207
|
navigator.userAgent = "react-native";
|
|
208
208
|
global.createImageBitmap = global.createImageBitmap ?? ((...params) => new Promise(resolve => resolve(RNWebGPU.createImageBitmap(...params))));
|
|
209
209
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js
CHANGED
|
@@ -155,7 +155,7 @@ if (!navigator) {
|
|
|
155
155
|
navigator.gpu = RNWebGPU.gpu;
|
|
156
156
|
|
|
157
157
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
158
|
-
// @ts-
|
|
158
|
+
// @ts-ignore
|
|
159
159
|
navigator.userAgent = "react-native";
|
|
160
160
|
global.createImageBitmap = global.createImageBitmap ?? ((...params) => new Promise(resolve => resolve(RNWebGPU.createImageBitmap(...params))));
|
|
161
161
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../src/Canvas.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAW9C,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAE1D,IAAI,QAAQ,EAAE;QACZ,GAAG,EAAE,GAAG,CAAC;QACT,uBAAuB,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,aAAa,CAAC;QACvE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,GAAG,WAAW,KAAK,MAAM,CAAC;QACvE,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;KAC7C,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAKD,KAAK,aAAa,GAAG,gBAAgB,GAAG;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,YAAY,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,aAAa,GAAG,IAAI,CAAC;CACzD;AAED,eAAO,MAAM,MAAM,iGA6BjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAEvE,UAAU,WAAY,SAAQ,SAAS;IACrC,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB;;AAGD,wBAAiE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,WAAW,GAAG,MAAM,IAAI,CAAC;AAE9B,eAAO,MAAM,4BAA4B,YAAa,UAAU,SAM/D,CAAC;AAEF,eAAO,MAAM,eAAe,WAClB,MAAM,IAAI,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC,yCAwB/D,CAAC"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>libwebgpu_dawn.a</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>libwebgpu_dawn.a</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
15
15
|
<array>
|
|
16
16
|
<string>arm64</string>
|
|
17
|
-
<string>x86_64</string>
|
|
18
17
|
</array>
|
|
19
18
|
<key>SupportedPlatform</key>
|
|
20
19
|
<string>ios</string>
|
|
21
|
-
<key>SupportedPlatformVariant</key>
|
|
22
|
-
<string>simulator</string>
|
|
23
20
|
</dict>
|
|
24
21
|
<dict>
|
|
25
22
|
<key>BinaryPath</key>
|
|
26
23
|
<string>libwebgpu_dawn.a</string>
|
|
27
24
|
<key>LibraryIdentifier</key>
|
|
28
|
-
<string>ios-
|
|
25
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
29
26
|
<key>LibraryPath</key>
|
|
30
27
|
<string>libwebgpu_dawn.a</string>
|
|
31
28
|
<key>SupportedArchitectures</key>
|
|
32
29
|
<array>
|
|
33
30
|
<string>arm64</string>
|
|
31
|
+
<string>x86_64</string>
|
|
34
32
|
</array>
|
|
35
33
|
<key>SupportedPlatform</key>
|
|
36
34
|
<string>ios</string>
|
|
35
|
+
<key>SupportedPlatformVariant</key>
|
|
36
|
+
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>libwebgpu_dawn_visionos.a</string>
|
|
10
|
+
<key>LibraryIdentifier</key>
|
|
11
|
+
<string>xros-arm64</string>
|
|
12
|
+
<key>LibraryPath</key>
|
|
13
|
+
<string>libwebgpu_dawn_visionos.a</string>
|
|
14
|
+
<key>SupportedArchitectures</key>
|
|
15
|
+
<array>
|
|
16
|
+
<string>arm64</string>
|
|
17
|
+
</array>
|
|
18
|
+
<key>SupportedPlatform</key>
|
|
19
|
+
<string>xros</string>
|
|
20
|
+
</dict>
|
|
21
|
+
<dict>
|
|
22
|
+
<key>BinaryPath</key>
|
|
23
|
+
<string>libwebgpu_dawn_visionos.a</string>
|
|
24
|
+
<key>LibraryIdentifier</key>
|
|
25
|
+
<string>xros-arm64_x86_64-simulator</string>
|
|
26
|
+
<key>LibraryPath</key>
|
|
27
|
+
<string>libwebgpu_dawn_visionos.a</string>
|
|
28
|
+
<key>SupportedArchitectures</key>
|
|
29
|
+
<array>
|
|
30
|
+
<string>arm64</string>
|
|
31
|
+
<string>x86_64</string>
|
|
32
|
+
</array>
|
|
33
|
+
<key>SupportedPlatform</key>
|
|
34
|
+
<string>xros</string>
|
|
35
|
+
<key>SupportedPlatformVariant</key>
|
|
36
|
+
<string>simulator</string>
|
|
37
|
+
</dict>
|
|
38
|
+
</array>
|
|
39
|
+
<key>CFBundlePackageType</key>
|
|
40
|
+
<string>XFWK</string>
|
|
41
|
+
<key>XCFrameworkFormatVersion</key>
|
|
42
|
+
<string>1.0</string>
|
|
43
|
+
</dict>
|
|
44
|
+
</plist>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-wgpu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "React Native WebGPU",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -28,15 +28,13 @@
|
|
|
28
28
|
"!**/.*"
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
|
-
"example": "yarn workspace react-native-webgpu-example",
|
|
32
31
|
"test": "jest -i",
|
|
33
32
|
"test:ref": "REFERENCE=true yarn test -i",
|
|
34
33
|
"tsc": "tsc --noEmit",
|
|
35
|
-
"lint": "eslint
|
|
36
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
34
|
+
"lint": "eslint . --ext .ts,.tsx --max-warnings 0 --cache --fix",
|
|
37
35
|
"prepare": "bob build",
|
|
38
36
|
"build-dawn": "ts-node scripts/build/dawn.ts",
|
|
39
|
-
"clean-dawn": "rimraf ./libs && rimraf
|
|
37
|
+
"clean-dawn": "rimraf ./libs && rimraf ../../externals/dawn/out",
|
|
40
38
|
"clang-format": "yarn clang-format-ios && yarn clang-format-android && yarn clang-format-common",
|
|
41
39
|
"clang-format-ios": "find ios/ -iname \"*.h\" -o -iname \"*.mm\" -o -iname \"*.cpp\" | xargs clang-format -i",
|
|
42
40
|
"clang-format-android": "find android/cpp/ -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
|
|
@@ -64,7 +62,6 @@
|
|
|
64
62
|
"registry": "https://registry.npmjs.org/"
|
|
65
63
|
},
|
|
66
64
|
"devDependencies": {
|
|
67
|
-
"@react-native/eslint-config": "^0.74.84",
|
|
68
65
|
"@types/jest": "^29.5.12",
|
|
69
66
|
"@types/lodash": "^4.17.5",
|
|
70
67
|
"@types/node": "^20.14.7",
|
|
@@ -73,14 +70,9 @@
|
|
|
73
70
|
"@types/react": "^18.2.44",
|
|
74
71
|
"@types/seedrandom": "^3.0.8",
|
|
75
72
|
"@types/ws": "^8.5.10",
|
|
76
|
-
"@
|
|
77
|
-
"@webgpu/types": "^0.1.42",
|
|
73
|
+
"@webgpu/types": "^0.1.44",
|
|
78
74
|
"clang-format": "^1.8.0",
|
|
79
75
|
"del-cli": "^5.1.0",
|
|
80
|
-
"eslint": "8",
|
|
81
|
-
"eslint-config-react-native-wcandillon": "^3.10.2",
|
|
82
|
-
"eslint-plugin-import": "^2.29.1",
|
|
83
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
84
76
|
"jest": "^29.7.0",
|
|
85
77
|
"lodash": "^4.17.21",
|
|
86
78
|
"pixelmatch": "5.3.0",
|
|
@@ -96,22 +88,13 @@
|
|
|
96
88
|
"ts-morph": "^22.0.0",
|
|
97
89
|
"ts-node": "^10.9.2",
|
|
98
90
|
"turbo": "^1.10.7",
|
|
99
|
-
"typescript": "^5.2.2",
|
|
100
91
|
"wgpu-matrix": "^3.0.2",
|
|
101
92
|
"ws": "^8.18.0"
|
|
102
93
|
},
|
|
103
|
-
"resolutions": {
|
|
104
|
-
"@types/react": "^18.2.44",
|
|
105
|
-
"@webgpu/types": "^0.1.42"
|
|
106
|
-
},
|
|
107
94
|
"peerDependencies": {
|
|
108
95
|
"react": "*",
|
|
109
96
|
"react-native": "*"
|
|
110
97
|
},
|
|
111
|
-
"workspaces": [
|
|
112
|
-
"example"
|
|
113
|
-
],
|
|
114
|
-
"packageManager": "yarn@3.6.1",
|
|
115
98
|
"react-native-builder-bob": {
|
|
116
99
|
"source": "src",
|
|
117
100
|
"output": "lib",
|
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.license = package["license"]
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported, :visionos => "1.0" }
|
|
15
15
|
s.source = { :git => "https://github.com/wcandillon/react-native-webgpu.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
17
|
s.source_files = [
|
|
@@ -23,6 +23,10 @@ Pod::Spec.new do |s|
|
|
|
23
23
|
'libs/ios/libwebgpu_dawn.xcframework',
|
|
24
24
|
]
|
|
25
25
|
|
|
26
|
+
s.visionos.vendored_frameworks = [
|
|
27
|
+
'libs/ios/libwebgpu_dawn_visionos.xcframework',
|
|
28
|
+
]
|
|
29
|
+
|
|
26
30
|
s.pod_target_xcconfig = {
|
|
27
31
|
'HEADER_SEARCH_PATHS' => '$(PODS_TARGET_SRCROOT)/cpp',
|
|
28
32
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const triangleVertWGSL = "@vertex\nfn main(\n @builtin(vertex_index) VertexIndex : u32\n) -> @builtin(position) vec4f {\n var pos = array<vec2f, 3>(\n vec2(0.0, 0.5),\n vec2(-0.5, -0.5),\n vec2(0.5, -0.5)\n );\n\n return vec4f(pos[VertexIndex], 0.0, 1.0);\n}";
|
|
2
|
-
export declare const redFragWGSL = "@fragment\nfn main() -> @location(0) vec4f {\n return vec4(1.0, 0.0, 0.0, 1.0);\n}";
|
|
3
|
-
//# sourceMappingURL=triangle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triangle.d.ts","sourceRoot":"","sources":["../../../../../example/src/Triangle/triangle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,0PAW3B,CAAC;AAEH,eAAO,MAAM,WAAW,wFAGtB,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const solidColorLitWGSL = "struct Uniforms {\n worldViewProjectionMatrix: mat4x4f,\n worldMatrix: mat4x4f,\n color: vec4f,\n};\n\nstruct Vertex {\n @location(0) position: vec4f,\n @location(1) normal: vec3f,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n @location(0) normal: vec3f,\n};\n\n@group(0) @binding(0) var<uniform> uni: Uniforms;\n\n@vertex fn vs(vin: Vertex) -> VSOut {\n var vOut: VSOut;\n vOut.position = uni.worldViewProjectionMatrix * vin.position;\n vOut.normal = (uni.worldMatrix * vec4f(vin.normal, 0)).xyz;\n return vOut;\n}\n\n@fragment fn fs(vin: VSOut) -> @location(0) vec4f {\n let lightDirection = normalize(vec3f(4, 10, 6));\n let light = dot(normalize(vin.normal), lightDirection) * 0.5 + 0.5;\n return vec4f(uni.color.rgb * light, uni.color.a);\n}";
|
|
2
|
-
export declare const wireframeWGSL = "struct Uniforms {\n worldViewProjectionMatrix: mat4x4f,\n worldMatrix: mat4x4f,\n color: vec4f,\n};\n\nstruct LineUniforms {\n stride: u32,\n thickness: f32,\n alphaThreshold: f32,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n};\n\n@group(0) @binding(0) var<uniform> uni: Uniforms;\n@group(0) @binding(1) var<storage, read> positions: array<f32>;\n@group(0) @binding(2) var<storage, read> indices: array<u32>;\n@group(0) @binding(3) var<uniform> line: LineUniforms;\n\n@vertex fn vsIndexedU32(@builtin(vertex_index) vNdx: u32) -> VSOut {\n // indices make a triangle so for every 3 indices we need to output\n // 6 values\n let triNdx = vNdx / 6;\n // 0 1 0 1 0 1 0 1 0 1 0 1 vNdx % 2\n // 0 0 1 1 2 2 3 3 4 4 5 5 vNdx / 2\n // 0 1 1 2 2 3 3 4 4 5 5 6 vNdx % 2 + vNdx / 2\n // 0 1 1 2 2 0 0 1 1 2 2 0 (vNdx % 2 + vNdx / 2) % 3\n let vertNdx = (vNdx % 2 + vNdx / 2) % 3;\n let index = indices[triNdx * 3 + vertNdx];\n\n // note:\n //\n // * if your indices are U16 you could use this\n //\n // let indexNdx = triNdx * 3 + vertNdx;\n // let twoIndices = indices[indexNdx / 2]; // indices is u32 but we want u16\n // let index = (twoIndices >> ((indexNdx & 1) * 16)) & 0xFFFF;\n //\n // * if you're not using indices you could use this\n //\n // let index = triNdx * 3 + vertNdx;\n\n let pNdx = index * line.stride;\n let position = vec4f(positions[pNdx], positions[pNdx + 1], positions[pNdx + 2], 1);\n\n var vOut: VSOut;\n vOut.position = uni.worldViewProjectionMatrix * position;\n return vOut;\n}\n\n@fragment fn fs() -> @location(0) vec4f {\n return uni.color + vec4f(0.5);\n}\n\nstruct BarycentricCoordinateBasedVSOutput {\n @builtin(position) position: vec4f,\n @location(0) barycenticCoord: vec3f,\n};\n\n@vertex fn vsIndexedU32BarycentricCoordinateBasedLines(\n @builtin(vertex_index) vNdx: u32\n) -> BarycentricCoordinateBasedVSOutput {\n let vertNdx = vNdx % 3;\n let index = indices[vNdx];\n\n // note:\n //\n // * if your indices are U16 you could use this\n //\n // let twoIndices = indices[vNdx / 2]; // indices is u32 but we want u16\n // let index = (twoIndices >> ((vNdx & 1) * 16)) & 0xFFFF;\n //\n // * if you're not using indices you could use this\n //\n // let index = vNdx;\n\n let pNdx = index * line.stride;\n let position = vec4f(positions[pNdx], positions[pNdx + 1], positions[pNdx + 2], 1);\n\n var vsOut: BarycentricCoordinateBasedVSOutput;\n vsOut.position = uni.worldViewProjectionMatrix * position;\n\n // emit a barycentric coordinate\n vsOut.barycenticCoord = vec3f(0);\n vsOut.barycenticCoord[vertNdx] = 1.0;\n return vsOut;\n}\n\nfn edgeFactor(bary: vec3f) -> f32 {\n let d = fwidth(bary);\n let a3 = smoothstep(vec3f(0.0), d * line.thickness, bary);\n return min(min(a3.x, a3.y), a3.z);\n}\n\n@fragment fn fsBarycentricCoordinateBasedLines(\n v: BarycentricCoordinateBasedVSOutput\n) -> @location(0) vec4f {\n let a = 1.0 - edgeFactor(v.barycenticCoord);\n if (a < line.alphaThreshold) {\n discard;\n }\n\n return vec4((uni.color.rgb + 0.5) * a, a);\n}\n";
|
|
3
|
-
//# sourceMappingURL=Shaders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Shaders.d.ts","sourceRoot":"","sources":["../../../../../example/src/Wireframe/Shaders.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,6wBA6B5B,CAAC;AAEH,eAAO,MAAM,aAAa,oiGA0GzB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
type Mesh = {
|
|
2
|
-
positions: [number, number, number][];
|
|
3
|
-
triangles: [number, number, number][];
|
|
4
|
-
normals: [number, number, number][];
|
|
5
|
-
};
|
|
6
|
-
export declare function convertMeshToTypedArrays(mesh: Mesh, scale: number, offset?: number[]): {
|
|
7
|
-
vertices: Float32Array;
|
|
8
|
-
indices: Uint32Array;
|
|
9
|
-
};
|
|
10
|
-
export declare const modelData: {
|
|
11
|
-
teapot: {
|
|
12
|
-
vertices: Float32Array;
|
|
13
|
-
indices: Uint32Array;
|
|
14
|
-
};
|
|
15
|
-
sphere: {
|
|
16
|
-
vertices: Float32Array;
|
|
17
|
-
indices: Uint32Array;
|
|
18
|
-
};
|
|
19
|
-
jewel: {
|
|
20
|
-
vertices: Float32Array;
|
|
21
|
-
indices: Uint32Array;
|
|
22
|
-
};
|
|
23
|
-
rock: {
|
|
24
|
-
vertices: Float32Array;
|
|
25
|
-
indices: Uint32Array;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=models.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../example/src/Wireframe/models.ts"],"names":[],"mappings":"AAUA,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACtC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACtC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CACrC,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,EACb,MAAM,WAAY;;;EAoBnB;AAoED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAKrB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="@webgpu/types" />
|
|
2
|
-
export interface DrawingContext {
|
|
3
|
-
width: number;
|
|
4
|
-
height: number;
|
|
5
|
-
getCurrentTexture(): GPUTexture;
|
|
6
|
-
getImageData(): Promise<{
|
|
7
|
-
data: number[];
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
format: string;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=DrawingContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawingContext.d.ts","sourceRoot":"","sources":["../../../../../example/src/components/DrawingContext.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,IAAI,UAAU,CAAC;IAChC,YAAY,IAAI,OAAO,CAAC;QACtB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const cubeVertexSize: number;
|
|
2
|
-
export declare const cubePositionOffset = 0;
|
|
3
|
-
export declare const cubeColorOffset: number;
|
|
4
|
-
export declare const cubeUVOffset: number;
|
|
5
|
-
export declare const cubeVertexCount = 36;
|
|
6
|
-
export declare const cubeVertexArray: Float32Array;
|
|
7
|
-
//# sourceMappingURL=cube.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cube.d.ts","sourceRoot":"","sources":["../../../../../example/src/components/cube.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,CAAC;AACrC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,eAAe,KAAK,CAAC;AAGlC,eAAO,MAAM,eAAe,cA2C1B,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface SphereMesh {
|
|
2
|
-
vertices: Float32Array;
|
|
3
|
-
indices: Uint16Array;
|
|
4
|
-
}
|
|
5
|
-
export declare const SphereLayout: {
|
|
6
|
-
vertexStride: number;
|
|
7
|
-
positionsOffset: number;
|
|
8
|
-
normalOffset: number;
|
|
9
|
-
uvOffset: number;
|
|
10
|
-
};
|
|
11
|
-
export declare function createSphereMesh(radius: number, widthSegments?: number, heightSegments?: number, randomness?: number): SphereMesh;
|
|
12
|
-
//# sourceMappingURL=sphere.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sphere.d.ts","sourceRoot":"","sources":["../../../../../../example/src/components/meshes/sphere.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAGF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,aAAa,SAAK,EAClB,cAAc,SAAK,EACnB,UAAU,SAAI,GACb,UAAU,CAkFZ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"teapot.d.ts","sourceRoot":"","sources":["../../../../../../example/src/components/meshes/teapot.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;;;;CAIhB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function computeSurfaceNormals(positions: [number, number, number][], triangles: [number, number, number][]): [number, number, number][];
|
|
2
|
-
export declare function generateNormals(maxAngle: number, positions: [number, number, number][], triangles: [number, number, number][]): {
|
|
3
|
-
positions: [number, number, number][];
|
|
4
|
-
normals: [number, number, number][];
|
|
5
|
-
triangles: [number, number, number][];
|
|
6
|
-
};
|
|
7
|
-
type ProjectedPlane = "xy" | "xz" | "yz";
|
|
8
|
-
export declare function computeProjectedPlaneUVs(positions: [number, number, number][], projectedPlane?: ProjectedPlane): [number, number][];
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../example/src/components/meshes/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EACrC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GACpC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CA4B5B;AAsBD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EACrC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;;;;EA2ItC;AAED,KAAK,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAQzC,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EACrC,cAAc,GAAE,cAAqB,GACpC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAuBpB"}
|