Jump to content

Question concerning the include file


macklebee
 Share

Recommended Posts

Since the include file is being used for the LE3 editor, the question that comes to mind is whether all of the LE commands will be used for the editor. Are the items listed here just what is currently needed for the editor or will there be a full version released? Or maybe this is just an abbreviated version that you posted for show?

 

SuperStrict

Import brl.pngloader
Import "le3.lib"
Import "le_const.bmx"
Import "le_types.bmx"

Extern "c"

       'General
       'Function leSetHook(hookid:Int,hook:Byte Ptr)="SetHook"
       Function leGetLogText_(char:Byte Ptr,length:Int)="GetLogText"

       'Bank
       Function lePeekBankByte:Int(bank:LEBank,position:Int)="PeekBankByte"
       Function leGetBankSize:Int(bank:LEBank)="GetBankSize"
       Function leGetBankBuffer:Byte Ptr(bank:LEBank)="GetBankBuffer"

       'Network
       Function leCreateServer:leServer(port:Int)="CreateServer"
       Function leUpdateServer:leMessage(server:leServer,timeout:Int)="UpdateServer"
       Function leDisconnectServer(server:leServer,client:LEPeer,force:Int)="DisconnectServer"
       Function leSendServer:Int(server:leServer,client:LEPeer,messageid:Int,date:Byte Ptr,size:Int,channel:Int,flags:Int)="SendServer"

       'Window
       Function leCreateWindow:leWindow(title$z,width:Int,height:Int,style:Int)="CreateWindow"
       Function leCreateCustomWindow:leWindow(hwnd:Int)="CreateCustomWindow"
       Function leGetWindowWidth:Int(window:leWindow)="GetWindowWidth"
       Function leGetWindowHeight:Int(window:leWindow)="GetWindowHeight"
       Function leSetWindowShape(window:LEWindow,x:Int,y:Int,width:Int,height:Int)="SetWindowShape"
       Function leFreeWindow(window:leWindow)="FreeWindow"

       'Graphics driver
       Function leSetGraphicsDriver(graphicsdriver:LEGraphicsDriver)="SetGraphicsDriver"
       Function leCreateOpenGL1GraphicsDriver:LEOpenGL1GraphicsDriver()="CreateOpenGL1GraphicsDriver"
       Function leCreateOpenGL3GraphicsDriver:LEOpenGL3GraphicsDriver()="CreateOpenGL3GraphicsDriver"
       Function leGetGraphicsDriver:LEGraphicsDriver()="GetGraphicsDriver"
       Function leGetGraphicsDriverName_:Int(graphicsdriver:LEGraphicsDriver,name:Byte Ptr,length:Int)="GetGraphicsDriverName"
       Function leGetGraphicsDriverVendor:Int(graphicsdriver:LEGraphicsDriver)="GetGraphicsDriverVendor"
       Function leGraphicsDriverSupported:Int(graphicsdriver:LEGraphicsDriver)="GraphicsDriverSupported"
       Function leBuffersSupported:Int()="BuffersSupported"

       'File system
       Function leSetDir(path$z)="SetDir"

       'Context
       Function leCreateContext:LEContext(window:LEWindow,multisamplemode:Int)="CreateContext"
       Function leSwapContext(context:LEContext,sync:Int)="SwapContext"
       'Function leFreeContext(context:LEContext)="FreeContext"

       'Buffer
       Function leCreateBuffer:LEBuffer(width:Int,height:Int,colortextures:Int,depthtexture:Int,multisamplemode:Int)="CreateBuffer"    
       Function leClearBuffer(Buffer:LEBuffer,Mode:Int)="ClearBuffer"
       Function leGetBufferColorTexture:LETexture(Buffer:LEBuffer,index:Int)="GetBufferColorTexture"
       Function leGetBufferDepthTexture:LETexture(Buffer:LEBuffer)="GetBufferDepthTexture"
       Function leGetBuffer:LEBuffer()="GetBuffer"
       Function leGetBufferWidth:Int(buffer:LEBuffer)="GetBufferWidth"
       Function leGetBufferHeight:Int(buffer:LEBuffer)="GetBufferHeight"
       Function leSetBuffer(Buffer:LEBuffer)="SetBuffer"
       Function leFreeBuffer(Buffer:LEBuffer)="FreeBuffer"
       Function leGetBufferPixels(buffer:LEBuffer,buf:Byte Ptr,component:Int)="GetBufferPixels"

       'World
       Function leCreateWorld:LEWorld()="CreateWorld"
       Function leSetWorld(World:LEWorld)="SetWorld"
       Function leGetWorld:LEWorld()="GetWorld"
       Function leRenderWorld()="RenderWorld"
       Function leFreeWorld(World:LEWorld)="FreeWorld"
       Function leSetWorldAmbientLight(world:LEWorld,r:Float,g:Float,b:Float,a:Float)="SetWorldAmbientLight"

       'Entity
       Function leSetEntityPosition(entity:LEEntity,x:Float,y:Float,z:Float,glb:Int)="SetEntityPosition"
       Function leSetEntityRotation(entity:LEEntity,x:Float,y:Float,z:Float,glb:Int)="SetEntityRotation"
       Function leGetEntityPosition(entity:LEEntity,rotation:Byte Ptr,glb:Int)="GetEntityPosition"
       Function leGetEntityRotation(entity:LEEntity,rotation:Byte Ptr,glb:Int)="GetEntityRotation"
       Function leGetEntityMatrix(entity:LEEntity,matrix:Byte Ptr)="GetEntityMatrix"
       Function leMoveEntity(entity:LEEntity,x:Float,y:Float,z:Float,glb:Int)="MoveEntity"
       Function leTurnEntity(entity:LEEntity,x:Float,y:Float,z:Float,glb:Int)="TurnEntity"
       Function leAlignEntityToVector(entity:LEEntity,x:Float,y:Float,z:Float,axis:Int,rate:Float,roll:Float)="AlignEntityToVector"
       Function leSetEntityMaterial(entity:LEEntity,material:LEMaterial)="SetEntityMaterial"
       Function leFreeEntity(entity:LEEntity)="FreeEntity"
       Function leHideEntity(entity:LEEntity)="HideEntity"
       Function leShowEntity(entity:LEEntity)="ShowEntity"
       Function leGetEntityAABB(entity:LEEntity,aabb:Byte Ptr,Mode:Int)="GetEntityAABB"
       Function leCountEntityChildren(entity:LEEntity)="CountEntityChildren"
       Function leGetEntityChild(entity:LEEntity,n:Int)="GetEntityChild"
       Function leSetEntityParent(entity:LEEntity,parent:LEEntity,glb:Int)="SetEntityParent"
       Function leEntityHidden:Int(entity:LEEntity)="EntityHidden"

       'Pivot
       Function leCreatePivot:LEPivot(parent:LEEntity)="CreatePivot"

       'Camera
       Function leCreateCamera_:LECamera(parent:LEEntity)="CreateCamera"
       Function leSetCameraProjectionMode(Camera:LECamera,projectionmode:Int)="SetCameraProjectionMode"
       Function leGetCameraProjectionMode:Int(Camera:LECamera)="GetCameraProjectionMode"
       Function leSetCameraClearColor(Camera:LECamera,r:Float,g:Float,b:Float,a:Float)="SetCameraClearColor"
       Function leGetCameraClearColor(Camera:LECamera,color:TVec4)="GetCameraClearColor"
       Function leSetCameraZoom(Camera:LECamera,zoom:Float)="SetCameraZoom"
       Function leGetCameraZoom:Float(Camera:LECamera)="GetCameraZoom"
       Function leSetCameraDrawMode(Camera:LECamera,Mode:Int)="SetCameraDrawMode"
       Function leSetCameraRange(camera:LECamera,nearrange:Float,farrange:Float)="SetCameraRange"
       Function leGetCameraRange(camera:LECamera,Range:Byte Ptr)="GetCameraRange"
       Function leSetCameraFOV(camera:LECamera,fov:Float)="SetCameraFOV"
       Function leGetCameraFOV:Float(camera:LECamera)="GetCameraFOV"
       Function leSetCameraMotionBlurMode(camera:LECamera,mode:Int)="SetCameraMotionBlurMode"
       Function leSetCameraViewport(camera:LECamera,x:Float,y:Float,width:Float,height:Float)="SetCameraViewport"
       Function leGetCameraViewport(camera:LECamera,viewport:Byte Ptr)="GetCameraViewport"

       'Light
       Function leCreateDirectionalLight:LEDirectionalLight(parent:LEEntity)="CreateDirectionalLight"

       'Model
       Function leLoadModel:LEModel(path$z,flags:Int)="LoadModel"
       Function leCreateModelSphere:LEModel(sides:Int)="CreateModelSphere"
       Function leCreateCube:LEModel(parent:LEEntity)="CreateCube"
       Function leFlipModelNormals(model:LEModel)="FlipModelNormals"
       'Function leCreateModelSphere:Byte Ptr(sides:Int)="CreateModelSphere"

       'Timing
       Function leUPS:Float()="UPS"
       Function leUpdateTime()="UpdateTime"

       'Font
       Function leLoadfont:LEFont(path$z,size:Int,style:Int,family:Int)="LoadFont"
       Function leDrawFontText(font:LEFont,text$z,x:Int,y:Int,kerning:Float)="DrawFontText"
       Function leGetFontTextWidth(font:LEFont,text$z)="GetFontTextWidth"
       Function leGetFontHeight(font:LEFont)="GetFontHeight"
       Function leFreeFont(font:LEFont)="FreeFont"

       'Drawing
       Function leDrawLine(x0:Int,y0:Int,x1:Int,y1:Int)="DrawLine"
       Function leDrawRect(x:Int,y:Int,width:Int,height:Int,style:Int)="DrawRect"
       Function leDrawImage(image:LETexture,x:Int,y:Int,width:Int,height:Int)="DrawImage"
       Function leSetBlendMode(blendmode:Int)="SetBlendMode"
       Function leSetColor(r:Float,g:Float,b:Float,a:Float)="SetColor"
       Function leSetClearColor(r:Float,g:Float,b:Float,a:Float)="SetClearColor"
       Function leSetScale(x:Float,y:Float)="SetScale"
       Function leSetRotation(rotation:Float)="SetRotation"
       Function leSetTranslation(x:Float,y:Float)="SetTranslation"
       Function leTileImage(texture:LETexture)="TileImage"
       Function leSetViewport(x:Int,y:Int,width:Int,height:Int)="SetViewport"

       'Asset
       Function leGetAssetName_:Int(asset:LEAsset,name:Byte Ptr,length:Int)="GetAssetName"
       Function leGetAssetAssetReference:LEAssetReference(asset:LEAsset)="GetAssetAssetReference"
       Function leReloadAsset:Int(asset:LEAsset,flags:Int)="ReloadAsset"

       'Asset Reference
       Function leFindAssetReference:LEAssetReference(name$z)="FindAssetReference"
       Function leReloadAssetReference:Int(assetreference:LEAssetReference,flags:Int)="ReloadAssetReference"
       Function leSetAssetReferenceName(assetreference:LEAssetReference,name$z)="SetAssetReferenceName"

       'Texture
       Function leCreatetexture:LETexture(width:Int,height:Int,format:Int,flags:Int,frames:Int)="CreateTexture"
       Function leLoadTexture_:LETexture(path$z,flags:Int)="LoadTexture"
       Function leGetTextureTarget:Int(texture:LETexture)="GetTextureTarget"
       'Function leLockTexture(texture:LETexture,miplevel:Int,framenumber:Int)="LockTexture"
       'Function leUnlockTexture(texture:LETexture,miplevel:Int,framenumber:Int)="UnlockTexture"
       'Function leWriteTexturePixel(texture:LETexture,x:Int,y:Int,r:Int,g:Int,b:Int,a:Int,miplevel:Int,framenumber:Int)="WriteTexturePixel"
       'Function leReadTexturePixel:Int(texture:LETexture,x:Int,y:Int,miplevel:Int,framenumber:Int)="ReadTexturePixel"
       Function leGetTexturePixels(texture:LETexture,buf:Byte Ptr,miplevel:Int,framenumber:Int,face:Int)="GetTexturePixels"
       Function leSetTexturePixels(texture:LETexture,buf:Byte Ptr,miplevel:Int,framenumber:Int,face:Int)="SetTexturePixels"    
       Function leGetTextureWidth(texture:LETexture,miplevel:Int)="GetTextureWidth"
       Function leGetTextureHeight(texture:LETexture,miplevel:Int)="GetTextureHeight"
       Function leSetTextureFilter(texture:LETexture,texturefilter:Int)="SetTextureFilter"
       Function leFreeTexture(texture:LETexture)="FreeTexture"
       'Function leTextureLocked(texture:LETexture,miplevel:Int,framenumber:Int)="TextureLocked"
       'Function leReloadTexture:Int(texture:LETexture,flags:Int)="ReloadTexture"
       Function leBindTexture(texture:LETexture,index:Int)="BindTexture"
       Function leGetTextureData:Byte Ptr(texture:LETexture,miplevel:Int,framenumber:Int)="GetTextureData"
       Function leCountTextureMipmaps:Int(texture:LETexture)="CountTextureMipmaps"
       Function leGetTextureMipmapSize:Int(texture:LETexture)="GetTextureMipmapSize"
       Function leGetTextureFormat:Int(texture:LETexture)="GetTextureFormat"
       Function leSetTextureClampMode(texture:LETexture,x:Int,y:Int,z:Int)="SetTextureClampMode"
       Function leGetTextureClampMode:Int(texture:LETexture,axis:Int)="GetTextureClampMode"
       Function leGetTextureAnisotropy:Float(texture:LETexture)="GetTextureAnisotropy"
       Function leSetTextureAnisotropy(texture:LETexture,anisotropy:Float)="SetTextureAnisotropy"

       'Shader
       Function leLoadshader:LEShader(path$z,flags:Int)="LoadShader"
       Function leSetShader(shader:LEShader)="SetShader"
       'Function leReloadShader:Int(shader:LEShader,flags:Int)="ReloadShader"
       Function leSetShaderFloat:Int(shader:LEShader,name$z,f:Float)="SetShaderFloat"
       Function leSetShaderVec2:Int(shader:LEShader,name$z,x:Float,y:Float)="SetShaderVec2"
       Function leSetShaderVec4:Int(shader:LEShader,name$z,x:Float,y:Float,z:Float,w:Float)="SetShaderVec4"
       Function leSetShaderMat4:Int(shader:LEShader,name$z,mat:Byte Ptr)="SetShaderMat4"
       Function leFreeShader(shader:LEShader)="FreeShader"
       Function leSetShaderSource(shader:LEShader,source$z,n:Int)="SetShaderSource"
       Function leGetShaderSource_:Int(shader:LEShader,n:Int,s:Byte Ptr,l:Int)="GetShaderSource"
       Function leGetShaderError_:Int(shader:LEShader,s:Byte Ptr,l:Int)="GetShaderError"
       Function leCompileShader:Int(shader:LEShader,n:Int)="CompileShader"
       Function leLinkShader:Int(shader:LEShader)="LinkShader"
       Function leCreateShader:LEShader()="CreateShader"

       'Material
       Function leLoadmaterial:LEMaterial(path$z,flags:Int)="LoadMaterial"
       Function leChooseMaterialShader:LEShader(material:LEMaterial)="ChooseMaterialShader"
       Function leGetMaterialTexture:LETexture(material:LEMaterial,index:Int)="GetMaterialTexture"
       Function leSetMaterialShader(material:LEMaterial,shader:LEShader)="SetMaterialShader"
       Function leGetMaterialShader:LEShader(material:LEMaterial)="GetMaterialShader"
       Function leSetMaterialTexture(material:LEMaterial,texture:LETexture,index:Int)="SetMaterialTexture"
       Function leFreeMaterial(material:LEMaterial)="FreeMaterial"
       Function leSetMaterialBlendMode(material:LEMaterial,mode:Int)="SetMaterialBlendMode"
       Function leGetMaterialBlendMode:Int(material:LEMaterial)="GetMaterialBlendMode"
       Function leSetMaterialShadowMode(material:LEMaterial,mode:Int)="SetMaterialShadowMode"
       Function leGetMaterialShadowMode:Int(material:LEMaterial)="GetMaterialShadowMode"
       Function leSetMaterialBackFaceCullMode(material:LEMaterial,mode:Int)="SetMaterialBackFaceCullMode"
       Function leGetMaterialBackFaceCullMode:Int(material:LEMaterial)="GetMaterialBackFaceCullMode"
       Function leSetMaterialZSortMode(material:LEMaterial,mode:Int)="SetMaterialZSortMode"
       Function leGetMaterialZSortMode:Int(material:LEMaterial)="GetMaterialZSortMode"
       Function leSetMaterialDepthTestMode(material:LEMaterial,mode:Int)="SetMaterialDepthTestMode"
       Function leGetMaterialDepthTestMode:Int(material:LEMaterial)="GetMaterialDepthTestMode"
       Function leSetMaterialFloat(material:LEMaterial,name$z,x:Float)="SetMaterialFloat"
       Function leSetMaterialVec2(material:LEMaterial,name$z,x:Float,y:Float)="SetMaterialVec2"
       Function leSetMaterialVec3(material:LEMaterial,name$z,x:Float,y:Float,z:Float)="SetMaterialVec3"
       Function leSetMaterialVec4(material:LEMaterial,name$z,x:Float,y:Float,z:Float,w:Float)="SetMaterialVec4"
       Function leGetMaterialFloat:Float(material:LEMaterial,name$z)="GetMaterialFloat"
       Function leGetMaterialVec4(material:LEMaterial,name$z,v:Byte Ptr)="GetMaterialVec4"
       Function leMaterialContainsValue:Int(material:LEMaterial,name$z)="MaterialContainsValue"

