SpriteImageRGB
SpriteImageRGB SpriteIndex, VertexIndex, VertexColour
 
Parameters:

    SpriteIndex = The Sprite you wish to set
    VertexIndex = The Vertex your wish to alter
    VertexColour = The RGB colour value of this vertex
Returns: NONE
 

      SpriteImageRGB allows you to set the RGB colour value level at any of the sprites corners. The RGB colours values only take effect when sprite is set to "Gouraud RGB" drawmode.



FACTS:


      * 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 have random RGB values applied, so the sprites will shown the various stages of texel zooming with a gouraud RGB applied to them also.


  
  
  
; 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+256
     
     clip=lp*10
     
   ; set the 4 UV corners of this sprite
     SpriteImageUV Spr,0,Clip,Clip
     SpriteImageRGB Spr,0,RndRGB()
     
     SpriteImageUV Spr,1,ImgWidth-Clip,Clip
     SpriteImageRGB Spr,1,RndRGB()
     
     SpriteImageUV Spr,2,ImgWidth-Clip,ImgHeight-Clip
     SpriteImageRGB Spr,2,RndRGB()
     
     SpriteImageUV Spr,3,clip,ImgHeight-Clip
     SpriteImageRGB Spr,3,RndRGB()
     
     DrawSprite Spr
     
   ; Read the Sprites Vertex positions
     For Vertex=0 To 3
        Vx#=GetSpriteVertexX(Spr,Vertex)
        Vy#=GetSpriteVertexY(Spr,Vertex)
        Col=GetSpriteImageRGB(Spr,Vertex)
        r=RgbR(col)
        g=RgbG(col)
        b=RgbB(col)
        
        s$=Digits$(r,3)+","+Digits$(g,3)+","+Digits$(b,3)+""
        CenterText vx#,vy#,s$
     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: GetSpriteImageU | GetSpriteImageV | SpriteDrawMode | SpriteImageIntensity | SpriteImageUV :
 


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