Texture flags from a b3d model

Blitz3D Forums/Blitz3D Programming/Texture flags from a b3d model

FlagDKT(Posted 2006) [#1]
Since I need to scale my b3d model textures according to detail level I choose when starting the game, I use a simple scaletexture function. I create then a brush with that scaled texture and paint my model.

This function needs to know the textureflag to apply to the new scaled texture.
How could I get texture flags from my b3d model or from a brush?
I could use texturefilename strings, like "_alpha" , "_mip" etc..but it's a bit unhandy.
Do you think there's a better way to scale the textures of b3d models?
thanx

Function Scltexture(texhandle,xys#,tflags)
	txwidth=TextureWidth(texhandle)
	txheight=TextureHeight(texhandle)
	id=CreateTexture(txwidth/xys,txheight/xys,tflags)	
    LockBuffer(TextureBuffer(texhandle))
    LockBuffer(TextureBuffer(id))
    While j<= TextureHeight(id)-1
		i=0
		While i<= TextureWidth(id)-1
			argb=ReadPixelFast(i*xys,j*xys,TextureBuffer(texhandle))
			WritePixelFast (i,j,argb,TextureBuffer(id))
		i=i+1
		Wend
	j=j+1
    Wend
    UnlockBuffer(TextureBuffer(texhandle))
    UnlockBuffer(TextureBuffer(id))
	FreeTexture texhandle
	Return id
End Function



kevin8084(Posted 2006) [#2]
did you try GetEntityBrush or GetSurfaceBrush?


FlagDKT(Posted 2006) [#3]
those commands return only the brush...I need to know the textureFlag that is:

1: Color (default)
2: Alpha
4: Masked
8: Mipmapped
16: Clamp U
32: Clamp V
64: Spherical environment map
128: Cubic environment map
256: Store texture in vram
512: Force the use of high color textures

how could I retrieve these from a brush or a b3d model?


kevin8084(Posted 2006) [#4]
by writing a program to retrieve them using the info from here: http://blitzbasic.com/sdkspecs/sdkspecs/b3dfile_specs.txt
Specifically, the TEXS chunk:
TEXS
  {
	char file[]                 ;texture file name
  int flags,blend             ;blitz3D TextureFLags and TextureBlend: default=1,2
	float x_pos,y_pos           ;x and y position of texture: default=0,0
	float x_scale,y_scale       ;x and y scale of texture: default=1,1
	float rotation              ;rotation of texture (in radians): default=0
  } 



FlagDKT(Posted 2006) [#5]
thx...It's the only solution


kevin8084(Posted 2006) [#6]
not a problem...


Tom(Posted 2006) [#7]
Hi, I have some functions in one of my DLLs to get such info about textures & brushes, check it out here.

www.tomspeed.com/memorylib/

Use with version Blitz3D 1.98 only!

Place .DLL and .Decls into your Userlibs folder. Grab the samples to see functions working.

Before trying, always BACKUP IMPORTANT WORK!!! :)

Let me know how you get on with it.

Tom