Code:
program particles;
uses
SysUtils, IRRLICHT in 'IRRLICHT.pas';
var
font:IFont;
texture:ITexture;
ps,model,bill,Light,water,room,camera:ISceneNode;
meshhil,mesh,meshmodel:IAnimatedMesh;
anim:IAnimator;
finished:boolean=false;
EEvents:TEngineEvents;
Save8087CW: Word;
begin
Save8087CW := Get8087CW;
Set8087CW($133F);
Device_Init(EDT_DIRECT3D9,800,600,16,false,true,true);
Render_SetResizeAble(true);
Device_SetWindowCaption('IRRLICHT 4 Delphi');
Render_SetDebug(true,true);
Device_SetCursorVisible(true);
font:=Font_Load('../../media/fonthaettenschweiler.bmp');
texture:=Texture_Load('../../media/irrlichtlogo.BMP');
camera:=Scene_AddFPSCamera;
Node_SetPosition(camera,80,80,-600);
Scene_AddSkyBox(
'../../media/irrlicht2_up.jpg',
'../../media/irrlicht2_dn.jpg',
'../../media/irrlicht2_lf.jpg',
'../../media/irrlicht2_rt.jpg',
'../../media/irrlicht2_ft.jpg',
'../../media/irrlicht2_bk.jpg');
mesh:=Scene_AddMesh('../../media/room.3ds');
Mesh_MakePlanarTextureMapping(mesh,0.008);
room:=Scene_AddOctTreeSceneNode(mesh);
Node_SetMaterialTexture(room,0,'../../media/wall.jpg');
Node_SetSpecularColor(room,Color(0,0,0,0),0);
meshhil:=Scene_AddHillPlaneMesh( 'myHill',20,20,40,40,0,4,4,10,10);
water:=Scene_AddWaterSurface(meshhil,vect(0,7,0),ZEROVECT,ADDVECT,3.0,300.0,30.0);
Node_SetMaterialTexture(water,0,'../../media/stones.jpg');
Node_SetMaterialTexture(water,1,'../../media/water.jpg');
Node_SetMaterialType(water,EMT_REFLECTION_2_LAYER);
Light:=Scene_AddLight(1200.0,ZEROVECT,color(256,256,200,255));
anim:=Scene_CreateFlyCircleAnimator(vect(0,150,0),vect(0,1,0),250,0.001);
Node_AddAnimator(light,anim);
bill:=Scene_AddBillboard(50,50,ZEROVECT,CWHITE,light);
Node_SetMaterialTexture(bill,0,'../../media/particlewhite.bmp');
Node_SetMaterialFlag(bill,EMF_LIGHTING,false);
Node_SetMaterialType(bill,EMT_TRANSPARENT_ADD_COLOR);
meshmodel:=Scene_AddMesh('../../media/dwarf.x');
model:=Scene_AddNodFromMesh(meshmodel,vect(-120,-10,-140),ZEROVECT,vect(2,2,2));
Anim_SetAnimationSpeed(model,150);
Node_SetMaterialFlag(model,EMF_NORMALIZE_NORMALS,true);
Node_AddShadowVolume(model);
Scene_SetShadowColor(color(150,0,0,0));
Node_AddShadowVolume(model);
//ps:=Scene_AddParticleSystem(vect(-70,60,40),ZEROVECT,vect(2,2,2),false,model);
ps:=Scene_AddParticleSystem(vect(0,0,0),ZEROVECT,vect(1,1,1),false,model);
Par_SetParticleSize(ps,20,20);
{Par_AddBoxEmitter(ps,-7,0,-7,7,1,7,vect(0,0.06,0),
color(0,255,255,255),
color(0,255,255,255),80,100,800,2000);
}
Par_AddAnimatedMeshEmitter(ps,model,ZEROVECT,color(0,255,255,255),color(0,255,255,255));
//Par_AddCylinderEmitter(ps,ZEROVECT,20,vect(0,0,0),2,vect(0,0.03,0),color(0,255,255,255),color(0,255,255,255));
//Par_AddPointEmitter(ps,vect(0,0.03,0),color(0,255,255,255),color(0,255,255,255));
//Par_AddRingEmitter(ps,vect(0,0,0),2,2,vect(0,0.03,0),color(0,255,255,255),color(0,255,255,255));
//Par_AddSphereEmitter(ps,vect(0,0,0),6,vect(0,0.03,0),color(0,255,255,255),color(0,255,255,255));
//Par_AddFadeOutParticleAffector(ps);
//Par_AddAttractionParticleAffector(ps,vect(100,10,0),100,true,false,true,false);
//Par_AddGravityAffector(ps,vect(0,0.03,0));
Par_AddRotationAffector(ps,vect(5.0,5.0,5.0),vect(0,0,0));
Node_SetMaterialTexture(ps,0,'../../media/fire.bmp');
Node_SetMaterialFlag(ps,EMF_LIGHTING,false);
Node_SetMaterialFlag(ps,EMF_ZWRITE_ENABLE,false);
Node_SetMaterialType(ps,EMT_TRANSPARENT_VERTEX_ALPHA);
Scene_AddRealisticWater('../../media/waterbump.dds',
while (Device_Run) and (not finished) do
begin
Device_GetEvents(EEvents);
Render_BeginScene(true,true,0,0,0);
Scene_DrawAll;
Texture_DrawD2ImageColor(texture,800-89,600-32,0,0,88,31,color(255,255,255,255),false);
Render_EndScene;
if EEvents.loopKeyInput.Key=27 then finished:=true;
end;
Device_Stop;
Set8087CW(Save8087CW);
end.
Bookmarks