Skip to content

Commit 52cce41

Browse files
committed
Updated OpenVDB (OSX) to 2.2.0, rebuilt OpenEXR (OSX) with GCC4.8 instead of Clang
1 parent 711298a commit 52cce41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1924
-851
lines changed

include/openvdb/Grid.h

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ typedef boost::shared_ptr<GridCPtrSet> GridCPtrSetPtr;
417417
/// @brief Predicate functor that returns @c true for grids that have a specified name
418418
struct OPENVDB_API GridNamePred
419419
{
420-
GridNamePred(const Name& name): name(name) {}
420+
GridNamePred(const Name& _name): name(_name) {}
421421
bool operator()(const GridBase::ConstPtr& g) const { return g && g->getName() == name; }
422422
Name name;
423423
};
@@ -632,35 +632,42 @@ class Grid: public GridBase
632632
/// value maps to a voxel if the corresponding value already mapped to a voxel
633633
/// OR if it is a voxel in the other grid. Thus, a resulting value can only
634634
/// map to a tile if the corresponding value already mapped to a tile
635-
/// AND if it is a tile value in other grid.
635+
/// AND if it is a tile value in the other grid.
636636
///
637637
/// @note This operation modifies only active states, not values.
638638
/// Specifically, active tiles and voxels in this grid are not changed, and
639639
/// tiles or voxels that were inactive in this grid but active in the other grid
640640
/// are marked as active in this grid but left with their original values.
641641
template<typename OtherTreeType>
642-
void topologyUnion(const Grid<OtherTreeType>& other) { tree().topologyUnion(other.tree()); }
642+
void topologyUnion(const Grid<OtherTreeType>& other);
643643

644-
/// @brief Intersects this tree's set of active values with the active values
645-
/// of the other tree, whose @c ValueType may be different.
646-
/// @details The resulting state of a value is active only if the corresponding
644+
/// @brief Intersect this grid's set of active values with the active values
645+
/// of the other grid, whose value type may be different.
646+
/// @details The resulting state of a value is active only if the corresponding
647647
/// value was already active AND if it is active in the other tree. Also, a
648648
/// resulting value maps to a voxel if the corresponding value
649649
/// already mapped to an active voxel in either of the two grids
650650
/// and it maps to an active tile or voxel in the other grid.
651651
///
652-
/// @note This operation can delete branches in this grid if they
653-
/// overlap with inactive tiles in the other grid. Likewise active
654-
/// voxels can be turned into unactive voxels resulting in leaf
655-
/// nodes with no active values. Thus, it is recommended to
656-
/// subsequently call prune.
652+
/// @note This operation can delete branches of this grid that overlap with
653+
/// inactive tiles in the other grid. Also, because it can deactivate voxels,
654+
/// it can create leaf nodes with no active values. Thus, it is recommended
655+
/// to prune this grid after calling this method.
657656
template<typename OtherTreeType>
658-
void topologyIntersection(const Grid<OtherTreeType>& other)
659-
{
660-
tree().topologyIntersection(other.tree());
661-
}
657+
void topologyIntersection(const Grid<OtherTreeType>& other);
662658

663-
/// @todo topologyDifference
659+
/// @brief Difference this grid's set of active values with the active values
660+
/// of the other grid, whose value type may be different.
661+
/// @details After this method is called, voxels in this grid will be active
662+
/// only if they were active to begin with and if the corresponding voxels
663+
/// in the other grid were inactive.
664+
///
665+
/// @note This operation can delete branches of this grid that overlap with
666+
/// active tiles in the other grid. Also, because it can deactivate voxels,
667+
/// it can create leaf nodes with no active values. Thus, it is recommended
668+
/// to prune this grid after calling this method.
669+
template<typename OtherTreeType>
670+
void topologyDifference(const Grid<OtherTreeType>& other);
664671

665672
//
666673
// Statistics
@@ -1106,6 +1113,9 @@ Grid<TreeT>::newTree()
11061113
}
11071114

11081115

1116+
////////////////////////////////////////
1117+
1118+
11091119
template<typename TreeT>
11101120
inline void
11111121
Grid<TreeT>::fill(const CoordBBox& bbox, const ValueType& value, bool active)
@@ -1138,6 +1148,36 @@ Grid<TreeT>::merge(Grid& other, MergePolicy policy)
11381148
}
11391149

11401150

