Volume class

Create a volume rendering. It takes in a 2D texture representing the density in XY plane. The volume is construct by extruding the XY plane in Z axis.

Signature:

export default class Volume extends Visualize 

Methods

MethodDescription
setParameter(name, value)Set the rendering parameters of bar chart visualization.
setPosition(position)
setScaling(scale)Set the size of visualization object.

Example

var textureBuffer = new Float32Array(2048 * 2048);
for (var i = 0; i < 2048; i++) {
    for (var j = 0; j < 2048; j++) {
        var distance = Math.sqrt(Math.pow((i - 1024), 2) + Math.pow((j - 1024), 2));
        textureBuffer[i * 2048 + j] = Math.max(0.0, 1 - distance / 512);
    }
}

const volume = new Modelo.Scene3D.Visualize.Volume(viewer.getRenderScene());
viewer.getScene().addVisualize(volume);

volume.setParameter("data", { "data": textureBuffer, "width": 2048, "height": 2048} );
volume.setParameter("platteImage", "platte.png");
volume.setParameter("gradientImage", "density.png");
volume.setScaling([50, 50, 15]);
volume.setPosition([0, 0, 7.7]);
volume.setEnabled(true);