Difference between revisions of "User:Substitute541/Love3D"
(→Download: corrected things) |
m (Qubodup moved page Love3D to User:Substitute541/Love3D: name collision problems) |
||
(40 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | '''IF YOU'RE LOOKING FOR ANOTHER LIBRARY OF THE SAME NAME SEE : [https://love2d.org/forums/viewtopic.php?f=5&t=11307 L3D Library]''' | |
− | This | + | This library allows you to simulate pseudo-3D, although you can model some basic 3D polyhedrons with the 3D triangles. There are also other functions too. |
== Download == | == Download == | ||
− | [https://dl.dropbox.com/u/105405645/Love2D%20Libraries/ | + | [https://dl.dropbox.com/u/105405645/Love2D%20Libraries/Love3D%20by%20Substitute541.zip The Love3D Library.zip] |
+ | Current Version : 0.3.2 [Backface Update] | ||
+ | |||
+ | [https://dl.dropbox.com/u/105405645/Test%20Files/test5.love Lighting Demo] | ||
+ | |||
+ | [https://dl.dropbox.com/u/105405645/Test%20Files/test6.love Ambient Lighting Demo] | ||
+ | |||
+ | [https://dl.dropbox.com/u/105405645/Test%20Files/Love3D/test7.love Backface Culling Demo] | ||
== Instructions == | == Instructions == | ||
* Unzip the .zip file | * Unzip the .zip file | ||
* If you are using this, put the Love3D.lua in your .love file | * If you are using this, put the Love3D.lua in your .love file | ||
− | * On | + | * On the outside of any function in main.lua add : |
<source lang="lua"> | <source lang="lua"> | ||
require "Love3D" | require "Love3D" | ||
+ | </source> | ||
+ | * Then on the INSIDE of love.load(), near the end of the function, add : | ||
+ | <source lang="lua"> | ||
+ | love3D.load(fl, vpX, vpY) | ||
+ | </source> | ||
+ | * (Note : FL means Focal Length. This value is usually 250. vp means Vanishing Point) And you're done! Just call the functions and you're ready to go! | ||
− | love3D.load() | + | '''How to load additional extensions''' |
+ | * Put yourExtension.lua in your love file | ||
+ | * Love3D.lua will automatically require yourExtension.lua when it exists. So just load it inside love.load() AFTER loading Love3D. | ||
+ | <source lang="lua"> | ||
+ | love3D.extensionName.load() | ||
</source> | </source> | ||
− | + | * And you're done! | |
+ | |||
+ | == Functions == | ||
+ | '''Love3D Functions''' | ||
+ | *'''love3D.load'''. Loads the library, must be called in the love.load function | ||
+ | |||
+ | *'''love3D.calculatePointPosition'''. Calculates point position by transforming the 3D coordinates to 2D | ||
+ | |||
+ | *'''love3D.isBackFace'''. Checks if the face is a [http://en.wikipedia.org/wiki/Backface_culling#Backface_culling backface] | ||
+ | |||
+ | *'''love3D.graphics.quad'''. Draws a quadrilateral | ||
+ | |||
+ | *'''love3D.graphics.triangle'''. Draws a triangle | ||
+ | |||
+ | *'''love3D.graphics.lineSegment2D'''. Draws a 2D line segment in 3D space | ||
+ | |||
+ | *'''love3D.graphics.draw2D'''. Draws a 2D image in 3D space | ||
+ | |||
+ | *'''love3D.func.rotateX/Y/Z'''. Rotates a point in a chosen center point | ||
+ | |||
+ | *'''love3D.func.checkDistCollision'''. Checks if two circular objects in 3D space are colliding | ||
+ | |||
+ | *'''love3D.func.getAvgZTriangle/Quad'''. Finds the average Z of a triangle/quad | ||
+ | |||
+ | *'''love3D.func.zSortTriangle/Quad'''. Sorts a triangle/quad by their average Z | ||
+ | |||
+ | *'''love3D.func.zSortTriangle2'''. Sorts a triangle triangle by their minimum Z | ||
+ | |||
+ | *'''love3D.func.zSortPoint'''. Sorts a table of points | ||
+ | |||
+ | *'''love3D.checkVersion'''. Checks the current version of Love3D | ||
+ | |||
+ | '''Light3D Functions''' | ||
+ | |||
+ | *'''love3D.light.load'''. Loads Light3D.lua | ||
+ | |||
+ | *'''love3D.light.set'''. Sets all the variables | ||
+ | |||
+ | *'''love3D.light.setAmbience'''. Sets the ambient lighting | ||
+ | |||
+ | *'''love3D.light.getLightFactor'''. Gets the light factor (only used by love3D.light.getNewColor) | ||
+ | |||
+ | *'''love3D.light.getNewColor'''. Gets the new color | ||
+ | |||
+ | == Possible uses == | ||
+ | *Spinning cube for menu screens | ||
+ | |||
+ | *A more accurate Parallax Scrolling | ||
+ | |||
+ | == Changelog == | ||
+ | * 0.1.x : Added the perspective function | ||
+ | * 0.2.0 -> 0.2.8 : Added simple perspective functions and graphics functions | ||
+ | * 0.2.9 : Optimized code, renamed the perspective function | ||
+ | * 0.3.0 : Added simple lighting, optimized code | ||
+ | * 0.3.1 : Added ambient lighting, removed the <nowiki>[[Experimental]]</nowiki> tag | ||
+ | * 0.3.2 : Added [http://en.wikipedia.org/wiki/Backface_culling#Backface_culling Backface culling], added a second zSort function for the triangle, added support for [[Beetle Debug]], added Preset3D | ||
+ | |||
+ | == Screenshots == | ||
+ | [[Image:Love3Dlighting.jpg |thumb|500px| The Love3D Lighting demo (please note that the color on the demo is gray, not red).]] | ||
+ | |||
+ | == Contributors == | ||
+ | *[[User:Substitute541|Substitute541]] | ||
− | == | + | {{#set:LOVE Version=0.8.x}} |
− | + | {{#set:Description=This allows you to simulate real 3D in a 2D engine. No Raycasting!}} | |
+ | [[Category:Libraries]] |
Latest revision as of 03:16, 31 March 2016
IF YOU'RE LOOKING FOR ANOTHER LIBRARY OF THE SAME NAME SEE : L3D Library
This library allows you to simulate pseudo-3D, although you can model some basic 3D polyhedrons with the 3D triangles. There are also other functions too.
Contents
Download
The Love3D Library.zip Current Version : 0.3.2 [Backface Update]
Instructions
- Unzip the .zip file
- If you are using this, put the Love3D.lua in your .love file
- On the outside of any function in main.lua add :
require "Love3D"
- Then on the INSIDE of love.load(), near the end of the function, add :
love3D.load(fl, vpX, vpY)
- (Note : FL means Focal Length. This value is usually 250. vp means Vanishing Point) And you're done! Just call the functions and you're ready to go!
How to load additional extensions
- Put yourExtension.lua in your love file
- Love3D.lua will automatically require yourExtension.lua when it exists. So just load it inside love.load() AFTER loading Love3D.
love3D.extensionName.load()
- And you're done!
Functions
Love3D Functions
- love3D.load. Loads the library, must be called in the love.load function
- love3D.calculatePointPosition. Calculates point position by transforming the 3D coordinates to 2D
- love3D.isBackFace. Checks if the face is a backface
- love3D.graphics.quad. Draws a quadrilateral
- love3D.graphics.triangle. Draws a triangle
- love3D.graphics.lineSegment2D. Draws a 2D line segment in 3D space
- love3D.graphics.draw2D. Draws a 2D image in 3D space
- love3D.func.rotateX/Y/Z. Rotates a point in a chosen center point
- love3D.func.checkDistCollision. Checks if two circular objects in 3D space are colliding
- love3D.func.getAvgZTriangle/Quad. Finds the average Z of a triangle/quad
- love3D.func.zSortTriangle/Quad. Sorts a triangle/quad by their average Z
- love3D.func.zSortTriangle2. Sorts a triangle triangle by their minimum Z
- love3D.func.zSortPoint. Sorts a table of points
- love3D.checkVersion. Checks the current version of Love3D
Light3D Functions
- love3D.light.load. Loads Light3D.lua
- love3D.light.set. Sets all the variables
- love3D.light.setAmbience. Sets the ambient lighting
- love3D.light.getLightFactor. Gets the light factor (only used by love3D.light.getNewColor)
- love3D.light.getNewColor. Gets the new color
Possible uses
- Spinning cube for menu screens
- A more accurate Parallax Scrolling
Changelog
- 0.1.x : Added the perspective function
- 0.2.0 -> 0.2.8 : Added simple perspective functions and graphics functions
- 0.2.9 : Optimized code, renamed the perspective function
- 0.3.0 : Added simple lighting, optimized code
- 0.3.1 : Added ambient lighting, removed the [[Experimental]] tag
- 0.3.2 : Added Backface culling, added a second zSort function for the triangle, added support for Beetle Debug, added Preset3D