OpenGL43Instance::OpenGL43Instance( const char* appName, uint32_t appVersion )
	: Instance()
{
	fDebug( appName, appVersion );

	EnumerateGpus();
}
Instance* OpenGL43Instance::CreateDevice( int devid, int queueCount )
{
	OpenGL43Instance* ret = (OpenGL43Instance*)malloc( sizeof(OpenGL43Instance) );
	memset( ret, 0, sizeof(OpenGL43Instance) );
	memcpy( ret, this, sizeof(OpenGL43Instance) );
	ret->mCpuRamCounter = 0;
	ret->mGpuRamCounter = 0;
	ret->mDevId = devid;

	fDebug( devid, queueCount );

	return ret;
}
Exemple #3
0
Raspicam::Raspicam( Config* config, const std::string& conf_obj )
	: ::Camera()
	, IL::Camera( config->integer( conf_obj + ".width", 1280 ), config->integer( conf_obj + ".height", 720 ), 0, true, true )
	, mConfig( config )
	, mConfigObject( conf_obj )
	, mLiveFrameCounter( 0 )
	, mLedTick( 0 )
	, mLedState( true )
	, mRecording( false )
	, mRecordStream( nullptr )
{
	fDebug( config, conf_obj );

	IL::Camera::setMirror( true, false );
// 	IL::Camera::setWhiteBalanceControl( IL::Camera::WhiteBalControlAuto );
	IL::Camera::setWhiteBalanceControl( IL::Camera::WhiteBalControlHorizon );
	IL::Camera::setExposureControl( IL::Camera::ExposureControlLargeAperture );
	IL::Camera::setExposureValue( mConfig->integer( mConfigObject + ".exposure", 0 ), mConfig->integer( mConfigObject + ".aperture", 2.8f ), mConfig->integer( mConfigObject + ".iso", 0 ), mConfig->integer( mConfigObject + ".shutter_speed", 0 ) );
	IL::Camera::setSharpness( mConfig->integer( mConfigObject + ".sharpness", 100 ) );
	IL::Camera::setFramerate( mConfig->integer( mConfigObject + ".fps", 60 ) );
	IL::Camera::setBrightness( mConfig->integer( mConfigObject + ".brightness", 55 ) );
	IL::Camera::setSaturation( mConfig->integer( mConfigObject + ".saturation", 8 ) );
	IL::Camera::setContrast( mConfig->integer( mConfigObject + ".contrast", 0 ) );
	IL::Camera::setFrameStabilisation( mConfig->boolean( mConfigObject + ".stabilisation", false ) );

	mEncoder = new IL::VideoEncode( mConfig->integer( mConfigObject + ".kbps", 1024 ), IL::VideoEncode::CodingAVC, true );
	IL::Camera::SetupTunnel( 71, mEncoder, 200 );

	mLiveTicks = 0;
	mRecordTicks = 0;
	mRecordFrameData = nullptr;
	mRecordFrameDataSize = 0;
	mRecordFrameSize = 0;

	mLink = Link::Create( config, conf_obj + ".link" );

	mLiveThread = new HookThread<Raspicam>( "cam_live", this, &Raspicam::LiveThreadRun );
	mLiveThread->Start();
	mLiveThread->setPriority( 99 );
}
Exemple #4
0
File::File( File* side, std::string filename, File::MODE mode )
	: mType( FILE )
	, mMode( mode )
{
	fDebug( side, filename, mode );

	std::string path = side->mPath.substr( 0, side->mPath.rfind( "/" ) + 1 ) + filename;

	gDebug() << "Resulting path : '" << path << "'\n";

	std::ios_base::openmode std_mode = std::ios_base::binary;

	if ( mode & READ ) {
		std_mode |= std::ios_base::in;
	}
	if ( mode & WRITE ) {
		std_mode |= std::ios_base::out;
	}

	mPath = path;
#ifdef GE_ANDROID
	mIsAsset = false;
	mStream = new std::fstream( filename, std_mode );
	if ( !mStream->is_open() ) {
		mStream = new std::fstream( std::string( BaseWindow::androidState()->activity->internalDataPath ) + "/" + filename, std_mode );
	}
	if ( !mStream->is_open() ) {
		mStream = (std::fstream*)AAssetManager_open( BaseWindow::androidState()->activity->assetManager, filename.c_str(), AASSET_MODE_STREAMING );
		mIsAsset = true;
	}
#elif GE_IOS
	mStream = new std::fstream( filename, std_mode );
	if ( !mStream->is_open() ) {
		delete mStream;
		mStream = _ge_iOSOpen( filename.c_str(), std_mode );
	}
#else
	mStream = new std::fstream( path, std_mode );
#endif
}
Exemple #5
0
File::File( const File* other )
	: mType( other->mType )
	, mMode( other->mMode )
	, mStream( nullptr )
{
	fDebug( other );

	if ( mType == FILE ) {
		std::ios_base::openmode std_mode = std::ios_base::binary;

		if ( mMode & READ ) {
			std_mode |= std::ios_base::in;
		}
		if ( mMode & WRITE ) {
			std_mode |= std::ios_base::out;
		}

		mPath = other->mPath;
	#ifdef GE_ANDROID
		mIsAsset = false;
		mStream = new std::fstream( mPath, std_mode );
		if ( !mStream->is_open() ) {
			mStream = new std::fstream( std::string( BaseWindow::androidState()->activity->internalDataPath ) + "/" + mPath, std_mode );
		}
		if ( !mStream->is_open() ) {
			mStream = (std::fstream*)AAssetManager_open( BaseWindow::androidState()->activity->assetManager, mPath.c_str(), AASSET_MODE_STREAMING );
			mIsAsset = true;
		}
	#elif GE_IOS
		mStream = new std::fstream( mPath, std_mode );
		if ( !mStream->is_open() ) {
			delete mStream;
			mStream = _ge_iOSOpen( mPath.c_str(), std_mode );
		}
	#else
		mStream = new std::fstream( mPath, std_mode );
	#endif
	}
}
Exemple #6
0
File::File( std::string filename, MODE mode )
	: mType( FILE )
	, mMode( mode )
	, mStream( nullptr )
{
	fDebug( filename, mode );

	std::ios_base::openmode std_mode = std::ios_base::binary;

	if ( mode & READ ) {
		std_mode |= std::ios_base::in;
	}
	if ( mode & WRITE ) {
		std_mode |= std::ios_base::out;
	}

	mPath = filename;
#ifdef GE_ANDROID
	mIsAsset = false;
	mStream = new std::fstream( filename, std_mode );
	if ( !mStream->is_open() ) {
		mStream = new std::fstream( std::string( BaseWindow::androidState()->activity->internalDataPath ) + "/" + filename, std_mode );
	}
	if ( !mStream->is_open() ) {
		mStream = (std::fstream*)AAssetManager_open( BaseWindow::androidState()->activity->assetManager, filename.c_str(), AASSET_MODE_STREAMING );
		mIsAsset = true;
	}
#elif GE_IOS
	mStream = new std::fstream( filename, std_mode );
	if ( !mStream->is_open() ) {
		delete mStream;
		mStream = _ge_iOSOpen( filename.c_str(), std_mode );
	}
#else
	mStream = new std::fstream( filename, std_mode );
#endif
}
Exemple #7
0
void Link::RegisterLink( const std::string& name, std::function< Link* ( Config*, const std::string& ) > instanciate )
{
	fDebug( name );
	mKnownLinks[ name ] = instanciate;
}
std::list< Object* > ObjectLoaderObj::LoadObjects( Instance* instance, File* file )
{
	fDebug( instance, file );

	std::list< Object* > objects;
	std::string currentName = "";

	std::string line;
	std::stringstream tokenizer;
	std::stringstream tokenizer2;
	std::string type;
	std::string str;
	std::string str2;
	float f = 0.0f;

	std::vector< Vector3f > verts;
	std::vector< Vector3f > tex;
	std::vector< Vector3f > norms;
	Material base_mat;
	base_mat.diffuse[0] = base_mat.diffuse[1] = base_mat.diffuse[2] = base_mat.diffuse[3]= 1.0f;
	Material* mat = &base_mat;

	uint32_t iVert = 0;
	uint32_t iTex = 0;
	uint32_t iNorm = 0;
	uint32_t iFace = 0;

	verts.reserve( 1024 );
	tex.reserve( 1024 );
	norms.reserve( 1024 );

	std::unordered_map< std::string, uint32_t > elements;

	Vertex* buff = ( Vertex* )instance->Malloc( sizeof( Vertex ) * 1024 * 1024 );
	uint32_t iBuff = 0;
	uint32_t maxBuff = 1024 * 1024;

	uint32_t* indices = ( uint32_t* )instance->Malloc( sizeof( uint32_t ) * 128 * 3 * 1024 );
	uint32_t iIndices = 0;
	uint32_t maxIndices = 128 * 3 * 1024;

	while ( file->ReadLine( line ) )
	{
		tokenizer.clear();
		tokenizer.str( line );

		type = "";
		tokenizer >> type;

		if ( type == "mtllib" ) {
			str = "";
			tokenizer >> str;
			LoadMaterials( instance, file, str );
		}

		if ( type == "g" ) {
			// Insert loaded data
			if ( elements.size() > 0 ) {
				gDebug() << "Inserting object " << currentName << "\n";
				uint32_t finalVerticesCount = iBuff;
				Vertex* finalVertices = ( Vertex* )instance->Malloc( sizeof( Vertex ) * iBuff, false );
				memcpy( finalVertices, buff, sizeof( Vertex ) * iBuff );
				uint32_t finalIndicesCount = iIndices;
				uint32_t* finalIndices = ( uint32_t* )instance->Malloc( sizeof( uint32_t ) * iIndices, false );
				memcpy( finalIndices, indices, sizeof( uint32_t ) * iIndices );
				Vector3f center = Vector3f();
				for ( uint32_t i = 0; i < iBuff; i++ ) {
					center = center + Vector3f( finalVertices[i].x, finalVertices[i].y, finalVertices[i].z ) * ( 1.0f / (float)iBuff );
				}
				for ( uint32_t i = 0; i < iBuff; i++ ) {
					finalVertices[i].x -= center.x;
					finalVertices[i].y -= center.y;
					finalVertices[i].z -= center.z;
				}
				Object* obj = instance->CreateObject( finalVertices, finalVerticesCount, finalIndices, finalIndicesCount );
				obj->matrix()->Translate( center.x, center.y, center.z );
				obj->setName( currentName );
				if ( mat && mat != &base_mat ) {
					if ( mat->map_Kd ) obj->setTexture( instance, 0, mat->map_Kd );
// 					if ( mat->map_bump ) obj->setTexture( instance, 1, mat->map_bump );
				}
				objects.emplace_back( obj );
			}

			elements.clear();
			iBuff = 0;
			iIndices = 0;
			currentName = "";
			tokenizer >> currentName;
		}

		if ( type == "usemtl" ) {
			tokenizer >> str;
			if ( mMaterials.find( str ) != mMaterials.end() ) {
				mat = mMaterials[ str ];
			} else {
				mat = &base_mat;
			}
		}