Grass demo

Blitz3D Forums/Blitz3D Programming/Grass demo

Moraldi(Posted 2006) [#1]
Looking the AGore's GrassDemo.bb located in the samples directory of Blitz3D I didn't understand anything about the following piece of code:

CameraProject(camera,EntityX(flare,1),EntityY(flare,1),EntityZ(flare,1))
	
vx# = ProjectedX() - (gwidth/2)
vy# = ProjectedY() - (gheight/2)
sx = vx + (gwidth/2) : sy = vy + (gheight/2)
PositionEntity s1,SpriteX(sx,sy,128),SpriteY(sx,sy,128),SpriteZ(sx,sy,128)
	sx = -vx/2 + (gwidth/2) : sy = -vy/2 + (gheight/2)
	PositionEntity s2,SpriteX(sx,sy,128),SpriteY(sx,sy,128),SpriteZ(sx,sy,128)
	sx = -vx/5 + (gwidth/2) : sy = -vy/5 + (gheight/2)
	PositionEntity s3,SpriteX(sx,sy,128),SpriteY(sx,sy,128),SpriteZ(sx,sy,128)
	sx = -vx/1.2 + (gwidth/2) : sy = -vy/1.2 + (gheight/2)
	PositionEntity s4,SpriteX(sx,sy,128),SpriteY(sx,sy,128),SpriteZ(sx,sy,128)
	
	RotateSprite s1,-EntityYaw(camera)
EntityAlpha s1,ProjectedZ()
EntityAlpha s2,1-(Abs(vx)/(gwidth/2))
EntityAlpha s3,1-(Abs(vx)/(gwidth/2))
EntityAlpha s4,1-(Abs(vx)/(gwidth/2))



I removed the lines above but I didn't notice a difference.
Does anyone knows what they do?

Thanks


Filax(Posted 2006) [#2]
This piece of code is used to display the lens flare
sprite position and alpha.


Moraldi(Posted 2006) [#3]
But there is no difference in the output if you remove these lines...


Damien Sturdy(Posted 2006) [#4]
There is if you look at the sun.


Moraldi(Posted 2006) [#5]
I am sorry, I was a little bit harry. I had to turn the camera several degrees in order to see the difference

Thanks both!