Textured Polygons for All!
Posted: Sun Jan 20, 2013 7:44 am
*It should actually be called textured quadrilaterals, but that's irrelevant.
*You need a GPU that supports pixel effects.
After hours of thinking and math, here's what everyone's been waiting for!
Usage:
Updates:
v2
-Fixed image being rotated one quarter turn ccw.
v3
-Added parallel edge support.
v4
-If image is nil, no image will be drawn.
-If only the vertices are given (e.g. texture.quad(v1,v2,v3,v4) ) the function will behave properly.
v5
-Added tiled textures, see Demo's source code.
v6
-Fixed repeat options to work like expected
-Many small tweaks
v7
-Assume edges are parallel if it's close, otherwise the math would degrade.
-Clear effect after writing image
v8
-Change scaling to image-based instead of polygon-based (More intuitive)
Known issues:
-Does not display properly when using love's built in push and pop stuffs.
I'm so excited to see what people will make with this!
Also, please tell me what I should do so you can be comfortable using it straight out of the box.
Controls for Demo:
Click and drag the corners of the image.
*You need a GPU that supports pixel effects.
After hours of thinking and math, here's what everyone's been waiting for!
Usage:
Code: Select all
local texture=require'Perspective'
function love.draw()
texture.quad(image,vertex1,vertex2,vertex3,vertex4)
end
v2
-Fixed image being rotated one quarter turn ccw.
v3
-Added parallel edge support.
v4
-If image is nil, no image will be drawn.
-If only the vertices are given (e.g. texture.quad(v1,v2,v3,v4) ) the function will behave properly.
v5
-Added tiled textures, see Demo's source code.
v6
-Fixed repeat options to work like expected
-Many small tweaks
v7
-Assume edges are parallel if it's close, otherwise the math would degrade.
-Clear effect after writing image
v8
-Change scaling to image-based instead of polygon-based (More intuitive)
Known issues:
-Does not display properly when using love's built in push and pop stuffs.
I'm so excited to see what people will make with this!
Also, please tell me what I should do so you can be comfortable using it straight out of the box.
Controls for Demo:
Click and drag the corners of the image.