我想为我的伪造查看器设置一个黑色背景,但是我不知道该怎么做...我想在全息齿轮上运行它来进行一些测试。
我正在尝试此查看器
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上发现了这个,但是当我全黑时,什么也没发生。
答案 0 :(得分:0)
使用viewer.setBackgroundColor(0,0,0,0,0,0)
,请确保在初始化查看器后调用它。
工作代码: https://github.com/search?q=org%3AAutodesk-Forge+setbackgroundcolor&type=Code