Help turn off 2X multiply
Blitz3D Forums/Blitz3D Programming/Help turn off 2X multiply
| ||
OK, I'm dead tired and I can't quite see through this code atm ... I'm trying to use Halo's lib which gives the GetTextureBlend() command. This is supposed to cycle through each entitiy and figure out if it has a 2X multiply texture on it or one of it's surfaces and then deactivate the TextureBlend() of 5 so that there is no 2X multiply. Oh and by the way right now I'm checking GfxDriverCaps3D() = 110 so that I can see the 2X multiply being turned off on my machine which does support cube mapping of course. If GfxDriverCaps3D() = 110 For extModel.EXT_Entity = Each EXT_Entity If extModel\root For i = 1 To CountChildren(extModel\root) If EntityClass$(GetChild(extModel\root,i)) = "Mesh" brush = GetEntityBrush(GetChild(extModel\root,i)) If brush tex1 = GetBrushTexture(brush,0) tex2 = GetBrushTexture(brush,1) If tex1 If GetTextureBlend(tex1) = 5 TextureBlend(tex1, 0) EndIf EntityTexture(GetChild(extModel\root,i),tex1,0) FreeTexture(tex1) EndIf If tex2 If GetTextureBlend(tex2) = 5 TextureBlend(tex2, 0) EndIf EntityTexture(GetChild(extModel\root,i),tex2,1) FreeTexture(tex2) EndIf FreeBrush(brush) EndIf For j = 1 To CountSurfaces(GetChild(extModel\root,i)) surface = GetSurface(GetChild(extModel\root,i),j) If surface surfaceBrush = GetSurfaceBrush(surface) If surfaceBrush tex1 = GetBrushTexture(surfaceBrush,0) tex2 = GetBrushTexture(surfaceBrush,1) If tex1 If GetTextureBlend(tex1) = 5 TextureBlend(tex1, 0) EndIf EntityTexture(GetChild(extModel\root,i),tex1,0) FreeTexture(tex1) EndIf If tex2 If GetTextureBlend(tex2) = 5 TextureBlend(tex2, 0) EndIf EntityTexture(GetChild(extModel\root,i),tex2,1) FreeTexture(tex2) EndIf FreeBrush(surfaceBrush) EndIf EndIf Next EndIf Next EndIf Next EndIf |
| ||
Nifty. |
| ||
Doesn't work yet though! |
| ||
I see a few problems with that code.. it'll only check one layer of children which you can easily get around by using a couple of functions (See Code Below). Also, when you're checking the surfaces you're texturing the whole entity instead of just the surface you checked. You need to use BrushTexture( ) and PaintSurface( ).If GfxDriverCaps3D() = 110 For extModel.EXT_Entity = Each EXT_Entity If extModel\root Remove2xBlend extModel\root EndIf Next EndIf Function Remove2xBlend( iEntity ) If EntityClass( iEntity ) = "Mesh" brush = GetEntityBrush(iEntity) If brush For k = 0 To 7 iTex = GetBrushTexture( brush, k ) If iTex If GetTextureBlend( iTex ) = 5 TextureBlend( iTex, 0 ) EndIf BrushTexture brush, iTex, 0, k PaintEntity iEntity, brush FreeTexture iTex EndIf Next FreeBrush brush EndIf For j = 1 To CountSurfaces(iEntity) surface = GetSurface(iEntity,j) If surface surfaceBrush = GetSurfaceBrush(surface) If surfaceBrush For k = 0 To 7 iTex = GetBrushTexture( surfaceBrush, k ) If iTex If GetTextureBlend( iTex ) = 5 TextureBlend( iTex, 0 ) EndIf BrushTexture surfaceBrush, iTex, 0, k PaintSurface surface, surfaceBrush FreeTexture iTex EndIf Next FreeBrush surfaceBrush EndIf EndIf Next EndIf ;Parse Children Remove2xBlendFromChildren iEntity End Function Function Remove2xBlendFromChildren( iEntity ) For i = 1 To CountChildren( iEntity ) iChild = GetChild( iEntity, i ) Remove2xBlend iChild Next End Function Oh, and I added a loop to check every texture layer. |
| ||
Thanks for the effort Falcon! Definitely some good spots there. Unfortunately, it still doesn't work :( |
| ||
The Blitz texture structure could have changed. The current working command is like this: ProcedureDLL GetTextureBlend(texture) texture=PeekL(texture) ProcedureReturn PeekL(texture+24) EndProcedure |
| ||
Is that the PureBASIC code? Or is that what I should be calling in Blitz? Also, I'm assuming you've used it in Blitz 1.87? |
| ||
Just did a test and it seems that I'm either missing another lib ... or GetTextureBlend() always returns 0 because it's just not working right. What else do I need beside the b3dlib? |
| ||
Well, I have an algorithm to turn off blend modes at least by itentifying the texture name ... but I can't really tell if it's turning off 2X or what! |
| ||
Ok, well problem is now that it can't identify the texture I want to turn off... These forums are just great for venting! |
| ||
Well, I've got it but not by sorting through textures, instead I'm just turning all texture blend modes to the default. Works decent enough and should run on those cards that didn't like 2X multiply before. Of course now we'll have to test it. |