• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ clPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中clPtr的典型用法代码示例。如果您正苦于以下问题:C++ clPtr类的具体用法?C++ clPtr怎么用?C++ clPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了clPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: EmitParticles

void clParticleEmitter_Sphere::EmitParticles( const clPtr<clParticleSystem>& PS, float DeltaTime ) const
{
	FAccumulatedTime += DeltaTime;

	while (
	   FAccumulatedTime > 1.0f / FEmissionRate &&
	   PS->GetParticles().size() < FMaxParticles )
	{
		FAccumulatedTime -= 1.0f / FEmissionRate;
		sParticle P;

		float Theta = Math::RandomInRange( 0.0f, Math::TWOPI );
		float Phi   = Math::RandomInRange( 0.0f, Math::TWOPI );
		float R     = FRadius;

		float SinTheta = sin( Theta );

		float x = R * SinTheta * cos( Phi );
		float y = R * SinTheta * sin( Phi );
		float z = R * cos( Theta );

		P.FPosition = FCenter + vec3( x, y, z );
		P.FVelocity = vec3( x, y, z ).GetNormalized() * Math::RandomInRange( FRadialVelocityMin, FRadialVelocityMax );
		P.FAcceleration = vec3( 0.0f );
		P.FTTL = Math::RandomInRange( FLifetimeMin, FLifetimeMax );
		P.FLifeTime = P.FTTL;
		P.FRGBA = Math::RandomVector4InRange( FColorMin, FColorMax );
		P.FRGBA.w = 1.0f;
		P.FSize = Math::RandomInRange( FSizeMin, FSizeMax );
		PS->AddParticle( P );
	}
}
开发者ID:adarash,项目名称:Mastering-Android-NDK,代码行数:32,代码来源:ParticleEmitter.cpp


示例2: FS

FSTmp::FSTmp(clPtr<FS> _baseFS)
	: FS(TMP)
{
	// to prevent build FSTmp on top of another FSTmp
	if (_baseFS->Type() == FS::TMP)
		baseFS = ((FSTmp*)_baseFS.Ptr())->baseFS;
	else
		baseFS = _baseFS;
}
开发者ID:0-wiz-0,项目名称:WCMCommander,代码行数:9,代码来源:vfs-tmp.cpp


示例3: ShouldRemove

bool ShouldRemove( const clPtr<iTask> T, size_t ID )
{
	if ( T->GetTaskID() == ID )
	{
		T->Exit();
		return true;
	}

	return false;
}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:10,代码来源:WorkerThread.cpp


示例4:

void clCanvas::Rect3D( const LMatrix4& Proj, const LMatrix4& MV,
                       const LVector3& V1,
                       const LVector3& V2,
                       const LVector3& V3,
                       const LVector3& V4,
                       const clPtr<clGLTexture>& Texture,
                       const clPtr<clGLSLShaderProgram>& SP )
{
	LGL3->glDisable( GL_DEPTH_TEST );

	Texture->Bind( 0 );

	clPtr<clGLSLShaderProgram> S = SP ? SP : FRect3DSP;

	S->Bind();
	S->SetUniformNameMat4Array( "u_MVP", 1, MV * Proj );

	FRect3D->Restart( 6 );
	FRect3D->SetTexCoordV( LVector2( 0, 0 ) );
	FRect3D->EmitVertexV( V1 );
	FRect3D->SetTexCoordV( LVector2( 1, 0 ) );
	FRect3D->EmitVertexV( V2 );
	FRect3D->SetTexCoordV( LVector2( 0, 1 ) );
	FRect3D->EmitVertexV( V4 );

	FRect3D->SetTexCoordV( LVector2( 1, 0 ) );
	FRect3D->EmitVertexV( V2 );
	FRect3D->SetTexCoordV( LVector2( 1, 1 ) );
	FRect3D->EmitVertexV( V3 );
	FRect3D->SetTexCoordV( LVector2( 0, 1 ) );
	FRect3D->EmitVertexV( V4 );
	FRect3DVA->SetVertexAttribs( FRect3D );

	FRect3DVA->Draw( false );
}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:35,代码来源:Canvas.cpp


示例5: LoadFileAsBlob

