ソースを参照

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


読み込み中…
キャンセル
保存