1151+
template<typename TreeT>
1152+
template<typename OtherTreeType>
1153+
inline void
1154+
Grid<TreeT>::topologyUnion(const Grid<OtherTreeType>& other)
1155+
{
1156+
tree().topologyUnion(other.tree());
1157+
}
1158+
1159+
1160+
template<typename TreeT>
1161+
template<typename OtherTreeType>
1162+
inline void
1163+
Grid<TreeT>::topologyIntersection(const Grid<OtherTreeType>& other)
1164+
{
1165+
tree().topologyIntersection(other.tree());
1166+
}
1167+
1168+
1169+
template<typename TreeT>
1170+
template<typename OtherTreeType>
1171+
inline void
1172+
Grid<TreeT>::topologyDifference(const Grid<OtherTreeType>& other)
1173+
{
1174+
tree().topologyDifference(other.tree());
1175+
}
1176+
1177+
1178+
////////////////////////////////////////
1179+
1180+
11411181
template<typename TreeT>
11421182
inline void
11431183
Grid<TreeT>::evalMinMax(ValueType& minVal, ValueType& maxVal) const

include/openvdb/Platform.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,31 @@
5555
#define OPENVDB_CHECK_GCC(MAJOR, MINOR) 0
5656
#endif
5757

58+
/// Macro for determining if there are sufficient C++0x/C++11 features
59+
#ifdef __INTEL_COMPILER
60+
#ifdef __INTEL_CXX11_MODE__
61+
#define OPENVDB_HAS_CXX11 1
62+
#endif
63+
#elif defined(__clang__)
64+
#ifndef _LIBCPP_VERSION
65+
#include <ciso646>
66+
#endif
67+
#ifdef _LIBCPP_VERSION
68+
#define OPENVDB_HAS_CXX11 1
69+
#endif
70+
#elif defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus > 199711L)
71+
#define OPENVDB_HAS_CXX11 1
72+
#elif defined(_MSC_VER)
73+
#if (_MSC_VER >= 1700)
74+
#define OPENVDB_HAS_CXX11 1
75+
#endif
76+
#endif
77+
#if defined(__GNUC__) && !OPENVDB_CHECK_GCC(4, 4)
78+
// ICC uses GCC's standard library headers, so even if the ICC version
79+
// is recent enough for C++11, the GCC version might not be.
80+
#undef OPENVDB_HAS_CXX11
81+
#endif
82+
5883
/// For compilers that need templated function specializations to have
5984
/// storage qualifiers, we need to declare the specializations as static inline.
6085
/// Otherwise, we'll get linker errors about multiply defined symbols.