clPtr<Blob> LoadFileAsBlob( const std::string& FName )
{
	clPtr<iIStream> input = g_FS->CreateReader( FName );
	clPtr<Blob> Res = new Blob();
	Res->CopyMemoryBlock( input->MapStream(), input->GetSize() );
	return Res;
}
开发者ID:JovinPJ,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:7,代码来源:main.cpp


示例6: FSArch

clPtr<FS> clArchPlugin::OpenFS( clPtr<FS> Fs, FSPath& Path ) const
{
	FSString Uri = Fs->Uri( Path );

	struct archive* Arch = ArchOpen( Uri.GetUtf8() );

	if ( Arch == nullptr )
	{
		return nullptr;
	}

	FSArchNode RootDir;
	RootDir.fsStat.mode = S_IFDIR;

	FSPath NodePath;
	struct archive_entry* entry = archive_entry_new2( Arch );

	int Res;

	while ( ( Res = archive_read_next_header2( Arch, entry ) ) == ARCHIVE_OK )
	{
		NodePath.Set( CS_UTF8, archive_entry_pathname( entry ) );

		FSString* ItemName = NodePath.GetItem( NodePath.Count() - 1 );

		if ( NodePath.Count() == 1 && ( ItemName->IsDot() || ItemName->IsEmpty() ) )
		{
			// skip root dir
			continue;
		}

		const mode_t Mode = archive_entry_mode( entry );
		const int64_t Size = archive_entry_size( entry );
		RootDir.entryOffset += Size;

		FSStat ItemStat;
		ItemStat.mode = S_ISREG( Mode ) ? Mode : S_IFDIR;
		ItemStat.size = Size;
		ItemStat.m_CreationTime = archive_entry_ctime( entry );
		ItemStat.m_LastAccessTime = archive_entry_atime( entry );
		ItemStat.m_LastWriteTime = archive_entry_mtime( entry );
		ItemStat.m_ChangeTime = ItemStat.m_LastWriteTime;

		FSArchNode* Dir = ArchGetParentDir( &RootDir, NodePath, ItemStat );
		FSArchNode* Item = Dir->Add( FSArchNode( ItemName->GetUtf8(), ItemStat ) );
		if (Item) {
			Item->entryOffset = archive_read_header_position( Arch );
		}
	}

	if ( Res != ARCHIVE_EOF )
	{
		dbg_printf( "Couldn't read archive entry: %s\n", archive_error_string( Arch ) );
	}

	archive_entry_free( entry );
	ArchClose( Arch );

	return new FSArch( RootDir, Uri );
}
开发者ID:corporateshark,项目名称:WCMCommander,代码行数:60,代码来源:plugin-archive.cpp


示例7: AttachToScene

void clExplosion::AttachToScene( const clPtr<clSceneNode>& Scene )
{
	if ( !m_Node )
	{
		m_Node = make_intrusive<clParticleSystemNode>();

		const vec4 Pal[] =
		{
			vec4( 0.2f, 0.30f, 0.8f, 1.0f ),
			vec4( 0.7f, 0.25f, 0.3f, 1.0f ),
			vec4( 0.1f, 0.80f, 0.2f, 1.0f )
		};

		vec4 Color = Pal[ Math::RandomInRange( 0, 3 ) ];

		auto Emitter = make_intrusive<clParticleEmitter_Explosion>();
		Emitter->FCenter = vec3( 0.0f );
		Emitter->FSizeMin = 0.02f;
		Emitter->FSizeMax = 0.05f;
		Emitter->FLifetimeMin = 0.1f;
		Emitter->FLifetimeMax = 1.0f;
		Emitter->FMaxParticles = 10000;
		Emitter->FEmissionRate = 300;
		Emitter->FRadialVelocityMin = 1.0f;
		Emitter->FRadialVelocityMax = 2.0f;
		Emitter->FColorMin = Color;
		Emitter->FColorMax = Color;
		Emitter->FAcceleration = 10.0f * m_ParticleAccel; //vec3( 0.0f, 0.0f, -3.0f );

		m_Node->AddEmitter( Emitter );
	}

	Scene->Add( m_Node );
}
开发者ID:adarash,项目名称:Mastering-Android-NDK,代码行数:34,代码来源:Actors.cpp


