Working on new dll to extend Blitz3d
Blitz3D Forums/Blitz3D Userlibs/Working on new dll to extend Blitz3d
| ||
Now that blitz3d is "finalized", I am writing a dll to extend blitz3d and have added the following commands ;Distance BP_Distance2d#(x1#,y1#,x2#,y2#) : "Distance2D@16" BP_Distance3d#(x1#,y1#,z1#,x2#,y2#,z2#) : "Distance3D@24" BP_PointInRect#(x1#,y1#,rx#,ry#,rw#,rh#) : "PointInRect@24" ;Camera BP_GetCamClsMode%(camera,index$) : "GetCamClsMode@8" ; index$ = "Color" Or "Zbuffer" BP_GetCamClsColorR%(camera) : "GetCamClsColorR@4" BP_GetCamClsColorG%(camera) : "GetCamClsColorG@4" BP_GetCamClsColorB%(camera) : "GetCamClsColorB@4" BP_GetCamProjMode%(camera) : "GetCamProjMode@4" BP_GetCamRangeNear#(camera) : "GetCamRangeNear@4" BP_GetCamRangeFar#(camera) : "GetCamRangeFar@4" BP_GetCamZoom#(camera) : "GetCamZoom@4" BP_GetCamViewPortX%(camera) : "GetCamViewPortX@4" BP_GetCamViewPortY%(camera) : "GetCamViewPortY@4" BP_GetCamViewPortW%(camera) : "GetCamViewPortW@4" BP_GetCamViewPortH%(camera) : "GetCamViewPortH@4" BP_GetCamFogMode%(camera) : "GetCamFogMode@4" BP_GetCamFogNear#(camera) : "GetCamFogNear@4" BP_GetCamFogFar#(camera) : "GetCamFogFar@4" BP_GetCamFogColorR%(camera) : "GetCamFogColorR@4" BP_GetCamFogColorG%(camera) : "GetCamFogColorG@4" BP_GetCamFogColorB%(camera) : "GetCamFogColorB@4" ;Light BP_SetLightType%(light,style) : "SetLightType@8" BP_SetLightDiffuse%(light,red,green,blue,alpha#) : "SetLightDiffuse@20" BP_SetLightSpecular%(light,red,green,blue,alpha#) : "SetLightSpecular@20" BP_SetLightAmbient%(light,red,green,blue,alpha#) : "SetLightAmbient@20" BP_SetLightMaxRange%(light,range#) : "SetLightMaxRange@8" BP_GetLightType%(light) : "GetLightType@4" BP_GetLightMaxRange#(light) : "GetLightMaxRange@4" BP_GetLightRange#(light) : "GetLightRange@4" BP_GetLightInner#(light) : "GetLightInner@4" BP_GetLightOuter#(light) : "GetLightOuter@4" BP_GetLightDiffuseR%(light) : "GetLightDiffuseR@4" BP_GetLightDiffuseG%(light) : "GetLightDiffuseG@4" BP_GetLightDiffuseB%(light) : "GetLightDiffuseB@4" BP_GetLightDiffuseA#(light) : "GetLightDiffuseA@4" BP_GetLightSpecularR%(light) : "GetLightSpecularR@4" BP_GetLightSpecularG%(light) : "GetLightSpecularG@4" BP_GetLightSpecularB%(light) : "GetLightSpecularB@4" BP_GetLightSpecularA#(light) : "GetLightSpecularA@4" BP_GetLightAmbientR%(light) : "GetLightAmbientR@4" BP_GetLightAmbientG%(light) : "GetLightAmbientG@4" BP_GetLightAmbientB%(light) : "GetLightAmbientB@4" BP_GetLightAmbientA#(light) : "GetLightAmbientA@4" ;Entity BP_GetEntityAlpha#(entity) : "GetEntityAlpha@4" BP_GetEntityScaleX#(entity) : "GetEntityScaleX@4" BP_GetEntityScaleY#(entity) : "GetEntityScaleY@4" BP_GetEntityScaleZ#(entity) : "GetEntityScaleZ@4" BP_GetEntityAutoNear#(entity) : "GetEntityAutoNear@4" BP_GetEntityAutoFar#(entity) : "GetEntityAutoFar@4" BP_GetEntityOrder%(entity) : "GetEntityOrder@4" BP_GetNextEntity%(entity) : "GetNextEntity@4" BP_GetLastEntity%(entity) : "GetLastEntity@4" BP_GetEntityHidden%(entity) : "GetEntityHidden@4" BP_GetEntityRadiusX#(entity) : "GetEntityRadiusX@4" BP_GetEntityRadiusY#(entity) : "GetEntityRadiusY@4" BP_GetEntityBoxX#(entity) : "GetEntityBoxX@4" BP_GetEntityBoxY#(entity) : "GetEntityBoxY@4" BP_GetEntityBoxZ#(entity) : "GetEntityBoxZ@4" BP_GetEntityBoxW#(entity) : "GetEntityBoxW@4" BP_GetEntityBoxH#(entity) : "GetEntityBoxH@4" BP_GetEntityBoxD#(entity) : "GetEntityBoxD@4" BP_GetEntityPickmode%(entity) : "GetEntityPickmode@4" BP_GetEntityObscurer%(entity) : "GetEntityObscurer@4" BP_GetEntityColorR%(entity) : "GetEntityColorR@4" BP_GetEntityColorG%(entity) : "GetEntityColorG@4" BP_GetEntityColorB%(entity) : "GetEntityColorB@4" BP_GetEntityShine#(entity) : "GetEntityShine@4" BP_GetEntityBlend%(entity) : "GetEntityBlend@4" BP_GetEntityFX%(entity) : "GetEntityFX@4" ;Texture BP_GetTextureBlend%(texture) : "GetTextureBlend@4" BP_GetTextureCoords%(texture) : "GetTextureCoords@4" BP_GetTextureScaleU#(texture) : "GetTextureScaleU@4" BP_GetTextureScaleV#(texture) : "GetTextureScaleV@4" BP_GetTexturePositionU#(texture) : "GetTexturePositionU@4" BP_GetTexturePositionV#(texture) : "GetTexturePositionV@4" BP_GetTextureRotation#(texture) : "GetTextureRotation@4" BP_GetTextureFlags%(texbuffer) : "GetTextureFlags@4" BP_GetBufferDepth%(texbuffer) : "GetBufferDepth@4" ;Brush BP_GetBrushBlend%(brush) : "GetBrushBlend@4" BP_GetBrushColorRGB%(brush) : "GetBrushColorRGB@4" BP_GetBrushColorR%(brush) : "GetBrushColorR@4" BP_GetBrushColorG%(brush) : "GetBrushColorG@4" BP_GetBrushColorB%(brush) : "GetBrushColorB@4" BP_GetBrushFX%(brush) : "GetBrushFX@4" BP_GetBrushShininess#(brush) : "GetBrushShininess@4" BP_GetBrushAlpha#(brush) : "GetBrushAlpha@4" ;Color Conversion BP_GetIntRed%(IntColor) : "GetIntRed@4" BP_GetIntGreen%(IntColor) : "GetIntGreen@4" BP_GetIntBlue%(IntColor) : "GetIntBlue@4" BP_GetIntAlpha%(IntColor) : "GetIntAlpha@4" BP_GetRGBInt%(r,g,b) : "GetRGBInt@12" BP_GetRGBAInt%(r,g,b,a) : "GetRGBAInt@16" ;Math BP_CurveValue#(newvalue#,oldvalue#,increments#) : "CurveValue@12" BP_WrapValue#(value#,lo#,hi#) : "WrapValue@12" BP_ClampValue#(value#,lo#,hi#) : "ClampValue@12" BP_Min#(value1#,value2#) : "Min@8" BP_Max#(value1#,value2#) : "Max@8" ;Memory BP_PeekByte%(adress) : "PeekByte@4" BP_PeekShort%(adress) : "PeekShort@4" BP_PeekInt%(adress) : "PeekInt@4" BP_PeekFloat#(address) : "PeekFloat@4" BP_PokeByte(adress,value%) : "PokeByte@8" BP_PokeShort(address,value%) : "PokeShort@8" BP_PokeInt(adress,value%) : "PokeInt@8" BP_PokeFloat(address,value#) : "PokeFloat@8" many of these were available with previous dll's created by other members of the community but have broken with subsequent updates etc. I would like to add a few functions to manipulate images/textures and specifically am trying to determine the offset to the actual pixel data (imagebuffer + 72 no longer is correct) and would appreciate any info I can get on this or any other internals. I will make this dll available to the community at large upon completion. thanks, Bill |
| ||
Nice. Always welcome. |
| ||
Nice looking lib. |
| ||
Should be useful. Much appreciated. |
| ||
Any time scale on this? |
| ||
What you see listed here is already complete, have contacted a few members who have done similiar work in the past re:offsets I am having trouble resolving and am awaiting their replies, next coupla days. |
| ||
Hi Bill, will you be adding the source??? |
| ||
If not the source itself, I will include a list of all viable offesets I have been able to find so others can build upon them |
| ||
specifically am trying to determine the offset to the actual pixel data (imagebuffer + 72 no longer is correct) I don't understand. I have b3d 1.99 and the pixel data offset is still imagebuffer+72. This code works. Edit: you need to include MemoryAccess.bb ;Image pixel data offset Include "MemoryAccess.bb" Graphics 640,480,0,2 SetBuffer BackBuffer() image=LoadImage("test.bmp") ;8x8 bufferimage=ImageBuffer(image) WritePixel 0,0,33,bufferimage WritePixel 1,0,44,bufferimage WritePixel 2,0,55,bufferimage width=PeekI(bufferimage+92) ;bufferimage+28 for Blitz+ not tested !! height=PeekI(bufferimage+96) ;bufferimage+32 videoaddress=PeekI(bufferimage+72) ;bufferimage+76 Dim pixel(8,8) pixel(0,0)=PeekB(videoaddress) pixel(1,0)=PeekB(videoaddress+4) pixel(2,0)=PeekB(videoaddress+8) Print "bufferimage="+bufferimage Print "width="+width Print "height="+height Print "videoaddress="+videoaddress Print "pixel(0,0)="+pixel(0,0) Print "pixel(1,0)="+pixel(1,0) Print "pixel(2,0)="+pixel(2,0) Print "" For offset=0 To 12-1 byte=PeekB(videoaddress+offset) Print "address="+(videoaddress+offset)+" byte="+byte Next Print "" For offset=0 To 12-1 Step 4 rgba=PeekI(videoaddress+offset) PokeI(videoaddress+offset,$FF0000) ;Red Print "address="+(videoaddress+offset)+" rgba="+rgba Next Print "" Print "Let's see what we poked in" For offset=0 To 12-1 Step 4 rgba=PeekI(videoaddress+offset) Print "address="+(videoaddress+offset)+" rgba="+Hex(rgba) Next DrawImage image,256,16 WaitKey() End |
| ||
I was working with a loaded texture ( not an image ) at the time and +72 is 0 until the buffer has been locked/unlocked (possibly updated with other actions, I don't know) |