Ver Fonte

remove pre haxe4 code

Nicolas Cannasse há 1 ano atrás
pai
commit
32de86c5f1
58 ficheiros alterados com 84 adições e 186 exclusões
  1. 1 1
      h2d/Drawable.hx
  2. 2 2
      h2d/HtmlText.hx
  3. 2 2
      h2d/KeyFrames.hx
  4. 1 1
      h2d/Object.hx
  5. 0 5
      h2d/RenderContext.hx
  6. 1 1
      h2d/Scene.hx
  7. 0 4
      h2d/Video.hx
  8. 1 1
      h2d/domkit/BaseComponents.hx
  9. 3 3
      h2d/domkit/Style.hx
  10. 1 1
      h2d/filter/AbstractMask.hx
  11. 0 2
      h3d/Engine.hx
  12. 1 1
      h3d/anim/Animation.hx
  13. 1 1
      h3d/anim/BufferAnimation.hx
  14. 1 11
      h3d/impl/DirectXDriver.hx
  15. 1 1
      h3d/mat/MaterialDatabase.hx
  16. 3 3
      h3d/mat/Pass.hx
  17. 1 1
      h3d/mat/PbrMaterial.hx
  18. 1 1
      h3d/pass/DirShadowMap.hx
  19. 0 2
      h3d/pass/HardwarePick.hx
  20. 7 7
      h3d/scene/Object.hx
  21. 1 1
      h3d/scene/Renderer.hx
  22. 1 1
      h3d/scene/World.hx
  23. 2 2
      h3d/scene/fwd/LightSystem.hx
  24. 2 2
      h3d/scene/pbr/LightSystem.hx
  25. 5 5
      h3d/scene/pbr/Renderer.hx
  26. 2 2
      hxd/App.hx
  27. 2 2
      hxd/File.hx
  28. 1 1
      hxd/IndexBuffer.hx
  29. 5 5
      hxd/System.hl.hx
  30. 0 4
      hxd/fmt/bfnt/FontParser.hx
  31. 0 4
      hxd/fmt/fbx/BaseLibrary.hx
  32. 1 1
      hxd/fmt/fbx/HMDOut.hx
  33. 1 1
      hxd/fmt/pak/Loader.hx
  34. 3 3
      hxd/fs/FileConverter.hx
  35. 2 4
      hxd/fs/LocalFileSystem.hx
  36. 0 21
      hxd/impl/Api.hx
  37. 0 10
      hxd/impl/TypedArray.hx
  38. 0 4
      hxd/net/BinaryLoader.hx
  39. 3 8
      hxd/net/Socket.hx
  40. 0 4
      hxd/res/BitmapFont.hx
  41. 10 15
      hxd/res/DynamicText.hx
  42. 0 4
      hxd/res/Embed.hx
  43. 1 1
      hxd/res/Loader.hx
  44. 0 4
      hxd/res/TiledMap.hx
  45. 1 1
      hxd/snd/ChannelBase.hx
  46. 2 2
      hxd/snd/LoadingData.hx
  47. 1 1
      hxd/snd/Manager.hx
  48. 1 1
      hxd/snd/NativeChannel.hx
  49. 1 1
      hxd/snd/openal/PitchDriver.hx
  50. 1 1
      hxd/snd/openal/ReverbDriver.hx
  51. 1 1
      hxd/snd/openal/SpatializationDriver.hx
  52. 0 4
      hxd/snd/webaudio/Context.hx
  53. 0 8
      hxsl/MacroParser.hx
  54. 1 1
      samples/Bounds.hx
  55. 1 1
      samples/Camera2D.hx
  56. 2 2
      samples/Flows.hx
  57. 1 1
      samples/Lights.hx
  58. 1 1
      samples/Sao.hx

+ 1 - 1
h2d/Drawable.hx

