Skip to content
Snippets Groups Projects
Unverified Commit 58ff3cc6 authored by John Bogovic's avatar John Bogovic Committed by GitHub
Browse files

add flag to skip renderer's bounding box intersection (#110)

* add flag to skip renderer's bounding box culling
* RealRandomAccessibleSource skips render intersecton check by default
* flag is specified in a new constructor
* RealRandomAccessibleSource add bounding box check method
parent 97983cae
No related branches found
No related tags found
No related merge requests found
...@@ -121,6 +121,12 @@ public class TransformedSource< T > implements Source< T >, MipmapOrdering ...@@ -121,6 +121,12 @@ public class TransformedSource< T > implements Source< T >, MipmapOrdering
this.composed = new AffineTransform3D(); this.composed = new AffineTransform3D();
} }
@Override
public boolean doBoundingBoxCulling()
{
return source.doBoundingBoxCulling();
}
/* /*
* EXTRA TRANSFORMATION methods * EXTRA TRANSFORMATION methods
*/ */
......
...@@ -57,17 +57,25 @@ public abstract class RealRandomAccessibleSource< T extends Type< T > > implemen ...@@ -57,17 +57,25 @@ public abstract class RealRandomAccessibleSource< T extends Type< T > > implemen
protected final VoxelDimensions voxelDimensions; protected final VoxelDimensions voxelDimensions;
protected final boolean doBoundingBoxIntersectionCheck;
public RealRandomAccessibleSource( final RealRandomAccessible< T > accessible, final T type, final String name ) public RealRandomAccessibleSource( final RealRandomAccessible< T > accessible, final T type, final String name )
{ {
this( accessible, type, name, null ); this( accessible, type, name, null, false );
} }
public RealRandomAccessibleSource( final RealRandomAccessible< T > accessible, final T type, final String name, final VoxelDimensions voxelDimensions ) public RealRandomAccessibleSource( final RealRandomAccessible< T > accessible, final T type, final String name, final VoxelDimensions voxelDimensions )
{
this( accessible, type, name, voxelDimensions, false );
}
public RealRandomAccessibleSource( final RealRandomAccessible< T > accessible, final T type, final String name, final VoxelDimensions voxelDimensions, final boolean doBoundingBoxIntersectionCheck )
{ {
this.accessible = accessible; this.accessible = accessible;
this.type = type.createVariable(); this.type = type.createVariable();
this.name = name; this.name = name;
this.voxelDimensions = voxelDimensions; this.voxelDimensions = voxelDimensions;
this.doBoundingBoxIntersectionCheck = doBoundingBoxIntersectionCheck;
} }
@Override @Override
...@@ -125,4 +133,10 @@ public abstract class RealRandomAccessibleSource< T extends Type< T > > implemen ...@@ -125,4 +133,10 @@ public abstract class RealRandomAccessibleSource< T extends Type< T > > implemen
{ {
return 1; return 1;
} }
@Override
public boolean doBoundingBoxCulling()
{
return doBoundingBoxIntersectionCheck;
}
} }
...@@ -68,6 +68,22 @@ public interface Source< T > ...@@ -68,6 +68,22 @@ public interface Source< T >
*/ */
public RandomAccessibleInterval< T > getSource( int t, int level ); public RandomAccessibleInterval< T > getSource( int t, int level );
/**
* Whether this source participates in bounding box culling.
* <p>
* If {@code true}, then this source will only be rendered if its bounding
* box, i.e., the interval of {@link #getSource}, intersects the
* current screen area (when transformed to viewer coordinates).
* <p>
* If {@code false}, then this source will be always rendered (if it is
* set to be visible.)
*
* @return {@code true}, if this source participates in bounding box culling.
*/
public default boolean doBoundingBoxCulling()
{
return true;
}
/** /**
* Get the 3D stack at timepoint index t, extended to infinity and interpolated. * Get the 3D stack at timepoint index t, extended to infinity and interpolated.
......
...@@ -83,6 +83,12 @@ class VisibilityUtils ...@@ -83,6 +83,12 @@ class VisibilityUtils
for ( final SourceAndConverter< ? > source : sources ) for ( final SourceAndConverter< ? > source : sources )
{ {
if( !source.getSpimSource().doBoundingBoxCulling() )
{
result.add( source );
continue;
}
final Source< ? > spimSource = source.getSpimSource(); final Source< ? > spimSource = source.getSpimSource();
final int level = MipmapTransforms.getBestMipMapLevel( screenTransform, spimSource, t ); final int level = MipmapTransforms.getBestMipMapLevel( screenTransform, spimSource, t );
spimSource.getSourceTransform( t, level, sourceToScreen ); spimSource.getSourceTransform( t, level, sourceToScreen );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment