FxView.hx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import hrt.prefab.fx.FX;
  2. import hrt.prefab.l3d.Polygon;
  3. class ColorMult extends hxsl.Shader {
  4. static var SRC = {
  5. @param var color : Vec3;
  6. @param var amount : Float = 1.0;
  7. var pixelColor : Vec4;
  8. function fragment() {
  9. pixelColor.rgb = mix(pixelColor.rgb, pixelColor.rgb * color, amount);
  10. }
  11. }
  12. }
  13. //PARAM=-lib hide
  14. class FxView extends hxd.App {
  15. override function init() {
  16. var prefab = hxd.Res.hideEffect.load();
  17. var unk = prefab.getOpt(hrt.prefab.Unknown);
  18. if( unk != null )
  19. throw "Prefab "+unk.getPrefabType()+" was not compiled";
  20. var ctx = new hrt.prefab.Context();
  21. var shared = new hrt.prefab.ContextShared();
  22. ctx.shared = shared;
  23. shared.root2d = s2d;
  24. shared.root3d = s3d;
  25. ctx.init();
  26. function play() {
  27. var i = prefab.make(ctx);
  28. var fx = cast(i.local3d, hrt.prefab.fx.FX.FXAnimation);
  29. fx.onEnd = function() {
  30. fx.remove();
  31. play();
  32. };
  33. }
  34. play();
  35. new h3d.scene.CameraController(20,s3d);
  36. }
  37. static function main() {
  38. h3d.mat.PbrMaterialSetup.set();
  39. hxd.Res.initEmbed();
  40. new FxView();
  41. }
  42. }