SHARE
TWEET

Untitled

a guest Jul 17th, 2017 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import vs from "shaders/physicalcustom.vs"
  2. import fs from "shaders/physicalcustom.fs"
  3.  
  4. export default class MeshCustomMaterial extends THREE.MeshPhysicalMaterial {
  5.  
  6.     constructor(parameters, uniforms={}){
  7.         super(parameters)
  8.  
  9.         this.defines = { 'PHYSICAL': '' };
  10.  
  11.         this.uniforms = THREE.UniformsUtils.merge([
  12.             THREE.ShaderLib.physical.uniforms,
  13.             THREE.ShaderLib.standard.uniforms,
  14.             uniforms
  15.         ] )
  16.        
  17.         this.setFlags(this)
  18.     this.setValues(parameters)
  19.         this.isMeshStandardMaterial = true
  20.         this.lights = true
  21.     }
  22.    
  23.     setFlags(material) {
  24.         material.vertexShader = vs;
  25.         material.fragmentShader = fs;
  26.         material.type = 'MeshCustomMaterial';
  27.     }
  28.  
  29. }
RAW Paste Data
Top