当前位置: 首页>>代码示例>>C++>>正文


C++ ParticleSystem::Initialize方法代码示例

本文整理汇总了C++中ParticleSystem::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSystem::Initialize方法的具体用法?C++ ParticleSystem::Initialize怎么用?C++ ParticleSystem::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleSystem的用法示例。


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

示例1: Initialize

void Initialize( void )
{
	SDL_Init( SDL_INIT_VIDEO );

	SDL_SetVideoMode( 800, 600, 0, SDL_OPENGL | SDL_HWSURFACE );
	SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
	
	glDisable( GL_DEPTH_TEST ); 
	
	glHint( GL_POINT_SMOOTH_HINT,GL_NICEST );
	glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
	
	glEnable( GL_BLEND );
	glEnable( GL_TEXTURE_2D );

	glViewport (0, 0, 800, 600);
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
	
	glMatrixMode (GL_PROJECTION);
	glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 100.0);
	glMatrixMode (GL_MODELVIEW);

	fireParticles.Initialize();
	smokeParticles.Initialize();
}
开发者ID:Alyanorno,项目名称:particle_system,代码行数:25,代码来源:main.cpp

示例2: InitScene

HRESULT InitScene()
{
	HRESULT hr;

	SetWindowText(hwnd, TITLE);

	MYVALID(D3DXLoadMeshFromX("../media/meshes/sky.X", D3DXMESH_MANAGED, device, NULL, NULL, NULL, NULL, &skymesh));
	MYVALID(D3DXLoadMeshFromX("../media/meshes/box.X", D3DXMESH_MANAGED, device, NULL, NULL, NULL, NULL, &mesh));
	MYVALID(D3DXCreateTextureFromFileA(device, "../media/textures/fire.png", &texture1));
	MYVALID(D3DXCreateTextureFromFileA(device, "../media/textures/stones.jpg", &texture2));
	MYVALID(D3DXCreateCubeTextureFromFileA(device, "../media/textures/sky4.dds", &skytex));
	MYVALID(device->CreateTexture(512, 512, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &text, NULL));

	MYVALID(DXCreateEffect("../media/shaders/skinning.fx", device, &effect));
	MYVALID(DXCreateEffect("../media/shaders/sky.fx", device, &skyeffect));

	system1.Initialize(device, 500);
	system1.ParticleTexture = texture1;

	// load dwarfs
	dwarfs[0].Effect = effect;
	dwarfs[0].Method = SM_Shader;
	dwarfs[0].Path = "../media/meshes/dwarf/";
	
	MYVALID(dwarfs[0].Load(device, "../media/meshes/dwarf/dwarf.X"));

	dwarfs[0].Clone(dwarfs[1]);
	dwarfs[0].Clone(dwarfs[2]);
	dwarfs[0].Clone(dwarfs[3]);
	dwarfs[0].Clone(dwarfs[4]);
	dwarfs[0].Clone(dwarfs[5]);

	D3DXVECTOR3 scale(0.1f, 0.1f, 0.1f);
	D3DXVECTOR3 trans;
	D3DXQUATERNION rot;

	// dwarf 0
	trans = D3DXVECTOR3(-1, 0, 1);

	D3DXQuaternionRotationYawPitchRoll(&rot, -0.785f, 0, 0);
	D3DXMatrixTransformation(&dwarfmatrices[0], NULL, NULL, &scale, NULL, &rot, &trans);

	// dwarf 1
	trans = D3DXVECTOR3(-1, 0, -1);

	D3DXQuaternionRotationYawPitchRoll(&rot, -2.356f, 0, 0);
	D3DXMatrixTransformation(&dwarfmatrices[1], NULL, NULL, &scale, NULL, &rot, &trans);

	// dwarf 2
	trans = D3DXVECTOR3(1, 0, -1);

	D3DXQuaternionRotationYawPitchRoll(&rot, 2.356f, 0, 0);
	D3DXMatrixTransformation(&dwarfmatrices[2], NULL, NULL, &scale, NULL, &rot, &trans);

	// dwarf 3
	trans = D3DXVECTOR3(1, 0, 1);

	D3DXQuaternionRotationYawPitchRoll(&rot, 0.785f, 0, 0);
	D3DXMatrixTransformation(&dwarfmatrices[3], NULL, NULL, &scale, NULL, &rot, &trans);

	// dwarf 4
	trans = D3DXVECTOR3(-0.2f, 0, -0.2f);

	D3DXQuaternionRotationYawPitchRoll(&rot, -1.57f, 0, 0);
	D3DXMatrixTransformation(&dwarfmatrices[4], NULL, NULL, &scale, NULL, &rot, &trans);

	// dwarf 5
	trans = D3DXVECTOR3(0.2f, 0, 0);

	D3DXQuaternionRotationYawPitchRoll(&rot, -1.57f, 0, 0);
	D3DXMatrixTransformation(&dwarfmatrices[5], NULL, NULL, &scale, NULL, &rot, &trans);

	// skins
	DwarfSkin(0, 1, 1, 3, 1, 1, 3, 0);
	DwarfSkin(1, 2, 0, 1, 3, 3, 1, 1);
	DwarfSkin(2, 3, 2, 2, 2, 1, 2, 3);
	DwarfSkin(3, 1, 3, 2, 1, 3, 0, 2);
	DwarfSkin(4, 1, 1, 3, 3, 2, 2, 1);
	DwarfSkin(5, 0, 0, 1, 2, 3, 0, 1);

	// 0, 1, 2 - dead
	// 3, 5 - stand
	// 4 - jump
	// 6 - cheer with weapon
	// 7 - cheer with one hand
	// 8 - cheer with both hands
	dwarfs[0].SetAnimation(6);
	dwarfs[1].SetAnimation(8);
	dwarfs[2].SetAnimation(7);
	dwarfs[3].SetAnimation(4);
	dwarfs[4].SetAnimation(2);
	dwarfs[5].SetAnimation(1);

	// other
	device->SetRenderState(D3DRS_LIGHTING, false);
	device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
	device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);

	DXRenderText(HELP_TEXT, text, 512, 512);
	cameraangle = D3DXVECTOR2(0.785f, 0.785f);
//.........这里部分代码省略.........
开发者ID:IwishIcanFLighT,项目名称:Asylum_Tutorials,代码行数:101,代码来源:main.cpp


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