示例8: Append

void FSList::Append( clPtr<FSNode> p )
{
	p->next = 0;

	if ( last )
	{
		last->next = p.ptr();
	}
	else
	{
		first = p.ptr();
	}

	last = p.ptr();
	p.drop();
	count++;
}
开发者ID:KonstantinKuklin,项目名称:WalCommander,代码行数:17,代码来源:vfs.cpp


示例9: Traverse

void iSceneTraverser::Traverse( clPtr<clSceneNode> Node )
{
	if ( !Node ) { return; }

	Reset();

	Node->AcceptTraverser( this );
}
开发者ID:alhazmy13,项目名称:Mastering-Android-NDK,代码行数:8,代码来源:Nodes.cpp


示例10: Picasa_ParseXMLResponse

void clGallery::ListDownloaded( clPtr<clBlob> B )
{
	if ( B )
	{
		/// Parse the blob
		FURLs.clear();

		void*  Data     = B->GetData();
		size_t DataSize = B->GetSize();

		Picasa_ParseXMLResponse( std::string( ( char* )Data, DataSize ), FURLs );
	}
	else
	{
		FNoImagesList = true;
		return;
	}

	for ( size_t j = 0 ; j != FURLs.size() ; j++ )
	{
		printf( "URL[%d] = %s\n", ( int )j, FURLs[j].c_str() );
	}

	fflush( stdout );

	// теперь что-то создать в FImages ?
	FImages.clear(); // resize(FURLs.size());

	for ( size_t j = 0 ; j != FURLs.size() ; j++ )
	{
		LPhotoSize Size = L_PHOTO_SIZE_128;
		std::string ImgUrl = Picasa_GetDirectImageURL( FURLs[j], Size );

		clPtr<sImageDescriptor> Desc = new sImageDescriptor();
		Desc->FSize    = Size;
		Desc->FURL     = ImgUrl;
		Desc->FID      = j;

		FImages.push_back( Desc );

		// и запустить загрузку
		Desc->StartDownload( true );
	}

	FNoImagesList = false;
}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:46,代码来源:GalleryTable.cpp


示例11: clGLTexture

void clCanvas::TextStr( float X1, float Y1, float X2, float Y2, const std::string& Str, int Size, const LVector4& Color, const clPtr<clTextRenderer>& TR, int FontID )
{
	clPtr<clBitmap> B = TR->RenderTextWithFont( Str, FontID, Size, 0xFFFFFFFF, true );
	clPtr<clGLTexture> Texture = new clGLTexture();
	Texture->LoadFromBitmap( B );
	this->TexturedRect2D( X1, Y1, X2, Y2, Color, Texture );

	// make sure we draw everything before detroying the texture
	LGL3->glFinish();
}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:10,代码来源:Canvas.cpp


示例12: RenderDirect

void RenderDirect( clPtr<clFlowUI> Control )
{
    int Num = Control->FNumImg;
    int CurImg = Control->GetCurrentImage();
    float Dist = ( float )( Num * OneImageSize );

    if ( Num < 1 ) {
        return;
    }

    // index = [curr - 2 .. curr + 2]
    /// Left -> Right -> Selected rendering order
    int ImgOrder[] = { CurImg - 3, CurImg - 2, CurImg - 1, CurImg + 3, CurImg + 2, CurImg + 1, CurImg };

    for ( int in_i = 0 ; in_i < 7 ; in_i++ )
    {
        int i = ImgOrder[in_i];

        if ( i < 0 ) {
            i += ( 1 - ( ( int )( i / Num ) ) ) * Num;
        }

        if ( i >= Num ) {
            i -= ( ( int )( i / Num ) ) * Num;
        }

        if ( i < Num && i > -1 )
        {
            vec3 Pt[4];
            Control->QuadCoords( Pt, Control->FFlinger->FValue - ( float )( i ) * OneImageSize );

            vec3 Q[4];

            for ( int j = 0 ; j < 4 ; j++ )
            {
                Q[j] = Control->FProjection * Control->FView * Pt[j];
            }

            BoxR( Q, 0xFFFFFF );
        }
    }
}
开发者ID:,项目名称:,代码行数:42,代码来源:


