Skip to content

Commit

Permalink
Stone fence post
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
jasonsturges committed Nov 21, 2024
1 parent 387374d commit d47cdda
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h2>Models</h2>
<div>
<header>Fence</header>
<ul>
<li><a href="/three-low-poly/models/fence/fence-column">Fence Column</a></li>
<li><a href="/three-low-poly/models/fence/stone-fence-post">Stone Fence Post</a></li>
<li><a href="/three-low-poly/models/fence/wrought-iron-bar">Wrought Iron Bar</a></li>
<li><a href="/three-low-poly/models/fence/wrought-iron-fence">Wrought Iron Fence</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>
<script type="module">
import GUI from "lil-gui";
import { centerMesh, FenceColumn } from "../../../src/index.js";
import { centerMesh, StoneFencePost } from "../../../src/index.js";
import { createOrbitScene } from "../../utils/orbitScene.js";

const { scene } = createOrbitScene();
Expand All @@ -27,7 +27,7 @@
height: 2.25,
};

let fenceColumn = new FenceColumn(params);
let fenceColumn = new StoneFencePost(params);
scene.add(fenceColumn);
centerMesh(fenceColumn);

Expand All @@ -37,7 +37,7 @@

function update() {
scene.remove(fenceColumn);
fenceColumn = new FenceColumn(params);
fenceColumn = new StoneFencePost(params);
scene.add(fenceColumn);
centerMesh(fenceColumn);
}
Expand Down
6 changes: 3 additions & 3 deletions examples/scenes/graveyard.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
Candle,
CrossHeadstone,
EllipticLeafGeometry,
FenceColumn,
Lantern,
LeafEffect,
Mausoleum,
Expand All @@ -31,6 +30,7 @@
Rocks,
RoundedHeadstone,
SquareHeadstone,
StoneFencePost,
WroughtIronFence,
} from "../../src/index.js";
import { DoubleSide, MeshStandardMaterial } from "three";
Expand Down Expand Up @@ -93,15 +93,15 @@
}

// Fence
const stoneColumn = new FenceColumn();
const stoneFencePost = new StoneFencePost();
const wroughtIronFence = new WroughtIronFence({ count: 15 });
const enclosedFenceGroup = new THREE.Group();
const sideLength = 4;
const columnSpacing = 6;

for (let side = 0; side < sideLength; side++) {
for (let i = 0; i < sideLength; i++) {
const column = stoneColumn.clone();
const column = stoneFencePost.clone();
const x = side === 1 || side === 3 ? i * columnSpacing : side === 0 ? 0 : (sideLength - 1) * columnSpacing;
const z = side === 0 || side === 2 ? i * columnSpacing : side === 1 ? (sideLength - 1) * columnSpacing : 0;
column.position.set(x, 0, z);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export { RoundedHeadstone } from "./models/cemetery/RoundedHeadstone";
export { SquareHeadstone } from "./models/cemetery/SquareHeadstone";

// Fence
export { FenceColumn } from "./models/fence/FenceColumn";
export { StoneFencePost } from "./models/fence/StoneFencePost";
export { WroughtIronBar } from "./models/fence/WroughtIronBar";
export { WroughtIronFence } from "./models/fence/WroughtIronFence";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Mesh, MeshStandardMaterial } from "three";
import { StoneFencePostGeometry } from "../../geometry/fence/StoneFencePostGeometry";

export class FenceColumn extends Mesh<StoneFencePostGeometry, MeshStandardMaterial> {
export class StoneFencePost extends Mesh<StoneFencePostGeometry, MeshStandardMaterial> {
constructor({ height = 2.25 } = {}) {
super(
new StoneFencePostGeometry({ height }),
Expand Down

0 comments on commit d47cdda

Please sign in to comment.