This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StreamingBuffer::StreamingBuffer( size_t blockSizeBytes ) | |
: mBlockSize( std::max<size_t>( blockSizeBytes, 1 ) ) | |
{ | |
allocateNewWriteBlock(); | |
mReadOffset = 0; | |
} | |
void StreamingBuffer::pushFront( const void *data, size_t dataSize ) | |
{ | |
std::lock_guard<std::mutex> lock( mMutex ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CI_API StreamingBuffer { | |
public: | |
StreamingBuffer( size_t blockSizeBytes = 65536 ); | |
StreamingBuffer( const StreamingBuffer &rhs ) = delete; | |
StreamingBuffer( StreamingBuffer &&rhs ) = delete; | |
void pushFront( const void *data, size_t sizeBytes ); | |
size_t popBack( void *output, size_t maxSize ); | |
size_t getSize() const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "cinder/app/AppBasic.h" | |
#include "cinder/Rand.h" | |
#include "cinder/params/params.h" | |
#include <list> | |
using namespace ci; | |
using namespace ci::app; | |
using namespace std; | |
// We'll create a new Cinder Application by deriving from the AppBasic class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void outputCinderCode( const Shape2d &shape, const std::string &name ) | |
{ | |
app::console() << "Shape2d " << name << ";" << std::endl; | |
for( vector<Path2d>::const_iterator pathIt = shape.getContours().begin(); pathIt != shape.getContours().end(); ++pathIt ) { | |
app::console() << name << ".appendContour( Path2d() );" << std::endl; | |
size_t pt = 0; | |
app::console() << name << ".getContours().back().moveTo( " << pathIt->getPoints()[0].x << ", " << pathIt->getPoints()[0].y << " );" << std::endl; | |
pt++; | |
for( std::vector<Path2d::SegmentType>::const_iterator segIt = pathIt->getSegments().begin(); segIt != pathIt->getSegments().end(); ++segIt ) { | |
if( *segIt == Path2d::CLOSE ) |