Skip to content

Commit

Permalink
Merge branch 'main' into staticMaterials
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jul 12, 2024
2 parents b8d02a0 + 0141b18 commit 8a0855e
Show file tree
Hide file tree
Showing 26 changed files with 33 additions and 61 deletions.
Binary file modified images/Metal002_col.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Metal002_col_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Metal002_met.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Metal002_met_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Metal002_nrm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Metal002_nrm_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Metal002_rgh.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Metal002_rgh_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Metal007_col.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Metal007_col_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Metal007_met.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Metal007_met_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Metal007_nrm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Metal007_nrm_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Metal007_rgh.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Metal007_rgh_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Plastic018B_col.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Plastic018B_col_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Plastic018B_nrm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Plastic018B_nrm_jpg.ts

Large diffs are not rendered by default.

Binary file modified images/Plastic018B_rgh.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/Plastic018B_rgh_jpg.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/buoyancy/view/BuoyancyLabScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export default class BuoyancyLabScreenView extends BuoyancyScreenView<BuoyancyLa

scale.position.copy( ThreeUtils.vectorToThree( new Vector3( 0, 0.25, 0 ) ) );
scene.add( scale );
}, null );
} );
} );
image.setScaleMagnitude( 0.12 );
return image;
Expand Down
27 changes: 7 additions & 20 deletions js/buoyancy/view/applications/BuoyancyApplicationsScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ import FluidIconMesh from '../../../common/view/FluidIconMesh.js';
import BoatDesign from '../../model/applications/BoatDesign.js';
import BooleanProperty from '../../../../../axon/js/BooleanProperty.js';
import Mass from '../../../common/model/Mass.js';
import Cuboid from '../../../common/model/Cuboid.js';
import CuboidView from '../../../common/view/CuboidView.js';
import Scale from '../../../common/model/Scale.js';
import ScaleView from '../../../common/view/ScaleView.js';
import Boat from '../../model/applications/Boat.js';
import DebugView from '../../../common/view/DebugView.js';
import ApplicationsDebugView from './ApplicationsDebugView.js';
Expand Down Expand Up @@ -484,24 +480,15 @@ export default class BuoyancyApplicationsScreenView extends BuoyancyScreenView<B
}

protected override getMassViewFromMass( mass: Mass ): MassView {
let massView!: MassView;

if ( mass instanceof Cuboid ) {
massView = new CuboidView( mass, this, this.displayProperties );
}
else if ( mass instanceof Scale ) {
massView = new ScaleView( mass, this, this.model.gravityProperty );
}
else if ( mass instanceof Bottle ) {
massView = new BottleView( mass, this, this.displayProperties );
if ( mass instanceof Bottle ) {
return new BottleView( mass, this, this.displayProperties );
}
else if ( mass instanceof Boat ) {
massView = new BoatView( mass, this, this.model.pool.fluidYInterpolatedProperty, this.displayProperties );
return new BoatView( mass, this, this.model.pool.fluidYInterpolatedProperty, this.displayProperties );
}
else {
return super.getMassViewFromMass( mass );
}

assert && assert( !!massView, `massView is falsy, mass: ${mass.constructor.name}` );

return massView;
}

public override step( dt: number ): void {
Expand All @@ -516,7 +503,7 @@ export default class BuoyancyApplicationsScreenView extends BuoyancyScreenView<B

protected override getMinClosestEntry( entries: PointedAtMassView[] ): PointedAtMassView | undefined {
return _.minBy( entries, entry => {
entry.massView.mass instanceof Boat ? Number.POSITIVE_INFINITY : entry.t;
return entry.massView.mass instanceof Boat ? Number.POSITIVE_INFINITY : entry.t;
} );
}

Expand Down
30 changes: 9 additions & 21 deletions js/buoyancy/view/shapes/BuoyancyShapesScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ import BuoyancyScreenView from '../BuoyancyScreenView.js';
import StrictOmit from '../../../../../phet-core/js/types/StrictOmit.js';
import FluidIconMesh from '../../../common/view/FluidIconMesh.js';
import Mass from '../../../common/model/Mass.js';
import Cuboid from '../../../common/model/Cuboid.js';
import CuboidView from '../../../common/view/CuboidView.js';
import Scale from '../../../common/model/Scale.js';
import Ellipsoid from '../../../common/model/Ellipsoid.js';
import EllipsoidView from '../../../common/view/EllipsoidView.js';
import HorizontalCylinder from '../../../common/model/HorizontalCylinder.js';
Expand Down Expand Up @@ -298,33 +295,24 @@ export default class BuoyancyShapesScreenView extends BuoyancyScreenView<Buoyanc
}

protected override getMassViewFromMass( mass: Mass ): MassView {
let massView!: MassView;

if ( mass instanceof Cuboid ) {
massView = new CuboidView( mass, this, this.displayProperties );
}
else if ( mass instanceof Scale ) {
massView = new ScaleView( mass, this, this.model.gravityProperty );
}
else if ( mass instanceof Cone ) {
massView = new ConeView( mass, this, this.displayProperties );
if ( mass instanceof Cone ) {
return new ConeView( mass, this, this.displayProperties );
}
else if ( mass instanceof Ellipsoid ) {
massView = new EllipsoidView( mass, this, this.displayProperties );
return new EllipsoidView( mass, this, this.displayProperties );
}
else if ( mass instanceof HorizontalCylinder ) {
massView = new HorizontalCylinderView( mass, this, this.displayProperties );
return new HorizontalCylinderView( mass, this, this.displayProperties );
}
else if ( mass instanceof VerticalCylinder ) {
massView = new VerticalCylinderView( mass, this, this.displayProperties );
return new VerticalCylinderView( mass, this, this.displayProperties );
}
else if ( mass instanceof Duck ) {
massView = new DuckView( mass, this, this.displayProperties );
return new DuckView( mass, this, this.displayProperties );
}
else {
return super.getMassViewFromMass( mass );
}

assert && assert( !!massView, `massView is falsy, mass: ${mass.constructor.name}` );

return massView;
}

/**
Expand Down
13 changes: 5 additions & 8 deletions js/common/view/DensityBuoyancyScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,18 +575,15 @@ export default class DensityBuoyancyScreenView<Model extends DensityBuoyancyMode
}

protected getMassViewFromMass( mass: Mass ): MassView {
let massView!: MassView;

if ( mass instanceof Cuboid ) {
massView = new CuboidView( mass, this, this.displayProperties );
return new CuboidView( mass, this, this.displayProperties );
}
else if ( mass instanceof Scale ) {
massView = new ScaleView( mass, this, this.model.gravityProperty );
return new ScaleView( mass, this, this.model.gravityProperty );
}
else {
throw new Error( 'massView is falsy' );
}

assert && assert( !!massView, `massView is falsy, mass: ${mass.constructor.name}` );

return massView;
}

protected fillFluidGeometry( y: number, fluidPositionArray: Float32Array, fluidGeometry: BufferGeometry, wasFilled: boolean ): boolean {
Expand Down

0 comments on commit 8a0855e

Please sign in to comment.