gpu-curtains
Version:
gpu-curtains is a 3D WebGPU rendering engine. It can be used as a standalone 3D engine, but also includes extra classes focused on mapping 3d objects to DOM elements; It allows users to synchronize values such as position, sizing, or scale between them.
28 lines (26 loc) • 845 B
JavaScript
const compareRenderingOptions = (newOptions = {}, baseOptions = {}) => {
const renderingOptions = [
"useProjection",
"transparent",
"depth",
"depthWriteEnabled",
"depthCompare",
"depthFormat",
"cullMode",
"sampleCount",
"targets",
"stencil",
"verticesOrder",
"topology"
];
return renderingOptions.map((key) => {
if (newOptions[key] !== void 0 && baseOptions[key] === void 0 || baseOptions[key] !== void 0 && newOptions[key] === void 0) {
return key;
} else if (Array.isArray(newOptions[key]) || typeof newOptions[key] === "object") {
return JSON.stringify(newOptions[key]) !== JSON.stringify(baseOptions[key]) ? key : false;
} else {
return newOptions[key] !== baseOptions[key] ? key : false;
}
}).filter(Boolean);
};
export { compareRenderingOptions };