@p100-web/core-three 100.0.91 → 100.0.92
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/dist/pcomponents/PMaskedMaterial.js +51 -51
- package/dist/pcomponents/PModelAnnotation.js +2 -2
- package/dist/pcomponents/PModelAnnotation.js.map +1 -1
- package/dist/pcomponents/PModelAnnotations.d.ts.map +1 -1
- package/dist/pcomponents/PModelAnnotations.js +2 -2
- package/dist/pcomponents/PModelAnnotations.js.map +1 -1
- package/dist/settings/IThreeRenderSettings.d.ts +9 -0
- package/dist/settings/IThreeRenderSettings.d.ts.map +1 -0
- package/dist/settings/IThreeRenderSettings.js +2 -0
- package/dist/settings/IThreeRenderSettings.js.map +1 -0
- package/package.json +33 -33
|
@@ -138,60 +138,60 @@ function createChromaKeyMaterial(args) {
|
|
|
138
138
|
keySoftness: { value: 0.001 }, // squared threshold
|
|
139
139
|
stereoMultiplier: { value: 1 }, // squared threshold
|
|
140
140
|
},
|
|
141
|
-
vertexShader: `
|
|
142
|
-
varying vec2 vUv;
|
|
143
|
-
void main() {
|
|
144
|
-
vUv = uv;
|
|
145
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
146
|
-
}
|
|
141
|
+
vertexShader: `
|
|
142
|
+
varying vec2 vUv;
|
|
143
|
+
void main() {
|
|
144
|
+
vUv = uv;
|
|
145
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
146
|
+
}
|
|
147
147
|
`,
|
|
148
148
|
fragmentShader: args.transparent
|
|
149
|
-
? `
|
|
150
|
-
uniform sampler2D map;
|
|
151
|
-
uniform vec3 keyColor;
|
|
152
|
-
uniform float keyThreshold;
|
|
153
|
-
uniform float keySoftness;
|
|
154
|
-
uniform float stereoMultiplier;
|
|
155
|
-
varying vec2 vUv;
|
|
156
|
-
|
|
157
|
-
void main() {
|
|
158
|
-
vec2 uv = vUv;
|
|
159
|
-
uv.y *= stereoMultiplier;
|
|
160
|
-
vec4 col = texture2D(map, uv);
|
|
161
|
-
|
|
162
|
-
// squared distance to key color
|
|
163
|
-
vec3 diff = col.rgb - keyColor;
|
|
164
|
-
float distSq = dot(diff, diff);
|
|
165
|
-
|
|
166
|
-
// Smooth alpha:
|
|
167
|
-
// distSq <= keyThreshold → fully transparent
|
|
168
|
-
// distSq >= keyThreshold+softness → fully opaque
|
|
169
|
-
float alpha = smoothstep(keyThreshold, keyThreshold + keySoftness, distSq);
|
|
170
|
-
|
|
171
|
-
// multiply original texture alpha as well
|
|
172
|
-
gl_FragColor = vec4(col.rgb, col.a * alpha);
|
|
173
|
-
}
|
|
149
|
+
? `
|
|
150
|
+
uniform sampler2D map;
|
|
151
|
+
uniform vec3 keyColor;
|
|
152
|
+
uniform float keyThreshold;
|
|
153
|
+
uniform float keySoftness;
|
|
154
|
+
uniform float stereoMultiplier;
|
|
155
|
+
varying vec2 vUv;
|
|
156
|
+
|
|
157
|
+
void main() {
|
|
158
|
+
vec2 uv = vUv;
|
|
159
|
+
uv.y *= stereoMultiplier;
|
|
160
|
+
vec4 col = texture2D(map, uv);
|
|
161
|
+
|
|
162
|
+
// squared distance to key color
|
|
163
|
+
vec3 diff = col.rgb - keyColor;
|
|
164
|
+
float distSq = dot(diff, diff);
|
|
165
|
+
|
|
166
|
+
// Smooth alpha:
|
|
167
|
+
// distSq <= keyThreshold → fully transparent
|
|
168
|
+
// distSq >= keyThreshold+softness → fully opaque
|
|
169
|
+
float alpha = smoothstep(keyThreshold, keyThreshold + keySoftness, distSq);
|
|
170
|
+
|
|
171
|
+
// multiply original texture alpha as well
|
|
172
|
+
gl_FragColor = vec4(col.rgb, col.a * alpha);
|
|
173
|
+
}
|
|
174
174
|
`
|
|
175
|
-
: `
|
|
176
|
-
uniform sampler2D map;
|
|
177
|
-
uniform vec3 keyColor;
|
|
178
|
-
uniform float keyThreshold;
|
|
179
|
-
uniform float stereoMultiplier;
|
|
180
|
-
varying vec2 vUv;
|
|
181
|
-
|
|
182
|
-
void main() {
|
|
183
|
-
vec2 uv = vUv;
|
|
184
|
-
uv.y *= stereoMultiplier;
|
|
185
|
-
vec4 col = texture2D(map, uv);
|
|
186
|
-
|
|
187
|
-
// squared distance to key color
|
|
188
|
-
vec3 diff = col.rgb - keyColor;
|
|
189
|
-
float distSq = dot(diff, diff);
|
|
190
|
-
|
|
191
|
-
// branch-free alpha mask
|
|
192
|
-
if (distSq < keyThreshold) discard;
|
|
193
|
-
gl_FragColor = vec4(col.rgb, 1);
|
|
194
|
-
}
|
|
175
|
+
: `
|
|
176
|
+
uniform sampler2D map;
|
|
177
|
+
uniform vec3 keyColor;
|
|
178
|
+
uniform float keyThreshold;
|
|
179
|
+
uniform float stereoMultiplier;
|
|
180
|
+
varying vec2 vUv;
|
|
181
|
+
|
|
182
|
+
void main() {
|
|
183
|
+
vec2 uv = vUv;
|
|
184
|
+
uv.y *= stereoMultiplier;
|
|
185
|
+
vec4 col = texture2D(map, uv);
|
|
186
|
+
|
|
187
|
+
// squared distance to key color
|
|
188
|
+
vec3 diff = col.rgb - keyColor;
|
|
189
|
+
float distSq = dot(diff, diff);
|
|
190
|
+
|
|
191
|
+
// branch-free alpha mask
|
|
192
|
+
if (distSq < keyThreshold) discard;
|
|
193
|
+
gl_FragColor = vec4(col.rgb, 1);
|
|
194
|
+
}
|
|
195
195
|
`,
|
|
196
196
|
//
|
|
197
197
|
});
|
|
@@ -10,8 +10,8 @@ export default class PModelAnnotation extends PModelAnnotationBase {
|
|
|
10
10
|
const positionNode = annotation.children[this.positionIndex];
|
|
11
11
|
const targetNode = annotation.children[this.targetIndex];
|
|
12
12
|
return {
|
|
13
|
-
position: positionNode.getWorldPosition(positionNode.position),
|
|
14
|
-
target: targetNode.getWorldPosition(targetNode.position),
|
|
13
|
+
position: positionNode.getWorldPosition(positionNode.position.clone()),
|
|
14
|
+
target: targetNode.getWorldPosition(targetNode.position.clone()),
|
|
15
15
|
name: annotation.name,
|
|
16
16
|
};
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PModelAnnotation.js","sourceRoot":"","sources":["../../src/pcomponents/PModelAnnotation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,IAAI,oBAAoB,GAEzC,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,oBAAoB;IAChE,MAAM,KAAU,CAAC;IAEjB,QAAQ,KAAI,CAAC;IAEb,aAAa;QAKX,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAY,CAAC;QAC/C,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YAClD,MAAM,YAAY,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC7D,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACzD,OAAO;gBACL,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,YAAY,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"PModelAnnotation.js","sourceRoot":"","sources":["../../src/pcomponents/PModelAnnotation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,IAAI,oBAAoB,GAEzC,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,oBAAoB;IAChE,MAAM,KAAU,CAAC;IAEjB,QAAQ,KAAI,CAAC;IAEb,aAAa;QAKX,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAY,CAAC;QAC/C,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YAClD,MAAM,YAAY,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC7D,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACzD,OAAO;gBACL,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACtE,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAChE,IAAI,EAAE,UAAU,CAAC,IAAI;aACtB,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PModelAnnotations.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PModelAnnotations.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,IAAI,qBAAqB,EAC1C,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,qBAAqB;IAClE,MAAM,IAAI,IAAI;IAEd,QAAQ;IAER,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"PModelAnnotations.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PModelAnnotations.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,IAAI,qBAAqB,EAC1C,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,qBAAqB;IAClE,MAAM,IAAI,IAAI;IAEd,QAAQ;IAER,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,GAAG,IAAI;CAoB7E"}
|
|
@@ -14,8 +14,8 @@ export default class PModelAnnotations extends PModelAnnotationsBase {
|
|
|
14
14
|
const positionNode = annotation.children[this.positionIndex];
|
|
15
15
|
const targetNode = annotation.children[this.targetIndex];
|
|
16
16
|
return {
|
|
17
|
-
position: positionNode.getWorldPosition(positionNode.position),
|
|
18
|
-
target: targetNode.getWorldPosition(targetNode.position),
|
|
17
|
+
position: positionNode.getWorldPosition(positionNode.position.clone()),
|
|
18
|
+
target: targetNode.getWorldPosition(targetNode.position.clone()),
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PModelAnnotations.js","sourceRoot":"","sources":["../../src/pcomponents/PModelAnnotations.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,IAAI,qBAAqB,GAE3C,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,qBAAqB;IAClE,MAAM,KAAU,CAAC;IAEjB,QAAQ,KAAI,CAAC;IAEb,aAAa,CAAC,IAAY;QACxB,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAY,CAAC;QACvC,IAAI,EAAE,EAAE,CAAC;YACP,MAAM,UAAU,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YAC5D,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACrC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;oBAChD,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,MAAM,YAAY,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC7D,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"PModelAnnotations.js","sourceRoot":"","sources":["../../src/pcomponents/PModelAnnotations.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,IAAI,qBAAqB,GAE3C,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,qBAAqB;IAClE,MAAM,KAAU,CAAC;IAEjB,QAAQ,KAAI,CAAC;IAEb,aAAa,CAAC,IAAY;QACxB,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAY,CAAC;QACvC,IAAI,EAAE,EAAE,CAAC;YACP,MAAM,UAAU,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YAC5D,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACrC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;oBAChD,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,MAAM,YAAY,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC7D,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACzD,OAAO;oBACL,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;oBACtE,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;iBACjE,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICameraSettings, IQualitySettings, IThreePostProcessingSettings, IThreeRendererSettings } from "@p100-web/core";
|
|
2
|
+
interface IThreeRenderSettings {
|
|
3
|
+
camera: ICameraSettings;
|
|
4
|
+
postProcessing: IThreePostProcessingSettings | null;
|
|
5
|
+
renderer: IThreeRendererSettings;
|
|
6
|
+
quality: IQualitySettings;
|
|
7
|
+
}
|
|
8
|
+
export { type IThreeRenderSettings };
|
|
9
|
+
//# sourceMappingURL=IThreeRenderSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IThreeRenderSettings.d.ts","sourceRoot":"","sources":["../../src/settings/IThreeRenderSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEzH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,4BAA4B,GAAG,IAAI,CAAC;IACpD,QAAQ,EAAE,sBAAsB,CAAC;IACjC,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,OAAO,EAAE,KAAK,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IThreeRenderSettings.js","sourceRoot":"","sources":["../../src/settings/IThreeRenderSettings.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@p100-web/core-three",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "100.0.
|
|
5
|
-
"author": "Peter Drugge",
|
|
6
|
-
"license": "ISC",
|
|
7
|
-
"description": "",
|
|
8
|
-
"devDependencies": {
|
|
9
|
-
"eslint": "^8.57.0",
|
|
10
|
-
"@types/three": "^0.179.0",
|
|
11
|
-
"typescript": "^5.4.2"
|
|
12
|
-
},
|
|
13
|
-
"peerDependencies": {
|
|
14
|
-
"@p100-web/core": "^100.0.
|
|
15
|
-
"three": "^0.179.1",
|
|
16
|
-
"troika-three-text": "^0.52.4",
|
|
17
|
-
"@tweenjs/tween.js": "^25.0.0"
|
|
18
|
-
},
|
|
19
|
-
"files": ["dist"],
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"detect-gpu": "^5.0.70"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"clean": "rimraf dist",
|
|
25
|
-
"build": "tsc -p tsconfig.json"
|
|
26
|
-
},
|
|
27
|
-
"exports": {
|
|
28
|
-
".": {
|
|
29
|
-
"import": "./dist/index.js",
|
|
30
|
-
"types": "./dist/index.d.ts"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@p100-web/core-three",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "100.0.92",
|
|
5
|
+
"author": "Peter Drugge",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"description": "",
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"eslint": "^8.57.0",
|
|
10
|
+
"@types/three": "^0.179.0",
|
|
11
|
+
"typescript": "^5.4.2"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"@p100-web/core": "^100.0.92",
|
|
15
|
+
"three": "^0.179.1",
|
|
16
|
+
"troika-three-text": "^0.52.4",
|
|
17
|
+
"@tweenjs/tween.js": "^25.0.0"
|
|
18
|
+
},
|
|
19
|
+
"files": ["dist"],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"detect-gpu": "^5.0.70"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"clean": "rimraf dist",
|
|
25
|
+
"build": "tsc -p tsconfig.json"
|
|
26
|
+
},
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|