@@ -162,7 +162,7 @@ class Drawable extends Object {
 	**/
 	public function getShader< T:hxsl.Shader >( stype : Class<T> ) : T {
 		if (shaders != null) for( s in shaders ) {
-			var s = hxd.impl.Api.downcast(s, stype);
+			var s = Std.downcast(s, stype);
 			if( s != null )
 				return s;
 		}

+ 2 - 2
h2d/HtmlText.hx

@@ -138,7 +138,7 @@ class HtmlText extends Text {
 			var c = Std.downcast(s, h3d.shader.ColorMatrix);
 			if ( c != null && !c.enabled )
 				continue;
-			var s = hxd.impl.Api.downcast(s, stype);
+			var s = Std.downcast(s, stype);
 			if( s != null )
 				return s;
 		}
@@ -851,7 +851,7 @@ class HtmlText extends Text {
 	override function getBoundsRec( relativeTo : Object, out : h2d.col.Bounds, forSize : Bool ) {
 		if( forSize )
 			for( i in elements )
-				if( hxd.impl.Api.isOfType(i,h2d.Bitmap) || hxd.impl.Api.isOfType(i,h2d.Interactive) )
+				if( i is h2d.Bitmap || i is h2d.Interactive )
 					i.visible = false;
 		super.getBoundsRec(relativeTo, out, forSize);
 		if( forSize )

+ 2 - 2
h2d/KeyFrames.hx

@@ -129,7 +129,7 @@ class KeyFrames extends Mask {
 	@:dox(hide) @:noCompletion
 	public function set_smooth( v : Bool ) : Bool {
 		for( l in layers ){
-			var bmp = hxd.impl.Api.downcast(l.spr, h2d.Bitmap);
+			var bmp = Std.downcast(l.spr, h2d.Bitmap);
 			if( bmp != null )
 				bmp.smooth = v;
 		}
@@ -239,7 +239,7 @@ class KeyFrames extends Mask {
 
 		switch( f.property ) {
 		case AnchorPoint:
-			var bmp = hxd.impl.Api.downcast(l.spr, h2d.Bitmap);
+			var bmp = Std.downcast(l.spr, h2d.Bitmap);
 			if( bmp != null ) {
 				bmp.tile.dx = -calcValue(0);
 				bmp.tile.dy = -calcValue(1);

+ 1 - 1
h2d/Object.hx

@@ -386,7 +386,7 @@ class Object #if (domkit && !domkit_heaps) implements domkit.Model<h2d.Object> #
 	public function getScene() : Scene {
 		var p = this;
 		while( p.parent != null ) p = p.parent;
-		return hxd.impl.Api.downcast(p, Scene);
+		return Std.downcast(p, Scene);
 	}
 
 	function set_visible(b) {

+ 0 - 5
h2d/RenderContext.hx

@@ -603,10 +603,6 @@ class RenderContext extends h3d.impl.RenderContext {
 		if( blend != currentBlend ) {
 			currentBlend = blend;
 			pass.setBlendMode(blend);
-			#if flash
-			// flash does not allow blend separate operations
-			// this will get us good color but wrong alpha
-			#else
 			// accumulate correctly alpha values
 			if( blend == Alpha || blend == Add ) {
 				pass.blendAlphaSrc = One;
@@ -614,7 +610,6 @@ class RenderContext extends h3d.impl.RenderContext {
 				if( inFilterBlend != null )
 					pass.blendSrc = One;
 			}
-			#end
 		}
 		manager.fillParams(buffers, compiledShader, currentShaders);
 		engine.selectMaterial(pass);

+ 1 - 1
h2d/Scene.hx

@@ -643,7 +643,7 @@ class Scene extends Layers implements h3d.IDrawable implements hxd.SceneEvents.I
 		var f = events.getFocus();
 		if( f == null )
 			return null;
-		var i = hxd.impl.Api.downcast(f, h2d.Interactive);
+		var i = Std.downcast(f, h2d.Interactive);
 		if( i == null )
 			return null;
 		return interactive[interactive.indexOf(i)];

+ 0 - 4
h2d/Video.hx

@@ -338,11 +338,7 @@ class Video extends Drawable {
 	#if js
 
 	function errorHandler(e : js.html.Event) {
-		#if (haxe_ver >= 4)
 		onError(v.error.code + ": " + v.error.message);
-		#else
-		onError(Std.string(v.error.code));
-		#end
 	}
 
 	function endHandler(e : js.html.Event) {

+ 1 - 1
h2d/domkit/BaseComponents.hx

@@ -450,7 +450,7 @@ class ObjectComp implements h2d.domkit.Object implements domkit.Component.Compon
 	}
 
 	static function getFlowProps( o : h2d.Object ) {
-		var p = hxd.impl.Api.downcast(o.parent, h2d.Flow);
+		var p = Std.downcast(o.parent, h2d.Flow);
 		return p == null ? null : p.getProperties(o);
 	}
 

+ 3 - 3
h2d/domkit/Style.hx

@@ -21,7 +21,7 @@ class Style extends domkit.CssStyle {
 	public function load( r : hxd.res.Resource, watchChanges = true ) {
 		if( watchChanges ) r.watch(function() {
 			#if (sys || nodejs)
-			var fs = hxd.impl.Api.downcast(hxd.res.Loader.currentInstance.fs, hxd.fs.LocalFileSystem);
+			var fs = Std.downcast(hxd.res.Loader.currentInstance.fs, hxd.fs.LocalFileSystem);
 			if( fs != null ) fs.clearCache();
 			#end
 			onChange();
@@ -128,7 +128,7 @@ class Style extends domkit.CssStyle {
 				fl.padding = 10;
 				errorsText = new h2d.Text(hxd.res.DefaultFont.get(), fl);
 			}
-			var fl = hxd.impl.Api.downcast(errorsText.parent, h2d.Flow);
+			var fl = Std.downcast(errorsText.parent, h2d.Flow);
 			var sc = fl.getScene();
 			fl.maxWidth = sc.width;
 			errorsText.text = errors.join("\n");
@@ -397,7 +397,7 @@ class Style extends domkit.CssStyle {
 		var dom = obj.dom;
 		if(dom != null) {
 			for( s in dom.style ) {
-				if( s.p.name == "text" || hxd.impl.Api.isOfType(s.value,h2d.Tile) ) continue;
+				if( s.p.name == "text" || Std.isOfType(s.value,h2d.Tile) ) continue;
 				lines.push(' <font color="#D0D0D0"> ${s.p.name}</font> <font color="#808080">${s.value}</font><font color="#606060"> (style)</font>');
 			}
 			for( i in 0...dom.currentSet.length ) {

+ 1 - 1
h2d/filter/AbstractMask.hx

@@ -87,7 +87,7 @@ class AbstractMask extends Filter {
 		mask = m;
 		if( m != null && bindCount > 0 ) {
 			if( m.filter != null ) {
-				if( hxd.impl.Api.isOfType(m.filter,Hide) ) throw "Same mask can't be part of several filters";
+				if( m.filter is Hide ) throw "Same mask can't be part of several filters";
 				throw "Can't set mask with filter "+m.filter;
 			}
 			m.filter = hide;

+ 0 - 2
h3d/Engine.hx

@@ -90,8 +90,6 @@ class Engine {
 		#else
 		driver = new h3d.impl.GlDriver(antiAlias);
 		#end
-		#elseif flash
-		driver = new h3d.impl.Stage3dDriver(antiAlias);
 		#elseif (hldx && dx12)
 		driver = new h3d.impl.DX12Driver();
 		#elseif hldx

+ 1 - 1
h3d/anim/Animation.hx

@@ -170,7 +170,7 @@ class Animation {
 				objects.remove(a);
 				continue;
 			}
-			var joint = hxd.impl.Api.downcast(obj, h3d.scene.Skin.Joint);
+			var joint = Std.downcast(obj, h3d.scene.Skin.Joint);
 			if( joint != null ) {
 				currentSkin = cast joint.parent;
 				a.targetSkin = currentSkin != null ? currentSkin : joint.skin;

+ 1 - 1
h3d/anim/BufferAnimation.hx

@@ -81,7 +81,7 @@ class BufferAnimation extends Animation {
 		if( a == null )
 			a = new BufferAnimation(name, frameCount, sampling);
 		super.clone(a);
-		var la = hxd.impl.Api.downcast(a, BufferAnimation);
+		var la = Std.downcast(a, BufferAnimation);
 		la.setData(data, stride);
 		return a;
 	}

+ 1 - 11
h3d/impl/DirectXDriver.hx

@@ -1,16 +1,6 @@
 package h3d.impl;
 
-#if (hldx && haxe_ver < 4)
-
-class DirectXDriver extends h3d.impl.Driver {
-
-	public function new() {
-		throw "HL DirectX support requires Haxe 4.0+";
-	}
-
-}
-
-#elseif (hldx && !dx12)
+#if (hldx && !dx12)
 
 import h3d.impl.Driver;
 import dx.Driver;

+ 1 - 1
h3d/mat/MaterialDatabase.hx

@@ -26,7 +26,7 @@ class MaterialDatabase {
 	function saveData( model : hxd.res.Resource, data : Dynamic ) {
 		var file = getFilePath(model);
 		#if ((sys || nodejs) && !usesys)
-		var fs = hxd.impl.Api.downcast(hxd.res.Loader.currentInstance.fs, hxd.fs.LocalFileSystem);
+		var fs = Std.downcast(hxd.res.Loader.currentInstance.fs, hxd.fs.LocalFileSystem);
 		if( fs != null && !haxe.io.Path.isAbsolute(file) )
 			file = fs.baseDir + file;
 		if( data == null )

+ 3 - 3
h3d/mat/Pass.hx

@@ -256,7 +256,7 @@ class Pass {
 		var sl = shaders;
 		var prev = null;
 		while( sl != null ) {
-			if( hxd.impl.Api.isOfType(sl.s, t) ) {
+			if( Std.isOfType(sl.s, t) ) {
 				resetRendererFlags();
 				if ( selfShadersCache == sl )
 					selfShadersCache = selfShadersCache.next;
@@ -272,7 +272,7 @@ class Pass {
 		sl = selfShaders;
 		prev = null;
 		while( sl != null ) {
-			if( hxd.impl.Api.isOfType(sl.s, t) ) {
+			if( Std.isOfType(sl.s, t) ) {
 				resetRendererFlags();
 				if ( selfShadersCache == sl )
 					selfShadersCache = selfShadersCache.next;
@@ -294,7 +294,7 @@ class Pass {
 
 	function _getShader< T:hxsl.Shader >(t:Class<T>, s : hxsl.ShaderList) : T {
 		while( s != null && s != parentShaders ) {
-			var sh = hxd.impl.Api.downcast(s.s, t);
+			var sh = Std.downcast(s.s, t);
 			if( sh != null )
 				return sh;
 			s = s.next;

+ 1 - 1
h3d/mat/PbrMaterial.hx

@@ -213,7 +213,7 @@ class PbrMaterial extends Material {
 		mainPass.enableLights = true;
 
 		// Backward compatibility
-		if(Std.isOfType((props:Dynamic).culling, Bool))
+		if( (props:Dynamic).culling is Bool )
 			props.culling = (props:Dynamic).culling ? Back : None;
 		#if editor
 		if( (props:Dynamic).colorMask == null ) props.colorMask = 15;

+ 1 - 1
h3d/pass/DirShadowMap.hx

@@ -75,7 +75,7 @@ class DirShadowMap extends Shadows {
 				var b = m.primitive.getBounds();
 				if( b.xMin > b.xMax ) return;
 
-				var absPos = Std.isOfType(m.primitive, h3d.prim.Instanced) ? identity : m.getAbsPos();
+				var absPos = m.primitive is h3d.prim.Instanced ? identity : m.getAbsPos();
 				if( autoZPlanes ) {
 					btmp.load(b);
 					btmp.transform(absPos);

+ 0 - 2
h3d/pass/HardwarePick.hx

@@ -41,9 +41,7 @@ class HardwarePick extends Default {
 	override function dispose() {
 		super.dispose();
 		texOut.dispose();
-		#if !flash
 		texOut.depthBuffer.dispose();
-		#end
 	}
 
 	override function getOutputs() : Array<hxsl.Output> {

+ 7 - 7
h3d/scene/Object.hx

@@ -414,7 +414,7 @@ class Object {
 	**/
 	public function getMeshes( ?out : Array<Mesh> ) {
 		if( out == null ) out = [];
-		var m = hxd.impl.Api.downcast(this, Mesh);
+		var m = Std.downcast(this, Mesh);
 		if( m != null ) out.push(m);
 		for( c in children )
 			c.getMeshes(out);
@@ -425,7 +425,7 @@ class Object {
 		Search for an mesh recursively by name, return null if not found.
 	**/
 	public function getMeshByName( name : String) {
-		return hxd.impl.Api.downcast(getObjectByName(name), Mesh);
+		return Std.downcast(getObjectByName(name), Mesh);
 	}
 
 	/**
@@ -516,7 +516,7 @@ class Object {
 		if( !visible || (culled && inheritCulled) )
 			return;
 		if( !culled ) {
-			var m = hxd.impl.Api.downcast(this, Mesh);
+			var m = Std.downcast(this, Mesh);
 			if( m != null ) callb(m);
 		}
 		for( o in children )
@@ -576,7 +576,7 @@ class Object {
 	public function getScene() {
 		var p = this;
 		while( p.parent != null ) p = p.parent;
-		return hxd.impl.Api.downcast(p, Scene);
+		return Std.downcast(p, Scene);
 	}
 
 	/**
@@ -603,14 +603,14 @@ class Object {
 		Tell if the object is a Mesh.
 	**/
 	public inline function isMesh() {
-		return hxd.impl.Api.downcast(this, Mesh) != null;
+		return Std.downcast(this, Mesh) != null;
 	}
 
 	/**
 		If the object is a Mesh, return the corresponding Mesh. If not, throw an exception.
 	**/
 	public function toMesh() : Mesh {
-		var m = hxd.impl.Api.downcast(this, Mesh);
+		var m = Std.downcast(this, Mesh);
 		if( m != null )
 			return m;
 		throw this + " is not a Mesh";
@@ -630,7 +630,7 @@ class Object {
 		for( obj in children ) {
 			var c = obj.getCollider();
 			if( c == null ) continue;
-			var cgrp = hxd.impl.Api.downcast(c, h3d.col.Collider.GroupCollider);
+			var cgrp = Std.downcast(c, h3d.col.Collider.GroupCollider);
 			if( cgrp != null ) {
 				for( c in cgrp.colliders )
 					colliders.push(c);

+ 1 - 1
h3d/scene/Renderer.hx

@@ -72,7 +72,7 @@ class Renderer extends hxd.impl.AnyProps {
 
 	public function getPass<T:h3d.pass.Base>( c : Class<T> ) : T {
 		for( p in allPasses )
-			if( hxd.impl.Api.isOfType(p, c) )
+			if( Std.isOfType(p, c) )
 				return cast p;
 		return null;
 	}

+ 1 - 1
h3d/scene/World.hx

@@ -540,7 +540,7 @@ class World extends Object {
 					c.buffers.set(g.m.bits, b);
 					initMaterial(b, g.m);
 				}
-				var p = hxd.impl.Api.downcast(b.primitive, h3d.prim.BigPrimitive);
+				var p = Std.downcast(b.primitive, h3d.prim.BigPrimitive);
 
 				if(e.optimized) {
 					var m = e.transform;

+ 2 - 2
h3d/scene/fwd/LightSystem.hx

@@ -23,11 +23,11 @@ class LightSystem extends h3d.scene.LightSystem {
 	}
 
 	function get_additiveLighting() {
-		return hxd.impl.Api.downcast(ambientShader,h3d.shader.AmbientLight).additive;
+		return Std.downcast(ambientShader,h3d.shader.AmbientLight).additive;
 	}
 
 	function set_additiveLighting(b) {
-		return hxd.impl.Api.downcast(ambientShader,h3d.shader.AmbientLight).additive = b;
+		return Std.downcast(ambientShader,h3d.shader.AmbientLight).additive = b;
 	}
 
 	override function initLights(ctx) {

+ 2 - 2
h3d/scene/pbr/LightSystem.hx

@@ -13,7 +13,7 @@ class LightSystem extends h3d.scene.LightSystem {
 	}
 
 	override function computeLight( obj : h3d.scene.Object, shaders : hxsl.ShaderList ) : hxsl.ShaderList {
-		var light = hxd.impl.Api.downcast(obj, h3d.scene.pbr.Light);
+		var light = Std.downcast(obj, h3d.scene.pbr.Light);
 		if( light != null ) {
 			shaders = ctx.allocShaderList(light.shader, shaders);
 			if( light.shadows.shader != null && light.shadows.mode != None )
@@ -48,7 +48,7 @@ class LightSystem extends h3d.scene.LightSystem {
 		var width = currentTarget == null ? ctx.engine.width : currentTarget.width;
 		var height = currentTarget == null ? ctx.engine.height : currentTarget.height;
 		while( plight != null ) {
-			var light = hxd.impl.Api.downcast(plight, h3d.scene.pbr.Light);
+			var light = Std.downcast(plight, h3d.scene.pbr.Light);
 			if( light != null && light.primitive == null ) {
 				if( light.shadows.shader != null && shadows) lightPass.addShader(light.shadows.shader);
 				lightPass.addShader(light.shader);

+ 5 - 5
h3d/scene/pbr/Renderer.hx

@@ -230,7 +230,7 @@ class Renderer extends h3d.scene.Renderer {
 	function lighting() {
 
 		begin(Shadows);
-		var ls = hxd.impl.Api.downcast(getLightSystem(), h3d.scene.pbr.LightSystem);
+		var ls = Std.downcast(getLightSystem(), h3d.scene.pbr.LightSystem);
 		var count = ctx.engine.drawCalls;
 		if( ls != null ) drawShadows(ls);
 		if( ctx.lightSystem != null ) ctx.lightSystem.drawPasses = ctx.engine.drawCalls - count;
@@ -246,7 +246,7 @@ class Renderer extends h3d.scene.Renderer {
 
 		begin(Lighting);
 		if ( displayMode == Performance ) {
-			var ls = hxd.impl.Api.downcast(getLightSystem(), h3d.scene.pbr.LightSystem);
+			var ls = Std.downcast(getLightSystem(), h3d.scene.pbr.LightSystem);
 			var s = new h3d.shader.pbr.Light.Performance();
 			performance.shader.gradient = getLightingPerformanceGradient();
 			s.maxLights = performance.shader.gradient.width - 1;
@@ -330,7 +330,7 @@ class Renderer extends h3d.scene.Renderer {
 		var light = @:privateAccess ctx.lights;
 		var passes = get("shadow");
 		while( light != null ) {
-			var plight = hxd.impl.Api.downcast(light, h3d.scene.pbr.Light);
+			var plight = Std.downcast(light, h3d.scene.pbr.Light);
 			if( plight != null ) {
 				if( !shadows ) passes.clear();
 				ls.drawShadows(plight, passes);
@@ -377,7 +377,7 @@ class Renderer extends h3d.scene.Renderer {
 		if (!shadows)
 			passes.clear();
 		while( light != null ) {
-			var plight = hxd.impl.Api.downcast(light, h3d.scene.pbr.Light);
+			var plight = Std.downcast(light, h3d.scene.pbr.Light);
 			if( plight != null ) {
 				plight.shadows.setContext(ctx);
 				plight.shadows.computeStatic(passes);
@@ -564,7 +564,7 @@ class Renderer extends h3d.scene.Renderer {
 		lighting();
 
 		begin(Forward);
-		var ls = hxd.impl.Api.downcast(getLightSystem(), h3d.scene.pbr.LightSystem);
+		var ls = Std.downcast(getLightSystem(), h3d.scene.pbr.LightSystem);
 		ls.forwardMode = true;
 		setTargets([textures.hdr, getPbrDepth()]);
 		renderPass(colorDepthOutput, get("forward"));

+ 2 - 2
hxd/App.hx

@@ -64,8 +64,8 @@ class App implements h3d.IDrawable {
 		If you call disposePrevious, it will call dispose() on the previous scene.
 	**/
 	public function setScene( scene : hxd.SceneEvents.InteractiveScene, disposePrevious = true ) {
-		var new2D = hxd.impl.Api.downcast(scene, h2d.Scene);
-		var new3D = hxd.impl.Api.downcast(scene, h3d.scene.Scene);
+		var new2D = Std.downcast(scene, h2d.Scene);
+		var new3D = Std.downcast(scene, h3d.scene.Scene);
 		if( new2D != null ) {
 			sevents.removeScene(s2d);
 			sevents.addScene(scene, 0);

+ 2 - 2
hxd/File.hx

@@ -24,7 +24,7 @@ class File {
 
 	public static function browse( onSelect : BrowseSelect -> Void, ?options : BrowseOptions ) {
 		if( options == null ) options = {};
-		#if (hl && (haxe_ver >= 4))
+		#if hl
 			var old = hxd.System.allowTimeout;
 			hxd.System.allowTimeout = false;
 			var path = hl.UI.loadFile({
@@ -103,7 +103,7 @@ class File {
 
 	public static function saveAs( dataContent : haxe.io.Bytes, ?options : BrowseOptions ) {
 		if( options == null ) options = { };
-		#if (hl && (haxe_ver >= 4))
+		#if hl
 			var old = hxd.System.allowTimeout;
 			hxd.System.allowTimeout = false;
 			var path = hl.UI.saveFile({

+ 1 - 1
hxd/IndexBuffer.hx

@@ -25,7 +25,7 @@ abstract IndexBuffer(InnerData) {
 
 	public inline function new(length = 0) {
 		#if js
-		this = #if (haxe_ver >= 4) js.Syntax.construct #else untyped __new__ #end(Array, length);
+		this = js.Syntax.construct(Array, length);
 		#else
 		this = new InnerData();
 		if( length > 0 ) grow(length);

+ 5 - 5
hxd/System.hl.hx

@@ -131,7 +131,7 @@ class System {
 
 	static function runMainLoop() {
 		#if (haxe_ver >= 4.1)
-		var reportError = function(e:Dynamic) reportError(Std.isOfType(e,haxe.Exception)?e:new haxe.Exception(Std.string(e),null,e));
+		var reportError = function(e:Dynamic) reportError((e is haxe.Exception)?e:new haxe.Exception(Std.string(e),null,e));
 		#else
 		var reportError = function(e) reportError(e);
 		#end
@@ -442,7 +442,7 @@ class System {
 	}
 
 	static function get_allowTimeout() @:privateAccess {
-		#if (usesys || (haxe_ver < 4))
+		#if usesys
 		return false;
 		#else
 		return !sentinel.pause;
@@ -450,7 +450,7 @@ class System {
 	}
 
 	static function set_allowTimeout(b) @:privateAccess {
-		#if (usesys || (haxe_ver < 4))
+		#if usesys
 		return false;
 		#else
 		return sentinel.pause = !b;
@@ -469,8 +469,8 @@ class System {
 
 	#if (hlsdl || hldx)
 	@:keep static var _ = {
-		haxe.MainLoop.add(timeoutTick, -1) #if (haxe_ver >= 4) .isBlocking = false #end;
-		haxe.MainLoop.add(updateCursor, -1) #if (haxe_ver >= 4) .isBlocking = false #end;
+		haxe.MainLoop.add(timeoutTick, -1).isBlocking = false;
+		haxe.MainLoop.add(updateCursor, -1).isBlocking = false;
 	}
 	#end
 

+ 0 - 4
hxd/fmt/bfnt/FontParser.hx

@@ -1,10 +1,6 @@
 package hxd.fmt.bfnt;
 
-#if (haxe_ver < 4)
-import haxe.xml.Fast in Access;
-#else
 import haxe.xml.Access;
-#end
 
 class FontParser {
 

+ 0 - 4
hxd/fmt/fbx/BaseLibrary.hx

@@ -3,11 +3,7 @@ import haxe.io.Bytes;
 using hxd.fmt.fbx.Data;
 import h3d.col.Point;
 
-#if (haxe_ver < 4)
-import haxe.xml.Fast in Access;
-#else
 import haxe.xml.Access;
-#end
 
 class TmpObject {
 	public var index : Int;

+ 1 - 1
hxd/fmt/fbx/HMDOut.hx

@@ -42,7 +42,7 @@ class HMDOut extends BaseLibrary {
 		if ( index.vidx.length > 0 && uvs[0] == null ) @:privateAccess
 			throw "Need UVs to build tangents" + geom.lib != null ? ' in ${geom.lib.fileName}' : '';
 
-		#if (hl && !hl_disable_mikkt && (haxe_ver >= "4.0"))
+		#if (hl && !hl_disable_mikkt)
 		var m = new hl.Format.Mikktspace();
 		m.buffer = new hl.Bytes(8 * 4 * index.vidx.length);
 		m.stride = 8;

+ 1 - 1
hxd/fmt/pak/Loader.hx

@@ -16,7 +16,7 @@ class Loader extends h2d.Object {
 		this.onDone = onDone;
 		if( hxd.res.Loader.currentInstance == null )
 			hxd.res.Loader.currentInstance = new hxd.res.Loader(new FileSystem());
-		fs = hxd.impl.Api.downcast(hxd.res.Loader.currentInstance.fs, FileSystem);
+		fs = Std.downcast(hxd.res.Loader.currentInstance.fs, FileSystem);
 		if( fs == null )
 			throw "Can only use loader with PAK file system";
 		hxd.System.setLoop(render);

+ 3 - 3
hxd/fs/FileConverter.hx

@@ -120,7 +120,7 @@ class FileConverter {
 	}
 
 	function makeCommmand( obj : Dynamic ) : { cmd : ConvertCommand, priority : Int } {
-		if( hxd.impl.Api.isOfType(obj,String) )
+		if( obj is String )
 			return { cmd : { conv : loadConvert(obj) }, priority : 0 };
 		if( obj.convert == null )
 			throw "Missing 'convert' in "+obj;
@@ -145,9 +145,9 @@ class FileConverter {
 	function formatValue( v : Dynamic ) : String {
 		if( !Reflect.isObject(v) )
 			return Std.string(v);
-		if( Std.isOfType(v,String) )
+		if( v is String )
 			return v;
-		if( Std.isOfType(v,Array) ) {
+		if( v is Array ) {
 			var a : Array<Dynamic> = v;
 			return [for( v in a ) formatValue(v)].toString();
 		}

+ 2 - 4
hxd/fs/LocalFileSystem.hx

@@ -236,13 +236,11 @@ class LocalFileSystem implements FileSystem {
 		if( configuration == null )
 			configuration = "default";
 
-		#if (macro && haxe_ver >= 4.0)
+		#if macro
 		var exePath = null;
-		#elseif (haxe_ver >= 3.3)
+		#else
 		var pr = Sys.programPath();
 		var exePath = pr == null ? null : pr.split("\\").join("/").split("/");
-		#else
-		var exePath = Sys.executablePath().split("\\").join("/").split("/");
 		#end
 
 		if( exePath != null ) exePath.pop();

+ 0 - 21
hxd/impl/Api.hx

@@ -1,21 +0,0 @@
-package hxd.impl;
-
-class Api {
-
-	public static inline function downcast<T:{},S:T>( value : T, c : Class<S> ) : S {
-		#if haxe4
-		return Std.downcast(value,c);
-		#else
-		return Std.instance(value,c);
-		#end
-	}
-
-	public static inline function isOfType( v : Dynamic, t : Dynamic) : Bool {
-		#if (haxe_ver >= 4.1)
-		return Std.isOfType(v, t);
-		#else
-		return Std.is(v, t);
-		#end
-	}
-
-}

+ 0 - 10
hxd/impl/TypedArray.hx

@@ -2,7 +2,6 @@ package hxd.impl;
 
 #if js
 
-#if haxe4
 typedef Float32Array = js.lib.Float32Array;
 typedef Uint16Array = js.lib.Uint16Array;
 typedef Int16Array = js.lib.Int16Array;
@@ -10,15 +9,6 @@ typedef Uint8Array = js.lib.Uint8Array;
 typedef ArrayBuffer = js.lib.ArrayBuffer;
 typedef Uint32Array = js.lib.Uint32Array;
 typedef ArrayBufferView = js.lib.ArrayBufferView;
-#else
-typedef Float32Array = js.html.Float32Array;
-typedef Uint16Array = js.html.Uint16Array;
-typedef Int16Array = js.html.Int16Array;
-typedef Uint8Array = js.html.Uint8Array;
-typedef ArrayBuffer = js.html.ArrayBuffer;
-typedef Uint32Array = js.html.Uint32Array;
-typedef ArrayBufferView = js.html.ArrayBufferView;
-#end
 
 #else
 typedef Float32Array = haxe.ds.Vector<Float32>;

+ 0 - 4
hxd/net/BinaryLoader.hx

@@ -36,11 +36,7 @@ class BinaryLoader {
 		}
 
 		xhr.onprogress = function(e) {
-			#if (haxe_ver >= 4)
 			onProgress(Std.int(js.Syntax.code("{0}.loaded || {0}.position", e)), Std.int(js.Syntax.code("{0}.total || {0}.totalSize", e)));
-			#else
-			onProgress(Std.int(untyped __js__("{0}.loaded || {0}.position", e)), Std.int(untyped __js__("{0}.total || {0}.totalSize", e)));
-			#end
 		}
 		xhr.send();
 

+ 3 - 8
hxd/net/Socket.hx

@@ -34,7 +34,7 @@ class Socket {
 
 	static var openedSocks = [];
 	#if hl
-	var s : #if (haxe_ver >= 4) hl.uv.Stream #else Dynamic #end;
+	var s : hl.uv.Stream;
 	#elseif (nodejs && hxnodejs)
 	var s : js.node.net.Socket;
 	#end
@@ -44,11 +44,6 @@ class Socket {
 
 	public function new() {
 		out = new SocketOutput();
-		#if hl
-			#if (haxe_ver < 4)
-			throw "Not supported in Haxe 3.x";
-			#end
-		#end
 	}
 
 	public function set_timeout(t:Null<Float>) {
@@ -58,7 +53,7 @@ class Socket {
 	public function connect( host : String, port : Int, onConnect : Void -> Void ) {
 		close();
 		openedSocks.push(this);
-		#if (hl && haxe_ver >= 4)
+		#if hl
 		var tcp = new hl.uv.Tcp();
 		s = tcp;
 		tcp.connect(new sys.net.Host(host), port, function(b) {
@@ -79,7 +74,7 @@ class Socket {
 	public function bind( host : String, port : Int, onConnect : Socket -> Void, listenCount = 5 ) {
 		close();
 		openedSocks.push(this);
-		#if (hl && haxe_ver >= 4)
+		#if hl
 		var tcp = new hl.uv.Tcp();
 		s = tcp;
 		try {

+ 0 - 4
hxd/res/BitmapFont.hx

@@ -1,9 +1,5 @@
 package hxd.res;
-#if (haxe_ver < 4)
-import haxe.xml.Fast in Access;
-#else
 import haxe.xml.Access;
-#end
 
 class BitmapFont extends Resource {
 

+ 10 - 15
hxd/res/DynamicText.hx

@@ -3,12 +3,7 @@ package hxd.res;
 import haxe.macro.Context;
 import haxe.macro.Expr;
 #end
-#if (haxe_ver < 4)
-import haxe.xml.Fast in Access;
-#else
 import haxe.xml.Access;
-#end
-import hxd.impl.Api;
 
 typedef DynamicTextMeta = Map<String,DynamicTextMetaContent>;
 typedef DynamicTextMetaContent = { skip : Bool, sub : DynamicTextMeta };
@@ -87,7 +82,7 @@ class DynamicText {
 				return null;
 			missingStr = true;
 		}
-		if( Api.isOfType(old,Array) ) {
+		if( Std.isOfType(old,Array) ) {
 			onMissing(path,"should be a group");
 			return null;
 		}
@@ -162,23 +157,23 @@ class DynamicText {
 						path.pop();
 						continue;
 					}
-					if( Api.isOfType(sub,String) ) {
+					if( Std.isOfType(sub,String) ) {
 						onMissing(path,"should be a text and not a group");
 						path.pop();
 						continue;
 					}
 					// build structure
 					var ref = ref == null ? null : refIds.get(id);
-					if( Api.isOfType(sub,Array) ) {
+					if( Std.isOfType(sub,Array) ) {
 						var elements : Array<Dynamic> = sub;
 						var data = [for( e in x.elements ) e];
 						var dataRef = ref == null ? null : [for( e in ref.elements ) e];
 						for( i in 0...elements.length ) {
 							var e = elements[i];
 							path.push("[" + i + "]");
-							if( Api.isOfType(e, Array) ) {
+							if( Std.isOfType(e, Array) ) {
 								throw "TODO";
-							} else if( Api.isOfType(e, String) || Reflect.isFunction(e) ) {
+							} else if( Std.isOfType(e, String) || Reflect.isFunction(e) ) {
 								var enew = applyText(path, e, data[i], dataRef == null ? null : dataRef[i], onMissing);
 								if( enew != null )
 									elements[i] = enew;
@@ -201,11 +196,11 @@ class DynamicText {
 			if( str != null ) {
 				function replaceRec(obj:Dynamic,f,str) {
 					var v : Dynamic = Reflect.field(obj, f);
-					if( Api.isOfType(v, String) )
+					if( Std.isOfType(v, String) )
 						Reflect.setField(obj, f, str);
 					else if( Reflect.isFunction(v) )
 						Reflect.setField(obj, f, (_) -> str);
-					else if( Api.isOfType(v,Array) ) {
+					else if( Std.isOfType(v,Array) ) {
 						var arr : Array<Dynamic> = v;
 						for( i in 0...arr.length )
 							arr[i] = applyText(path, arr[i], null, null, onMissing);
@@ -242,12 +237,12 @@ class DynamicText {
 				for( e in x.elements ) {
 					var v : Dynamic = parseXmlData(e);
 					if( isArray ) {
-						if( !Api.isOfType(v, Array) ) v = [v];
+						if( !Std.isOfType(v, Array) ) v = [v];
 					} else {
-						if( Api.isOfType(v, Array) ) {
+						if( Std.isOfType(v, Array) ) {
 							for( i in 0...a.length ) {
 								var v = a[i];
-								if( !Api.isOfType(v, Array) )
+								if( !Std.isOfType(v, Array) )
 									a[i] = [v];
 							}
 							isArray = true;

+ 0 - 4
hxd/res/Embed.hx

@@ -85,11 +85,7 @@ class Embed {
 
 	#if js
 	static function __init__() untyped {
-		#if (haxe_ver >= 4)
 		js.Syntax.code("var hx__registerFont");
-		#else
-		__js__("var hx__registerFont");
-		#end
 		untyped hx__registerFont = function(name, data) {
 			var s = js.Browser.document.createStyleElement();
 			s.type = "text/css";

+ 1 - 1
hxd/res/Loader.hx

@@ -46,7 +46,7 @@ class Loader {
 			currentInstance = old;
 			cache.set(path, res);
 		} else {
-			if( hxd.impl.Api.downcast(res,c) == null )
+			if( Std.downcast(res,c) == null )
 				throw path+" has been reintrepreted from "+Type.getClass(res)+" to "+c;
 		}
 		return res;

+ 0 - 4
hxd/res/TiledMap.hx

@@ -1,9 +1,5 @@
 package hxd.res;
-#if (haxe_ver < 4)
-import haxe.xml.Fast in Access;
-#else
 import haxe.xml.Access;
-#end
 
 typedef TiledMapLayer = {
 	var data : Array<Int>;

+ 1 - 1
hxd/snd/ChannelBase.hx

@@ -18,7 +18,7 @@ class ChannelBase {
 	public function getEffect<T:Effect>( etype : Class<T> ) : T {
 		if(effects == null) return null;  // Already released
 		for (e in effects) {
-			var e = hxd.impl.Api.downcast(e, etype);
+			var e = Std.downcast(e, etype);
 			if (e != null) return e;
 		}
 		return null;

+ 2 - 2
hxd/snd/LoadingData.hx

@@ -11,7 +11,7 @@ class LoadingData extends Data {
 
 	override function decode(out:haxe.io.Bytes, outPos:Int, sampleStart:Int, sampleCount:Int):Void {
 		var d = snd.getData();
-		if( hxd.impl.Api.isOfType(d, LoadingData) )
+		if( d is LoadingData )
 			throw "Sound data is not yet available, use load() first";
 		d.decode(out, outPos, sampleStart, sampleCount);
 	}
@@ -20,7 +20,7 @@ class LoadingData extends Data {
 		if( waitCount > 10 )
 			throw "Failed to load data";
 		var d = snd.getData();
-		if( hxd.impl.Api.isOfType(d, LoadingData) ) {
+		if( Std.isOfType(d, LoadingData) ) {
 			waitCount++;
 			haxe.Timer.delay(load.bind(onEnd), 100);
 			return;

+ 1 - 1
hxd/snd/Manager.hx

@@ -148,7 +148,7 @@ class Manager {
 		if( instance == null ) {
 			instance = new Manager();
 			instance.updateEvent = haxe.MainLoop.add(instance.update);
-			#if (haxe_ver >= 4) instance.updateEvent.isBlocking = false; #end
+			instance.updateEvent.isBlocking = false;
 		}
 		return instance;
 	}

+ 1 - 1
hxd/snd/NativeChannel.hx

@@ -34,7 +34,7 @@ private class ALChannel {
 	public function new(samples, native) {
 		if ( nativeUpdate == null ) {
 			nativeUpdate = haxe.MainLoop.add(updateChannels);
-			#if (haxe_ver >= 4) nativeUpdate.isBlocking = false; #end
+			nativeUpdate.isBlocking = false;
 			nativeChannels = [];
 		}
 		this.native = native;

+ 1 - 1
hxd/snd/openal/PitchDriver.hx

@@ -7,7 +7,7 @@ import hxd.snd.effect.Pitch;
 class PitchDriver extends EffectDriver<Pitch> {
 
 	override function apply(e : Pitch, source : SourceHandle) : Void {
-		AL.sourcef(source.inst, AL.PITCH, hxd.impl.Api.downcast(e, hxd.snd.effect.Pitch).value);
+		AL.sourcef(source.inst, AL.PITCH, Std.downcast(e, hxd.snd.effect.Pitch).value);
 	}
 
 	override function unbind(e : Pitch, source : SourceHandle) : Void {

+ 1 - 1
hxd/snd/openal/ReverbDriver.hx

@@ -80,7 +80,7 @@ class ReverbDriver extends hxd.snd.Driver.EffectDriver<Reverb> {
 	}
 
 	override function apply(e : Reverb, s : SourceHandle) : Void {
-		var e = hxd.impl.Api.downcast(e, hxd.snd.effect.Reverb);
+		var e = Std.downcast(e, hxd.snd.effect.Reverb);
 		var send = s.getAuxiliarySend(e);
 		AL.source3i(s.inst, EFX.AUXILIARY_SEND_FILTER, slot.toInt(), send, EFX.FILTER_NULL);
 	}

+ 1 - 1
hxd/snd/openal/SpatializationDriver.hx

@@ -17,7 +17,7 @@ class SpatializationDriver extends EffectDriver<Spatialization> {
 	}
 
 	override function apply(e : Spatialization, s : SourceHandle) : Void {
-		var e = hxd.impl.Api.downcast(e, hxd.snd.effect.Spatialization);
+		var e = Std.downcast(e, hxd.snd.effect.Spatialization);
 
 		AL.source3f(s.inst, AL.POSITION,  -e.position.x,  e.position.y,  e.position.z);
 		AL.source3f(s.inst, AL.VELOCITY,  -e.velocity.x,  e.velocity.y,  e.velocity.z);

+ 0 - 4
hxd/snd/webaudio/Context.hx

@@ -24,11 +24,7 @@ class Context {
 				ctx = new js.html.audio.AudioContext();
 			} catch( e : Dynamic ) try {
 				// Fallback to Chrome webkit prefix.
-				#if (haxe_ver >= 4)
 				ctx = js.Syntax.code('new window.webkitAudioContext()');
-				#else
-				ctx = untyped __js__('new window.webkitAudioContext()');
-				#end
 			} catch( e : Dynamic ) {
 				ctx = null;
 			}

+ 0 - 8
hxsl/MacroParser.hx

@@ -186,11 +186,7 @@ class MacroParser {
 					qualifiers : [],
 				}
 			}]);
-		#if haxe4
 		case EFunction(FNamed(name,_),f) if( f.expr != null ):
-		#else
-		case EFunction(name, f) if( name != null && f.expr != null ):
-		#end
 			EFunction({
 				name : name,
 				ret : f.ret == null ? null : (switch( f.ret ) {
@@ -243,11 +239,7 @@ class MacroParser {
 			EParenthesis(parseExpr(e));
 		case EIf(cond, eif, eelse), ETernary(cond, eif, eelse):
 			EIf(parseExpr(cond), parseExpr(eif), eelse == null ? null : parseExpr(eelse));
-		#if (haxe_ver >= 4)
 		case EFor({ expr : EBinop(OpIn,{ expr : EConst(CIdent(n)) }, eloop) },eblock):
-		#else
-		case EFor( { expr : EIn( { expr : EConst(CIdent(n)) }, eloop) }, eblock):
-		#end
 			EFor(n, parseExpr(eloop), parseExpr(eblock));
 		case EReturn(e):
 			EReturn(e == null ? null : parseExpr(e));

+ 1 - 1
samples/Bounds.hx

@@ -50,7 +50,7 @@ class Bounds extends hxd.App {
 		for( i in 1...2 ) {
 			var prev = boxes[i - 1];
 			var b = boxes[i].getBounds(prev);
-			var g = hxd.impl.Api.downcast(prev.getChildAt(2), h2d.Graphics);
+			var g = Std.downcast(prev.getChildAt(2), h2d.Graphics);
 			g.clear();
 			g.beginFill(0xFFFFFF, 0.5);
 			g.drawRect(b.x, b.y, b.width, b.height);

+ 1 - 1
samples/Camera2D.hx

@@ -39,7 +39,7 @@ class Camera2D extends SampleApp {
 
 	private function setSliderAndTextInputValue( slider : h2d.Slider, value : Float ) {
 		slider.value = value;
-		var tf : h2d.TextInput = hxd.impl.Api.downcast(slider.parent.getChildAt(2),h2d.TextInput);
+		var tf : h2d.TextInput = Std.downcast(slider.parent.getChildAt(2),h2d.TextInput);
 		if(tf!=null) tf.text = "" + hxd.Math.fmt(value);
 	}
 

+ 2 - 2
samples/Flows.hx

@@ -517,7 +517,7 @@ class Flows extends hxd.App {
 						movingFlow.verticalAlign = vAligns[(vAligns.indexOf(movingFlow.verticalAlign)+1)%3];
 
 						if (movingFlow.verticalAlign == vAligns[0]) {
-							var parent = hxd.impl.Api.downcast(movingFlow.parent, Flow);
+							var parent = Std.downcast(movingFlow.parent, Flow);
 
 							parent.horizontalAlign = hAligns[(hAligns.indexOf(parent.horizontalAlign)+1)%3];
 							if (parent.horizontalAlign == hAligns[0]) {
@@ -525,7 +525,7 @@ class Flows extends hxd.App {
 
 								if (parent.verticalAlign == vAligns[0]) {
 
-									var parent = hxd.impl.Api.downcast(parent.parent, Flow);
+									var parent = Std.downcast(parent.parent, Flow);
 
 									parent.horizontalAlign = hAligns[(hAligns.indexOf(parent.horizontalAlign)+1)%3];
 									if (parent.horizontalAlign == hAligns[0]) {

+ 1 - 1
samples/Lights.hx

@@ -141,7 +141,7 @@ class Lights extends SampleApp {
 			m.m.x = m.cx + Math.cos(m.pos) * m.ray;
 			m.m.y = m.cy + Math.sin(m.pos) * m.ray;
 
-			var cc = hxd.impl.Api.downcast(m.m.cullingCollider, h3d.col.Sphere);
+			var cc = Std.downcast(m.m.cullingCollider, h3d.col.Sphere);
 			if( cc != null ) {
 				var absPos = m.m.getAbsPos();
 				cc.x = absPos.tx;

+ 1 - 1
samples/Sao.hx

@@ -135,7 +135,7 @@ class Sao extends SampleApp {
 		if(K.isPressed(K.BACKSPACE))
 			reset();
 
-		var r = hxd.impl.Api.downcast(s3d.renderer, CustomRenderer);
+		var r = Std.downcast(s3d.renderer, CustomRenderer);
 		if(K.isPressed(K.NUMBER_1))
 			r.mode = 0;
 		if(K.isPressed(K.NUMBER_2))