react-three-game 0.0.98 → 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.
@@ -189,7 +189,7 @@ function MaterialComponentEditor({ component, onUpdate, basePath = "", }) {
189
189
  }
190
190
  // View for Material component
191
191
  function MaterialComponentView({ properties: rawProps }) {
192
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
192
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
193
193
  const { getTexture } = useAssetRuntime();
194
194
  const properties = rawProps;
195
195
  const materialSource = properties !== null && properties !== void 0 ? properties : {};
@@ -256,22 +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 materialKey = [
260
- materialType,
261
- textureName !== null && textureName !== void 0 ? textureName : 'none',
262
- (_l = texture === null || texture === void 0 ? void 0 : texture.uuid) !== null && _l !== void 0 ? _l : 'texture-pending',
263
- normalMapTextureName !== null && normalMapTextureName !== void 0 ? normalMapTextureName : 'none',
264
- (_m = normalMapTexture === null || normalMapTexture === void 0 ? void 0 : normalMapTexture.uuid) !== null && _m !== void 0 ? _m : 'normal-pending',
265
- ].join(':');
266
- const sharedProps = Object.assign(Object.assign({ map: finalTexture, side: resolvedSide }, materialProps), overrides);
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);
267
262
  if (materialType === 'basic') {
268
- return _jsx("meshBasicNodeMaterial", Object.assign({ attach: "material" }, sharedProps), materialKey);
263
+ return _jsx("meshBasicNodeMaterial", Object.assign({ attach: "material" }, sharedProps));
269
264
  }
270
265
  if (materialType === 'sprite') {
271
266
  const spriteTransparent = materialSource.transparent !== false;
272
- return (_jsx("spriteNodeMaterial", Object.assign({ attach: "material", map: finalTexture, color: (_o = materialSource.color) !== null && _o !== void 0 ? _o : '#ffffff', opacity: (_p = materialSource.opacity) !== null && _p !== void 0 ? _p : 1, transparent: spriteTransparent, alphaTest: (_q = materialSource.alphaTest) !== null && _q !== void 0 ? _q : 0, depthTest: (_r = materialSource.depthTest) !== null && _r !== void 0 ? _r : false, depthWrite: (_s = materialSource.depthWrite) !== null && _s !== void 0 ? _s : false, toneMapped: (_t = materialSource.toneMapped) !== null && _t !== void 0 ? _t : true }, overrides, { rotation: rotation !== null && rotation !== void 0 ? rotation : 0, sizeAttenuation: sizeAttenuation !== null && sizeAttenuation !== void 0 ? sizeAttenuation : true }), materialKey));
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 })));
273
270
  }
274
- return (_jsx("meshStandardNodeMaterial", Object.assign({ attach: "material" }, sharedProps, { normalMap: finalNormalMap, normalScale: finalNormalMap ? [(_u = normalScaleProp === null || normalScaleProp === void 0 ? void 0 : normalScaleProp[0]) !== null && _u !== void 0 ? _u : 1, (_v = normalScaleProp === null || normalScaleProp === void 0 ? void 0 : normalScaleProp[1]) !== null && _v !== void 0 ? _v : 1] : undefined }), materialKey));
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 })));
275
272
  }
276
273
  const MaterialComponent = {
277
274
  name: 'Material',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-three-game",
3
- "version": "0.0.98",
3
+ "version": "0.0.99",
4
4
  "description": "high performance 3D game engine built in React",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",