autodesk-forge - 伪造查看器背景
问题描述
我想为我的伪造查看器设置黑色背景,但我不知道该怎么做......我想在全息透镜上运行它以进行一些测试。
我正在尝试这个查看器
https://github.com/Autodesk-Forge/viewer-javascript-offline.sample
copyLightPreset = copyLightPreset;var _compat = __webpack_require__(4);var DefaultLightPreset = exports.DefaultLightPreset = 1; // "Sharp Highlights"
var DefaultLightPreset2d = exports.DefaultLightPreset2d = 0; // "Simple Grey"
var BackgroundPresets = exports.BackgroundPresets = { "Fusion Grey": [230, 230, 230, 150, 150, 150], "Sky Blue": [226, 244, 255, 156, 172, 180], "Snow": [181, 186, 199, 181, 186, 199], "Midnight": [41, 76, 120, 1, 2, 3], "White": [255, 255, 255, 255, 255, 255], "AutoCADModel": [30, 40, 48, 30, 40, 48], "Dark Grey": [51, 51, 51, 51, 51, 51], "Dark Sky": [51, 51, 51, 51, 51, 51], "Infinity Pool": [255, 255, 255, 255, 255, 255], "Tranquility": [0, 84, 166, 0, 84, 166], "Grey Room": [129, 129, 129, 129, 129, 129], "Photo Booth": [237, 237, 237, 237, 237, 237], "RaaS SBS": [1, 1, 1, 90, 90, 90], "Plaza": [79, 102, 130, 79, 102, 130], "Field": [202, 226, 252, 202, 201, 190], "Boardwalk": [216, 230, 248, 230, 228, 220], //This will get modified when the user changes the background
//using the color picker.
"Custom": [230, 230, 230, 150, 150, 150] };var bg = BackgroundPresets;var LightPresets = exports.LightPresets = [//Notes: tonemap = which tone map method to use. Any tonemap method other than zero will cause colors to be linearized before use.
// 0 = None, 1 = Prism Cannon-Lum (color preserving), 2 = OGC Cannon RGB (non-color preserving)
// exposure = exponential bias to use as pre-tonemap multiplier for all rendered colors, including background
// lightMultiplier = linear scale of direct light intensity (diffuse only, not ambient)
// bgColorGradient = which background color preset to use as default for the environment map
// illuminance = cosine-weighted integral of the upper-hemisphere (i.e., actual lux)
//Image-based lighting from RaaS. Initial exposure is empirically obtained.
//These do not normally require any extra lights, because they have the lights fully baked into
//the environment maps.
//Simple ***non-HDR*** environment.
{ name: "Simple Grey", // localized in viewer-environments.loc.json
path: null, tonemap: 0, E_bias: 0, directLightColor: [1.0, 0.84, 0.67], ambientColor: [0.8 * 0.25, 0.9 * 0.25, 1.0 * 0.25], lightMultiplier: 1.0, bgColorGradient: bg["Fusion Grey"], darkerFade: false, rotation: 0.0 }, //Fusion Environments which require extra lights
我在 viewer3D.js 上找到了这个,但是当我把所有东西都涂成黑色时没有任何反应。
解决方案
使用viewer.setBackgroundColor(0,0,0,0,0,0)
,请务必在查看器初始化后调用它。
工作代码: https ://github.com/search?q=org%3AAutodesk-Forge+setbackgroundcolor&type=Code
推荐阅读
- java - 为 JUnit 4/5 创建注释以在测试中初始化和注入对象
- git - 将 2 个 git repos 与冲突结合后,我希望 Powershell 中的 git mergetool 始终为每个文件选择 (m)odified
- kotlin - 将 ktor 应用程序部署到 Heroku 后出现日志错误
- node.js - 使用节点js导入csv文件mongodb
- laravel - Eloquent 构建器实例上不存在属性 [id]
- firebase - 为什么我从托管在 Firebase 上的 NextJs 应用程序仅针对 POST 请求收到“502 网关”错误?
- sharepoint - 在 SharePoint 文档库上自动创建子文件夹
- mysql - Mysql group by 聚合排序和限制
- xamarin - 从共享代码发送到平台代码时,消息中心多次命中 - Xamarin.forms
- c# - C#锁与多个互斥而不是一个