瀏覽代碼

Add ability to provide a hook to execute just prior to rendering.

This allows interoperability with other WebGL code.
pull/1121/head
Matthew Petroff 2 年之前
父節點
當前提交
8a40ae1b42
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. +15
    -0
      src/js/libpannellum.js

+ 15
- 0
src/js/libpannellum.js 查看文件

@@ -747,6 +747,7 @@ function Renderer(container, context) {
* @param {Object} [params] - Extra configuration parameters.
* @param {number} [params.roll] - Camera roll (in radians).
* @param {string} [params.returnImage] - Return rendered image? If specified, should be 'ImageBitmap', 'image/jpeg', or 'image/png'.
* @param {function} [params.hook] - Hook for executing arbitrary function in this environment.
*/
this.render = function(pitch, yaw, hfov, params) {
var focal, i, s, roll = 0;
@@ -789,6 +790,20 @@ function Renderer(container, context) {
roll += roll_adj;
}

// Execute function hook
if (params.hook) {
params.hook({
gl: gl,
program: program,
previewProgram: previewProgram,
imageType: imageType,
texCoordBuffer: texCoordBuffer,
cubeVertBuf: cubeVertBuf,
cubeVertTexCoordBuf: cubeVertTexCoordBuf,
cubeVertIndBuf: cubeVertIndBuf
});
}

// If no WebGL
if (!gl && (imageType == 'multires' || imageType == 'cubemap')) {
// Determine face transforms


Loading…
取消
儲存