Skip to content

Commit

Permalink
Merge pull request #1096 from AnalyticalGraphicsInc/asyncGeometryTests
Browse files Browse the repository at this point in the history
Render Async Geometry
  • Loading branch information
pjcozzi committed Aug 30, 2013
2 parents f3cb080 + e0a56c9 commit 93d0d70
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions Specs/Scene/GeometryRenderingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,39 @@ defineSuite([
primitive = primitive && primitive.destroy();
}

function renderAsync(instance, afterView) {
var primitive = new Primitive({
geometryInstances : instance,
appearance : new PerInstanceColorAppearance({
flat : true
})
});

var frameState = createFrameState();

waitsFor(function() {
return render(context, frameState, primitive) > 0;
});

runs(function() {
viewSphere3D(frameState.camera, primitive._boundingSphere, primitive.modelMatrix);

if (typeof afterView === 'function') {
afterView(frameState, primitive);
}

context.getUniformState().update(frameState);

ClearCommand.ALL.execute(context);
expect(context.readPixels()).toEqual([0, 0, 0, 0]);

render(context, frameState, primitive);
expect(context.readPixels()).not.toEqual([0, 0, 0, 0]);

primitive = primitive && primitive.destroy();
});
}

describe('BoxGeometry', function() {
var instance;
beforeAll(function() {
Expand Down Expand Up @@ -321,6 +354,10 @@ defineSuite([
it('pick', function() {
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});
}, 'WebGL');

describe('CircleGeometry', function() {
Expand Down Expand Up @@ -355,6 +392,10 @@ defineSuite([
it('pick', function() {
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});
}, 'WebGL');

describe('CylinderGeometry', function() {
Expand Down Expand Up @@ -391,6 +432,10 @@ defineSuite([
it('pick', function() {
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});
}, 'WebGL');

describe('EllipseGeometry', function() {
Expand Down Expand Up @@ -427,6 +472,10 @@ defineSuite([
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});

it('rotated', function() {
var rotated = new GeometryInstance({
geometry : new EllipseGeometry({
Expand Down Expand Up @@ -504,6 +553,10 @@ defineSuite([
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});

it('renders bottom', function() {
var afterView = function(frameState, primitive) {
var height = (extrudedHeight - geometryHeight) * 0.5;
Expand Down Expand Up @@ -556,6 +609,10 @@ defineSuite([
it('pick', function() {
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});
}, 'WebGL');

describe('SphereGeometry', function() {
Expand Down Expand Up @@ -590,6 +647,10 @@ defineSuite([
it('pick', function() {
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});
}, 'WebGL');

describe('ExtentGeometry', function() {
Expand Down Expand Up @@ -626,6 +687,10 @@ defineSuite([
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});

it('rotated geometry', function() {
var rotated = new GeometryInstance({
geometry : new ExtentGeometry({
Expand Down Expand Up @@ -712,6 +777,10 @@ defineSuite([
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});

it('renders bottom', function() {
var afterView = function(frameState, primitive) {
var transform = Transforms.eastNorthUpToFixedFrame(primitive._boundingSphere.center);
Expand Down Expand Up @@ -790,6 +859,10 @@ defineSuite([
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});

it('at height', function() {
var atHeight = new GeometryInstance({
geometry : PolygonGeometry.fromPositions({
Expand Down Expand Up @@ -895,6 +968,10 @@ defineSuite([
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});

it('renders bottom', function() {
var afterView = function(frameState, primitive) {
var height = (extrudedHeight - geometryHeight) * 0.5;
Expand Down Expand Up @@ -990,6 +1067,10 @@ defineSuite([
it('pick', function() {
pickGeometry(instance, afterView3D);
});

it('async', function() {
renderAsync(instance, afterView3D);
});
}, 'WebGL');

describe('CorridorGeometry', function() {
Expand Down Expand Up @@ -1033,6 +1114,10 @@ defineSuite([
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});

it('at height', function() {
var atHeight = new GeometryInstance({
geometry : new CorridorGeometry({
Expand Down Expand Up @@ -1097,6 +1182,10 @@ defineSuite([
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});

it('renders bottom', function() {
var afterView = function(frameState, primitive) {
var height = (extrudedHeight - geometryHeight) * 0.5;
Expand Down Expand Up @@ -1174,6 +1263,10 @@ defineSuite([
it('pick', function() {
pickGeometry(instance);
});

it('async', function() {
renderAsync(instance);
});
});

describe('Custom geometry', function() {
Expand Down

0 comments on commit 93d0d70

Please sign in to comment.