@tscircuit/3d-viewer 0.0.463 → 0.0.464
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.
- package/dist/index.js +36 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28509,7 +28509,7 @@ import * as THREE15 from "three";
|
|
|
28509
28509
|
// package.json
|
|
28510
28510
|
var package_default = {
|
|
28511
28511
|
name: "@tscircuit/3d-viewer",
|
|
28512
|
-
version: "0.0.
|
|
28512
|
+
version: "0.0.463",
|
|
28513
28513
|
main: "./dist/index.js",
|
|
28514
28514
|
module: "./dist/index.js",
|
|
28515
28515
|
type: "module",
|
|
@@ -35099,7 +35099,7 @@ import * as THREE29 from "three";
|
|
|
35099
35099
|
function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
35100
35100
|
const meshes = [];
|
|
35101
35101
|
if (!textures || !boardData || pcbThickness === null) return meshes;
|
|
35102
|
-
const createTexturePlane = (texture, yOffset, isBottomLayer, keySuffix, usePolygonOffset = false) => {
|
|
35102
|
+
const createTexturePlane = (texture, yOffset, isBottomLayer, keySuffix, usePolygonOffset = false, renderOrder = 0) => {
|
|
35103
35103
|
if (!texture) return null;
|
|
35104
35104
|
const planeGeom = new THREE29.PlaneGeometry(boardData.width, boardData.height);
|
|
35105
35105
|
const material = new THREE29.MeshBasicMaterial({
|
|
@@ -35109,8 +35109,9 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35109
35109
|
depthWrite: false,
|
|
35110
35110
|
// Important for layers to avoid z-fighting issues with board itself
|
|
35111
35111
|
polygonOffset: usePolygonOffset,
|
|
35112
|
-
polygonOffsetFactor: usePolygonOffset ? -
|
|
35113
|
-
|
|
35112
|
+
polygonOffsetFactor: usePolygonOffset ? -4 : 0,
|
|
35113
|
+
// Increased for better z-fighting prevention
|
|
35114
|
+
polygonOffsetUnits: usePolygonOffset ? -4 : 0
|
|
35114
35115
|
});
|
|
35115
35116
|
const mesh = new THREE29.Mesh(planeGeom, material);
|
|
35116
35117
|
mesh.position.set(boardData.center.x, boardData.center.y, yOffset);
|
|
@@ -35118,6 +35119,7 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35118
35119
|
mesh.rotation.set(Math.PI, 0, 0);
|
|
35119
35120
|
}
|
|
35120
35121
|
mesh.name = `${isBottomLayer ? "bottom" : "top"}-${keySuffix}-texture-plane`;
|
|
35122
|
+
mesh.renderOrder = renderOrder;
|
|
35121
35123
|
return mesh;
|
|
35122
35124
|
};
|
|
35123
35125
|
const topTraceMesh = createTexturePlane(
|
|
@@ -35125,14 +35127,20 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35125
35127
|
pcbThickness / 2 + BOARD_SURFACE_OFFSET.traces,
|
|
35126
35128
|
// Use consistent copper offset
|
|
35127
35129
|
false,
|
|
35128
|
-
"trace"
|
|
35130
|
+
"trace",
|
|
35131
|
+
false,
|
|
35132
|
+
2
|
|
35133
|
+
// Render after soldermask
|
|
35129
35134
|
);
|
|
35130
35135
|
if (topTraceMesh) meshes.push(topTraceMesh);
|
|
35131
35136
|
const topTraceWithMaskMesh = createTexturePlane(
|
|
35132
35137
|
textures.topTraceWithMask,
|
|
35133
35138
|
pcbThickness / 2 + BOARD_SURFACE_OFFSET.traces,
|
|
35134
35139
|
false,
|
|
35135
|
-
"trace-with-mask"
|
|
35140
|
+
"trace-with-mask",
|
|
35141
|
+
false,
|
|
35142
|
+
2
|
|
35143
|
+
// Render after soldermask
|
|
35136
35144
|
);
|
|
35137
35145
|
if (topTraceWithMaskMesh) meshes.push(topTraceWithMaskMesh);
|
|
35138
35146
|
const topSilkscreenMesh = createTexturePlane(
|
|
@@ -35140,7 +35148,10 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35140
35148
|
pcbThickness / 2 + 0.017,
|
|
35141
35149
|
// Slightly above trace
|
|
35142
35150
|
false,
|
|
35143
|
-
"silkscreen"
|
|
35151
|
+
"silkscreen",
|
|
35152
|
+
false,
|
|
35153
|
+
3
|
|
35154
|
+
// Render after traces
|
|
35144
35155
|
);
|
|
35145
35156
|
if (topSilkscreenMesh) meshes.push(topSilkscreenMesh);
|
|
35146
35157
|
const bottomTraceMesh = createTexturePlane(
|
|
@@ -35148,21 +35159,30 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35148
35159
|
-pcbThickness / 2 - BOARD_SURFACE_OFFSET.traces,
|
|
35149
35160
|
// Use consistent copper offset
|
|
35150
35161
|
true,
|
|
35151
|
-
"trace"
|
|
35162
|
+
"trace",
|
|
35163
|
+
false,
|
|
35164
|
+
2
|
|
35165
|
+
// Render after soldermask
|
|
35152
35166
|
);
|
|
35153
35167
|
if (bottomTraceMesh) meshes.push(bottomTraceMesh);
|
|
35154
35168
|
const bottomTraceWithMaskMesh = createTexturePlane(
|
|
35155
35169
|
textures.bottomTraceWithMask,
|
|
35156
35170
|
-pcbThickness / 2 - BOARD_SURFACE_OFFSET.traces,
|
|
35157
35171
|
true,
|
|
35158
|
-
"trace-with-mask"
|
|
35172
|
+
"trace-with-mask",
|
|
35173
|
+
false,
|
|
35174
|
+
2
|
|
35175
|
+
// Render after soldermask
|
|
35159
35176
|
);
|
|
35160
35177
|
if (bottomTraceWithMaskMesh) meshes.push(bottomTraceWithMaskMesh);
|
|
35161
35178
|
const bottomSilkscreenMesh = createTexturePlane(
|
|
35162
35179
|
textures.bottomSilkscreen,
|
|
35163
35180
|
-pcbThickness / 2 - 0.017,
|
|
35164
35181
|
true,
|
|
35165
|
-
"silkscreen"
|
|
35182
|
+
"silkscreen",
|
|
35183
|
+
false,
|
|
35184
|
+
3
|
|
35185
|
+
// Render after traces
|
|
35166
35186
|
);
|
|
35167
35187
|
if (bottomSilkscreenMesh) meshes.push(bottomSilkscreenMesh);
|
|
35168
35188
|
const topSoldermaskMesh = createTexturePlane(
|
|
@@ -35171,8 +35191,10 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35171
35191
|
// Just above board surface, below traces
|
|
35172
35192
|
false,
|
|
35173
35193
|
"soldermask",
|
|
35174
|
-
true
|
|
35194
|
+
true,
|
|
35175
35195
|
// Enable polygon offset
|
|
35196
|
+
1
|
|
35197
|
+
// Render after board (renderOrder)
|
|
35176
35198
|
);
|
|
35177
35199
|
if (topSoldermaskMesh) meshes.push(topSoldermaskMesh);
|
|
35178
35200
|
const bottomSoldermaskMesh = createTexturePlane(
|
|
@@ -35181,8 +35203,10 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35181
35203
|
// Just below board surface (bottom side)
|
|
35182
35204
|
true,
|
|
35183
35205
|
"soldermask",
|
|
35184
|
-
true
|
|
35206
|
+
true,
|
|
35185
35207
|
// Enable polygon offset
|
|
35208
|
+
1
|
|
35209
|
+
// Render after board (renderOrder)
|
|
35186
35210
|
);
|
|
35187
35211
|
if (bottomSoldermaskMesh) meshes.push(bottomSoldermaskMesh);
|
|
35188
35212
|
return meshes;
|