All files / src/WebGL/materials VolumetricMaterial.ts

0% Statements 0/32
0% Branches 0/1
0% Functions 0/2
0% Lines 0/32

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48                                                                                               
//Volumetric material
 
import { FrontSide } from "../constants/Sides";
import { Color } from "../core/Color";
import { Material } from "./Material";
 
/** @constructor */
export class VolumetricMaterial extends Material {
  transparent = false;
  volumetric = true;
  color = new Color(0xffffff);
  transferfn = null;
  map = undefined;
  extent = [];
  maxdepth = 100.0;
  unit = 0;
  texmatrix = null;
  transfermin = -1.0;
  transfermax = 1.0;
  subsamples = 5.0;
  shaderID = "volumetric";
  side = FrontSide;
 
  constructor(parameters?: any) {
    super();
    // this.fog = true; // TODO: to integrate the new shader with the fog stuff
    this.setValues(parameters);
  }
  clone<T extends this>(material = new VolumetricMaterial() as T): T {
    super.clone.call(this, material);
    material.transparent = this.transparent;
    material.volumetric = this.volumetric;
    material.color = this.color;
    material.transferfn = this.transferfn;
    material.map = this.map;
    material.extent = this.extent;
    material.maxdepth = this.maxdepth;
    material.unit = this.unit;
    material.texmatrix = this.texmatrix;
    material.transfermin = this.transfermin;
    material.transfermax = this.transfermax;
    material.subsamples = this.subsamples;
    material.shaderID = this.shaderID;
    material.side = this.side;
    return material;
  }
}