Difference between revisions of "User:Substitute541/Love3D"

(Download)
(Instructions)
Line 12: Line 12:
  
 
== 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 the outside of any function in main.lua add :
+
* On the outside of any function in main.lua add :
 
<source lang="lua">
 
<source lang="lua">
 
require "Love3D"
 
require "Love3D"
 
</source>
 
</source>
# Then on the INSIDE of love.load(), near the end of the function, add :
+
* Then on the INSIDE of love.load(), near the end of the function, add :
 
<source lang="lua">
 
<source lang="lua">
 
love3D.load(fl, vpX, vpY)
 
love3D.load(fl, vpX, vpY)
 
</source>
 
</source>
# (Note : FL means Focal Length. This value is usually 250. vp means Vanishing Point) And your done! Just call the functions and your ready to go!
+
* (Note : FL means Focal Length. This value is usually 250. vp means Vanishing Point) And your done! Just call the functions and your ready to go!
 +
 
 +
'''How to load Light3D'''
 +
* Put Light3D.lua in your love file
 +
* Just like Love3D, add
 +
<source lang="lua">
 +
-- on the outside
 +
require "Light3D"
 +
 
 +
-- on the inside
 +
love3D.light.load()
 +
</source>
 +
* And your done!
  
 
== Functions ==
 
== Functions ==

Revision as of 08:00, 17 October 2012

Osphere.png This library is still in beta, you can expect some bugs...  


IF YOUR 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.

Download

|The Love3D Library.zip Current Version : 0.3.0 [The Light Update]

| Lighting Demo

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 your done! Just call the functions and your ready to go!

How to load Light3D

  • Put Light3D.lua in your love file
  • Just like Love3D, add
-- on the outside
require "Light3D"

-- on the inside
love3D.light.load()
  • And your 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.graphics.quad. Draws a quadrilateral
  • love3D.graphics.triangle. Draws a triangle
  • love3D.graphics.lineSegment2D. Draws a 2D line segmentin 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
  • love3D.func.zSortPoint. Sorts a table of points

Light3D Functions

  • love3D.light.load. Loads Light3D.lua
  • love3D.light.set. Sets all the variables
  • 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

Screenshots

The Love3D Lighting demo (please note that the color on the demo is gray, not red).

Contributors