Test.hx 630 B

12345678910111213141516171819202122232425262728
  1. class Test extends hxd.App {
  2. override function render(e) {
  3. var tex = new h3d.mat.Texture(800,600);
  4. tex.clear(0xFF202020);
  5. engine.pushTarget(tex);
  6. super.render(e);
  7. engine.popTarget();
  8. hxd.File.saveBytes("output.png",tex.capturePixels().toPNG());
  9. Sys.exit(0);
  10. }
  11. override function init() {
  12. var c = new h3d.prim.Cube();
  13. c.unindex();
  14. c.addNormals();
  15. new h3d.scene.DirLight(new h3d.Vector(-1,-2,-6),s3d);
  16. var m = new h3d.scene.Mesh(c, s3d);
  17. m.material.mainPass.enableLights = true;
  18. m.material.color.setColor(0xFF704020);
  19. }
  20. static function main() {
  21. new Test();
  22. }
  23. }