Use high quality render for CadQuery download
This commit is contained in:
@@ -4,12 +4,16 @@ import {
|
||||
createHealthyResponse,
|
||||
createUnhealthyResponse,
|
||||
timeoutErrorMessage,
|
||||
RenderArgs,
|
||||
} from './common'
|
||||
|
||||
export const render = async ({ code }) => {
|
||||
export const render = async ({
|
||||
code,
|
||||
settings: { quality = 'low' },
|
||||
}: RenderArgs) => {
|
||||
const body = JSON.stringify({
|
||||
settings: {
|
||||
deflection: 0.15,
|
||||
deflection: quality === 'low' ? 0.35 : 0.11,
|
||||
},
|
||||
file: code,
|
||||
})
|
||||
@@ -1,14 +1,24 @@
|
||||
import { STLLoader } from 'three/examples/jsm/loaders/STLLoader'
|
||||
import { State } from 'src/helpers/hooks/useIdeState'
|
||||
|
||||
export const lambdaBaseURL =
|
||||
// process.env.CAD_LAMBDA_BASE_URL ||
|
||||
'https://oxt2p7ddgj.execute-api.us-east-1.amazonaws.com/prod'
|
||||
process.env.CAD_LAMBDA_BASE_URL ||
|
||||
'https://2inlbple1b.execute-api.us-east-1.amazonaws.com/prod2'
|
||||
|
||||
export const stlToGeometry = (url) =>
|
||||
new Promise((resolve, reject) => {
|
||||
new STLLoader().load(url, resolve, null, reject)
|
||||
})
|
||||
|
||||
export interface RenderArgs {
|
||||
code: State['code']
|
||||
settings: {
|
||||
camera: State['camera']
|
||||
viewerSize: State['viewerSize']
|
||||
quality: State['objectData']['quality']
|
||||
}
|
||||
}
|
||||
|
||||
export function createHealthyResponse({ date, data, consoleMessage, type }) {
|
||||
return {
|
||||
status: 'healthy',
|
||||
@@ -4,9 +4,10 @@ import {
|
||||
createHealthyResponse,
|
||||
createUnhealthyResponse,
|
||||
timeoutErrorMessage,
|
||||
RenderArgs,
|
||||
} from './common'
|
||||
|
||||
export const render = async ({ code, settings }) => {
|
||||
export const render = async ({ code, settings }: RenderArgs) => {
|
||||
const pixelRatio = window.devicePixelRatio || 1
|
||||
const size = {
|
||||
x: Math.round(settings.viewerSize?.width * pixelRatio),
|
||||
@@ -67,7 +68,7 @@ export const render = async ({ code, settings }) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const stl = async ({ code, settings }) => {
|
||||
export const stl = async ({ code, settings }: RenderArgs) => {
|
||||
const body = JSON.stringify({
|
||||
settings: {},
|
||||
file: code,
|
||||
Reference in New Issue
Block a user