2
0
Эх сурвалжийг харах

usesys, usegl compatibility

ncannasse 7 жил өмнө
parent
commit
0daba3517a
5 өөрчлөгдсөн 41 нэмэгдсэн , 69 устгасан
  1. 2 2
      h3d/Engine.hx
  2. 6 6
      h3d/impl/Driver.hx
  3. 13 13
      h3d/impl/GlDriver.hx
  4. 9 37
      hxd/Pad.hx
  5. 11 11
      hxd/System.hl.hx

+ 2 - 2
h3d/Engine.hx

@@ -45,7 +45,7 @@ class Engine {
 	var nullTexture : h3d.mat.Texture;
 	var textureColorCache = new Map<Int,h3d.mat.Texture>();
 	@:allow(hxd.res) var resCache = new Map<{},Dynamic>();
-	
+
 	@:access(hxd.Stage)
 	public function new( hardware = true, aa = 0 ) {
 		this.hardware = hardware;
@@ -56,7 +56,7 @@ class Engine {
 		realFps = hxd.System.getDefaultFrameRate();
 		lastTime = haxe.Timer.stamp();
 		stage.addResizeEvent(onStageResize);
-		#if (js || cpp || hlsdl || psgl)
+		#if (js || cpp || hlsdl || usegl)
 		driver = new h3d.impl.GlDriver(antiAlias);
 		#elseif flash
 		driver = new h3d.impl.Stage3dDriver(antiAlias);

+ 6 - 6
h3d/impl/Driver.hx

@@ -30,12 +30,12 @@ typedef VertexBuffer = { b : sdl.GL.Buffer, stride : Int };
 typedef Texture = { t : sdl.GL.Texture, width : Int, height : Int, internalFmt : Int, pixelFmt : Int, bits : Int };
 typedef DepthBuffer = { r : sdl.GL.Renderbuffer };
 typedef Query = { q : sdl.GL.Query, kind : QueryKind };
-#elseif psgl
-typedef IndexBuffer = psgl.GL.Buffer;
-typedef VertexBuffer = { b : psgl.GL.Buffer, stride : Int };
-typedef Texture = { t : psgl.GL.Texture, width : Int, height : Int, internalFmt : Int, pixelFmt : Int, bits : Int };
-typedef DepthBuffer = { r : psgl.GL.Renderbuffer };
-typedef Query = { q : psgl.GL.Query, kind : QueryKind };
+#elseif usegl
+typedef IndexBuffer = haxe.GLTypes.Buffer;
+typedef VertexBuffer = { b : haxe.GLTypes.Buffer, stride : Int };
+typedef Texture = { t : haxe.GLTypes.Texture, width : Int, height : Int, internalFmt : Int, pixelFmt : Int, bits : Int };
+typedef DepthBuffer = { r : haxe.GLTypes.Renderbuffer };
+typedef Query = { q : haxe.GLTypes.Query, kind : QueryKind };
 #elseif hldx
 typedef IndexBuffer = { res : dx.Resource, count : Int };
 typedef VertexBuffer = { res : dx.Resource, count : Int, stride : Int };

+ 13 - 13
h3d/impl/GlDriver.hx

@@ -4,7 +4,7 @@ import h3d.mat.Pass;
 import h3d.mat.Stencil;
 import h3d.mat.Data;
 
-#if (js||cpp||hlsdl||psgl)
+#if (js||cpp||hlsdl||usegl)
 
 #if js
 import js.html.Uint16Array;
@@ -45,15 +45,15 @@ private typedef VertexArray = sdl.GL.VertexArray;
 #if cpp
 private typedef Float32Array = Array<cpp.Float32>;
 #end
-#elseif psgl
-import psgl.GL;
-private typedef Uniform = psgl.GL.Uniform;
-private typedef Program = psgl.GL.Program;
-private typedef GLShader = psgl.GL.Shader;
-private typedef Framebuffer = psgl.GL.Framebuffer;
+#elseif usegl
+import haxe.GLTypes;
+private typedef Uniform = haxe.GLTypes.Uniform;
+private typedef Program = haxe.GLTypes.Program;
+private typedef GLShader = haxe.GLTypes.Shader;
+private typedef Framebuffer = haxe.GLTypes.Framebuffer;
 private typedef Texture = h3d.impl.Driver.Texture;
 private typedef Query = h3d.impl.Driver.Query;
-private typedef VertexArray = psgl.GL.VertexArray;
+private typedef VertexArray = haxe.GLTypes.VertexArray;
 #end
 
 private class CompiledShader {
@@ -92,7 +92,7 @@ private class CompiledProgram {
 }
 
 @:access(h3d.impl.Shader)
-#if (cpp||hlsdl||psgl)
+#if (cpp||hlsdl||usegl)
 @:build(h3d.impl.MacroHelper.replaceGL())
 #end
 class GlDriver extends Driver {
@@ -103,7 +103,7 @@ class GlDriver extends Driver {
 	public var gl : js.html.webgl.RenderingContext;
 	#end
 
-	#if (hlsdl||psgl)
+	#if (hlsdl||usegl)
 	var commonVA : VertexArray;
 	#end
 
@@ -754,7 +754,7 @@ class GlDriver extends Driver {
 	}
 
 	override function uploadTextureBitmap( t : h3d.mat.Texture, bmp : hxd.BitmapData, mipLevel : Int, side : Int ) {
-	#if (nme || hlsdl || psgl || openfl || lime)
+	#if (hxcpp || hl)
 		var pixels = bmp.getPixels();
 		uploadTexturePixels(t, pixels, mipLevel, side);
 		pixels.dispose();
@@ -775,7 +775,7 @@ class GlDriver extends Driver {
 	#end
 	}
 
-	#if !(hlsdl || psgl)
+	#if !hl
 	inline static function bytesToUint8Array( b : haxe.io.Bytes ) : Uint8Array {
 		#if (lime && !js)
 		return new Uint8Array(b);
@@ -1090,7 +1090,7 @@ class GlDriver extends Driver {
 
 	override function hasFeature( f : Feature ) : Bool {
 		return switch( f ) {
-		#if (hlsdl || psgl)
+		#if hl
 		case StandardDerivatives, FloatTextures, MultipleRenderTargets, Queries:
 			true; // runtime extension detect required ?
 		#else

+ 9 - 37
hxd/Pad.hx

@@ -4,8 +4,8 @@ package hxd;
 #if hlsdl
 import sdl.Event;
 import sdl.GameController;
-#elseif psgl
-import psgl.GameController;
+#elseif usesys
+import haxe.GameController;
 #elseif hldx
 import dx.GameController;
 #else
@@ -72,37 +72,9 @@ class Pad {
 		dpadRight : 20,
 		names : ["LX","LY","RX","RY","LT","RT","A","B","X","Y","Select","Guide","Start","LCLK","RCLK","LB","RB","DUp","DDown","DLeft","DRight"],
 	};
-	#elseif psgl
-
-	public static var CONFIG_PS4 = {
-
-		// unused
-		start : 0,
-		back : 0,
-		// ----
-
-		analogX : 16,
-		analogY : 17,
-		ranalogX : 18,
-		ranalogY : 19,
-
-		A : 14,
-		B : 13,
-		X : 15,
-		Y : 12,
-		LB : 10,
-		RB : 11,
-		LT : 8,
-		RT : 9,
-		analogClick : 1,
-		ranalogClick : 2,
-		options : 3, // only on PS4
-		dpadUp : 4,
-		dpadDown : 6,
-		dpadLeft : 7,
-		dpadRight : 5,
-		names : [null,null,"LCLK","RCLK","Option","DUp","DRight","DDown","DLeft","L2","R2","L1","R1","Triangle","Circle","Cross","Square","LX","LY","RX","RY","Touchpad"],
-	};
+	#elseif usesys
+
+	public static var CONFIG_SYS = GameController.CONFIG;
 
 	#elseif hldx
 
@@ -136,7 +108,7 @@ class Pad {
 
 	public static var DEFAULT_CONFIG =
 		#if hlsdl CONFIG_SDL
-		#elseif psgl CONFIG_PS4
+		#elseif usesys CONFIG_SYS
 		#elseif flash CONFIG_XBOX
 		#elseif hldx CONFIG_DX
 		#else {} #end;
@@ -285,11 +257,11 @@ class Pad {
 			});
 			var count = flash.ui.GameInput.numDevices; // necessary to trigger added
 		}
-		#elseif (hlsdl || psgl)
+		#elseif (hlsdl || hlps)
 		waitPad = onPad;
 		if( !initDone ) {
 			initDone = true;
-			#if psgl
+			#if hlps
 			haxe.MainLoop.add(syncPads);
 			#end
 			var c = @:privateAccess GameController.gctrlCount();
@@ -371,7 +343,7 @@ class Pad {
 		}
 
 	}
-	#elseif psgl
+	#elseif hlps
 
 	function sync() {
 		for( i in 0...buttons.length )

+ 11 - 11
hxd/System.hl.hx

@@ -49,17 +49,17 @@ class System {
 
 	static function mainLoop() : Void {
 		if( loopFunc != null ) loopFunc();
-		#if psgl
-		psgl.Api.present();
+		#if usesys
+		haxe.System.present();
 		#elseif hlsdl
 		@:privateAccess hxd.Stage.inst.window.present();
 		#end
 	}
 
 	public static function start( init : Void -> Void ) : Void {
-		#if psgl
-		if( !psgl.Api.init() ) return;
-		@:privateAccess Stage.inst = new Stage("", psgl.Api.width, psgl.Api.height);
+		#if usesys
+		if( !haxe.System.init() ) return;
+		@:privateAccess Stage.inst = new Stage("", haxe.System.width, haxe.System.height);
 		init();
 		#else
 		var width = 800;
@@ -140,8 +140,8 @@ class System {
 	}
 
 	public static function getDeviceName() : String {
-		#if psgl
-		return psgl.Api.name;
+		#if usesys
+		return haxe.System.name;
 		#elseif hlsdl
 		return "PC/" + sdl.Sdl.getDevices()[0];
 		#elseif hldx
@@ -157,7 +157,7 @@ class System {
 
 	public static function getValue( s : SystemValue ) : Bool {
 		return switch( s ) {
-		#if !psgl
+		#if !usesys
 		case IsWindowed:
 			return true;
 		#end
@@ -188,9 +188,9 @@ class System {
 
 	// getters
 
-	#if psgl
-	static function get_width() : Int return psgl.Api.width;
-	static function get_height() : Int return psgl.Api.height;
+	#if usesys
+	static function get_width() : Int return haxe.System.width;
+	static function get_height() : Int return haxe.System.height;
 	static function get_platform() : Platform return Console;
 	#elseif hldx
 	static function get_width() : Int return dx.Window.getScreenWidth();