Request: Get Brush Properties
Archives Forums/Blitz3D Bug Reports/Request: Get Brush Properties
| ||
This isn't a bug report by definition, but I currently can't find a work around for this IMHO important functionality. While there is GetSurfaceBrush, GetBrushTexture and TextureName$, I urgently need to determine the flags and all other properties, of brushes as well as of textures. As Long as I canot determine them, I simply cannot save these meshes correctly. Ok, I can write a loader that will determine these properties, but a Brush that is created at runtime, eg. by GetSurfaceBrush, won't allow this, while GetSurfaceBrush is actually required to save the mesh after using AddMesh. I already tried to use hacking solutions, peeking on offsets of handles etc. While some things still work (blendmode, fx etc.) Texture flags unfort. don't work anymore with the latest Blitz update. So, if threre will ever be a further Blitz3D version after V1.98, then please (on knees) please add these functions, Get Property for all properties that may be stored in a B3D file, in the BRUSH and TEXS chunks (and cannot already determined somehow), thank you! If there's an other solution, then please let me know. |
| ||
*gets down on knees* oh wait, what exactly are we begging for again? new functions? |
| ||
GetBrushNumberOfTextures(brush) GetBrushName$(brush) GetBrushRed(brush) GetBrushGreen(brush) GetBrushBlue(brush) GetBrushAlpha(brush) GetBrushShininess(brush) GetBrushBlendmode(brush) GetBrushFX(brush) (GetBrushTexture and GetTextureName$ already exists.) GetTextureFlags(tex) GetTextureBlendmode(tex) GetTextureX(tex) GetTextureY(tex) GetTextureScaleX(tex) GetTextureScaleY(tex) GetTextureRotation(tex) GetTextureCoordset(tex) EDIT BTW I wouldn't mind if it wasn't organized in seperate functions, to keep the number of new functions low. I think something like EG: GetProp$(TextureScaleX%,handle%) would work well too. handle could be a brush or texture handle. TextureScaleX% is a individual integer ID for this property. Return value may be string. I know, not that elegant, but it doesn't matter that much cause in most cases this has not to be fast. |
| ||
Ok right now I'm using Tomspeeds MemoryLib.dll: http://tomspeed.com/memorylib/. It works, as long as the texture is not DDS, unfortunately. EDIT to obtain texture scale U/V and TexCoordsSet you need to use further work-arounds, as described here: http://www.blitzbasic.com/Community/posts.php?topic=66551 (scroll down to my conclusion) |
| ||
@jfk It comes a little bit late, but try this: Global hackbank1,hackbank2 hackbank1=createbank(4) hackbank2=createbank(4) Dim scan(16,4) Function GetBrushAlpha#(brush) Local adr RtlMoveMemory1(hackbank1,brush,4) adr=PeekInt(hackbank1,0)+32 RtlMoveMemory1(hackbank2,adr,4) return PeekFloat(hackbank2,0) End Function Function GetBrushShininess#(brush) Local adr RtlMoveMemory1(hackbank1,brush,4) adr=PeekInt(hackbank1,0)+28 RtlMoveMemory1(hackbank2,adr,4) return PeekFloat(hackbank2,0) End Function Function GetBrushRED(brush) local adr RtlMoveMemory1(hackbank1,brush,4) adr=PeekInt(hackbank1,0)+16 RtlMoveMemory1(hackbank2,adr,4) Return PeekFloat(hackbank2,0)*255 End Function Function GetBrushGREEN(brush) Local adr RtlMoveMemory1(hackbank1,brush,4) adr=PeekInt(hackbank1,0)+20 RtlMoveMemory1(hackbank2,adr,4) Return PeekFloat(hackbank2,0)*255 End Function Function GetBrushBLUE(brush) local adr RtlMoveMemory1(hackbank1,brush,4) adr=PeekInt(hackbank1,0)+24 RtlMoveMemory1(hackbank2,adr,4) Return PeekFloat(hackbank2,0)*255 End Function Function GetBrushBLEND(brush) local adr RtlMoveMemory1(hackbank1,brush,4) adr=PeekInt(hackbank1,0)+4 RtlMoveMemory1(hackbank2,adr,4) Return Peekbyte(hackbank2,0) End Function Function GetBrushFX(brush) local adr RtlMoveMemory1(hackbank1,brush,4) adr=PeekInt(hackbank1,0)+40 RtlMoveMemory1(hackbank2,adr,4) Return Peekbyte(hackbank2,0) End Function Function GetTextureBlend(tex) local adr RtlMoveMemory1(hackbank1,tex,4) adr=PeekInt(hackbank1,0)+24 RtlMoveMemory1(hackbank2,adr,4) Return Peekbyte(hackbank2,0) End Function Function GetTextureScaleX#(tex) local adr RtlMoveMemory1(hackbank1,tex,4) adr=PeekInt(hackbank1,0)+36 RtlMoveMemory1(hackbank2,adr,4) Return (1.0/Peekfloat(hackbank2,0)) End Function Function GetTextureScaleY#(tex) local adr RtlMoveMemory1(hackbank1,tex,4) adr=PeekInt(hackbank1,0)+40 RtlMoveMemory1(hackbank2,adr,4) Return (1.0/Peekfloat(hackbank2,0)) End Function Function GetTexturePosX#(tex) local adr RtlMoveMemory1(hackbank1,tex,4) adr=PeekInt(hackbank1,0)+44 RtlMoveMemory1(hackbank2,adr,4) Return ((-1.0)*Peekfloat(hackbank2,0)) End Function Function GetTexturePosY#(tex) local adr RtlMoveMemory1(hackbank1,tex,4) adr=PeekInt(hackbank1,0)+48 RtlMoveMemory1(hackbank2,adr,4) Return ((-1.0)*Peekfloat(hackbank2,0)) End Function Function GetTextureFlags(tex,mode=2) ; Mode=0 for Createtexture() ; Mode=1 for Loadtexture() ; Mode=2 for GetBrushTexture() does not work proper! local adr RtlMoveMemory1(hackbank1,tex,4) Select mode Case 0 offset=140 Case 1 offset=228 Case 2 offset=196 Default offset=196 End select adr=PeekInt(hackbank1,0)+offset RtlMoveMemory1(hackbank2,adr,4) Return Peekshort(hackbank2,0) End Function Function GetTextureRotation#(tex) local adr RtlMoveMemory1(hackbank1,tex,4) adr=PeekInt(hackbank1,0)+52 RtlMoveMemory1(hackbank2,adr,4) Return (360.0/(pi*2))*(Peekfloat(hackbank2,0))*(-1.0) End Function You need the following .decls .lib "kernel32.dll" RtlMoveMemory1%(Destination*,Source,Length) : "RtlMoveMemory" Iīm sorry, that GetTextureFlags() does not work properly. I canīt find flags proper position inside the memory, when texture-handle was received with GetBrushTexture(). Any Ideas? Please can you mail me tomspeeds memorylib.dll. Canīt find a valid Link to download. thanks Shodan mail: heinz-helge@... |
| ||
See the other thread, it's inside the saveB3D_2007a (or similar).zip |
| ||
thanks jfk EO-11110 I will test it. Seems to be very helpful. |