SpriteImageIntensity
SpriteImageIntensity SpriteIndex, VertexIndex, IntensityLevel
 
Parameters:

    SpriteIndex = The Sprite you wish to set
    VertexIndex = The Vertex your wish to alter
    IntensityLevel = The intensity level ranges betwen 0 and 255)
Returns: NONE
 

      SpriteImageIntensity allows you to change the Intensity level at any of the sprites corners. The intensity values only take effect when sprite is set to "Gouaud Fade" drawmode.



FACTS:


      * Intensity values range from 0 to 255. (255=No Fade, 0 Totally faded out)

      * Sprites vertex range from vertex 0 to 3. They are ordered 0= top left, 1 top right, 2 bottom right, 3 bottom left.

      * Note: Sprites are drawn using a convex polygons, changing the intensity values can cause some render errors. So some care is needed.




Mini Tutorial:


      This example creates an random image then applies this image to the screen full of sprites. Each sprites has it's UV coords stepped in and faded intensity values, so the sprites will show the various stages of texel zooming with a gouraud fade applied.


  
; set variable to hold the image width and height
  ImgWidth=150
  ImgHeight=150
  
; First we'll create FX image 1
  CreateFXImage 1,ImgWidth,Imgheight
  
  
; tell pb to redirect all drawing operations
; to this image
  RenderToImage 1
  
; Fill it with boxes
  For lp=0 To ImgWidth/2
     BoxC lp,lp,ImgWidth-lp,ImgHeight-lp,true,RndRGB()
  Next lp
  
  
  
; Tell PB to re-direc all drawing back to the screen
  RenderToScreen
  
  
  MaxSprites=10
  
  pad=80
  y=pad
  x=(pad*2)
  
; Start a For next loop to create a collection of sprites
  For lp=0 To MaxSprites
   ; create a sprite and assign it image #1
     Spr=NewSprite(X,y,1)
     CenterSpriteHandle spr
     
   ; Set this sprite to Draw Mode #2 (rotated) + Shaded
     SpriteDrawMode spr,2+128
     
     clip=lp*10
     
   ; set the Intensity at 4 corners of this sprite
     SpriteImageIntensity Spr,0,255-Clip
     SpriteImageIntensity Spr,1,200-Clip
     SpriteImageIntensity Spr,2,100-Clip
     SpriteImageIntensity Spr,3,200-Clip
     
     DrawSprite Spr
     
     
   ; Read the Sprites Vertex positions
     For Vertex=0 To 3
        Vx#=GetSpriteVertexX(Spr,Vertex)
        Vy#=GetSpriteVertexY(Spr,Vertex)
        I=GetSpriteIMageIntensity(Spr,Vertex)
        
        CenterText vx#,vy#,Str$(i)
     Next vertex
     
     x=x+250
     If x=>(GetScreenWidth()-pad)
        X=(Pad*2)
        Y=y+200
     EndIf
  Next
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  


 
Related Info: SpriteDrawMode | SpriteImageRGB | SpriteImageUV :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com