示例13: Lock

void clWorkerThread::AddTask( const clPtr<iTask>& Task )
{
	tthread::lock_guard<tthread::mutex> Lock( FTasksMutex );

	// non-zero IDs should be unique
	if ( size_t ID = Task->GetTaskID() )
	{
		for ( std::list< clPtr<iTask> >::iterator i = FPendingTasks.begin(); i != FPendingTasks.end(); ++i )
		{
			// LASSERT( (*i)->GetTaskID() != ID );
		}
	}

	FPendingTasks.push_back( Task );

	FCondition.notify_all();
}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:17,代码来源:WorkerThread.cpp


示例14:

void clCanvas::TexturedRect2D( float X1, float Y1, float X2, float Y2, const LVector4& Color, const clPtr<clGLTexture>& Texture )
{
	LGL3->glDisable( GL_DEPTH_TEST );

	Texture->Bind( 0 );

	FTexRectSP->Bind();
	FTexRectSP->SetUniformNameVec4Array( "u_Color", 1, Color );
	FTexRectSP->SetUniformNameVec4Array( "u_RectSize", 1, LVector4( X1, Y1, X2, Y2 ) );

	LGL3->glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
	LGL3->glEnable( GL_BLEND );

	FRectVA->Draw( false );

	LGL3->glDisable( GL_BLEND );
}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:17,代码来源:Canvas.cpp


示例15: ExtractCurrentFile_ZIP

/// Internal routine to extract a single file from ZIP archive
int ExtractCurrentFile_ZIP( unzFile uf, const char* password, int* abort_flag, float* progress, const clPtr<iOStream>& fout )
{
	char filename_inzip[256];
	int err = UNZ_OK;
	void* buf;
	uInt size_buf;
	unz_file_info64 file_info;

	err = unzGetCurrentFileInfo64( uf, &file_info, filename_inzip, sizeof( filename_inzip ), NULL, 0, NULL, 0 );

	if ( err != UNZ_OK ) { return err; }

	uint64 file_size = ( uint64 )file_info.uncompressed_size;
	uint64 total_bytes = 0;

	unsigned char _buf[WRITEBUFFERSIZE];
	size_buf = WRITEBUFFERSIZE;
	buf = ( void* )_buf;

	err = unzOpenCurrentFilePassword( uf, password );

	if ( err != UNZ_OK ) { return err; }

	do
	{
		err = unzReadCurrentFile( uf, buf, size_buf );

		if ( err < 0 ) { break; }

		if ( err > 0 ) { total_bytes += err; fout->Write( buf, err ); }
	}
	while ( err > 0 );

	int close_err = unzCloseCurrentFile ( uf );

	if ( close_err != UNZ_OK ) { return close_err; }

	return err;
}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:40,代码来源:Archive.cpp


示例16: DirCalc

bool DirCalc( clPtr<FS> f, FSPath& path, clPtr<FSList> list, NCDialogParent* parent )
{
	bool doCurrentDir = list->Count() == 0;

	OperDirCalcData data(parent, f, path, list);
	DirCalcThreadWin dlg(parent, doCurrentDir ? _LT("Current folder metrics") : _LT("Selected folder(s) metrics"), &data, f->Uri(path).GetUnicode());

	dlg.RunNewThread( "Folder calc", DirCalcThreadFunc, &data ); //может быть исключение

	dlg.Enable();
	dlg.Show();

	int cmd = dlg.DoModal();
	dlg.StopThread();

	if ( cmd != CMD_OK )
	{
		return false;
	}

	return true;
}
开发者ID:0-wiz-0,项目名称:WCMCommander,代码行数:22,代码来源:dircalc.cpp


示例17: while

