Skip to content

Commit

Permalink
upgrade all the packages except for electron to 20.3.8 because node-f…
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyl-b committed Aug 17, 2023
1 parent 3741ab1 commit 84e5c8c
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 21 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
"ejs": "^3.1.9",
"electron": "^26.0.0",
"electron": "20.3.8",
"electron-rebuild": "^3.2.7",
"eslint": "^8.47.0",
"eslint-plugin-import": "^2.28.0",
Expand All @@ -86,7 +86,6 @@
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"typescript": "^5.1.6",

"underscore": "^1.13.6",
"walk": "^2.3.15",
"webpack": "^5.88.2",
Expand Down
2 changes: 1 addition & 1 deletion src/command/AbstractFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { toArray } from "../util/Conversion";
*/

export abstract class AbstractFactory<T extends THREE.Object3D> extends CancellableRegisterable {
protected get originalItem(): T | T[] | undefined { return undefined; }
get originalItem(): T | T[] | undefined { return undefined; }
protected get originalItems() { return toArray(this.originalItem); }
protected temps: TemporaryObject[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/command/GizmoMaterials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class GizmoMaterialDatabase {
static make(normalColor: THREE.Color, hoverColor: THREE.Color, side: number = THREE.FrontSide): GizmoMaterial {
return {
mesh: new THREE.MeshBasicMaterial(Object.assign({ opacity: 0.75, color: normalColor }, depthInfo, { side })),
line2: new LineMaterial({ ...depthInfo, color: normalColor.getHex(), opacity: 1, linewidth: 2, side }),
line2: new LineMaterial({ ...depthInfo, color: normalColor.getHex(), opacity: 1, linewidth: 2 }),
line: new THREE.LineBasicMaterial({ opacity: 0.75, color: normalColor }),
hover: {
mesh: new THREE.MeshBasicMaterial(Object.assign({ opacity: 1, color: hoverColor }, depthInfo, { side })),
Expand Down
4 changes: 2 additions & 2 deletions src/command/MultiFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface FactoryHelpers {

export type MultiplyableFactory = GeometryFactory & FactoryHelpers;

export class MultiGeometryFactory<T extends MultiplyableFactory> extends GeometryFactory {
export class MultiGeometryFactory<T extends GeometryFactory> extends GeometryFactory {
factories: T[] = [];

async calculate() {
Expand All @@ -28,7 +28,7 @@ export class MultiGeometryFactory<T extends MultiplyableFactory> extends Geometr
return (await Promise.all(result)).flat();
}

protected get originalItem(): visual.Item[] {
get originalItem(): visual.Item[] {
let result: visual.Item[] = [];
for (const i of this.factories) {
const original = i.originalItem;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/boolean/BooleanFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export class MultiBooleanFactory extends MultiGeometryFactory<MovingBooleanFacto
return this.showTemps(temps);
}

protected get originalItem(): visual.Item[] {
get originalItem(): visual.Item[] {
const tools = this.keepTools ? [] : this._tools.views;
return [...this._targets.views, ...tools];
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/boolean/CutFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export class MultiCutFactory extends GeometryFactory implements CutParams {
return (await Promise.all(promises)).flat();
}

protected get originalItem() {
get originalItem() {
return this.solids;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/extrude/ExtrudeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class PossiblyBooleanExtrudeFactory extends PossiblyBooleanFactory<Abstra
@delegate.get center!: THREE.Vector3;
@delegate.get direction!: THREE.Vector3;

get defaultOperationType() { return this.fantom.defaultOperationType }
//get defaultOperationType() { return this.fantom.defaultOperationType }
}

export class PossiblyBooleanFaceExtrudeFactory extends PossiblyBooleanExtrudeFactory {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/hole/SlotFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract class HoleFactory extends GeometryFactory implements HoleParams {
return result;
}

protected get originalItem() {
get originalItem() {
return this.solid;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/modifyface/DraftSolidFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class DraftSolidFactory extends GeometryFactory implements RotateFactoryL
return await c3d.ActionSolid.DraftSolid_async(solid, c3d.CopyMode.Copy, placement, angle, faces, c3d.FacePropagation.All, false, names);
}

protected get originalItem() { return this.solid }
get originalItem() { return this.solid }

private _phantom?: TemporaryObject;
async showPhantoms() {
Expand Down
5 changes: 0 additions & 5 deletions src/components/viewport/Viewport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ export class Viewport implements MementoOriginator<ViewportMemento> {
}));

this.scene.background = this.backgroundColor;
this.scene.autoUpdate = false;
this.helpersScene.autoUpdate = false;
this.multiplexer.push(this.points, this.selector);
}

Expand Down Expand Up @@ -731,7 +729,6 @@ function makeRenderTarget(renderer: THREE.WebGLRenderer): THREE.WebGLRenderTarge
if (process.platform === 'linux') {
// Linux seems to require an explicity float depth texture otherwise there are zbuffer artifacts
const depthTexture = new THREE.DepthTexture(size.width, size.height, THREE.FloatType);
// @ts-expect-error('three.js @types are out of date')
return new THREE.WebGLRenderTarget(size.width, size.height, { type: THREE.FloatType, generateMipmaps: false, samples: 4, depthTexture });
} else {
const gl = renderer.getContext();
Expand All @@ -741,10 +738,8 @@ function makeRenderTarget(renderer: THREE.WebGLRenderer): THREE.WebGLRenderTarge
// Since we render in Linear/HDR we need at least HalfFloatType for the buffer to avoid banding.
// Unfortunately, the
if (device === "Apple M1") {
// @ts-expect-error('three.js @types are out of date')
return new THREE.WebGLRenderTarget(size.width, size.height, { type: THREE.HalfFloatType, generateMipmaps: false, samples: 1 });
} else {
// @ts-expect-error('three.js @types are out of date')
return new THREE.WebGLRenderTarget(size.width, size.height, { type: THREE.HalfFloatType, generateMipmaps: false, samples: 4 });
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/viewport/ViewportNavigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ViewportNavigatorGizmo extends THREE.Object3D {
const boxGeometry = new THREE.BoxGeometry(2 * halfSize, 2 * halfSize, 2 * halfSize);
const box = new THREE.Mesh(boxGeometry, ViewportNavigatorExecutor.getBoxMaterial(new THREE.Color('#AAAAAA')));

const planeGeometry = new THREE.BufferGeometry(1.5 * halfSize, 1.5 * halfSize);
const planeGeometry = new THREE.BufferGeometry(/*1.5 * halfSize, 1.5 * halfSize*/);

const front = new THREE.Mesh(planeGeometry, ViewportNavigatorExecutor.getPlaneMaterial(new THREE.Color('#777777')));
front.rotation.x = Math.PI / 2;
Expand Down
2 changes: 1 addition & 1 deletion src/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { SnapManager } from './snaps/SnapManager';
import { SolidCopier } from "./SolidCopier";
import { TextureLoader } from "./TextureLoader";

THREE.Object3D.DefaultUp = Z;
THREE.Object3D.DEFAULT_UP = Z;

export class Editor {
private readonly disposable = new CompositeDisposable();
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ const createWindow = () => {
});

buildMenu(mainWindow);

// Open the DevTools
mainWindow.once('ready-to-show', () => {
mainWindow?.webContents.openDevTools({ mode: 'detach' })
})
};

ipcMain.handle('reload', async (event, args) => {
Expand Down
12 changes: 11 additions & 1 deletion src/selection/SelectionProxy.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { SelectionMemento } from "../editor/History";
import { ControlPoint, Curve3D, CurveEdge, Face, Item, PlaneInstance, Region, Solid, SpaceInstance, TopologyItem } from "../visual_model/VisualModel";
import { ModifiesSelection, Selectable } from "./SelectionDatabase";
import { Empty } from '../editor/Empties';
import { Group } from '../editor/Groups';

export class SelectionProxy implements ModifiesSelection {
constructor(protected readonly selection: ModifiesSelection) { }

has(item: Item) { return this.selection.has(item); }
add(items: Item | Item[] | TopologyItem[]) { this.selection.add(items); }
add(_items: Selectable | Selectable[]) { /*this.selection.add(items);*/ }
remove(selectables: Selectable[]) { this.selection.remove(selectables); }
removeFace(object: Face) { this.selection.removeFace(object); }
addFace(object: Face) { this.selection.addFace(object); }
Expand Down Expand Up @@ -41,4 +43,12 @@ export class SelectionProxy implements ModifiesSelection {
get regionIds() { return this.selection.regionIds }
get curveIds() { return this.selection.curveIds }
get controlPointIds() { return this.selection.controlPointIds }
get groups() { return this.selection.groups }
get empties() { return this.selection.empties }

removeGroup(group: Group): void {}
addGroup(group: Group): void {}

removeEmpty(empty: Empty): void {}
addEmpty(empty: Empty): void {}
}
2 changes: 1 addition & 1 deletion src/util/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class Helpers {
axes.position.set(0, 0, 0.01);
const material = axes.material as THREE.Material;
material.depthFunc = THREE.AlwaysDepth;
material.fog = false;
//material.fog = false;

axes.setColors(
new THREE.Color(styles.colors.red[600]).convertSRGBToLinear(),
Expand Down
3 changes: 2 additions & 1 deletion src/visual_model/VisualModelRaycasting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ const _v1 = new THREE.Vector3();
const _clipToWorldVector = new THREE.Vector4();
const _box = new THREE.Box3();
const _lineSegments = new LineSegments2();
const _instanceBuffer = new THREE.InstancedInterleavedBuffer([], 6, 1); // xyz, xyz
const _instanceArray: THREE.TypedArray = new Float32Array();
const _instanceBuffer = new THREE.InstancedInterleavedBuffer(_instanceArray, 6, 1); // xyz, xyz
const _lineSegmentsGeometry = new LineSegmentsGeometry();
_lineSegmentsGeometry.setAttribute('instanceStart', new THREE.InterleavedBufferAttribute(_instanceBuffer, 3, 0)); // xyz
_lineSegmentsGeometry.setAttribute('instanceEnd', new THREE.InterleavedBufferAttribute(_instanceBuffer, 3, 3)); // xyz
Expand Down

0 comments on commit 84e5c8c

Please sign in to comment.