EndExtern

Private

Global char:Byte[102400]

Public

Function leGetShaderSource:String(shader:LEShader,n:Int)
       Local char:Byte[]
       char=char[..leGetShaderSource_(shader,n,Null,0)+1]
       leGetShaderSource_(shader,n,char,char.length)
       Return String.FromCString(char)
EndFunction

Function leGetShaderError:String(shader:LEShader)
       Local char:Byte[]
       char=char[..leGetShaderError_(shader,Null,0)+1]
       leGetShaderError_(shader,char,char.length)
       Return String.FromCString(char)
EndFunction

Function leGetAssetName:String(asset:LEAsset)
       Local char:Byte[]
       char=char[..leGetAssetName_(asset,Null,0)+1]
       leGetAssetName_(asset,char,char.length)
       Return String.FromCString(char)
EndFunction

Function leGetGraphicsDriverName:String(graphicsdriver:LEGraphicsDriver)
       Local char:Byte[]
       char=char[..leGetGraphicsDriverName_(graphicsdriver,Null,0)+1]
       leGetGraphicsDriverName_(graphicsdriver,char,char.length)
       Return String.FromCString(char)
EndFunction

Function leGetLogText:String()
       Local char:Byte[]
       char=char[..leGetLogText_(Null,0)+1]
       leGetLogText_(char,char.length)
       Return String.FromCString(char)
