hart-estate-widget 0.0.22 → 0.0.23

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.
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -492,23 +492,23 @@ class HouseStore {
492
492
  } = (0, _modelHelpers.getMinMaxCoordinates)(walls);
493
493
  const centerX = (maxX + minX) / 2;
494
494
  const centerY = (maxY + minY) / 2;
495
- const longerValue = centerX > centerY ? centerX : centerY;
495
+ const lightsOffset = 25;
496
496
  this.houseGroup.position.set(-centerX, -centerY);
497
497
  const lights = [{
498
- x: centerX - longerValue,
499
- y: centerY - longerValue,
498
+ x: centerX - lightsOffset,
499
+ y: centerY - lightsOffset,
500
500
  z: this.wallsHeight * 3,
501
501
  power: 0.4,
502
502
  castShadow: true
503
503
  }, {
504
- x: centerX - longerValue,
505
- y: centerY - longerValue,
504
+ x: centerX - lightsOffset,
505
+ y: centerY - lightsOffset,
506
506
  z: this.wallsHeight * 2,
507
507
  power: 1,
508
508
  castShadow: false
509
509
  }, {
510
- x: centerX + longerValue,
511
- y: centerY + longerValue,
510
+ x: centerX + lightsOffset,
511
+ y: centerY + lightsOffset,
512
512
  z: this.wallsHeight * 2,
513
513
  power: 1.1,
514
514
  castShadow: false
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ require("core-js/modules/es.promise.js");
9
+
8
10
  require("core-js/modules/web.dom-collections.iterator.js");
9
11
 
10
12
  var _react = _interopRequireDefault(require("react"));
@@ -94,20 +96,26 @@ class ModelStore {
94
96
  this.scene = new THREE.Scene();
95
97
  this.scene.rotation.x = -Math.PI / 2;
96
98
  this.scene.scale.y = -1;
97
- this.scene.background = new THREE.Color('#FAFAFA');
99
+ this.scene.background = new THREE.Color('#E7E7E7');
100
+ this.scene.fog = new THREE.Fog('#E7E7E7', 5, 200);
98
101
  this.createGround();
99
102
  return this;
100
103
  });
101
104
 
102
105
  _defineProperty(this, "createGround", () => {
103
- this.textureLoader.load(_grass.default, texture => {
104
- texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
105
- texture.repeat.set(50, 50);
106
+ const textures = {};
107
+ const assets = [new Promise(resolve => this.loadTexture(_grass.default, [75, 75], texture => {
108
+ textures.map = texture;
109
+ resolve();
110
+ }))];
111
+ Promise.all(assets).then(() => {
106
112
  let groundMaterial = new THREE.MeshStandardMaterial({
107
- map: texture,
108
- color: 0xffffff
113
+ map: textures.map,
114
+ normalMap: textures.normalMap,
115
+ envMap: textures.envMap,
116
+ color: 0xe7e7e7
109
117
  });
110
- let groundMesh = new THREE.Mesh(new THREE.CircleGeometry(100, 100), groundMaterial);
118
+ let groundMesh = new THREE.Mesh(new THREE.CircleGeometry(250, 100), groundMaterial);
111
119
  groundMesh.position.z = -0.01;
112
120
  groundMesh.receiveShadow = true;
113
121
  this.scene.add(groundMesh);
@@ -254,6 +262,17 @@ class ModelStore {
254
262
  return ((_this$container2 = this.container) === null || _this$container2 === void 0 ? void 0 : _this$container2.offsetHeight) || window.innerHeight;
255
263
  }
256
264
 
265
+ loadTexture(img) {
266
+ let repeat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [1, 1];
267
+ let callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => {};
268
+ this.textureLoader.load(img, texture => {
269
+ texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
270
+ texture.repeat.set(repeat[0], repeat[1]);
271
+ texture.flipY = false;
272
+ callback(texture);
273
+ });
274
+ }
275
+
257
276
  }
258
277
 
259
278
  var _default = new ModelStore();
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "HART Estate widget",
4
4
  "author": "HART",
5
5
  "keywords": [],
6
- "version": "0.0.22",
6
+ "version": "0.0.23",
7
7
  "private": false,
8
8
  "main": "build/index.js",
9
9
  "module": "build/index.js",