Using the Load_Pixie function as a basis to load pixel-perfect sprites, I can't keep my alpha transparency when I use a rectangle .3ds mesh. How can I set the mask colour for a brush, or pass the alpha channel of the source .png froma texture? The code is this.
Function TG_Load_Pixie(file$,width=0,height=0)
; load squared texture
texture=LoadTexture(file,4)
If Not width
width=TextureWidth(texture)
EndIf
If Not height
height=TextureHeight(texture)
EndIf
; change these for viewports
viewwidth=GraphicsWidth()
viewheight=GraphicsHeight()
; find existing pixiespace parented to camera
magic=0
n=CountChildren(TG_camera\camera)
For i=1 To n
If EntityName(GetChild(TG_camera\camera,i))="pixiespace"
magic=GetChild(GetChild(TG_camera\camera,i),1)
EndIf
Next
If magic=0
magic=CreatePivot(TG_camera\camera)
NameEntity(magic,"pixiespace")
aspect#=Float(viewheight)/viewwidth
PositionEntity magic,-1,aspect,1
scale#=2.0/viewwidth
ScaleEntity magic,scale,-scale,-scale
magic=CreatePivot(magic)
PositionEntity magic,-.5,-.5,0
EndIf
; create sprite from texture as child of magic overlay
sprite=CopyMesh(TG_sprite)
EntityParent sprite,magic ;cludge for blitz bug in createsprite(parent)
brush=CreateBrush()
BrushFX brush,1
BrushTexture brush,texture
PaintEntity sprite,brush
FreeBrush brush
scale#=0.2/viewwidth
ScaleMesh sprite,width*scale,height*scale,1
Return sprite
End Function
|