createMaterial method

dynamic createMaterial(
  1. dynamic materialParams
)

Implementation

createMaterial(materialParams) {
  var material = GLTFMeshStandardSGMaterial(materialParams);
  material.fog = true;

  material.color = materialParams.color;

  material.map = materialParams.map;

  material.lightMap = null;
  material.lightMapIntensity = 1.0;

  material.aoMap = materialParams.aoMap;
  material.aoMapIntensity = 1.0;

  material.emissive = materialParams.emissive;
  material.emissiveIntensity = 1.0;
  material.emissiveMap = materialParams.emissiveMap;

  material.bumpMap = materialParams.bumpMap;
  material.bumpScale = 1;

  material.normalMap = materialParams.normalMap;
  material.normalMapType = TangentSpaceNormalMap;

  if (materialParams.normalScale) material.normalScale = materialParams.normalScale;

  material.displacementMap = null;
  material.displacementScale = 1;
  material.displacementBias = 0;

  material.specularMap = materialParams.specularMap;
  material.specular = materialParams.specular;

  material.glossinessMap = materialParams.glossinessMap;
  material.glossiness = materialParams.glossiness;

  material.alphaMap = null;

  material.envMap = materialParams.envMap;
  material.envMapIntensity = 1.0;

  return material;
}