react-three-game 0.0.97 → 0.0.99
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.
|
@@ -18,7 +18,7 @@ import { FieldRenderer, Label, NumberInput } from './Input';
|
|
|
18
18
|
import { useAssetRuntime } from '../assetRuntime';
|
|
19
19
|
import { MeshBasicNodeMaterial, MeshStandardNodeMaterial, SpriteNodeMaterial } from 'three/webgpu';
|
|
20
20
|
import { TexturePicker } from '../../assetviewer/page';
|
|
21
|
-
import { RepeatWrapping, ClampToEdgeWrapping,
|
|
21
|
+
import { RepeatWrapping, ClampToEdgeWrapping, NoColorSpace, SRGBColorSpace, NearestFilter, LinearFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, FrontSide, BackSide, DoubleSide, } from 'three';
|
|
22
22
|
function Vector2Editor({ label, value, onChange, min, max, step, }) {
|
|
23
23
|
var _a, _b;
|
|
24
24
|
return (_jsxs("div", { style: { display: 'flex', gap: 2 }, children: [_jsxs("div", { style: { flex: 1 }, children: [_jsxs(Label, { children: [label, " X"] }), _jsx(NumberInput, { value: (_a = value === null || value === void 0 ? void 0 : value[0]) !== null && _a !== void 0 ? _a : 0, onChange: x => { var _a; return onChange([x, (_a = value === null || value === void 0 ? void 0 : value[1]) !== null && _a !== void 0 ? _a : 0]); }, min: min, max: max, step: step, style: { width: '100%', minWidth: 0, boxSizing: 'border-box' } })] }), _jsxs("div", { style: { flex: 1 }, children: [_jsxs(Label, { children: [label, " Y"] }), _jsx(NumberInput, { value: (_b = value === null || value === void 0 ? void 0 : value[1]) !== null && _b !== void 0 ? _b : 0, onChange: y => { var _a; return onChange([(_a = value === null || value === void 0 ? void 0 : value[0]) !== null && _a !== void 0 ? _a : 0, y]); }, min: min, max: max, step: step, style: { width: '100%', minWidth: 0, boxSizing: 'border-box' } })] })] }));
|
|
@@ -235,7 +235,7 @@ function MaterialComponentView({ properties: rawProps }) {
|
|
|
235
235
|
repeat,
|
|
236
236
|
repeatCount,
|
|
237
237
|
offset,
|
|
238
|
-
colorSpace:
|
|
238
|
+
colorSpace: NoColorSpace,
|
|
239
239
|
generateMipmaps,
|
|
240
240
|
minFilter: resolvedMinFilter,
|
|
241
241
|
magFilter: resolvedMagFilter,
|
|
@@ -256,16 +256,19 @@ function MaterialComponentView({ properties: rawProps }) {
|
|
|
256
256
|
if (!properties) {
|
|
257
257
|
return _jsx("meshStandardNodeMaterial", { attach: "material", color: "red", wireframe: true });
|
|
258
258
|
}
|
|
259
|
-
const
|
|
260
|
-
|
|
259
|
+
const sharedProps = Object.assign(Object.assign({ map: finalTexture !== null && finalTexture !== void 0 ? finalTexture : null, side: resolvedSide, onUpdate: (material) => {
|
|
260
|
+
material.needsUpdate = true;
|
|
261
|
+
} }, materialProps), overrides);
|
|
261
262
|
if (materialType === 'basic') {
|
|
262
|
-
return _jsx("meshBasicNodeMaterial", Object.assign({ attach: "material" }, sharedProps)
|
|
263
|
+
return _jsx("meshBasicNodeMaterial", Object.assign({ attach: "material" }, sharedProps));
|
|
263
264
|
}
|
|
264
265
|
if (materialType === 'sprite') {
|
|
265
266
|
const spriteTransparent = materialSource.transparent !== false;
|
|
266
|
-
return (_jsx("spriteNodeMaterial", Object.assign({ attach: "material", map: finalTexture, color: (_l = materialSource.color) !== null && _l !== void 0 ? _l : '#ffffff', opacity: (_m = materialSource.opacity) !== null && _m !== void 0 ? _m : 1, transparent: spriteTransparent, alphaTest: (_o = materialSource.alphaTest) !== null && _o !== void 0 ? _o : 0, depthTest: (_p = materialSource.depthTest) !== null && _p !== void 0 ? _p : false, depthWrite: (_q = materialSource.depthWrite) !== null && _q !== void 0 ? _q : false, toneMapped: (_r = materialSource.toneMapped) !== null && _r !== void 0 ? _r : true
|
|
267
|
+
return (_jsx("spriteNodeMaterial", Object.assign({ attach: "material", map: finalTexture !== null && finalTexture !== void 0 ? finalTexture : null, color: (_l = materialSource.color) !== null && _l !== void 0 ? _l : '#ffffff', opacity: (_m = materialSource.opacity) !== null && _m !== void 0 ? _m : 1, transparent: spriteTransparent, alphaTest: (_o = materialSource.alphaTest) !== null && _o !== void 0 ? _o : 0, depthTest: (_p = materialSource.depthTest) !== null && _p !== void 0 ? _p : false, depthWrite: (_q = materialSource.depthWrite) !== null && _q !== void 0 ? _q : false, toneMapped: (_r = materialSource.toneMapped) !== null && _r !== void 0 ? _r : true, onUpdate: material => {
|
|
268
|
+
material.needsUpdate = true;
|
|
269
|
+
} }, overrides, { rotation: rotation !== null && rotation !== void 0 ? rotation : 0, sizeAttenuation: sizeAttenuation !== null && sizeAttenuation !== void 0 ? sizeAttenuation : true })));
|
|
267
270
|
}
|
|
268
|
-
return (_jsx("meshStandardNodeMaterial", Object.assign({ attach: "material" }, sharedProps, { normalMap: finalNormalMap, normalScale: finalNormalMap ? [(_s = normalScaleProp === null || normalScaleProp === void 0 ? void 0 : normalScaleProp[0]) !== null && _s !== void 0 ? _s : 1, (_t = normalScaleProp === null || normalScaleProp === void 0 ? void 0 : normalScaleProp[1]) !== null && _t !== void 0 ? _t : 1] : undefined })
|
|
271
|
+
return (_jsx("meshStandardNodeMaterial", Object.assign({ attach: "material" }, sharedProps, { normalMap: finalNormalMap !== null && finalNormalMap !== void 0 ? finalNormalMap : null, normalScale: finalNormalMap ? [(_s = normalScaleProp === null || normalScaleProp === void 0 ? void 0 : normalScaleProp[0]) !== null && _s !== void 0 ? _s : 1, (_t = normalScaleProp === null || normalScaleProp === void 0 ? void 0 : normalScaleProp[1]) !== null && _t !== void 0 ? _t : 1] : undefined })));
|
|
269
272
|
}
|
|
270
273
|
const MaterialComponent = {
|
|
271
274
|
name: 'Material',
|