EndFunction

Function leLoadtexture:LETexture(path:String,flags:Int=0)
       Local ext:String
       Local pixmap:TPixmap

       ext=ExtractExt(path).tolower()
       Select ext
       Case "tex","thb" Return leLoadTexture_(path,flags)
       Default
               pixmap=LoadPixmap(path)
               If pixmap
                       Return lePixmapToTexture(pixmap)
               EndIf
       EndSelect
EndFunction

Function leSaveTexture:Int(texture:LETexture,path:String)
       Local pixmap:TPixmap=leTextureToPixmap(texture)

       If pixmap
               Select ExtractExt(path).tolower()
               Case "png" Return SavePixmapPNG(pixmap,path)
               'Case "bmp" Return SavePixmapBMP(pixmap,path)
               'Case "tga" Return SavePixmapTGA(pixmap,path)
               Default Return False
               EndSelect
       EndIf
       Return False
EndFunction

Function leTextureToPixmap:TPixmap(texture:LETexture)
       Local pixmap:TPixmap=CreatePixmap(leGetTextureWidth(texture,0),leGetTextureHeight(texture,0),PF_RGBA8888)
       Local x:Int,y:Int,color:Int
       'Local lockmode:Int=leTextureLocked(texture,0,0)
       'If Not lockmode leLockTexture(texture,0,0)
       'For x=0 To pixmap.width-1
       '       For y=0 To pixmap.height-1
       '               pixmap.WritePixel(x,y,leReadTexturePixel(texture,x,y,0,0))
       '       Next
       'Next
       'If Not lockmode leUnlockTexture(texture,0,0)
       leGetTexturePixels texture,pixmap.pixels,0,0,0
       Return pixmap
EndFunction

Function leCreateCamera:LECamera(parent:LEEntity)
       'DebugStop
       Return leCreateCamera_(parent)
EndFunction

Function lePixmapToTexture:LETexture(pixmap:TPixmap)
       Local texture:LETexture
       Local x:Int,y:Int,color:Byte[4],colori:Int
       If pixmap.format<>PF_RGBA8888 pixmap=pixmap.convert(PF_RGBA8888)
       texture = leCreateTexture(pixmap.width,pixmap.height,LE_TEXTURE_RGBA,0,1)
       If texture
               'leLockTexture(texture,0,0)
               'For x=0 To pixmap.width-1
               '       For y=0 To pixmap.height-1
               '               colori = pixmap.ReadPixel(x,y)
               '               MemCopy color,Varptr colori,4
               '               leWriteTexturePixel(texture,x,y,color[2],color[1],color[0],color[3],0,0)
               '       Next
               'Next
               'leUnlockTexture(texture,0,0)
               leSetTexturePixels(texture,pixmap.pixels,0,0,0)
               'Print "BMX: "+Int(pixmap.pixels)
       EndIf
       Return texture
EndFunction

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...