include/openvdb/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class CombineArgs
306306
template<typename ValueType, typename CombineOp>
307307
struct SwappedCombineOp
308308
{
309-
SwappedCombineOp(CombineOp& op): op(op) {}
309+
SwappedCombineOp(CombineOp& _op): op(_op) {}
310310

311311
void operator()(CombineArgs<ValueType>& args)
312312
{

include/openvdb/io/Compression.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ enum {
8686
/*2*/ NO_MASK_AND_ONE_INACTIVE_VAL, // all inactive vals have the same non-background val
8787
/*3*/ MASK_AND_NO_INACTIVE_VALS, // mask selects between -background and +background
8888
/*4*/ MASK_AND_ONE_INACTIVE_VAL, // mask selects between backgd and one other inactive val
89-
/*5*/ MASK_AND_TWO_INACTIVE_VALS // mask selects between two non-background inactive vals
89+
/*5*/ MASK_AND_TWO_INACTIVE_VALS, // mask selects between two non-background inactive vals
90+
/*6*/ NO_MASK_AND_ALL_VALS // > 2 inactive vals, so no mask compression at all
9091
};
9192

9293

@@ -282,7 +283,7 @@ readCompressedValues(std::istream& is, ValueT* destBuf, Index destCount,
282283
zipped = compression & COMPRESS_ZIP,
283284
maskCompressed = compression & COMPRESS_ACTIVE_MASK;
284285

285-
int8_t metadata = NO_MASK_OR_INACTIVE_VALS;
286+
int8_t metadata = NO_MASK_AND_ALL_VALS;
286287
if (getFormatVersion(is) >= OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION) {
287288
// Read the flag that specifies what, if any, additional metadata
288289
// (selection mask and/or inactive value(s)) is saved.
@@ -297,9 +298,9 @@ readCompressedValues(std::istream& is, ValueT* destBuf, Index destCount,
297298
ValueT inactiveVal0 =
298299
((metadata == NO_MASK_OR_INACTIVE_VALS) ? background : math::negative(background));
299300

300-
if (metadata != NO_MASK_OR_INACTIVE_VALS &&
301-
metadata != NO_MASK_AND_MINUS_BG &&
302-
metadata != MASK_AND_NO_INACTIVE_VALS)
301+
if (metadata == NO_MASK_AND_ONE_INACTIVE_VAL ||
302+
metadata == MASK_AND_ONE_INACTIVE_VAL ||
303+
metadata == MASK_AND_TWO_INACTIVE_VALS)
303304
{
304305
// Read one of at most two distinct inactive values.
305306
is.read(reinterpret_cast<char*>(&inactiveVal0), sizeof(ValueT));
@@ -310,9 +311,9 @@ readCompressedValues(std::istream& is, ValueT* destBuf, Index destCount,
310311
}
311312

312313
MaskT selectionMask;
313-
if (metadata != NO_MASK_OR_INACTIVE_VALS &&
314-
metadata != NO_MASK_AND_MINUS_BG &&
315-
metadata != NO_MASK_AND_ONE_INACTIVE_VAL)
314+
if (metadata == MASK_AND_NO_INACTIVE_VALS ||
315+
metadata == MASK_AND_ONE_INACTIVE_VAL ||
316+
metadata == MASK_AND_TWO_INACTIVE_VALS)
316317
{
317318
// For use in mask compression (only), read the bitmask that selects
318319
// between two distinct inactive values.
@@ -323,7 +324,9 @@ readCompressedValues(std::istream& is, ValueT* destBuf, Index destCount,
323324
boost::scoped_array<ValueT> scopedTempBuf;
324325

325326
Index tempCount = destCount;
326-
if (maskCompressed && getFormatVersion(is) >= OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION) {
327+
if (maskCompressed && metadata != NO_MASK_AND_ALL_VALS
328+
&& getFormatVersion(is) >= OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION)
329+
{
327330
tempCount = valueMask.countOn();
328331
if (tempCount != destCount) {
329332
// If this node has inactive voxels, allocate a temporary buffer
@@ -395,7 +398,7 @@ writeCompressedValues(std::ostream& os, ValueT* srcBuf, Index srcCount,
395398
ValueT* tempBuf = srcBuf;
396399
boost::scoped_array<ValueT> scopedTempBuf;
397400

398-
int8_t metadata = NO_MASK_OR_INACTIVE_VALS;
401+
int8_t metadata = NO_MASK_AND_ALL_VALS;
399402

400403
if (!maskCompress) {
401404
os.write(reinterpret_cast<const char*>(&metadata), /*bytes=*/1);
@@ -478,13 +481,15 @@ writeCompressedValues(std::ostream& os, ValueT* srcBuf, Index srcCount,
478481
metadata = MASK_AND_ONE_INACTIVE_VAL;
479482
}
480483
}
484+
} else if (numUniqueInactiveVals > 2) {
485+
metadata = NO_MASK_AND_ALL_VALS;
481486
}
482487

483488
os.write(reinterpret_cast<const char*>(&metadata), /*bytes=*/1);
484489

485-
if (metadata != NO_MASK_OR_INACTIVE_VALS &&
486-
metadata != NO_MASK_AND_MINUS_BG &&
487-
metadata != MASK_AND_NO_INACTIVE_VALS)
490+
if (metadata == NO_MASK_AND_ONE_INACTIVE_VAL ||
491+
metadata == MASK_AND_ONE_INACTIVE_VAL ||
492+
metadata == MASK_AND_TWO_INACTIVE_VALS)
488493
{
489494
if (!toHalf) {
490495
// Write one of at most two distinct inactive values.
@@ -505,7 +510,7 @@ writeCompressedValues(std::ostream& os, ValueT* srcBuf, Index srcCount,
505510
}
506511
}
507512

508-
if (metadata == NO_MASK_OR_INACTIVE_VALS && numUniqueInactiveVals > 2) {
513+
if (metadata == NO_MASK_AND_ALL_VALS) {
509514
// If there are more than two unique inactive values, the entire input buffer
510515
// needs to be saved (both active and inactive values).
511516
/// @todo Save the selection mask as long as most of the inactive values

0 commit comments

Comments
 (0)