Sprite3D Luminosity

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 345
Joined: Sat Dec 25, 2004 2:37 pm

Sprite3D Luminosity

Post by thyphoon »

Hello
Why don't Add A function to change sprite3D Luminosity ?

under the Cpl.Bator's code to change sprite 3D luminosity on Windows...

regards

Thy

Code: Select all

    ;Thanks Cpl.Bator
    Structure vertex
          sx.f
          sy.f
          sz.f
          rhw.f
          Color.l
          specular.l
          tu.f
          tv.f
    EndStructure

    Structure PB_Sprite3D
             Texture.l         
             Vertice.vertex[4]
             Width.w
             Height.w
    EndStructure 

    Macro RGBA(r,g,b,a)
    a << 24 + b << 16 +g << 8 + r 
    EndMacro

    Procedure SetSprite3DLuminosity(spriteid.l,lum.c)
      Protected RGB_LUM.l,*S.PB_Sprite3D
      ;This function must between  Start3D end Stop3D
      ; 255 = Full luminosity 0 = Black
      LUM=0
      RGB_LUM = RGBA(Lum,Lum,Lum,255)
      *S=IsSprite3D(spriteid)
      *S\Vertice[0]\Color = RGB_LUM
      *S\Vertice[1]\Color = RGB_LUM
      *S\Vertice[3]\Color = RGB_LUM
      *S\Vertice[2]\Color = RGB_LUM
    EndProcedure
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 345
Joined: Sat Dec 25, 2004 2:37 pm

Post by thyphoon »

A code who works with DirectX7 and Directx9

Code: Select all

CompilerIf Subsystem("Directx9")
    ;Thanks to Fluid Byte and other english forum people
    ;I found this structure on clipsprite3D function on the forum
    Structure D3DTLVERTEX
     x.f
     y.f
     z.f
     rhw.f
     Color.l
     tu.f
     tv.f
   EndStructure

   Structure PB_Sprite3D
     TexRes.l                    ; TexRes
     Vertice.D3DTLVERTEX[4]       ; The 4 vertices for the rectangle sprite
     TmpVertice.D3DTLVERTEX[4]   ; The 4 vertices for the rectangle sprite
     Width.l                     ; width set with ZoomSprite3D()
     Height.l                     ; height set with ZoomSprite3D()
     RealWidth.l
     RealHeight.l
     Angle.f
     Transformed.l
   EndStructure
   
   
     CompilerElse ;Directx7
     
    ;Thanks Cpl.Bator !!!
    Structure vertex
          sx.f
          sy.f
          sz.f
          rhw.f
          Color.l
          specular.l
          tu.f
          tv.f
    EndStructure

    Structure PB_Sprite3D
             Texture.l         
             Vertice.vertex[4]
             Width.w
             Height.w
    EndStructure
    CompilerEndIf
   
    Macro RGBA(r,g,b,a)
    a << 24 + b << 16 +g << 8 + r
    EndMacro

    Procedure SetSpriteLuminosityEx(spriteid.l,lum.c)
      Protected RGB_LUM.l,*S.PB_Sprite3D
      ;Must be between  Start3D and stop3D
       ; 255 = full Luminosity 0 = Black
     
      RGB_LUM = RGBA(Lum,Lum,Lum,255)
      *S=IsSprite3D(spriteid)
      *S\Vertice[0]\Color = RGB_LUM
      *S\Vertice[1]\Color = RGB_LUM
      *S\Vertice[3]\Color = RGB_LUM
      *S\Vertice[2]\Color = RGB_LUM
    EndProcedure
Post Reply