Skip to content

Commit

Permalink
Clean up compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
nealkruis committed Feb 20, 2020
1 parent a22b1aa commit 32a411c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 41 deletions.
39 changes: 12 additions & 27 deletions third_party/penumbra/src/gl/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,33 +285,18 @@ float Context::setScene(mat4x4 sunView, const SurfaceBuffer &surfaceBuffer, bool
near_ = -MAX_FLOAT;
far_ = MAX_FLOAT;

if (&surfaceBuffer){
for (GLuint i = surfaceBuffer.begin * model.vertexSize;
i < surfaceBuffer.begin * model.vertexSize + surfaceBuffer.count * model.vertexSize;
i += model.vertexSize) {
vec4 point = {model.vertexArray[i], model.vertexArray[i + 1], model.vertexArray[i + 2], 0};
vec4 trans;
mat4x4_mul_vec4(trans, view, point);
left = std::min(trans[0], left);
right = std::max(trans[0], right);
bottom = std::min(trans[1], bottom);
top = std::max(trans[1], top);
// near_ = min(trans[2], near_);
far_ = std::min(trans[2], far_);
}
}
else {
for (GLuint i = 0; i < model.vertexArray.size(); i += model.vertexSize) {
vec4 point = {model.vertexArray[i], model.vertexArray[i + 1], model.vertexArray[i + 2], 0};
vec4 trans;
mat4x4_mul_vec4(trans, view, point);
left = std::min(trans[0], left);
right = std::max(trans[0], right);
bottom = std::min(trans[1], bottom);
top = std::max(trans[1], top);
// near_ = min(trans[2], near_);
far_ = std::min(trans[2], far_);
}
for (GLuint i = surfaceBuffer.begin * model.vertexSize;
i < surfaceBuffer.begin * model.vertexSize + surfaceBuffer.count * model.vertexSize;
i += model.vertexSize) {
vec4 point = {model.vertexArray[i], model.vertexArray[i + 1], model.vertexArray[i + 2], 0};
vec4 trans;
mat4x4_mul_vec4(trans, view, point);
left = std::min(trans[0], left);
right = std::max(trans[0], right);
bottom = std::min(trans[1], bottom);
top = std::max(trans[1], top);
// near_ = min(trans[2], near_);
far_ = std::min(trans[2], far_);
}

// Use model box to determine near clipping plane (and far if looking interior)
Expand Down
26 changes: 12 additions & 14 deletions third_party/penumbra/test/penumbra_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST(PenumbraTest, azimuth) {
for (float azm = 0.0f; azm <= 2 * M_PI; azm += M_PI_4) {
pumbra.setSunPosition(azm, 0.0f);
float wallPSSA = pumbra.calculatePSSA(wallId);
EXPECT_NEAR(wallPSSA, std::abs(cos(azm)), 0.0001) << "azm evaluates to " << azm;
EXPECT_NEAR(wallPSSA, std::abs(cos(azm)), 0.01) << "azm evaluates to " << azm;
// pumbra.renderScene(wallId);
}
}
Expand Down Expand Up @@ -158,16 +158,16 @@ TEST(PenumbraTest, interior) {
pumbra2.setModel();
pumbra2.setSunPosition(0.0f, 0.f);
float wallPSSA2 = pumbra2.calculatePSSA(wallFrontId);
EXPECT_NEAR(wallPSSA2, r_W * r_H - w_W * w_H, 0.0001);
EXPECT_NEAR(wallPSSA2, r_W * r_H - w_W * w_H, 0.01);
// pumbra2.renderScene(wallFrontId);

float backWallInteriorPSSA = pumbra2.calculateInteriorPSSAs({windowId}, {wallBackId})[wallBackId];
EXPECT_NEAR(backWallInteriorPSSA, w_W * w_H, 0.0001);
EXPECT_NEAR(backWallInteriorPSSA, w_W * w_H, 0.01);
// pumbra2.renderInteriorScene({windowId},{wallBackId});

pumbra2.setSunPosition(3.1415f, 0.f);
float wallPSSA3 = pumbra2.calculatePSSA(wallFrontId);
EXPECT_NEAR(wallPSSA3, 0, 0.0001); // WallFront should be blocked by back wall.
EXPECT_NEAR(wallPSSA3, 0, 0.01); // WallFront should be blocked by back wall.
// pumbra2.renderScene(wallFrontId);

pumbra2.setSunPosition(0.5f, 0.5f);
Expand Down Expand Up @@ -310,7 +310,7 @@ TEST(PenumbraTest, calculatePSSA_multiple_surfaces) {

//pumbra.renderScene(side);

EXPECT_NEAR(results[side], expectedResults, 0.0001);
EXPECT_NEAR(results[side], expectedResults, 0.01);
}
}
}
Expand Down Expand Up @@ -357,15 +357,13 @@ TEST(PenumbraTest, side_count_check) {
Pumbra::Surface wall(wallVerts);
Pumbra::Penumbra pumbra;

unsigned wallId = pumbra.addSurface(wall);
pumbra.addSurface(wall);
pumbra.setModel();

EXPECT_EQ(pumbra.getNumSurfaces(), 1);

pumbra.clearModel();

float const r_W = 1.f, r_D = 1.f, r_H = 1.f; // Overall dimensions

Pumbra::Polygon wallFrontVerts = { -.5f, .5f, -.5f, .5f, .5f, -.5f, .5f, .5f, .5f, -.5f, .5f, .5f };

Pumbra::Polygon wallBackVerts = { .5f, -.5f, -.5f, -.5f, -.5f, -.5f, -.5f, -.5f, .5f, .5f, -.5f, .5f };
Expand All @@ -376,9 +374,9 @@ TEST(PenumbraTest, side_count_check) {
Pumbra::Surface wallBack(wallBackVerts);
Pumbra::Surface roof(roofVerts);

const unsigned wallFrontId = pumbra.addSurface(wallFront);
const unsigned wallBackId = pumbra.addSurface(wallBack);
const unsigned roofId = pumbra.addSurface(roof);
pumbra.addSurface(wallFront);
pumbra.addSurface(wallBack);
pumbra.addSurface(roof);

pumbra.setModel();

Expand Down Expand Up @@ -406,9 +404,9 @@ TEST(PenumbraTest, bad_surface_input_errors) {

Pumbra::Penumbra pumbra(penumbraCallbackFunction, messageCallbackContextPtr);

const unsigned wallFrontId = pumbra.addSurface(wallFront);
const unsigned wallBackId = pumbra.addSurface(wallBack);
const unsigned roofId = pumbra.addSurface(roof);
pumbra.addSurface(wallFront);
pumbra.addSurface(wallBack);
pumbra.addSurface(roof);

pumbra.setModel();

Expand Down

7 comments on commit 32a411c

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

penumbra-integration (nealkruis) - x86_64-MacOS-10.13-clang: OK (2654 of 2666 tests passed, 669 test warnings)

Messages:\n

  • 681 tests had: EIO diffs.
  • 10 tests had: AUD diffs.
  • 10 tests had: BND diffs.
  • 10 tests had: MDD diffs.
  • 10 tests had: MTD diffs.
  • 10 tests had: RDD diffs.
  • 12 tests had: Table big diffs.
  • 8 tests had: ESO big diffs.
  • 8 tests had: MTR big diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 5 tests had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 670
  • Failed: 12

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

penumbra-integration (nealkruis) - x86_64-MacOS-10.13-clang: OK (2654 of 2666 tests passed, 669 test warnings)

Messages:\n

  • 681 tests had: EIO diffs.
  • 10 tests had: AUD diffs.
  • 10 tests had: BND diffs.
  • 10 tests had: MDD diffs.
  • 10 tests had: MTD diffs.
  • 10 tests had: RDD diffs.
  • 12 tests had: Table big diffs.
  • 8 tests had: ESO big diffs.
  • 8 tests had: MTR big diffs.
  • 5 tests had: ERR diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.

Failures:\n

regression Test Summary

  • Passed: 670
  • Failed: 12

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

penumbra-integration (nealkruis) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

Build Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

penumbra-integration (nealkruis) - x86_64-Linux-Ubuntu-18.04-custom_check: Build Failed

Failures:\n

Test Summary

  • Passed: 9
  • : 2

Build Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

penumbra-integration (nealkruis) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2686 of 2698 tests passed, 673 test warnings)

Messages:\n

  • 685 tests had: EIO diffs.
  • 10 tests had: AUD diffs.
  • 10 tests had: BND diffs.
  • 10 tests had: MDD diffs.
  • 10 tests had: MTD diffs.
  • 10 tests had: RDD diffs.
  • 12 tests had: Table big diffs.
  • 8 tests had: ESO big diffs.
  • 8 tests had: MTR big diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 5 tests had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 690
  • Failed: 12

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

penumbra-integration (nealkruis) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1292 of 1292 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

penumbra-integration (nealkruis) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (686 of 687 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 686
  • Timeout: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.