void OperRDThread::Run()
{
	if ( !fs.Ptr() ) { return; }

	int n = 8;
	int ret_err;

	int havePostponedStatError = 0;
	FSString postponedStrError;

	while ( true )
	{
		if ( !( fs->Flags() & FS::HAVE_SYMLINK ) )
		{
			break;
		}

		FSStat st;

		// if path is inaccessible, try .. path. Throw the exception later
		// This makes panel at least having some valid folder
		while ( fs->Stat( path, &st, &ret_err, Info() ) )
		{
			havePostponedStatError = 1;
			postponedStrError = fs->StrError( ret_err );

			if ( !path.IsAbsolute() || path.Count() <= 1 || !path.Pop() )
			{
				throw_msg( "%s", postponedStrError.GetUtf8() );
			}
		}

		// yell immediately if the path is inaccessible (orig behavior)
		//if (fs->Stat(path, &st, &ret_err, Info()))
		// throw_msg("%s", fs->StrError(ret_err).GetUtf8());

		if ( !st.IsLnk() )
		{
			break;
		}

		n--;

		if ( n < 0 )
		{
			throw_msg( "too many symbolic links '%s'", path.GetUtf8() );
		}

		path.Pop();

		if ( !ParzeLink( path, st.link ) )
		{
			throw_msg( "invalid symbolic link '%s'", path.GetUtf8() );
		}
	}

	clPtr<FSList> list = new FSList;

	int havePostponedReadError = 0;

	// if directory is not readable, try .. path. Throw the exception later
	// "Stat" call above does not catch this: it checks only folder existence, but not accessibilly
	while ( fs->ReadDir( list.ptr(), path, &ret_err, Info() ) )
	{
		havePostponedReadError = 1;
		postponedStrError = fs->StrError( ret_err );

		if ( !path.IsAbsolute() || path.Count() <= 1 || !path.Pop() )
		{
			throw_msg( "%s", postponedStrError.GetUtf8() );
		}
	}

	// yell immediately if the dir is unreadable (orig behavior)
	//int ret = fs->ReadDir(list.ptr(), path, &ret_err, Info());
	//if (ret)
	// throw_msg("%s", fs->StrError(ret_err).GetUtf8());

	FSStatVfs vst;
	fs->StatVfs( path, &vst, &ret_err, Info() );

	MutexLock lock( Node().GetMutex() ); //!!!

	if ( Node().NBStopped() ) { return; }

	OperRDData* data = ( ( OperRDData* )Node().Data() );
	data->list = list;
	data->path = path;
	data->executed = true;
	data->vst = vst;

	if ( havePostponedReadError || havePostponedStatError )
	{
		data->nonFatalErrorString = postponedStrError;
	}
}
开发者ID:FaionWeb,项目名称:WCMCommander,代码行数:96,代码来源:fileopers.cpp


示例18: DetachFromScene

void clExplosion::DetachFromScene( const clPtr<clSceneNode>& Scene )
{
	Scene->Remove( m_Node );
}
开发者ID:adarash,项目名称:Mastering-Android-NDK,代码行数:4,代码来源:Actors.cpp


示例19: OnStart

void OnStart( const std::string& RootPath )
{
    g_FrameBuffer = ( unsigned char* )malloc( ImageWidth * ImageHeight * 4 );
    memset( g_FrameBuffer, 0xFF, ImageWidth * ImageHeight * 4 );

    g_FS = new FileSystem();
    g_FS->Mount( "." );
#if defined(ANDROID)
    g_FS->Mount( RootPath );
    g_FS->AddAliasMountPoint( RootPath, "assets" );
#endif
    g_Audio.Start( iThread::Priority_Normal );
    g_Sound.Start( iThread::Priority_Normal );
}
开发者ID:voff4eg,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:14,代码来源:main.cpp


示例20: OnStart

void OnStart( const std::string& RootPath )
{
    g_FrameBuffer = ( unsigned char* )malloc( ImageWidth * ImageHeight * 4 );
    memset( g_FrameBuffer, 0x00, ImageWidth * ImageHeight * 4 );

    g_FS = new FileSystem();
    g_FS->Mount( "." );
#if defined(ANDROID)
    g_FS->Mount( RootPath );
    g_FS->AddAliasMountPoint( RootPath, "assets" );
#endif

    g_Flow = new clFlowUI( new clFlowFlinger(), 10 );

    XScale = 25.0f;
    YScale = 5.5f;
    XOfs =
        YOfs = 80.0f;
}
开发者ID:,项目名称:,代码行数:19,代码来源:



注:本文中的clPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cl_command_queue类代码示例发布时间:2022-05-31
下一篇:
C++ clDebugEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap