Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"jscad-fiber": "^0.0.85",
"jscad-to-gltf": "^0.0.4",
"looks-same": "^10.0.1",
"poppygl": "^0.0.20",
"poppygl": "^0.0.24",
"react-cosmos": "7.0.0",
"react-cosmos-plugin-vite": "7.0.0",
"tsup": "^8.3.0",
Expand Down
8 changes: 4 additions & 4 deletions tests/helpers/render-footprint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as jscadModeling from "@jscad/modeling"
import type { Geometry } from "@jscad/modeling/src/geometries/types"
import { convertJscadModelToGltf } from "jscad-to-gltf"
import { renderGLTFToPNGBufferFromGLBBuffer } from "poppygl"
import { renderGLTFToPNGFromGLB } from "poppygl"
import { importVanilla } from "../fixtures/importVanilla.js"
import {
applyCameraPreset,
Expand Down Expand Up @@ -73,7 +73,7 @@ function getTransformedBoundingBox(geometry: RenderResult) {
export async function renderFootprint(
footprint: string,
options: RenderFootprintOptions = {},
): Promise<Buffer> {
): Promise<Uint8Array> {
const { getJscadModelForFootprintWithPads } = await importVanilla()
const result = getJscadModelForFootprintWithPads(footprint, jscadModeling)

Expand Down Expand Up @@ -108,7 +108,7 @@ export async function renderFootprint(
}

if (!options.cameraPreset) {
return renderGLTFToPNGBufferFromGLBBuffer(glbBuffer, {
return renderGLTFToPNGFromGLB(glbBuffer, {
...baseRenderOptions,
camPos: options.camPos,
lookAt: options.lookAt,
Expand All @@ -121,7 +121,7 @@ export async function renderFootprint(
getDefaultCameraResult(getTransformedBoundingBox(result), defaultFov),
)

return renderGLTFToPNGBufferFromGLBBuffer(glbBuffer, {
return renderGLTFToPNGFromGLB(glbBuffer, {
...baseRenderOptions,
fov: cameraOptions.fov,
camPos: options.camPos ?? cameraOptions.camPos,
Expand Down
Binary file modified tests/snapshots/__snapshots__/pinrow8_female.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/snapshots/footprint-plated-hole.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Colorize,
} from "lib/vanilla/primitives"
import { convertJscadModelToGltf } from "jscad-to-gltf"
import { renderGLTFToPNGBufferFromGLBBuffer } from "poppygl"
import { renderGLTFToPNGFromGLB } from "poppygl"
import * as jscadModeling from "@jscad/modeling"

test("circular_hole_with_rect_pad plated hole", async () => {
Expand Down Expand Up @@ -48,7 +48,7 @@ test("circular_hole_with_rect_pad plated hole", async () => {
},
)

const pngBuffer = await renderGLTFToPNGBufferFromGLBBuffer(
const pngBuffer = await renderGLTFToPNGFromGLB(
gltfResult.data instanceof ArrayBuffer
? gltfResult.data
: Buffer.from(gltfResult.data as string),
Expand Down
6 changes: 3 additions & 3 deletions tests/snapshots/jstzh1_5mm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import * as React from "react"
import * as jscadModeling from "@jscad/modeling"
import { createJSCADRenderer } from "jscad-fiber"
import { convertJscadModelToGltf } from "jscad-to-gltf"
import { renderGLTFToPNGBufferFromGLBBuffer } from "poppygl"
import { renderGLTFToPNGFromGLB } from "poppygl"
import { JSTZH1_5mm } from "../../lib/JSTZH1_5mm"
import { Colorize, Cuboid, Translate } from "jscad-fiber"

async function renderComponentTopView(
element: React.ReactElement,
): Promise<Buffer> {
): Promise<Uint8Array> {
const container: any[] = []
const { createJSCADRoot } = createJSCADRenderer(jscadModeling as any)
const root = createJSCADRoot(container)
Expand All @@ -24,7 +24,7 @@ async function renderComponentTopView(
})

// Apply top-down camera preset for better component visibility
const pngBuffer = await renderGLTFToPNGBufferFromGLBBuffer(
const pngBuffer = await renderGLTFToPNGFromGLB(
gltfResult.data instanceof ArrayBuffer
? gltfResult.data
: Buffer.from(gltfResult.data as string),
Expand Down
Loading