BSDF Matlab/Octave implementation

This is the implementation of the BSDF format for Matlab/Octave. It's in good shape and well tested. Though it could do with some love from a Matlab expert to optimize the code and/or improve the implementation, e.g. by allowing custom extensions.


Download Bsdf.m and place it in a directory where Matlab can find it, e.g. by doing:



Functionality is provided via a single Bsdf class:

>> bsdf = Bsdf()
>> b = bsdf.encode({'just some objects', struct('foo', true, 'bar', []), 42.001});
>> size(b)
ans =
   48    1
>> bsdf.decode(b)
ans =
  [1,1] = just some objects
  [1,2] =

    scalar structure containing the fields:

      foo = 1
      bar = [](0x0)

  [1,3] =  42.001


Class Bsdf()

This class represents the main API to use BSDF in Matlab.

Options (for writing) are provided as object properties:

Method save(filename, data)

Save data to a file.

Method load(filename)

Load data from a file.

Method encode(data)

Serialize data to bytes. Returns a blob of bytes (a uint8 array).

Method decode(blob)

Load data from bytes.