im creating 1 framework for IR ...
the framework work like blitz3d and darkbasic
Code: Select all
//delphi API
function IR_InitEngine(DeviceType:IRDevice;W,H, BBP:integer;fullscreen,stencilbuffer, vsync:boolean ):boolean;stdcall;external ir_dll;
function IR_InitEngineOnWindow(DeviceType:IRDevice;HWND:integer;W,H, BBP:integer;fullscreen,stencilbuffer,AntiAlias, vsync:boolean ):boolean;stdcall;external ir_dll;
procedure IR_StopEngine;stdcall;external ir_dll;
procedure IR_SetWindowCaption(text:PWChar);stdcall;external ir_dll;
function IR_Run:boolean;stdcall;external ir_dll;
//**************************************************
procedure IR_Timer_Tick;stdcall;external ir_dll;
function IR_Timer_GetRealTime:integer;stdcall;external ir_dll;
function IR_Timer_GetTime:integer;stdcall;external ir_dll;
procedure IR_Timer_SetSpeed(speed:single=1.0);stdcall;external ir_dll;
//***
function IR_IsWindowActive:bool;stdcall;external ir_dll;
procedure IR_SetWindowResizeAble(resize:bool);stdcall;external ir_dll;
procedure IR_LogWrite(text:PWCHAR);stdcall;external ir_dll;
procedure IR_SetCursorVisible(value:bool);stdcall;external ir_dll;
procedure IR_Render_Debug(ShowFps, ShowDeviceName:boolean);stdcall;external ir_dll;
procedure IR_Render_SetTextureCreationFlag(Flag:E_TEXTURE_CREATION_FLAG;value:bool)stdcall;external ir_dll;
function IR_RenderBeginScene(backBuffer,zBuffer:bool;r,g, b:integer):bool;stdcall;external ir_dll;
function IR_RenderEndScene:boolean;stdcall;external ir_dll;
function IR_RenderDraw2DRectangle(Left,Top,right,Bottom:integer;r, g, b, alpha:integer):bool;stdcall;external ir_dll;
procedure IR_GuidInit;stdcall;external ir_dll;
procedure IR_GuidDraw;stdcall;external ir_dll;
procedure IR_GuidAddButton(index:integer;id:integer; x,y,w,h:integer );stdcall;external ir_dll;
procedure IR_TextureLoad(index:integer;filetoload:PCHAR);stdcall;external ir_dll;
function IR_TextureFree(index:integer):bool;stdcall;external ir_dll;
procedure IR_TextureSetColorKey(index:integer;x,y:integer);stdcall;external ir_dll;
procedure IR_TextureDrawD2Image(index,x,y:integer);stdcall;external ir_dll;
procedure IR_TextureDrawD2ImageColor(index,x,y,Left,Top,Right,Bottom,r, g, b, alpha:integer;UseAlpha:bool)stdcall;external ir_dll;
procedure IR_TextureDrawD2ImageColorClip(index:integer;x,y:integer;Left,Top,Right,Bottom:integer;r, g, b, alpha:integer;UseAlpha:bool;cLeft,cTop,cRight,cBottom:integer)stdcall;external ir_dll;
procedure IR_FontWrite (texto:pchar;x, y:integer;r,g,b,alpha:integer);stdcall;external ir_dll;
procedure IR_FontWrite_Num(Num:integer;x, y:integer;r,g,b,alpha:integer);stdcall;external ir_dll;
//´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´
function IR_LoadZipFile(filename:pchar;ignoreCase , ignorePaths:bool ):bool;stdcall;external ir_dll;
function IR_GetDir:pchar;stdcall;external ir_dll;
function IR_GetFPS:integer;stdcall;external ir_dll;
//*********************************************camera
procedure IR_Camera_AddNormal(PosX,PosY,PosZ,LookX,LookY,LookZ:single) ;stdcall;external ir_dll;
procedure IR_Camera_AddFPSStyle(rotateSpeed,moveSpeed:single;noVerticalMovement:bool) ;stdcall;external ir_dll;
procedure IR_Camera_AddMayaStyle(rotateSpeed ,zoomSpeed,translationSpeed:single) ;stdcall;external ir_dll;
procedure IR_Camera_SetPos(x,y,z:single) ;stdcall;external ir_dll;
procedure IR_Camera_SetFarValue (fFar:single);stdcall;external ir_dll;
procedure IR_Camera_SetNearValue (fNear:single);stdcall;external ir_dll;
procedure IR_Camera_SetAspectRatio(aspect:single);stdcall;external ir_dll;
procedure IR_Camera_SetFOV(fovy:single);stdcall;external ir_dll;
//************************************************************************
procedure IR_NodeCreateDummyCube(index:integer );stdcall;external ir_dll;
procedure IR_NodeSetTexture(index,textureIndex:integer );stdcall;external ir_dll;
procedure IR_NodeDrawAll;stdcall;external ir_dll;
//--+++++++++++++++++++++++++++++++++++++++
Procedure IR_Meshes_Add_MD2_From_File(Index:Integer;filename:pchar) ;stdcall;external ir_dll;
Procedure IR_Meshes_SetTexture(Index:Integer;textureIndex:integer) ;stdcall;external ir_dll;
Procedure IR_Meshes_Enable_lighting(Index:Integer;value:bool) ;stdcall;external ir_dll;
Procedure IR_Meshes_SetPosition(Index:Integer;x,y,z:single) ;stdcall;external ir_dll;
Procedure IR_Meshes_SetRotatin(Index:Integer;x,y,z:single) ;stdcall;external ir_dll;
Procedure IR_Meshes_SetScale(Index:Integer;x,y,z:single) ;stdcall;external ir_dll;
Procedure IR_Meshes_SetVisible(Index:Integer;Visible:bool ) ;stdcall;external ir_dll;
Procedure IR_Meshes_GetPosition(Index:Integer;x,y,z:single) ;stdcall;external ir_dll;
function IR_Meshes_GetPosition2(Index:Integer): IVEC3 ;stdcall;external ir_dll;
Procedure IR_Meshes_GetRotatin(Index:Integer;x,y,z:single) ;stdcall;external ir_dll;
function IR_Meshes_GetRotatin2(Index:Integer): IVEC3 ;stdcall;external ir_dll;
Procedure IR_Meshes_GetScale(Index:Integer;x,y,z:single) ;stdcall;external ir_dll;
function IR_Meshes_GetScale2(Index:Integer): IVEC3 ;stdcall;external ir_dll;
//--+++++++++++++++++++++++++++++++++++++++
procedure IR_Terrain_LoadHeightMap(heightMapFileName:pchar);stdcall;external ir_dll;
procedure IR_Terrain_SetPosition(x,y,z:single) ;stdcall;external ir_dll;
procedure IR_Terrain_SetRotation(x,y,z:single) ;stdcall;external ir_dll;
procedure IR_Terrain_SetScale(x,y,z:single) ;stdcall;external ir_dll;
procedure IR_Terrain_SetVertexColor(a,r,g,b:single);stdcall;external ir_dll;
procedure IR_Terrain_Add(maxLOD:integer=5; patchSize:E_TERRAIN_PATCH_SIZE=ETPS_17);stdcall;external ir_dll;
procedure IR_Terrain_Free;stdcall;external ir_dll;
procedure IR_Terrain_AddTriangleSelector;stdcall;external ir_dll;
procedure IR_Terrain_SetMaterialFlag(mType:E_MATERIAL_FLAG ;value:bool);stdcall;external ir_dll;
procedure IR_Terrain_SetMaterialType(Mtype:E_MATERIAL_TYPE);stdcall;external ir_dll;
procedure IR_Terrain_SetVisible(isVisible:bool);stdcall;external ir_dll;
function IR_Terrain_GetID:integer;stdcall;external ir_dll;
procedure IR_Terrain_SetDebugVisible(visible:bool);stdcall;external ir_dll;
procedure IR_Terrain_SetMaterialTexture(textureLayer:integer;filetoload:pchar);stdcall;external ir_dll;
procedure IR_Terrain_ScaleTexture(x,y:single);stdcall;external ir_dll;
//--+++++++++++++++++++++++++++++++++++++++
procedure IR_Terrain_LensFlare_Build;stdcall;external ir_dll;
procedure IR_Terrain_LensFlare_Render;stdcall;external ir_dll;
//--+++++++++++++++++++++++++++++++++++++++
procedure IR_SkyBox_LoadTexture( filetoload:pchar;textType:SKY_TEXTURE_TYPE);stdcall;external ir_dll;
procedure IR_SkyBox_AddToScene (Id:integer=-1);stdcall;external ir_dll;
procedure IR_LensFlare_Add;stdcall;external ir_dll;
function IR_Image_Load(index:integer;filename:pchar;colorkey:bool=true):bool;stdcall;external ir_dll;
procedure IR_Image_Free(index:integer);stdcall;external ir_dll;
function IR_Image_IsPointColide(index, x, y:integer):bool;stdcall;external ir_dll;
function IR_Image_IsImageColide(index,Image:integer):bool;stdcall;external ir_dll;
function IR_Image_Draw(index, x, y:integer;Tras:bool):bool;stdcall;external ir_dll;
shot with: lens flare,terrain ,md2 model and skyboxe
the code:
Code: Select all
program SkyBox;
{APPTYPE CONSOLE}
uses
windows,
SysUtils,
dialogs,divinput,
IRFrame in 'IRFrame.pas';
var
loop:boolean=true;
d:array [0..255]of char;
begin
IR_InitEngine(EDT_DIRECT3D9,800,600,16,false,FALSE,false);
IR_LogWrite('init engine');
IR_SetWindowCaption('Irrlicht Engine - 2D Graphics Demo');
IR_SetWindowResizeAble(true);
IR_LogWrite('load textures');
IR_TextureLoad(0,'2ddemo.bmp');
IR_Render_SetTextureCreationFlag( ETCF_CREATE_MIP_MAPS,false);
IR_SkyBox_LoadTexture('data\irrlicht2_up.jpg',TTop);
IR_SkyBox_LoadTexture('data\irrlicht2_dn.jpg',Tbottom);
IR_SkyBox_LoadTexture('data\irrlicht2_lf.jpg',Tleft);
IR_SkyBox_LoadTexture('data\irrlicht2_rt.jpg',Tright);
IR_SkyBox_LoadTexture('data\irrlicht2_ft.jpg',Tfront);
IR_SkyBox_LoadTexture('data\irrlicht2_bk.jpg',Tback);
IR_SkyBox_AddToScene;
IR_Render_SetTextureCreationFlag( ETCF_CREATE_MIP_MAPS,true);
IR_GuidInit;
IR_Camera_AddFPSStyle(10.0,505.0,true);
IR_Camera_SetPos(0,200,-10);
//IR_Camera_AddMayaStyle(-1500.0,200.0,1500.0);
IR_Camera_SetFarValue(15000.0);
IR_Meshes_Add_MD2_From_File(0,'data\faerie.md2');
IR_Meshes_Enable_lighting(0,false);
IR_TextureLoad(1,'data\faerie5.bmp');
IR_Meshes_SetTexture(0,1);
IR_Meshes_SetPosition(0,100,200,100);
IR_Meshes_SetScale(0,1.0,1.0,1.0);
IR_Terrain_LoadHeightMap('data\terrain-heightmap.bmp');
IR_Terrain_SetPosition(0,-200,0);
IR_Terrain_SetRotation(0,0,0);
IR_Terrain_SetScale(40.0,4.0,40.0);
IR_Terrain_SetVertexColor(255,255,255,255);
IR_Terrain_Add;
IR_Terrain_AddTriangleSelector;
IR_Terrain_SetMaterialFlag(EMF_LIGHTING,false);
IR_Terrain_SetMaterialTexture(0,'data\terrain-texture.jpg');
IR_Terrain_SetMaterialTexture(1,'data\detailmap3.jpg');
IR_Terrain_SetMaterialType(EMT_DETAIL_MAP);
IR_Terrain_ScaleTexture(1.0,20.0);
Div_Keyboard_Init;
if not IR_Image_Load(0,'data\21.jpg') then halt;
IR_Render_Debug(true,true);
IR_LensFlare_Add;
repeat
Div_Keyboard_Update;
IR_Timer_Tick;
IR_Run;
if Div_Keyboard_Up(KEY_ESCAPE ) then loop:=false;
IR_RenderBeginScene(true,true,0,0,45);
IR_NodeDrawAll;
IR_TextureDrawD2ImageColor(0,10,550,354,87,442,118,255,255,255,155,false);
IR_FontWrite('IR 4 Delphi By Luis Santos AKA Djoker',300,20,255,255,255,255);
IR_RenderEndScene;
sleep(15);
until not loop;
IR_Terrain_Free;
IR_StopEngine;
end.
ps : Irrlicht suport delphi .net but my project is not for .NET its 4 all copilers like blitz3d purebasic ibasic and blitzmax