mirror of
https://github.com/Reuh/wirefame.git
synced 2025-10-27 09:39:30 +00:00
First commit
This commit is contained in:
commit
b4798c8c16
7 changed files with 148562 additions and 0 deletions
1
init.lua
Normal file
1
init.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
return require((...)..".wirefame")
|
||||
22
test/bench.lua
Normal file
22
test/bench.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
local t = require("socket").gettime
|
||||
|
||||
--
|
||||
local wirefame = require("wirefame")
|
||||
|
||||
function wirefame.drawLine(x0, y0, x1, y1)
|
||||
love.graphics.line(x0, y0, x1, y1)
|
||||
end
|
||||
|
||||
local model = wirefame.open("metaknight.obj")
|
||||
|
||||
--
|
||||
local s = t()
|
||||
|
||||
for _=1,100 do
|
||||
model:draw(0, 0, 1000, 1000, 255)
|
||||
end
|
||||
|
||||
local e = t()
|
||||
|
||||
--
|
||||
print(e-s)
|
||||
31
test/box.obj
Normal file
31
test/box.obj
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Vertices: 8
|
||||
# Points: 0
|
||||
# Lines: 0
|
||||
# Faces: 6
|
||||
# Materials: 1
|
||||
|
||||
o 1
|
||||
|
||||
# Vertex list
|
||||
|
||||
v -0.5 -0.5 0.5
|
||||
v -0.5 -0.5 -0.5
|
||||
v -0.5 0.5 -0.5
|
||||
v -0.5 0.5 0.5
|
||||
v 0.5 -0.5 0.5
|
||||
v 0.5 -0.5 -0.5
|
||||
v 0.5 0.5 -0.5
|
||||
v 0.5 0.5 0.5
|
||||
|
||||
# Point/Line/Face list
|
||||
|
||||
usemtl Default
|
||||
f 4 3 2 1
|
||||
f 2 6 5 1
|
||||
f 3 7 6 2
|
||||
f 8 7 3 4
|
||||
f 5 8 4 1
|
||||
f 6 7 8 5
|
||||
l 8 7 5 4
|
||||
|
||||
# End of file
|
||||
9
test/frame.obj
Normal file
9
test/frame.obj
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
v 0.0 0.0 0.0
|
||||
v 1.0 0.0 0.0
|
||||
v 0.0 1.0 0.0
|
||||
v 0.0 0.0 1.0
|
||||
|
||||
p 1 2 3 4
|
||||
l 1 2
|
||||
l 1 3
|
||||
l 1 4
|
||||
32
test/main.lua
Normal file
32
test/main.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
local wirefame = require("wirefame")
|
||||
|
||||
love.graphics.setLineStyle("rough")
|
||||
|
||||
love.window.setMode(1000, 1000, { vsync = false })
|
||||
|
||||
wirefame.defaultColor = { 1, 0, 0, 1 }
|
||||
|
||||
local camera = { 0, 1, 3 }
|
||||
|
||||
local frame = wirefame.model("frame.obj")
|
||||
:setColor(1, 1, 1)
|
||||
|
||||
local model = wirefame.model("metaknight.obj")
|
||||
:scale(1/15, 1/15, 1/15)
|
||||
:translate(0, -0.7, 0)
|
||||
|
||||
local scene = wirefame.scene()
|
||||
:setViewport(0, 0, 1000, 1000)
|
||||
:lookAt(camera, {0,0,0}, {0,1,0})
|
||||
:setViewDistance(5)
|
||||
:add(frame, model)
|
||||
|
||||
function love.update(dt)
|
||||
model:rotate(dt/2, {0, 1, 0})
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
love.graphics.setColor(1, 1, 1)
|
||||
love.graphics.print(love.timer.getFPS(), 5, 5)
|
||||
scene:draw()
|
||||
end
|
||||
146934
test/metaknight.obj
Normal file
146934
test/metaknight.obj
Normal file
File diff suppressed because it is too large
Load diff
1533
wirefame.lua
Normal file
1533
wirefame.lua
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue