
04-16-2004, 04:49 PM
|
|
Freshman
|
|
Join Date: Aug 2002
Posts: 28
|
|
|
I have used this for spellcasting effects. It is easy to implement and draws really fast. Try something like this in your RenderScene function.
vObjD3DDevNC.SetRenderState D3DRS_ALPHABLENDENABLE, 1
for i = 1 to SpriteCount
If SpriteArray(i).Transparent = 0 Then
vObjD3DDevNC.SetRenderState D3DRS_SRCBLEND, 5
vObjD3DDevNC.SetRenderState D3DRS_DESTBLEND, 6
ElseIf SpriteArray(i).Transparent = 1 Then
vObjD3DDevNC.SetRenderState D3DRS_SRCBLEND, 5
vObjD3DDevNC.SetRenderState D3DRS_DESTBLEND, 7
End If
vObjD3DDevNC.SetTexture 0, TextureArray.fGetTextureArray(x).Texture
next i
vObjD3DDevNC.SetRenderState D3DRS_ALPHABLENDENABLE, 0
vObjD3DDevNC.EndScene
vObjD3DDevNC.Present ByVal 0, ByVal 0, 0, ByVal 0
As I go through my sprite array I read if I want the sprite tobe rendered solid or transparent and change the renderstate back and forth within he Renderscene function. You will need to order the solid, ground level sprites first. Then the transparent fog sprites should be at the end of the array. This just sort of blends the two colors.
|
|