|
@@ -307,23 +307,26 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
|
|
|
ctx.lightSystem = null;
|
|
|
|
|
|
var found = null;
|
|
|
- var passes = new h3d.pass.PassList(@:privateAccess ctx.passes);
|
|
|
-
|
|
|
- if( !passes.isEmpty() ) {
|
|
|
- var p = hardwarePass;
|
|
|
- if( p == null )
|
|
|
- hardwarePass = p = new h3d.pass.HardwarePick();
|
|
|
- ctx.setGlobal("depthMap", { texture : h3d.mat.Texture.fromColor(0xFF00000, 0) });
|
|
|
- p.pickX = pixelX;
|
|
|
- p.pickY = pixelY;
|
|
|
- p.setContext(ctx);
|
|
|
- p.draw(passes);
|
|
|
- if( p.pickedIndex >= 0 )
|
|
|
- for( po in passes )
|
|
|
- if( p.pickedIndex-- == 0 ) {
|
|
|
- found = po.obj;
|
|
|
- break;
|
|
|
- }
|
|
|
+ for ( passes in @:privateAccess ctx.passes ) {
|
|
|
+ if ( found != null )
|
|
|
+ break;
|
|
|
+ var passList = new h3d.pass.PassList(passes);
|
|
|
+ if( !passList.isEmpty() ) {
|
|
|
+ var p = hardwarePass;
|
|
|
+ if( p == null )
|
|
|
+ hardwarePass = p = new h3d.pass.HardwarePick();
|
|
|
+ ctx.setGlobal("depthMap", { texture : h3d.mat.Texture.fromColor(0xFF00000, 0) });
|
|
|
+ p.pickX = pixelX;
|
|
|
+ p.pickY = pixelY;
|
|
|
+ p.setContext(ctx);
|
|
|
+ p.draw(passList);
|
|
|
+ if( p.pickedIndex >= 0 )
|
|
|
+ for( po in passList )
|
|
|
+ if( p.pickedIndex-- == 0 ) {
|
|
|
+ found = po.obj;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
ctx.done();
|
|
@@ -402,23 +405,11 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
|
|
|
|
|
|
syncRec(ctx);
|
|
|
emitRec(ctx);
|
|
|
- // sort by pass id
|
|
|
- ctx.passes = haxe.ds.ListSort.sortSingleLinked(ctx.passes, function(p1, p2) {
|
|
|
- return p1.pass.passId - p2.pass.passId;
|
|
|
- });
|
|
|
|
|
|
- // group by pass implementation
|
|
|
- var curPass = ctx.passes;
|
|
|
var passes = [];
|
|
|
var passIndex = -1;
|
|
|
- while( curPass != null ) {
|
|
|
- var passId = curPass.pass.passId;
|
|
|
- var p = curPass, prev = null;
|
|
|
- while( p != null && p.pass.passId == passId ) {
|
|
|
- prev = p;
|
|
|
- p = p.next;
|
|
|
- }
|
|
|
- prev.next = null;
|
|
|
+ for ( passId in ctx.passes.keys() ) {
|
|
|
+ var curPass = ctx.passes.get(passId);
|
|
|
var pobjs = ctx.cachedPassObjects[++passIndex];
|
|
|
if( pobjs == null ) {
|
|
|
pobjs = new Renderer.PassObjects();
|
|
@@ -427,7 +418,6 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
|
|
|
pobjs.name = curPass.pass.name;
|
|
|
pobjs.passes.init(curPass);
|
|
|
passes.push(pobjs);
|
|
|
- curPass = p;
|
|
|
}
|
|
|
|
|
|
// send to rendered
|