Stereo Music Visualization using Manifold Harmonics  1.0
Namespaces | Functions | Variables
init.js File Reference

Namespaces

 init
 

Functions

function throwOnGLError (err, funcName, args)
 
function logGLCall (functionName, args)
 
function validateNoneOfTheArgsAreUndefined (functionName, args)
 
function logAndValidate (functionName, args)
 
function init ()
 
function webgl (callback)
 
function shaders (callback)
 
function setControls ()
 
function setCamera (x, y, z)
 
function setLight ()
 
function animate ()
 
function parseMHB (mhb_txt, callback)
 
function readMHB (mhb_txt_data, callback)
 
function model (callback)
 
function initArray (arr, size, fill)
 
function mhb (mhb_data)
 
function setMaterial ()
 
function nearest_pow2 (n)
 
function getNewTexture (buffer, size, rgb, debug_tex)
 

Variables

var canvas_w = 1280
 
var canvas_h = 720
 
var ratio = (canvas_w / canvas_h)
 
var renderer
 
var gl
 
var scene
 
var camera
 
var controls
 
var canvas
 
var mht_data_arr
 
var imht_data_arr
 
var mhb_data_arr
 
var mhb_txt_data
 
var size_mhb
 
var size_mht
 
var size_imht
 
var mhb_tex
 
var mht_tex
 
var imht_tex
 
var mhb_length
 
var mht_length
 
var imht_length
 
var harmonic_count
 
var num_vert
 
var posArray
 
var model_mesh
 
var vidx_arr
 
var shader_info
 
var vertex_shader
 
var fragment_shader
 
var light_angle = 0.0
 
var ambientJS
 
var directionalLight
 
var webgl_init = false
 
var model_init = false
 
var audio_init = false
 
var shader_init = false
 
var debug
 
var loader
 

Function Documentation

function animate ( )

ANIMATION LOOP

function getNewTexture (   buffer,
  size,
  rgb,
  debug_tex 
)

GENERATES AND RETURNS A NEW TEXTURE WITH: BUFFER = TEXTURE DATA RGB = GL.RGB | GL.RGBA SIZE = (WIDTH == HEIGHT)

function init ( )

INIT FUNCTION

function initArray (   arr,
  size,
  fill 
)

INITIALIZE ARRAYS

function mhb (   mhb_data)

DO THE MHB PROCESSING:

  • COMPUTE MHT AND IMHT
  • SET TEXTURES
  • SEND UNIFORMS + ATTRIBUTES TO SHADER
function model (   callback)
function nearest_pow2 (   n)

COMPUTES THE NEAREST POWER OF 2 NOTE: WEBGL TEXTURES LIKE TO BE A POWER OF 2

function parseMHB (   mhb_txt,
  callback 
)

PARSES THE MHB TEXT FILE INTO FLOAT32ARRAY

function readMHB (   mhb_txt_data,
  callback 
)

LOADS AND SAVES MHB TEXT FILE DATA

function setCamera (   x,
  y,
  z 
)

SET CAMERA POSITION

function setControls ( )

SET CONTROLS – MOUSE

function setLight ( )

SET THE LIGHTS

function setMaterial ( )

SETS SHADER UNIFORMS AND ATTRIBUTES

function shaders (   callback)

SET SHADERS

function throwOnGLError (   err,
  funcName,
  args 
)

DEBUG FUNCTIONS

function webgl (   callback)

INITIALIZE WEBGL & SCENE