PropsTexture.hx 573 B

1234567891011121314151617181920212223242526
  1. package h3d.shader.pbr;
  2. class PropsTexture extends hxsl.Shader {
  3. static var SRC = {
  4. @param var texture : Sampler2D;
  5. @param var emissive : Float;
  6. var output : {
  7. metalness : Float,
  8. roughness : Float,
  9. occlusion : Float,
  10. emissive : Float,
  11. };
  12. var calculatedUV : Vec2;
  13. function fragment() {
  14. var v = texture.get(calculatedUV);
  15. output.metalness = v.r;
  16. output.roughness = 1 - v.g * v.g;
  17. output.occlusion = v.b;
  18. output.emissive = emissive * v.a;
  19. }
  20. }
  21. public function new(?t) {
  22. super();
  23. this.texture = t;
  24. }
  25. }