소스 검색

Can mark s2d. By default, s2d use s3d mark (calling s3d.renderer mark).

clementlandrin 1 년 전
부모
커밋
f5b9485fc2
3개의 변경된 파일19개의 추가작업 그리고 8개의 파일을 삭제
  1. 11 6
      h2d/Scene.hx
  2. 6 2
      h3d/scene/Scene.hx
  3. 2 0
      hxd/App.hx

+ 11 - 6
h2d/Scene.hx

@@ -782,15 +782,20 @@ class Scene extends Layers implements h3d.IDrawable implements hxd.SceneEvents.I
 		ctx.frame++;
 		ctx.time += ctx.elapsedTime;
 		ctx.globalAlpha = alpha;
+		mark("s2d");
 		sync(ctx);
-		if( children.length == 0 ) return;
-		ctx.begin();
-		#if sceneprof h3d.impl.SceneProf.begin("2d", ctx.frame); #end
-		ctx.drawScene();
-		#if sceneprof h3d.impl.SceneProf.end(); #end
-		ctx.end();
+		if( children.length != 0 ) {
+			ctx.begin();
+			#if sceneprof h3d.impl.SceneProf.begin("2d", ctx.frame); #end
+			ctx.drawScene();
+			#if sceneprof h3d.impl.SceneProf.end(); #end
+			ctx.end();
+		}
+		mark("vsync");
 	}
 
+	public dynamic function mark(name : String) {}
+
 	override function sync( ctx : RenderContext ) {
 		var forceCamSync = posChanged;
 		if( !allocated )

+ 6 - 2
h3d/scene/Scene.hx

@@ -334,13 +334,13 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 		renderer.startEffects();
 
 		#if sceneprof h3d.impl.SceneProf.begin("sync", ctx.frame); #end
-		@:privateAccess renderer.mark("sync");
+		mark("sync");
 		syncRec(ctx);
 		#if sceneprof
 		h3d.impl.SceneProf.end();
 		h3d.impl.SceneProf.begin("emit", ctx.frame);
 		#end
-		@:privateAccess renderer.mark("emit");
+		mark("emit");
 		emitRec(ctx);
 		#if sceneprof h3d.impl.SceneProf.end(); #end
 
@@ -387,6 +387,10 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 		}
 	}
 
+	public dynamic function mark(name : String) {
+		@:privateAccess renderer.mark(name);
+	}
+
 	var prevDB : h3d.mat.Texture;
 	var prevEngine = null;
 	/**

+ 2 - 0
hxd/App.hx

@@ -113,6 +113,7 @@ class App implements h3d.IDrawable {
 		if( disposePrevious )
 			this.s2d.dispose();
 		this.s2d = s2d;
+		s2d.mark = function(name) s3d.mark(name);
 	}
 
 	function setScene3D( s3d : h3d.scene.Scene, disposePrevious = true ) {
@@ -139,6 +140,7 @@ class App implements h3d.IDrawable {
 		};
 		s3d = new h3d.scene.Scene();
 		s2d = new h2d.Scene();
+		s2d.mark = function(name) s3d.mark(name);
 		sevents = new hxd.SceneEvents();
 		sevents.addScene(s2d);
 		sevents.addScene(s3d);