# All files / src/WebGL/materials MeshBasicMaterial.ts

0% Statements 0/40
0% Branches 0/2
0% Functions 0/2
0% Lines 0/40

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
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61

     import { TextureOperations } from "./../constants/TextureOperations";
    import { Color } from "../core/Color";
    import { Material } from "./Material";

    /**
     * This class is ripped right out of three.js.
     * It was missing in 3Dmol despite being referenced in Mesh.ts
     */
    class MeshBasicMaterial extends Material {
      isMeshBasicMaterial = true;
      type = "MeshBasicMaterial";
      color = new Color(0xffffff); // emissive
      map = undefined;
      lightMap = null;
      lightMapIntensity = 1.0;
      aoMap = null;
      aoMapIntensity = 1.0;
      specularMap = null;
      alphaMap = null;
      envMap = null;
      combine = TextureOperations.MultiplyOperation;
      reflectivity = 1;
      refractionRatio = 0.98;
      wireframe = false;
      wireframeLinewidth = 1;
      wireframeLinecap = "round";
      wireframeLinejoin = "round";
      fog = true;

      constructor(values: Partial<Record<keyof MeshBasicMaterial, any>> = {} as any) {
        super();
        this.setValues(values);
      }

    	clone<T extends this>(material = new MeshBasicMaterial() as T): T {
        super.clone.call(this, material);

        material.color.copy(this.color);
        material.map = this.map
        material.lightMap = this.lightMap
        material.lightMapIntensity = this.lightMapIntensity
        material.aoMap = this.aoMap
        material.aoMapIntensity = this.aoMapIntensity
        material.specularMap = this.specularMap
        material.alphaMap = this.alphaMap
        material.envMap = this.envMap
        material.combine = this.combine
        material.reflectivity = this.reflectivity
        material.refractionRatio = this.refractionRatio
        material.wireframe = this.wireframe
        material.wireframeLinewidth = this.wireframeLinewidth
        material.wireframeLinecap = this.wireframeLinecap
        material.wireframeLinejoin = this.wireframeLinejoin
        material.fog = this.fog

        return material;
      }
    }

    export { MeshBasicMaterial };