overte-HifiExperiments/interface/src/AutoLock.h
matsukaze bbf4f889d8 Completed worklist job #19486
Job #19486  Don't render the duplicate triangles between adjacent
voxels.

Added checkable item to "developer" menu to activate/deactivate cull
shared faces.

Cull all shared voxel faces regardless of distribution in the octree.
Includes leaf to leaf, leaf to non-leaf, and non-leaf to non-leaf
comparison of contiguous faces.

Added new GL primitive renderer to manage the transfer of cube faces
from the voxel system to GL.

Added some useful classes for queue and lock management.

Modified statistics collection to report number of completely culled
nodes. Extra debugging info also includes the interior occlusions bit
mask of leaf voxels.
2014-02-03 09:45:12 -05:00

84 lines
1.3 KiB
C++

/**
* @file AutoLock.h
* A simple locking class featuring templated mutex policy and mutex barrier
* activation/deactivation constructor/destructor.
*
* @author Norman Crafts
* @copyright 2014, All rights reserved.
*/
#ifndef __AUTOLOCK_H__
#define __AUTOLOCK_H__
#include "Mutex.h"
/**
* @class AutoLock
*/
template
<
class MutexPolicy = Mutex
>
class AutoLock
{
public:
/** Dependency injection constructor
* AutoLock constructor with client mutex injection
*/
AutoLock(
MutexPolicy & client ///< Client mutex
);
/** Dependency injection constructor
* AutoLock constructor with client mutex injection
*/
AutoLock(
MutexPolicy *client ///< Client mutex
);
~AutoLock();
private:
/** Default constructor prohibited to API user
*/
AutoLock();
/** Copy constructor prohibited to API user
*/
AutoLock(
AutoLock const & copy
);
private:
MutexPolicy &_mutex; ///< Client mutex
};
template<class MutexPolicy>
inline
AutoLock<MutexPolicy>::AutoLock(
MutexPolicy &mutex
) :
_mutex(mutex)
{
_mutex.lock();
}
template<class MutexPolicy>
inline
AutoLock<MutexPolicy>::AutoLock(
MutexPolicy *mutex
) :
_mutex(*mutex)
{
_mutex.lock();
}
template<class MutexPolicy>
inline
AutoLock<MutexPolicy>::~AutoLock()
{
_mutex.unlock();
}
#endif // __AUTOLOCK_H__