Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarr committed Feb 23, 2024
1 parent c60ba08 commit f80bcea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/assets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global AFRAME, customElements */

function buildAssetHTML (assetUrl, categories) {
//if (!assetUrl) assetUrl = 'https://assets.3dstreet.app/';
// if (!assetUrl) assetUrl = 'https://assets.3dstreet.app/';
console.log('[street]', 'Using street assets from', assetUrl);
const surfacesRoughness = 0.8;
var assetsObj = {
Expand Down Expand Up @@ -300,7 +300,7 @@ class StreetAssets extends AFRAME.ANode {
this.setAttribute('url', assetUrl);
}
const assetsHTML = buildAssetHTML(assetUrl, categories);

this.insertAdjacentHTML('afterend', assetsHTML);

AFRAME.ANode.prototype.load.call(self);
Expand Down
23 changes: 11 additions & 12 deletions src/components/svg-extruder.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ AFRAME.registerComponent('svg-extruder', {
// fix texture properties to correctly show texture for extruded mesh
const extrudedMesh = el.getObject3D('mesh');
if (extrudedMesh && extrudedMesh.material) {
const texture = extrudedMesh.material.map;
const texture = extrudedMesh.material.map;
texture.wraps = texture.wrapt = THREE.repeatwrapping;
texture.repeat.set( 1 / 100, 1 / 100 );
texture.offset.set( 0.1, 0.5 );
texture.repeat.set(1 / 100, 1 / 100);
texture.offset.set(0.1, 0.5);
}
});

if (svgString) {
this.extrudeFromSVG(svgString);
el.setAttribute('material', 'src:#grass-texture;repeat:5 5;roughness:1');
el.setAttribute('material', 'src:#grass-texture;repeat:5 5;roughness:1');
el.setAttribute('scale', '0.05 0.05 0.05');
el.setAttribute('shadow', 'cast: true; receive: true');
}
Expand All @@ -33,17 +33,17 @@ AFRAME.registerComponent('svg-extruder', {
const depth = this.data.depth;
const el = this.el;
const svgData = this.loader.parse(svgString);
const fillMaterial = new THREE.MeshStandardMaterial({ color: "#F3FBFB" });
const fillMaterial = new THREE.MeshStandardMaterial({ color: '#F3FBFB' });
const stokeMaterial = new THREE.LineBasicMaterial({
color: "#00A5E6",
color: '#00A5E6'
});

const extrudeSettings = {
depth: depth,
bevelEnabled: false
};

//svgGroup.scale.y *= -1;
// svgGroup.scale.y *= -1;
let shapeIndex = 0;

const shapeGeometryArray = [];
Expand All @@ -57,15 +57,15 @@ AFRAME.registerComponent('svg-extruder', {

const linesGeometry = new THREE.EdgesGeometry(geometry);
const lines = new THREE.LineSegments(linesGeometry, stokeMaterial);

el.setObject3D('lines' + shapeIndex, lines);
lines.name = 'lines' + shapeIndex;
shapeIndex += 1;
});
});

// Merge array of extruded geometries into the mergedGeometry
const mergedGeometry =
const mergedGeometry =
THREE.BufferGeometryUtils.mergeBufferGeometries(shapeGeometryArray);

mergedGeometry.computeVertexNormals();
Expand All @@ -75,7 +75,7 @@ AFRAME.registerComponent('svg-extruder', {

// remove existing mesh from entity
el.removeObject3D('mesh');

el.setObject3D('mesh', mergedMesh);

const box = new THREE.Box3().setFromObject(mergedMesh);
Expand All @@ -91,15 +91,14 @@ AFRAME.registerComponent('svg-extruder', {
});

el.object3D.rotateX(Math.PI / 2);

},
update: function (oldData) {
// If `oldData` is empty, then this means we're in the initialization process.
// No need to update.
if (Object.keys(oldData).length === 0) { return; }

const svgString = this.data.svgString;

if (svgString) {
this.extrudeFromSVG(svgString);
}
Expand Down

0 comments on commit f80bcea

Please sign in to comment.