uploaded source :?

This commit is contained in:
UndeadMaelys 2021-03-15 16:31:35 +01:00
parent c7a56fdca9
commit dd487f7b2b
72 changed files with 3417 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

BIN
SDL2.dll

Binary file not shown.

BIN
default_font.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

165
g3d/camera.lua Normal file
View File

@ -0,0 +1,165 @@
-- written by groverbuger for g3d
-- february 2021
-- MIT license
local shader = require(G3D_PATH .. "/shader")
local newMatrix = require(G3D_PATH .. "/matrices")
----------------------------------------------------------------------------------------------------
-- define the camera singleton
----------------------------------------------------------------------------------------------------
local camera = {
fov = math.pi/2,
nearClip = 0.01,
farClip = 1000,
aspectRatio = love.graphics.getWidth()/love.graphics.getHeight(),
position = {0,0,0},
target = {0,0,1},
down = {0,-1,0},
viewMatrix = newMatrix(),
projectionMatrix = newMatrix(),
}
-- private variables used only for the first person camera functions
local fpsController = {
direction = 0,
pitch = 0
}
-- read-only variables, can't be set by the end user
function camera.getDirectionPitch()
return fpsController.direction, fpsController.pitch
end
-- convenient function to return the camera's normalized look vector
function camera:getLookVector()
local vx = camera.target[1] - camera.position[1]
local vy = camera.target[2] - camera.position[2]
local vz = camera.target[3] - camera.position[3]
local length = math.sqrt(vx^2 + vy^2 + vz^2)
-- make sure not to divide by 0
if length > 0 then
return vx/length, vy/length, vz/length
end
return vx,vy,vz
end
-- give the camera a point to look from and a point to look towards
function camera.lookAt(x,y,z, xAt,yAt,zAt)
camera.position[1] = x
camera.position[2] = y
camera.position[3] = z
camera.target[1] = xAt
camera.target[2] = yAt
camera.target[3] = zAt
-- update the fpsController's direction and pitch based on lookAt
-- thanks 4v0v!
local dx,dy,dz = camera:getLookVector()
fpsController.direction = math.pi/2 - math.atan2(dz, dx)
fpsController.pitch = -math.atan2(dy, math.sqrt(dx^2 + dz^2))
-- update the camera in the shader
camera.updateViewMatrix()
end
-- move and rotate the camera, given a point and a direction and a pitch (vertical direction)
function camera.lookInDirection(x,y,z, directionTowards,pitchTowards)
camera.position[1] = x or camera.position[1]
camera.position[2] = y or camera.position[2]
camera.position[3] = z or camera.position[3]
fpsController.direction = directionTowards or fpsController.direction
fpsController.pitch = pitchTowards or fpsController.pitch
-- convert the direction and pitch into a target point
-- turn the cos of the pitch into a sign value, either 1, -1, or 0
local sign = math.cos(fpsController.pitch)
sign = (sign > 0 and 1) or (sign < 0 and -1) or 0
-- don't let cosPitch ever hit 0, because weird camera glitches will happen
local cosPitch = sign*math.max(math.abs(math.cos(fpsController.pitch)), 0.00001)
camera.target[1] = camera.position[1]+math.sin(fpsController.direction)*cosPitch
camera.target[2] = camera.position[2]-math.sin(fpsController.pitch)
camera.target[3] = camera.position[3]+math.cos(fpsController.direction)*cosPitch
-- update the camera in the shader
camera.updateViewMatrix()
end
-- recreate the camera's view matrix from its current values
-- and send the matrix to the shader specified, or the default shader
function camera.updateViewMatrix(shaderGiven)
camera.viewMatrix:setViewMatrix(camera.position, camera.target, camera.down);
(shaderGiven or shader):send("viewMatrix", camera.viewMatrix)
end
-- recreate the camera's projection matrix from its current values
-- and send the matrix to the shader specified, or the default shader
function camera.updateProjectionMatrix(shaderGiven)
camera.projectionMatrix:setProjectionMatrix(camera.fov, camera.nearClip, camera.farClip, camera.aspectRatio);
(shaderGiven or shader):send("projectionMatrix", camera.projectionMatrix)
end
-- recreate the camera's orthographic projection matrix from its current values
-- and send the matrix to the shader specified, or the default shader
function camera.updateOrthographicMatrix(size, shaderGiven)
camera.projectionMatrix:setOrthographicMatrix(camera.fov, size or 5, camera.nearClip, camera.farClip, camera.aspectRatio);
(shaderGiven or shader):send("projectionMatrix", camera.projectionMatrix)
end
-- simple first person camera movement with WASD
-- put this local function in your love.update to use, passing in dt
function camera.firstPersonMovement(dt,speed)
-- collect inputs
local moveX,moveY = 0,0
local cameraMoved = false
if love.keyboard.isDown("w") then moveY = moveY - 1 end
if love.keyboard.isDown("a") then moveX = moveX - 1 end
if love.keyboard.isDown("s") then moveY = moveY + 1 end
if love.keyboard.isDown("d") then moveX = moveX + 1 end
if love.keyboard.isDown("space") then
camera.position[2] = camera.position[2] - speed*dt
cameraMoved = true
end
if love.keyboard.isDown("lshift") then
camera.position[2] = camera.position[2] + speed*dt
cameraMoved = true
end
-- do some trigonometry on the inputs to make movement relative to camera's direction
-- also to make the player not move faster in diagonal directions
if moveX ~= 0 or moveY ~= 0 then
local angle = math.atan2(moveY,moveX)
local directionX,directionZ = math.cos(fpsController.direction + angle)*speed*dt, math.sin(fpsController.direction + angle + math.pi)*speed*dt
camera.position[1] = camera.position[1] + directionX
camera.position[3] = camera.position[3] + directionZ
cameraMoved = true
end
-- update the camera's in the shader
-- only if the camera moved, for a slight performance benefit
if cameraMoved then
camera.lookInDirection()
end
end
-- use this in your love.mousemoved function, passing in the movements
function camera.firstPersonLook(dx,dy)
-- capture the mouse
love.mouse.setRelativeMode(true)
local sensitivity = 1/300
fpsController.direction = fpsController.direction + dx*sensitivity
fpsController.pitch = math.max(math.min(fpsController.pitch - dy*sensitivity, math.pi*0.5), math.pi*-0.5)
camera.lookInDirection(camera.position[1],camera.position[2],camera.position[3], fpsController.direction,fpsController.pitch)
end
return camera

560
g3d/collisions.lua Normal file
View File

@ -0,0 +1,560 @@
-- written by groverbuger for g3d
-- february 2021
-- MIT license
local vectors = require(G3D_PATH .. "/vectors")
local fastSubtract = vectors.subtract
local vectorAdd = vectors.add
local vectorCrossProduct = vectors.crossProduct
local vectorDotProduct = vectors.dotProduct
local vectorNormalize = vectors.normalize
local vectorMagnitude = vectors.magnitude
----------------------------------------------------------------------------------------------------
-- collision detection functions
----------------------------------------------------------------------------------------------------
--
-- none of these functions are required for developing 3D games
-- however these collision functions are very frequently used in 3D games
--
-- be warned! a lot of this code is butt-ugly
-- using a table per vector would create a bazillion tables and lots of used memory
-- so instead all vectors are all represented using three number variables each
-- this approach ends up making the code look terrible, but collision functions need to be efficient
local collisions = {}
-- finds the closest point to the source point on the given line segment
local function closestPointOnLineSegment(
a_x,a_y,a_z, -- point one of line segment
b_x,b_y,b_z, -- point two of line segment
x,y,z -- source point
)
local ab_x, ab_y, ab_z = b_x - a_x, b_y - a_y, b_z - a_z
local t = vectorDotProduct(x - a_x, y - a_y, z - a_z, ab_x, ab_y, ab_z) / (ab_x^2 + ab_y^2 + ab_z^2)
t = math.min(1, math.max(0, t))
return a_x + t*ab_x, a_y + t*ab_y, a_z + t*ab_z
end
-- model - ray intersection
-- based off of triangle - ray collision from excessive's CPML library
-- does a triangle - ray collision for every face in the model to find the shortest collision
--
-- sources:
-- https://github.com/excessive/cpml/blob/master/modules/intersect.lua
-- http://www.lighthouse3d.com/tutorials/maths/ray-triangle-intersection/
local tiny = 2.2204460492503131e-16 -- the smallest possible value for a double, "double epsilon"
local function triangleRay(
tri_0_x, tri_0_y, tri_0_z,
tri_1_x, tri_1_y, tri_1_z,
tri_2_x, tri_2_y, tri_2_z,
n_x, n_y, n_z,
src_x, src_y, src_z,
dir_x, dir_y, dir_z
)
-- cache these variables for efficiency
local e11,e12,e13 = fastSubtract(tri_1_x,tri_1_y,tri_1_z, tri_0_x,tri_0_y,tri_0_z)
local e21,e22,e23 = fastSubtract(tri_2_x,tri_2_y,tri_2_z, tri_0_x,tri_0_y,tri_0_z)
local h1,h2,h3 = vectorCrossProduct(dir_x,dir_y,dir_z, e21,e22,e23)
local a = vectorDotProduct(h1,h2,h3, e11,e12,e13)
-- if a is too close to 0, ray does not intersect triangle
if math.abs(a) <= tiny then
return
end
local s1,s2,s3 = fastSubtract(src_x,src_y,src_z, tri_0_x,tri_0_y,tri_0_z)
local u = vectorDotProduct(s1,s2,s3, h1,h2,h3) / a
-- ray does not intersect triangle
if u < 0 or u > 1 then
return
end
local q1,q2,q3 = vectorCrossProduct(s1,s2,s3, e11,e12,e13)
local v = vectorDotProduct(dir_x,dir_y,dir_z, q1,q2,q3) / a
-- ray does not intersect triangle
if v < 0 or u + v > 1 then
return
end
-- at this stage we can compute t to find out where
-- the intersection point is on the line
local thisLength = vectorDotProduct(q1,q2,q3, e21,e22,e23) / a
-- if hit this triangle and it's closer than any other hit triangle
if thisLength >= tiny and (not finalLength or thisLength < finalLength) then
--local norm_x, norm_y, norm_z = vectorCrossProduct(e11,e12,e13, e21,e22,e23)
return thisLength, src_x + dir_x*thisLength, src_y + dir_y*thisLength, src_z + dir_z*thisLength, n_x,n_y,n_z
end
end
-- detects a collision between a triangle and a sphere
--
-- sources:
-- https://wickedengine.net/2020/04/26/capsule-collision-detection/
local function triangleSphere(
tri_0_x, tri_0_y, tri_0_z,
tri_1_x, tri_1_y, tri_1_z,
tri_2_x, tri_2_y, tri_2_z,
tri_n_x, tri_n_y, tri_n_z,
src_x, src_y, src_z, radius
)
-- recalculate surface normal of this triangle
local side1_x, side1_y, side1_z = tri_1_x - tri_0_x, tri_1_y - tri_0_y, tri_1_z - tri_0_z
local side2_x, side2_y, side2_z = tri_2_x - tri_0_x, tri_2_y - tri_0_y, tri_2_z - tri_0_z
local n_x, n_y, n_z = vectorNormalize(vectorCrossProduct(side1_x, side1_y, side1_z, side2_x, side2_y, side2_z))
-- distance from src to a vertex on the triangle
local dist = vectorDotProduct(src_x - tri_0_x, src_y - tri_0_y, src_z - tri_0_z, n_x, n_y, n_z)
-- collision not possible, just return
if dist < -radius or dist > radius then
return
end
-- itx stands for intersection
local itx_x, itx_y, itx_z = src_x - n_x * dist, src_y - n_y * dist, src_z - n_z * dist
-- determine whether itx is inside the triangle
-- project it onto the triangle and return if this is the case
local c0_x, c0_y, c0_z = vectorCrossProduct(itx_x - tri_0_x, itx_y - tri_0_y, itx_z - tri_0_z, tri_1_x - tri_0_x, tri_1_y - tri_0_y, tri_1_z - tri_0_z)
local c1_x, c1_y, c1_z = vectorCrossProduct(itx_x - tri_1_x, itx_y - tri_1_y, itx_z - tri_1_z, tri_2_x - tri_1_x, tri_2_y - tri_1_y, tri_2_z - tri_1_z)
local c2_x, c2_y, c2_z = vectorCrossProduct(itx_x - tri_2_x, itx_y - tri_2_y, itx_z - tri_2_z, tri_0_x - tri_2_x, tri_0_y - tri_2_y, tri_0_z - tri_2_z)
if vectorDotProduct(c0_x, c0_y, c0_z, n_x, n_y, n_z) <= 0
and vectorDotProduct(c1_x, c1_y, c1_z, n_x, n_y, n_z) <= 0
and vectorDotProduct(c2_x, c2_y, c2_z, n_x, n_y, n_z) <= 0 then
n_x, n_y, n_z = src_x - itx_x, src_y - itx_y, src_z - itx_z
-- the sphere is inside the triangle, so the normal is zero
-- instead, just return the triangle's normal
if n_x == 0 and n_y == 0 and n_z == 0 then
return vectorMagnitude(n_x, n_y, n_z), itx_x, itx_y, itx_z, tri_n_x, tri_n_y, tri_n_z
end
return vectorMagnitude(n_x, n_y, n_z), itx_x, itx_y, itx_z, n_x, n_y, n_z
end
-- itx is outside triangle
-- find points on all three line segments that are closest to itx
-- if distance between itx and one of these three closest points is in range, there is an intersection
local radiussq = radius * radius
local smallestDist
local line1_x, line1_y, line1_z = closestPointOnLineSegment(tri_0_x, tri_0_y, tri_0_z, tri_1_x, tri_1_y, tri_1_z, src_x, src_y, src_z)
local dist = (src_x - line1_x)^2 + (src_y - line1_y)^2 + (src_z - line1_z)^2
if dist <= radiussq then
smallestDist = dist
itx_x, itx_y, itx_z = line1_x, line1_y, line1_z
end
local line2_x, line2_y, line2_z = closestPointOnLineSegment(tri_1_x, tri_1_y, tri_1_z, tri_2_x, tri_2_y, tri_2_z, src_x, src_y, src_z)
local dist = (src_x - line2_x)^2 + (src_y - line2_y)^2 + (src_z - line2_z)^2
if (smallestDist and dist < smallestDist or not smallestDist) and dist <= radiussq then
smallestDist = dist
itx_x, itx_y, itx_z = line2_x, line2_y, line2_z
end
local line3_x, line3_y, line3_z = closestPointOnLineSegment(tri_2_x, tri_2_y, tri_2_z, tri_0_x, tri_0_y, tri_0_z, src_x, src_y, src_z)
local dist = (src_x - line3_x)^2 + (src_y - line3_y)^2 + (src_z - line3_z)^2
if (smallestDist and dist < smallestDist or not smallestDist) and dist <= radiussq then
smallestDist = dist
itx_x, itx_y, itx_z = line3_x, line3_y, line3_z
end
if smallestDist then
n_x, n_y, n_z = src_x - itx_x, src_y - itx_y, src_z - itx_z
-- the sphere is inside the triangle, so the normal is zero
-- instead, just return the triangle's normal
if n_x == 0 and n_y == 0 and n_z == 0 then
return vectorMagnitude(n_x, n_y, n_z), itx_x, itx_y, itx_z, tri_n_x, tri_n_y, tri_n_z
end
return vectorMagnitude(n_x, n_y, n_z), itx_x, itx_y, itx_z, n_x, n_y, n_z
end
end
-- finds the closest point on the triangle from the source point given
--
-- sources:
-- https://wickedengine.net/2020/04/26/capsule-collision-detection/
local function trianglePoint(
tri_0_x, tri_0_y, tri_0_z,
tri_1_x, tri_1_y, tri_1_z,
tri_2_x, tri_2_y, tri_2_z,
tri_n_x, tri_n_y, tri_n_z,
src_x, src_y, src_z
)
-- recalculate surface normal of this triangle
local side1_x, side1_y, side1_z = tri_1_x - tri_0_x, tri_1_y - tri_0_y, tri_1_z - tri_0_z
local side2_x, side2_y, side2_z = tri_2_x - tri_0_x, tri_2_y - tri_0_y, tri_2_z - tri_0_z
local n_x, n_y, n_z = vectorNormalize(vectorCrossProduct(side1_x, side1_y, side1_z, side2_x, side2_y, side2_z))
-- distance from src to a vertex on the triangle
local dist = vectorDotProduct(src_x - tri_0_x, src_y - tri_0_y, src_z - tri_0_z, n_x, n_y, n_z)
-- itx stands for intersection
local itx_x, itx_y, itx_z = src_x - n_x * dist, src_y - n_y * dist, src_z - n_z * dist
-- determine whether itx is inside the triangle
-- project it onto the triangle and return if this is the case
local c0_x, c0_y, c0_z = vectorCrossProduct(itx_x - tri_0_x, itx_y - tri_0_y, itx_z - tri_0_z, tri_1_x - tri_0_x, tri_1_y - tri_0_y, tri_1_z - tri_0_z)
local c1_x, c1_y, c1_z = vectorCrossProduct(itx_x - tri_1_x, itx_y - tri_1_y, itx_z - tri_1_z, tri_2_x - tri_1_x, tri_2_y - tri_1_y, tri_2_z - tri_1_z)
local c2_x, c2_y, c2_z = vectorCrossProduct(itx_x - tri_2_x, itx_y - tri_2_y, itx_z - tri_2_z, tri_0_x - tri_2_x, tri_0_y - tri_2_y, tri_0_z - tri_2_z)
if vectorDotProduct(c0_x, c0_y, c0_z, n_x, n_y, n_z) <= 0
and vectorDotProduct(c1_x, c1_y, c1_z, n_x, n_y, n_z) <= 0
and vectorDotProduct(c2_x, c2_y, c2_z, n_x, n_y, n_z) <= 0 then
n_x, n_y, n_z = src_x - itx_x, src_y - itx_y, src_z - itx_z
-- the sphere is inside the triangle, so the normal is zero
-- instead, just return the triangle's normal
if n_x == 0 and n_y == 0 and n_z == 0 then
return vectorMagnitude(n_x, n_y, n_z), itx_x, itx_y, itx_z, tri_n_x, tri_n_y, tri_n_z
end
return vectorMagnitude(n_x, n_y, n_z), itx_x, itx_y, itx_z, n_x, n_y, n_z
end
-- itx is outside triangle
-- find points on all three line segments that are closest to itx
-- if distance between itx and one of these three closest points is in range, there is an intersection
local line1_x, line1_y, line1_z = closestPointOnLineSegment(tri_0_x, tri_0_y, tri_0_z, tri_1_x, tri_1_y, tri_1_z, src_x, src_y, src_z)
local dist = (src_x - line1_x)^2 + (src_y - line1_y)^2 + (src_z - line1_z)^2
local smallestDist = dist
itx_x, itx_y, itx_z = line1_x, line1_y, line1_z
local line2_x, line2_y, line2_z = closestPointOnLineSegment(tri_1_x, tri_1_y, tri_1_z, tri_2_x, tri_2_y, tri_2_z, src_x, src_y, src_z)
local dist = (src_x - line2_x)^2 + (src_y - line2_y)^2 + (src_z - line2_z)^2
if smallestDist and dist < smallestDist then
smallestDist = dist
itx_x, itx_y, itx_z = line2_x, line2_y, line2_z
end
local line3_x, line3_y, line3_z = closestPointOnLineSegment(tri_2_x, tri_2_y, tri_2_z, tri_0_x, tri_0_y, tri_0_z, src_x, src_y, src_z)
local dist = (src_x - line3_x)^2 + (src_y - line3_y)^2 + (src_z - line3_z)^2
if smallestDist and dist < smallestDist then
smallestDist = dist
itx_x, itx_y, itx_z = line3_x, line3_y, line3_z
end
if smallestDist then
n_x, n_y, n_z = src_x - itx_x, src_y - itx_y, src_z - itx_z
-- the sphere is inside the triangle, so the normal is zero
-- instead, just return the triangle's normal
if n_x == 0 and n_y == 0 and n_z == 0 then
return vectorMagnitude(n_x, n_y, n_z), itx_x, itx_y, itx_z, tri_n_x, tri_n_y, tri_n_z
end
return vectorMagnitude(n_x, n_y, n_z), itx_x, itx_y, itx_z, n_x, n_y, n_z
end
end
-- finds the collision point between a triangle and a capsule
-- capsules are defined with two points and a radius
--
-- sources:
-- https://wickedengine.net/2020/04/26/capsule-collision-detection/
local function triangleCapsule(
tri_0_x, tri_0_y, tri_0_z,
tri_1_x, tri_1_y, tri_1_z,
tri_2_x, tri_2_y, tri_2_z,
n_x, n_y, n_z,
tip_x, tip_y, tip_z,
base_x, base_y, base_z,
a_x, a_y, a_z,
b_x, b_y, b_z,
capn_x, capn_y, capn_z,
radius
)
-- find the normal of this triangle
-- tbd if necessary, this sometimes fixes weird edgecases
local side1_x, side1_y, side1_z = tri_1_x - tri_0_x, tri_1_y - tri_0_y, tri_1_z - tri_0_z
local side2_x, side2_y, side2_z = tri_2_x - tri_0_x, tri_2_y - tri_0_y, tri_2_z - tri_0_z
local n_x, n_y, n_z = vectorNormalize(vectorCrossProduct(side1_x, side1_y, side1_z, side2_x, side2_y, side2_z))
local dotOfNormals = math.abs(vectorDotProduct(n_x, n_y, n_z, capn_x, capn_y, capn_z))
-- default reference point to an arbitrary point on the triangle
-- for when dotOfNormals is 0, because then the capsule is parallel to the triangle
local ref_x, ref_y, ref_z = tri_0_x, tri_0_y, tri_0_z
if dotOfNormals > 0 then
-- capsule is not parallel to the triangle's plane
-- find where the capsule's normal vector intersects the triangle's plane
local t = vectorDotProduct(n_x, n_y, n_z, (tri_0_x - base_x) / dotOfNormals, (tri_0_y - base_y) / dotOfNormals, (tri_0_z - base_z) / dotOfNormals)
local plane_itx_x, plane_itx_y, plane_itx_z = base_x + capn_x*t, base_y + capn_y*t, base_z + capn_z*t
local _
-- then clamp that plane intersect point onto the triangle itself
-- this is the new reference point
_, ref_x, ref_y, ref_z = trianglePoint(
tri_0_x, tri_0_y, tri_0_z,
tri_1_x, tri_1_y, tri_1_z,
tri_2_x, tri_2_y, tri_2_z,
n_x, n_y, n_z,
plane_itx_x, plane_itx_y, plane_itx_z
)
end
-- find the closest point on the capsule line to the reference point
local c_x, c_y, c_z = closestPointOnLineSegment(a_x, a_y, a_z, b_x, b_y, b_z, ref_x, ref_y, ref_z)
-- do a sphere cast from that closest point to the triangle and return the result
return triangleSphere(
tri_0_x, tri_0_y, tri_0_z,
tri_1_x, tri_1_y, tri_1_z,
tri_2_x, tri_2_y, tri_2_z,
n_x, n_y, n_z,
c_x, c_y, c_z, radius
)
end
-- finds whether or not a triangle is inside an AABB
local function triangleAABB(
tri_0_x, tri_0_y, tri_0_z,
tri_1_x, tri_1_y, tri_1_z,
tri_2_x, tri_2_y, tri_2_z,
n_x, n_y, n_z,
min_x, min_y, min_z,
max_x, max_y, max_z
)
-- get the closest point from the centerpoint on the triangle
local len,x,y,z,nx,ny,nz = trianglePoint(
tri_0_x, tri_0_y, tri_0_z,
tri_1_x, tri_1_y, tri_1_z,
tri_2_x, tri_2_y, tri_2_z,
n_x, n_y, n_z,
(min_x+max_x)*0.5, (min_y+max_y)*0.5, (min_z+max_z)*0.5
)
-- if the point is not inside the AABB, return nothing
if not (x >= min_x and x <= max_x) then return end
if not (y >= min_y and y <= max_y) then return end
if not (z >= min_z and z <= max_z) then return end
-- the point is inside the AABB, return the collision data
return len, x,y,z, nx,ny,nz
end
-- runs a given intersection function on all of the triangles made up of a given vert table
local function findClosest(self, verts, func, ...)
-- declare the variables that will be returned by the function
local finalLength, where_x, where_y, where_z, norm_x, norm_y, norm_z
-- cache references to this model's properties for efficiency
local translation_x = self.translation[1]
local translation_y = self.translation[2]
local translation_z = self.translation[3]
local scale_x = self.scale[1]
local scale_y = self.scale[2]
local scale_z = self.scale[3]
for v=1, #verts, 3 do
-- apply the function given with the arguments given
-- also supply the points of the current triangle
local n_x, n_y, n_z = vectorNormalize(
verts[v][6]*scale_x,
verts[v][7]*scale_x,
verts[v][8]*scale_x
)
local length, wx,wy,wz, nx,ny,nz = func(
verts[v][1]*scale_x + translation_x,
verts[v][2]*scale_y + translation_y,
verts[v][3]*scale_z + translation_z,
verts[v+1][1]*scale_x + translation_x,
verts[v+1][2]*scale_y + translation_y,
verts[v+1][3]*scale_z + translation_z,
verts[v+2][1]*scale_x + translation_x,
verts[v+2][2]*scale_y + translation_y,
verts[v+2][3]*scale_z + translation_z,
n_x,
n_y,
n_z,
...
)
-- if something was hit
-- and either the finalLength is not yet defined or the new length is closer
-- then update the collision information
if length and (not finalLength or length < finalLength) then
finalLength = length
where_x = wx
where_y = wy
where_z = wz
norm_x = nx
norm_y = ny
norm_z = nz
end
end
-- normalize the normal vector before it is returned
if finalLength then
norm_x, norm_y, norm_z = vectorNormalize(norm_x, norm_y, norm_z)
end
-- return all the information in a standardized way
return finalLength, where_x, where_y, where_z, norm_x, norm_y, norm_z
end
function collisions:rayIntersection(src_x, src_y, src_z, dir_x, dir_y, dir_z)
return findClosest(self, self.verts, triangleRay, src_x, src_y, src_z, dir_x, dir_y, dir_z)
end
function collisions:sphereIntersection(src_x, src_y, src_z, radius)
return findClosest(self, self.verts, triangleSphere, src_x, src_y, src_z, radius)
end
function collisions:closestPoint(src_x, src_y, src_z)
return findClosest(self, self.verts, trianglePoint, src_x, src_y, src_z)
end
function collisions:capsuleIntersection(tip_x, tip_y, tip_z, base_x, base_y, base_z, radius)
-- the normal vector coming out the tip of the capsule
local norm_x, norm_y, norm_z = vectorNormalize(tip_x - base_x, tip_y - base_y, tip_z - base_z)
-- the base and tip, inset by the radius
-- these two coordinates are the actual extent of the capsule sphere line
local a_x, a_y, a_z = base_x + norm_x*radius, base_y + norm_y*radius, base_z + norm_z*radius
local b_x, b_y, b_z = tip_x - norm_x*radius, tip_y - norm_y*radius, tip_z - norm_z*radius
return findClosest(
self,
self.verts,
triangleCapsule,
tip_x, tip_y, tip_z,
base_x, base_y, base_z,
a_x, a_y, a_z,
b_x, b_y, b_z,
norm_x, norm_y, norm_z,
radius
)
end
----------------------------------------------------------------------------------------------------
-- AABB functions
----------------------------------------------------------------------------------------------------
-- generate an axis-aligned bounding box
-- very useful for less precise collisions, like hitboxes
--
-- translation, and scale are not included here because they are computed on the fly instead
-- rotation is never included because AABBs are axis-aligned
function collisions:generateAABB()
local aabb = {
min = {
math.huge,
math.huge,
math.huge,
},
max = {
-1*math.huge,
-1*math.huge,
-1*math.huge
}
}
for _,vert in ipairs(self.verts) do
aabb.min[1] = math.min(aabb.min[1], vert[1])
aabb.min[2] = math.min(aabb.min[2], vert[2])
aabb.min[3] = math.min(aabb.min[3], vert[3])
aabb.max[1] = math.max(aabb.max[1], vert[1])
aabb.max[2] = math.max(aabb.max[2], vert[2])
aabb.max[3] = math.max(aabb.max[3], vert[3])
end
self.aabb = aabb
return aabb
end
-- check if two models have intersecting AABBs
-- other argument is another model
--
-- sources:
-- https://developer.mozilla.org/en-US/docs/Games/Techniques/3D_collision_detection
function collisions:isIntersectionAABB(other)
-- cache these references
local a_min = self.aabb.min
local a_max = self.aabb.max
local b_min = other.aabb.min
local b_max = other.aabb.max
-- make shorter variable names for translation
local a_1 = self.translation[1]
local a_2 = self.translation[2]
local a_3 = self.translation[3]
local b_1 = other.translation[1]
local b_2 = other.translation[2]
local b_3 = other.translation[3]
-- do the calculation
local x = a_min[1]*self.scale[1] + a_1 <= b_max[1]*other.scale[1] + b_1 and a_max[1]*self.scale[1] + a_1 >= b_min[1]*other.scale[1] + b_1
local y = a_min[2]*self.scale[2] + a_2 <= b_max[2]*other.scale[2] + b_2 and a_max[2]*self.scale[2] + a_2 >= b_min[2]*other.scale[2] + b_2
local z = a_min[3]*self.scale[3] + a_3 <= b_max[3]*other.scale[3] + b_3 and a_max[3]*self.scale[3] + a_3 >= b_min[3]*other.scale[3] + b_3
return x and y and z
end
-- check if a given point is inside the model's AABB
function collisions:isPointInsideAABB(x,y,z)
local min = self.aabb.min
local max = self.aabb.max
local in_x = x >= min[1]*self.scale[1] + self.translation[1] and x <= max[1]*self.scale[1] + self.translation[1]
local in_y = y >= min[2]*self.scale[2] + self.translation[2] and y <= max[2]*self.scale[2] + self.translation[2]
local in_z = z >= min[3]*self.scale[3] + self.translation[3] and z <= max[3]*self.scale[3] + self.translation[3]
return in_x and in_y and in_z
end
-- returns the distance from the point given to the origin of the model
function collisions:getDistanceFrom(x,y,z)
return math.sqrt((x - self.translation[1])^2 + (y - self.translation[2])^2 + (z - self.translation[3])^2)
end
-- AABB - ray intersection
-- based off of ray - AABB intersection from excessive's CPML library
--
-- sources:
-- https://github.com/excessive/cpml/blob/master/modules/intersect.lua
-- http://gamedev.stackexchange.com/a/18459
function collisions:rayIntersectionAABB(src_1, src_2, src_3, dir_1, dir_2, dir_3)
local dir_1, dir_2, dir_3 = vectorNormalize(dir_1, dir_2, dir_3)
local t1 = (self.aabb.min[1]*self.scale[1] + self.translation[1] - src_1) / dir_1
local t2 = (self.aabb.max[1]*self.scale[1] + self.translation[1] - src_1) / dir_1
local t3 = (self.aabb.min[2]*self.scale[2] + self.translation[2] - src_2) / dir_2
local t4 = (self.aabb.max[2]*self.scale[2] + self.translation[2] - src_2) / dir_2
local t5 = (self.aabb.min[3]*self.scale[3] + self.translation[3] - src_3) / dir_3
local t6 = (self.aabb.max[3]*self.scale[3] + self.translation[3] - src_3) / dir_3
local min = math.min
local max = math.max
local tmin = max(max(min(t1, t2), min(t3, t4)), min(t5, t6))
local tmax = min(min(max(t1, t2), max(t3, t4)), max(t5, t6))
-- ray is intersecting AABB, but whole AABB is behind us
if tmax < 0 then
return false
end
-- ray does not intersect AABB
if tmin > tmax then
return false
end
-- return distance and the collision coordinates
local where_1 = src_1 + dir_1 * tmin
local where_2 = src_2 + dir_2 * tmin
local where_3 = src_3 + dir_3 * tmin
return tmin, where_1, where_2, where_3
end
return collisions

62
g3d/init.lua Normal file
View File

@ -0,0 +1,62 @@
-- written by groverbuger for g3d
-- february 2021
-- MIT license
--[[
__ __
/'__`\ /\ \
__ /\_\L\ \ \_\ \
/'_ `\/_/_\_<_ /'_` \
/\ \L\ \/\ \L\ \/\ \L\ \
\ \____ \ \____/\ \___,_\
\/___L\ \/___/ \/__,_ /
/\____/
\_/__/
--]]
-- add the path to g3d to the global namespace
-- so submodules can know how to load their dependencies
G3D_PATH = ...
local g3d = {
_VERSION = "g3d 1.3",
_DESCRIPTION = "Simple and easy 3D engine for LÖVE.",
_URL = "https://github.com/groverburger/g3d",
_LICENSE = [[
MIT License
Copyright (c) 2021 groverburger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]],
}
g3d.newModel = require(G3D_PATH .. "/model")
g3d.camera = require(G3D_PATH .. "/camera")
g3d.camera.updateProjectionMatrix()
g3d.camera.updateViewMatrix()
-- so that far polygons don't overlap near polygons
love.graphics.setDepthMode("lequal", true)
-- get rid of G3D_PATH from the global namespace
-- so the end user doesn't have to worry about any globals
G3D_PATH = nil
return g3d

183
g3d/matrices.lua Normal file
View File

@ -0,0 +1,183 @@
-- written by groverbuger for g3d
-- february 2021
-- MIT license
local vectors = require(G3D_PATH .. "/vectors")
local vectorCrossProduct = vectors.crossProduct
local vectorDotProduct = vectors.dotProduct
local vectorNormalize = vectors.normalize
----------------------------------------------------------------------------------------------------
-- matrix class
----------------------------------------------------------------------------------------------------
-- matrices are 16 numbers in table, representing a 4x4 matrix
local matrix = {}
matrix.__index = matrix
local function newMatrix()
local self = setmetatable({}, matrix)
self:identity()
return self
end
function matrix:identity()
self[1], self[2], self[3], self[4] = 1, 0, 0, 0
self[5], self[6], self[7], self[8] = 0, 1, 0, 0
self[9], self[10], self[11], self[12] = 0, 0, 1, 0
self[13], self[14], self[15], self[16] = 0, 0, 0, 1
end
function matrix:getValueAt(x,y)
return self[x + (y-1)*4]
end
-- multiply this matrix and another matrix together
-- this matrix becomes the result of the multiplication operation
local orig = newMatrix()
function matrix:multiply(other)
-- hold the values of the original matrix
-- because the matrix is changing while it is used
for i=1, 16 do
orig[i] = self[i]
end
local i = 1
for y=1, 4 do
for x=1, 4 do
self[i] = orig:getValueAt(1,y)*other:getValueAt(x,1)
self[i] = self[i] + orig:getValueAt(2,y)*other:getValueAt(x,2)
self[i] = self[i] + orig:getValueAt(3,y)*other:getValueAt(x,3)
self[i] = self[i] + orig:getValueAt(4,y)*other:getValueAt(x,4)
i = i + 1
end
end
end
function matrix:__tostring()
local str = ""
for i=1, 16 do
str = str .. self[i]
if i%4 == 0 and i > 1 then
str = str .. "\n"
else
str = str .. ", "
end
end
return str
end
----------------------------------------------------------------------------------------------------
-- transformation, projection, and rotation matrices
----------------------------------------------------------------------------------------------------
-- the three most important matrices for 3d graphics
-- these three matrices are all you need to write a simple 3d shader
-- returns a transformation matrix
-- translation and rotation are 3d vectors
local temp = newMatrix()
function matrix:setTransformationMatrix(translation, rotation, scale)
self:identity()
-- translations
self[4] = translation[1]
self[8] = translation[2]
self[12] = translation[3]
-- rotations
if #rotation == 3 then
-- use 3D rotation vector as euler angles
-- x
temp:identity()
temp[6] = math.cos(rotation[1])
temp[7] = -1*math.sin(rotation[1])
temp[10] = math.sin(rotation[1])
temp[11] = math.cos(rotation[1])
self:multiply(temp)
-- y
temp:identity()
temp[1] = math.cos(rotation[2])
temp[3] = math.sin(rotation[2])
temp[9] = -1*math.sin(rotation[2])
temp[11] = math.cos(rotation[2])
self:multiply(temp)
-- z
temp:identity()
temp[1] = math.cos(rotation[3])
temp[2] = -1*math.sin(rotation[3])
temp[5] = math.sin(rotation[3])
temp[6] = math.cos(rotation[3])
self:multiply(temp)
else
-- use 4D rotation vector as quaternion
temp:identity()
local qx,qy,qz,qw = rotation[1], rotation[2], rotation[3], rotation[4]
temp[1], temp[2], temp[3] = 1 - 2*qy^2 - 2*qz^2, 2*qx*qy - 2*qz*qw, 2*qx*qz + 2*qy*qw
temp[5], temp[6], temp[7] = 2*qx*qy + 2*qz*qw, 1 - 2*qx^2 - 2*qz^2, 2*qy*qz - 2*qx*qw
temp[9], temp[10], temp[11] = 2*qx*qz - 2*qy*qw, 2*qy*qz + 2*qx*qw, 1 - 2*qx^2 - 2*qy^2
self:multiply(temp)
end
-- scale
temp:identity()
temp[1] = scale[1]
temp[6] = scale[2]
temp[11] = scale[3]
self:multiply(temp)
return self
end
-- returns a perspective projection matrix
-- (things farther away appear smaller)
-- all arguments are scalars aka normal numbers
-- aspectRatio is defined as window width divided by window height
function matrix:setProjectionMatrix(fov, near, far, aspectRatio)
local top = near * math.tan(fov/2)
local bottom = -1*top
local right = top * aspectRatio
local left = -1*right
self[1], self[2], self[3], self[4] = 2*near/(right-left), 0, (right+left)/(right-left), 0
self[5], self[6], self[7], self[8] = 0, 2*near/(top-bottom), (top+bottom)/(top-bottom), 0
self[9], self[10], self[11], self[12] = 0, 0, -1*(far+near)/(far-near), -2*far*near/(far-near)
self[13], self[14], self[15], self[16] = 0, 0, -1, 0
end
-- returns an orthographic projection matrix
-- (things farther away are the same size as things closer)
-- all arguments are scalars aka normal numbers
-- aspectRatio is defined as window width divided by window height
function matrix:setOrthographicMatrix(fov, size, near, far, aspectRatio)
local top = size * math.tan(fov/2)
local bottom = -1*top
local right = top * aspectRatio
local left = -1*right
self[1], self[2], self[3], self[4] = 2/(right-left), 0, 0, -1*(right+left)/(right-left)
self[5], self[6], self[7], self[8] = 0, 2/(top-bottom), 0, -1*(top+bottom)/(top-bottom)
self[9], self[10], self[11], self[12] = 0, 0, -2/(far-near), -(far+near)/(far-near)
self[13], self[14], self[15], self[16] = 0, 0, 0, 1
end
-- returns a view matrix
-- eye, target, and down are all 3d vectors
function matrix:setViewMatrix(eye, target, down)
local z_1, z_2, z_3 = vectorNormalize(eye[1] - target[1], eye[2] - target[2], eye[3] - target[3])
local x_1, x_2, x_3 = vectorNormalize(vectorCrossProduct(down[1], down[2], down[3], z_1, z_2, z_3))
local y_1, y_2, y_3 = vectorCrossProduct(z_1, z_2, z_3, x_1, x_2, x_3)
self[1], self[2], self[3], self[4] = x_1, x_2, x_3, -1*vectorDotProduct(x_1, x_2, x_3, eye[1], eye[2], eye[3])
self[5], self[6], self[7], self[8] = y_1, y_2, y_3, -1*vectorDotProduct(y_1, y_2, y_3, eye[1], eye[2], eye[3])
self[9], self[10], self[11], self[12] = z_1, z_2, z_3, -1*vectorDotProduct(z_1, z_2, z_3, eye[1], eye[2], eye[3])
self[13], self[14], self[15], self[16] = 0, 0, 0, 1
end
return newMatrix

155
g3d/model.lua Normal file
View File

@ -0,0 +1,155 @@
-- written by groverbuger for g3d
-- february 2021
-- MIT license
local newMatrix = require(G3D_PATH .. "/matrices")
local loadObjFile = require(G3D_PATH .. "/objloader")
local collisions = require(G3D_PATH .. "/collisions")
local vectors = require(G3D_PATH .. "/vectors")
local vectorCrossProduct = vectors.crossProduct
local vectorNormalize = vectors.normalize
----------------------------------------------------------------------------------------------------
-- define a model class
----------------------------------------------------------------------------------------------------
local model = {}
model.__index = model
-- define some default properties that every model should inherit
-- that being the standard vertexFormat and basic 3D shader
model.vertexFormat = {
{"VertexPosition", "float", 3},
{"VertexTexCoord", "float", 2},
{"VertexNormal", "float", 3},
{"VertexColor", "byte", 4},
}
model.shader = require(G3D_PATH .. "/shader")
-- model class imports functions from the collisions library
for key,value in pairs(collisions) do
model[key] = value
end
-- this returns a new instance of the model class
-- a model must be given a .obj file or equivalent lua table, and a texture
-- translation, rotation, and scale are all 3d vectors and are all optional
local function newModel(verts, texture, translation, rotation, scale)
local self = setmetatable({}, model)
-- if verts is a string, use it as a path to a .obj file
-- otherwise verts is a table, use it as a model defintion
if type(verts) == "string" then
verts = loadObjFile(verts)
end
assert(verts and type(verts) == "table", "Invalid vertices given to newModel")
-- if texture is a string, use it as a path to an image file
-- otherwise texture is already an image, so don't bother
if type(texture) == "string" then
texture = love.graphics.newImage(texture)
end
-- initialize my variables
self.verts = verts
self.texture = texture
self.mesh = love.graphics.newMesh(self.vertexFormat, self.verts, "triangles")
self.mesh:setTexture(self.texture)
self.matrix = newMatrix()
self:setTransform(translation or {0,0,0}, rotation or {0,0,0}, scale or {1,1,1})
self:generateAABB()
return self
end
-- populate model's normals in model's mesh automatically
-- if true is passed in, then the normals are all flipped
function model:makeNormals(isFlipped)
for i=1, #self.verts, 3 do
local vp = self.verts[i]
local v = self.verts[i+1]
local vn = self.verts[i+2]
local n_1, n_2, n_3 = vectorNormalize(vectorCrossProduct(v[1]-vp[1], v[2]-vp[2], v[3]-vp[3], vn[1]-v[1], vn[2]-v[2], vn[3]-v[3]))
local flippage = isFlipped and -1 or 1
n_1 = n_1 * flippage
n_2 = n_2 * flippage
n_3 = n_3 * flippage
vp[6], v[6], vn[6] = n_1, n_1, n_1
vp[7], v[7], vn[7] = n_2, n_2, n_2
vp[8], v[8], vn[8] = n_3, n_3, n_3
end
end
-- move and rotate given two 3d vectors
function model:setTransform(translation, rotation, scale)
self.translation = translation or self.translation
self.rotation = rotation or self.rotation
self.scale = scale or self.scale
self:updateMatrix()
end
-- move given one 3d vector
function model:setTranslation(tx,ty,tz)
self.translation[1] = tx
self.translation[2] = ty
self.translation[3] = tz
self:updateMatrix()
end
-- rotate given one 3d vector
-- using euler angles
function model:setRotation(rx,ry,rz)
self.rotation[1] = rx
self.rotation[2] = ry
self.rotation[3] = rz
self.rotation[4] = nil
self:updateMatrix()
end
-- create a quaternion from an axis and an angle
function model:setAxisAngleRotation(x,y,z,angle)
x,y,z = vectorNormalize(x,y,z)
angle = angle / 2
self.rotation[1] = x * math.sin(angle)
self.rotation[2] = y * math.sin(angle)
self.rotation[3] = z * math.sin(angle)
self.rotation[4] = math.cos(angle)
self:updateMatrix()
end
-- rotate given one quaternion
function model:setQuaternionRotation(x,y,z,w)
self.rotation[1] = x
self.rotation[2] = y
self.rotation[3] = z
self.rotation[4] = w
self:updateMatrix()
end
-- resize model's matrix based on a given 3d vector
function model:setScale(sx,sy,sz)
self.scale[1] = sx
self.scale[2] = sy or sx
self.scale[3] = sz or sx
self:updateMatrix()
end
-- update the model's transformation matrix
function model:updateMatrix()
self.matrix:setTransformationMatrix(self.translation, self.rotation, self.scale)
end
-- draw the model
function model:draw(shader)
local shader = shader or self.shader
love.graphics.setShader(shader)
shader:send("modelMatrix", self.matrix)
love.graphics.draw(self.mesh)
love.graphics.setShader()
end
return newModel

125
g3d/objloader.lua Normal file
View File

@ -0,0 +1,125 @@
-- written by groverbuger for g3d
-- february 2021
-- MIT license
----------------------------------------------------------------------------------------------------
-- simple obj loader
----------------------------------------------------------------------------------------------------
-- stitch two tables together and return the result
local function concatTables(t1,t2,t3)
local ret = {}
for i,v in ipairs(t1) do
ret[#ret +1] = v
end
for i,v in ipairs(t2) do
ret[#ret +1] = v
end
for i,v in ipairs(t3) do
ret[#ret +1] = v
end
return ret
end
-- give path of file
-- returns a lua table representation
local function objLoader(path)
local verts = {}
local faces = {}
local uvs = {}
local normals = {}
-- go line by line through the file
for line in love.filesystem.lines(path) do
local words = {}
-- split the line into words
for word in line:gmatch("([^".."%s".."]+)") do
table.insert(words, word)
end
-- if the first word in this line is a "v", then this defines a vertex
if words[1] == "v" then
verts[#verts+1] = {tonumber(words[2]), tonumber(words[3]), tonumber(words[4])}
end
-- if the first word in this line is a "vt", then this defines a texture coordinate
if words[1] == "vt" then
uvs[#uvs+1] = {tonumber(words[2]), tonumber(words[3])}
end
-- if the first word in this line is a "vn", then this defines a vertex normal
if words[1] == "vn" then
normals[#normals+1] = {tonumber(words[2]), tonumber(words[3]), tonumber(words[4])}
end
-- if the first word in this line is a "f", then this is a face
-- a face takes three arguments which refer to points, each of those points take three arguments
-- the arguments a point takes is v,vt,vn
if words[1] == "f" then
local store = {}
assert(#words == 4, "Faces in "..path.." must be triangulated before they can be used in g3d!")
for i=2, #words do
local num = ""
local word = words[i]
local ii = 1
local char = word:sub(ii,ii)
while true do
char = word:sub(ii,ii)
if char ~= "/" then
num = num .. char
else
break
end
ii = ii + 1
end
store[#store+1] = tonumber(num)
local num = ""
ii = ii + 1
while true do
char = word:sub(ii,ii)
if ii <= #word and char ~= "/" then
num = num .. char
else
break
end
ii = ii + 1
end
store[#store+1] = tonumber(num)
local num = ""
ii = ii + 1
while true do
char = word:sub(ii,ii)
if ii <= #word and char ~= "/" then
num = num .. char
else
break
end
ii = ii + 1
end
store[#store+1] = tonumber(num)
end
faces[#faces+1] = store
end
end
-- put it all together in the right order
local compiled = {}
for i,face in pairs(faces) do
compiled[#compiled +1] = concatTables(verts[face[1]], uvs[face[2]], normals[face[3]])
compiled[#compiled +1] = concatTables(verts[face[4]], uvs[face[5]], normals[face[6]])
compiled[#compiled +1] = concatTables(verts[face[7]], uvs[face[8]], normals[face[9]])
end
return compiled
end
return objLoader

35
g3d/shader.lua Normal file
View File

@ -0,0 +1,35 @@
-- written by groverbuger for g3d
-- february 2021
-- MIT license
----------------------------------------------------------------------------------------------------
-- define the 3d shader
----------------------------------------------------------------------------------------------------
-- this is what projects 3d objects onto the 2d screen
local shader = love.graphics.newShader [[
uniform mat4 projectionMatrix;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
varying vec4 vertexColor;
#ifdef VERTEX
vec4 position(mat4 transform_projection, vec4 vertex_position)
{
vertexColor = VertexColor;
return projectionMatrix * viewMatrix * modelMatrix * vertex_position;
}
#endif
#ifdef PIXEL
vec4 effect(vec4 color, Image tex, vec2 texcoord, vec2 pixcoord)
{
vec4 texcolor = Texel(tex, texcoord);
if (texcolor.a == 0.0) { discard; }
return vec4(texcolor)*color*vertexColor;
}
#endif
]]
return shader

42
g3d/vectors.lua Normal file
View File

@ -0,0 +1,42 @@
-- written by groverbuger for g3d
-- february 2021
-- MIT license
----------------------------------------------------------------------------------------------------
-- vector functions
----------------------------------------------------------------------------------------------------
-- some basic vector functions that don't use tables
-- because these functions will happen often, this is done to avoid frequent memory allocation
local vectors = {}
function vectors.subtract(v1,v2,v3, v4,v5,v6)
return v1-v4, v2-v5, v3-v6
end
function vectors.add(v1,v2,v3, v4,v5,v6)
return v1+v4, v2+v5, v3+v6
end
function vectors.scalarMultiply(scalar, v1,v2,v3)
return v1*scalar, v2*scalar, v3*scalar
end
function vectors.crossProduct(a1,a2,a3, b1,b2,b3)
return a2*b3 - a3*b2, a3*b1 - a1*b3, a1*b2 - a2*b1
end
function vectors.dotProduct(a1,a2,a3, b1,b2,b3)
return a1*b1 + a2*b2 + a3*b3
end
function vectors.normalize(x,y,z)
local mag = math.sqrt(x^2 + y^2 + z^2)
return x/mag, y/mag, z/mag
end
function vectors.magnitude(x,y,z)
return math.sqrt(x^2 + y^2 + z^2)
end
return vectors

BIN
love.dll

Binary file not shown.

BIN
lua51.dll

Binary file not shown.

118
main.lua Normal file
View File

@ -0,0 +1,118 @@
g3d = require "g3d"
function love.load()
math.randomseed(os.time())
-- GRAPHICS
-- GOOD PIXEL
love.graphics.setDefaultFilter("nearest")
-- FONTS
DefaultFont = love.graphics.newImageFont("default_font.png",
" abcdefghijklmnopqrstuvwxyz" ..
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ..
"123456789.,!?-+/():;%&`'*#=[]\"")
love.graphics.setFont(DefaultFont)
obj_list = {}
-- obj_flower_pot = g3d.newModel("objects/flower_pot.obj","objects/flower_pot/texture.png",{0,0,0},{0,0,0},{1,-1,1}),
--
generate_museum(0,0,0)
end
function love.mousemoved(x,y, dx,dy)
g3d.camera.firstPersonLook(dx,dy)
end
function love.update(dt)
g3d.camera.firstPersonMovement(dt,5)
end
function love.keypressed(key)
if key == "z" then
obj_list = {}
math.randomseed(os.time())
generate_museum(0,0,0)
end
end
function love.draw()
-- draw everything
for _, obj in pairs(obj_list) do
obj:draw()
end
-- print coords
love.graphics.print("Press [z] to generate a new museum", 20, 20)
-- print coords
love.graphics.print("x: "..math.floor(g3d.camera.position[1])..", y: "..math.floor(g3d.camera.position[2])..", z: "..math.floor(g3d.camera.position[3]), 20, 40)
end
function generate_museum(x,y,z)
local width = math.random(10,20)
local height = 4
local depth = math.random(10,20)
-- make the ground
for w = 0, width, 1 do for d = 0, depth, 1 do
table.insert(obj_list,g3d.newModel("objects/ground.obj","objects/ground/texture.png",{x+w,y,z+d},{0,0,0},{1,-1,1}))
end end
-- make the walls
for w = 0, width, 1 do for h = 0, height, 1 do
table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+w,y-h,z},{0,math.pi/2,0},{1,-1,1}))
table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+w,y-h,z+depth},{0,math.pi/2,0},{1,-1,1}))
end end
for d = 0, depth, 1 do for h = 0, height, 1 do
table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x,y-h,z+d},{0,0,0},{1,-1,1}))
table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+width,y-h,z+d},{0,0,0},{1,-1,1}))
end end
-- decorate with paintings
local art_height = 2.5
for w = 2, width-2, 4 do
random_art(x+w,y-art_height,z,0,math.pi/2,0)
random_art(x+w,y-art_height,z+depth,0,-math.pi/2,0)
end
for d = 2, depth-2, 4 do
random_art(x,y-art_height,z+d,0,-math.pi,0)
random_art(x+width,y-art_height,z+d,0,0,0)
end
-- place carpet in the middle of the room
table.insert(obj_list,g3d.newModel("objects/carpet.obj","objects/carpet/texture.png",{x+width/2, y, z+depth/2},{0,math.random(),0},{1,-1,1}))
-- place camera in the middle of the room
g3d.camera.position = {x+width/2, y-2, z+depth/2}
end
function random_art(x,y,z,rotx,roty,rotz)
local art = math.random(0,9)
if art == 0 then
-- no art :S
elseif art == 1 then
table.insert(obj_list,g3d.newModel("objects/art_9_12.obj","objects/art_9_12/eri_sueños.png",{x,y-(12/16),z},{rotx,roty,rotz},{-1,1,1}))
elseif art == 2 then
table.insert(obj_list,g3d.newModel("objects/art_1_1.obj","objects/art_1_1/yari_walk.png",{x,y-(10/16),z},{rotx,roty,rotz},{-1,1,1}))
elseif art == 3 then
table.insert(obj_list,g3d.newModel("objects/art_16_9.obj","objects/art_16_9/clareta_tira.png",{x,y-(9/16),z},{rotx,roty,rotz},{-1,1,1}))
elseif art == 4 then
table.insert(obj_list,g3d.newModel("objects/art_16_12.obj","objects/art_16_12/clareta_garden_throne.png",{x,y-(12/16),z},{rotx,roty,rotz},{-1,1,1}))
elseif art == 5 then
table.insert(obj_list,g3d.newModel("objects/art_24_16.obj","objects/art_24_16/eri_dungeon.png",{x,y-(16/16),z},{rotx,roty,rotz},{-1,1,1}))
elseif art == 6 then
table.insert(obj_list,g3d.newModel("objects/art_12_9.obj","objects/art_12_9/noe_nerielle.png",{x,y-(9/16),z},{rotx,roty,rotz},{-1,1,1}))
elseif art == 7 then
table.insert(obj_list,g3d.newModel("objects/art_1_1.obj","objects/art_1_1/yari_pumpum.png",{x,y-(10/16),z},{rotx,roty,rotz},{-1,1,1}))
elseif art == 8 then
table.insert(obj_list,g3d.newModel("objects/art_12_6.obj","objects/art_12_6/eri_sigils.png",{x,y-(6/16),z},{rotx,roty,rotz},{-1,1,1}))
elseif art == 9 then
table.insert(obj_list,g3d.newModel("objects/art_16_24.obj","objects/art_16_24/eri_ariel_with_overalls.png",{x,y-(24/16),z},{rotx,roty,rotz},{-1,1,1}))
end
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

101
objects/art_12_6.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_12_6.mtl
o cube
v 0.0625 0.875 0.8125
v 0.0625 0.875 -0.8125
v 0.0625 0 0.8125
v 0.0625 0 -0.8125
v 0 0.875 -0.8125
v 0 0.875 0.8125
v 0 0 -0.8125
v 0 0 0.8125
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1.001
vt 0 1
vt 0.999 1.001
vt 0 1
vt 0.999 1
vt 0.999 1.001
vt 0 -0.1499999999999999
vt 0 0
vt 0.999 -0.1499999999999999
vt 0 0
vt 0.999 0
vt 0.999 -0.1499999999999999
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 1 1
vt 1 0
vt 1.099 1
vt 1 0
vt 1.099 0
vt 1.099 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd eri_sigils.png
newmtl none

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

File diff suppressed because one or more lines are too long

101
objects/art_12_9.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_12_9.mtl
o cube
v 0.0625 1.25 0.8125
v 0.0625 1.25 -0.8125
v 0.0625 0 0.8125
v 0.0625 0 -0.8125
v 0 1.25 -0.8125
v 0 1.25 0.8125
v 0 0 -0.8125
v 0 0 0.8125
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1.001
vt 0 1
vt 0.999 1.001
vt 0 1
vt 0.999 1
vt 0.999 1.001
vt 0 -0.1499999999999999
vt 0 0
vt 0.999 -0.1499999999999999
vt 0 0
vt 0.999 0
vt 0.999 -0.1499999999999999
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 1 1
vt 1 0
vt 1.099 1
vt 1 0
vt 1.099 0
vt 1.099 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd noe_nerielle.png
newmtl none

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

101
objects/art_16_12.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_16_12.mtl
o cube
v 0.0625 1.625 1.0625
v 0.0625 1.625 -1.0625
v 0.0625 0 1.0625
v 0.0625 0 -1.0625
v 0 1.625 -1.0625
v 0 1.625 1.0625
v 0 0 -1.0625
v 0 0 1.0625
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1.0008173076923077
vt 0 1
vt 1 1.0008173076923077
vt 0 1
vt 1 1
vt 1 1.0008173076923077
vt 0 0.00043269230769227285
vt 0 0.0012500000000000844
vt 0.9993749999999999 0.00043269230769227285
vt 0 0.0012500000000000844
vt 0.9993749999999999 0.0012500000000000844
vt 0.9993749999999999 0.00043269230769227285
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0.995625 1
vt 0.995625 0.00043269230769227285
vt 0.9962499999999999 1
vt 0.995625 0.00043269230769227285
vt 0.9962499999999999 0.00043269230769227285
vt 0.9962499999999999 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd clareta_garden_throne.png
newmtl none

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 KiB

File diff suppressed because one or more lines are too long

101
objects/art_16_24.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_16_24.mtl
o cube
v 0.0625 3.125 1.0625
v 0.0625 3.125 -1.0625
v 0.0625 0 1.0625
v 0.0625 0 -1.0625
v 0 3.125 -1.0625
v 0 3.125 1.0625
v 0 0 -1.0625
v 0 0 1.0625
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1.0008173076923077
vt 0 1
vt 1 1.0008173076923077
vt 0 1
vt 1 1
vt 1 1.0008173076923077
vt 0 0.00043269230769227285
vt 0 0.0012499999999999734
vt 0.9993749999999999 0.00043269230769227285
vt 0 0.0012499999999999734
vt 0.9993749999999999 0.0012499999999999734
vt 0.9993749999999999 0.00043269230769227285
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0.995625 1
vt 0.995625 0.00043269230769227285
vt 0.9962499999999999 1
vt 0.995625 0.00043269230769227285
vt 0.9962499999999999 0.00043269230769227285
vt 0.9962499999999999 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd eri_ariel_with_overalls.png
newmtl none

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 KiB

File diff suppressed because one or more lines are too long

101
objects/art_16_9.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_16_9.mtl
o cube
v 0.0625 1.3125 1.0625
v 0.0625 1.3125 -1.0625
v 0.0625 0.0625 1.0625
v 0.0625 0.0625 -1.0625
v 0 1.3125 -1.0625
v 0 1.3125 1.0625
v 0 0.0625 -1.0625
v 0 0.0625 1.0625
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0.16176470588235295 0
vt 0.16176470588235295 0.039166666666666794
vt 0.8230392156862746 0
vt 0.16176470588235295 0.039166666666666794
vt 0.8230392156862746 0.039166666666666794
vt 0.8230392156862746 0
vt 0.18774509803921569 1
vt 0.18774509803921569 1
vt 0.75 1
vt 0.18774509803921569 1
vt 0.75 1
vt 0.75 1
vt 0.18186274509803924 0
vt 0.18186274509803924 0.013333333333333308
vt 0.7441176470588236 0
vt 0.18186274509803924 0.013333333333333308
vt 0.7441176470588236 0.013333333333333308
vt 0.7441176470588236 0
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0.996078431372549 0.8300000000000001
vt 0.996078431372549 0.08000000000000007
vt 0.9965686274509804 0.8300000000000001
vt 0.996078431372549 0.08000000000000007
vt 0.9965686274509804 0.08000000000000007
vt 0.9965686274509804 0.8300000000000001
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd clareta_tira.png
newmtl none

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

File diff suppressed because one or more lines are too long

101
objects/art_1_1.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_1_1.mtl
o cube
v 0.0625 1.3125 0.625
v 0.0625 1.3125 -0.625
v 0.0625 0.0625 0.625
v 0.0625 0.0625 -0.625
v 0 1.3125 -0.625
v 0 1.3125 0.625
v 0 0.0625 -0.625
v 0 0.0625 0.625
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0.16176470588235295 0
vt 0.16176470588235295 0.039166666666666794
vt 0.8230392156862745 0
vt 0.16176470588235295 0.039166666666666794
vt 0.8230392156862745 0.039166666666666794
vt 0.8230392156862745 0
vt 0.1877450980392157 1
vt 0.1877450980392157 1
vt 0.75 1
vt 0.1877450980392157 1
vt 0.75 1
vt 0.75 1
vt 0.18186274509803924 0
vt 0.18186274509803924 0.013333333333333308
vt 0.7441176470588236 0
vt 0.18186274509803924 0.013333333333333308
vt 0.7441176470588236 0.013333333333333308
vt 0.7441176470588236 0
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0.996078431372549 0.8300000000000001
vt 0.996078431372549 0.08000000000000007
vt 0.9965686274509805 0.8300000000000001
vt 0.996078431372549 0.08000000000000007
vt 0.9965686274509805 0.08000000000000007
vt 0.9965686274509805 0.8300000000000001
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd yari_walk.png
newmtl none

View File

@ -0,0 +1 @@
{"meta":{"format_version":"3.6","creation_time":1615816586,"model_format":"free","box_uv":false},"name":"model","geometry_name":"","visible_box":[1,1,0],"resolution":{"width":10,"height":10},"elements":[{"name":"cube","from":[0,1,-10],"to":[1,21,10],"autouv":0,"color":3,"locked":false,"origin":[0,19,0],"faces":{"north":{"uv":[9.96078431372549,1.7,9.965686274509805,9.2],"texture":0},"east":{"uv":[0,0,10,10],"texture":0},"south":{"uv":[0,0,0,10],"texture":0},"west":{"uv":[1.6176470588235294,10,8.230392156862745,9.608333333333333],"texture":0},"up":{"uv":[1.877450980392157,0,7.5,0],"texture":0},"down":{"uv":[1.8186274509803924,10,7.4411764705882355,9.866666666666667],"texture":0}},"uuid":"8f7eaaee-1bd1-2983-c07d-cc5f83205924"}],"outliner":["8f7eaaee-1bd1-2983-c07d-cc5f83205924"],"textures":[{"path":"/home/maelys/Projects/Love2D/3d/objects/art_1_1/yari_walk.png","name":"yari_walk.png","folder":"art_1_1","namespace":"","id":"0","particle":false,"visible":true,"mode":"bitmap","saved":true,"uuid":"02f9cbf2-2e6e-b6e8-d1d7-c0df3cb18d1d","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADsUlEQVR4Xu2bP2jXQBTHLz/xh/8V/yA4iuiqgqAIouAmOnWp4uTgKNbBxU0XB4uOTk7apYu6CC1UBHFwEeymOBa0VupfaoOJvOvvhcv97nJ3v7yXNvklS5vkcrnvJ9/33h35JUrTNBVDvEUtgNYBbQi0OWCIc6AgS4Lzz/eKPec/144lCQAQjxs1BOybul8cLzkA6JhqsCpYyn5Vm7IA0Ad79fQ+ec+HL+dyIWI6rovmcharA1SV4AaTUDymgqlaPNybzQEqhFv31mW76AIdgE08l/VJHQCdFQlQAdy58U/mCAQQdTri9vXYWj2o8ontBiQOCAUA7REKACnaagPAB4JLrAlEYwAMOkOqFQCXC0IhcIsnqwIozJQIUUQaL4qvLw7lGMhzSSySv1/EwvTRPj61B2ASYJvaJktzYmHqSAahCvHsDkARu3ftFHG8Uuq+//gpSyae275tayYaz3HP/lSrsZZBEKkKxBt/fLxJArCdawwAEHLw8pJIkiSDvqEbidlHG+X+gUt/+uIe4KgbdyiwOgCF6EJVkUXn4PraAAgpgZOTOySbkZFFZ2VsHAAUj8pdEGoFwMcFjQfgAwHa+IQB99MnnweoAa3PCnXBrv0qEiArAN0JuvVt2U/NCbV2gBQ4Oi7/zF+868z28ok/uSnbViEcB0Q2D+hT2BOPx4sggPDcNjHmBYyiUWUAggdbEYRKAMwcOyv1n3k77c+h1gAU+6P4IAAF4qlflvA4wAOA7orcvgUAx3uDSgGcfPdKhsDrw6eyUICwMLpEg8D13oAegJb9VXGgGiAUAchCRQFQJB5JDlo6VwVAN17OnrrugFyu6EGoNQAQpLoAHKAD0Ntk1WJirPCNk1pS1oYDDPYPKX195bLOAGzlzzYnsCVCTvvTL4Yc5c8kEo6hS9T/g9YQJX6aw5YE9exvKnfL67t9FUGfKroWUoPGPu9iaHQ8l/gws/uUxBAAZcXTh0Bv9Bi3sx+mcmuAUACFK8gStlch04eA5ccSsOTVyyEOBCZGarWwCad44rrDyAH4ZG3/JeFKSw7hbDng28xxce7Ke9HpRCJJUhFFQjy9vyVUM6to1hA4sX+zUeyzB/4QOJ84awjYxONNAQKIc4VJswBEQoje79HffPotWQCAC9d+GZ2CbYJjZsALSJOgywEozrfdgJqCLiMFAHcuEucLAPqpygnkAHzwuxzQAmi6A3xDxcdNZdusSgiUHTTl9S2A9sPJ9sPJ9sPJ9sNJyqxat76Gvgr8B9wNv1+cgMVeAAAAAElFTkSuQmCC"}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

101
objects/art_24_16.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_24_16.mtl
o cube
v 0.0625 2.125 1.5625
v 0.0625 2.125 -1.5625
v 0.0625 0 1.5625
v 0.0625 0 -1.5625
v 0 2.125 -1.5625
v 0 2.125 1.5625
v 0 0 -1.5625
v 0 0 1.5625
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1.0008173076923077
vt 0 1
vt 1 1.0008173076923077
vt 0 1
vt 1 1
vt 1 1.0008173076923077
vt 0 0.00043269230769227285
vt 0 0.0012500000000000844
vt 0.9993749999999999 0.00043269230769227285
vt 0 0.0012500000000000844
vt 0.9993749999999999 0.0012500000000000844
vt 0.9993749999999999 0.00043269230769227285
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0.995625 1
vt 0.995625 0.00043269230769227285
vt 0.9962499999999999 1
vt 0.995625 0.00043269230769227285
vt 0.9962499999999999 0.00043269230769227285
vt 0.9962499999999999 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd eri_dungeon.png
newmtl none

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

File diff suppressed because one or more lines are too long

101
objects/art_9_12.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_12_9.mtl
o cube
v 0.0625 1.625 0.625
v 0.0625 1.625 -0.625
v 0.0625 0 0.625
v 0.0625 0 -0.625
v 0 1.625 -0.625
v 0 1.625 0.625
v 0 0 -0.625
v 0 0 0.625
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1
vt 0 1.001
vt 0 1
vt 0.999 1.001
vt 0 1
vt 0.999 1
vt 0.999 1.001
vt 0 -0.1499999999999999
vt 0 0
vt 0.999 -0.1499999999999999
vt 0 0
vt 0.999 0
vt 0.999 -0.1499999999999999
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 1 1
vt 1 0
vt 1.099 1
vt 1 0
vt 1.099 0
vt 1.099 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd eri_painting.png
newmtl none

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

File diff suppressed because one or more lines are too long

101
objects/carpet.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib carpet.mtl
o cube
v 1 0.0625 2
v 1 0.0625 -2
v 1 0 2
v 1 0 -2
v -1 0.0625 -2
v -1 0.0625 2
v -1 0 -2
v -1 0 2
vt 0.96875 1
vt 0.96875 0
vt 1 1
vt 0.96875 0
vt 1 0
vt 1 1
vt 0 1
vt 0 0
vt 0.03125 1
vt 0 0
vt 0.03125 0
vt 0.03125 1
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 0.015625
vt 0 0
vt 1 0.015625
vt 0 0
vt 1 0
vt 1 0.015625
vt 0 1
vt 0 0.984375
vt 1 1
vt 0 0.984375
vt 1 0.984375
vt 1 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd texture.png
newmtl none

View File

@ -0,0 +1 @@
{"meta":{"format_version":"3.6","creation_time":1615796434,"model_format":"free","box_uv":false},"name":"carpet","geometry_name":"","visible_box":[1,1,0],"resolution":{"width":16,"height":32},"elements":[{"name":"cube","from":[-16,0,-32],"to":[16,1,32],"autouv":0,"color":5,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,16,0.5],"texture":0},"east":{"uv":[15.5,0,16,32],"texture":0},"south":{"uv":[0,31.5,16,32],"texture":0},"west":{"uv":[0,0,0.5,32],"texture":0},"up":{"uv":[0,0,16,32],"texture":0},"down":{"uv":[0,0,16,32],"texture":0}},"uuid":"a26d98c3-7faf-7a10-8f9b-c71086b96d3e"}],"outliner":["a26d98c3-7faf-7a10-8f9b-c71086b96d3e"],"textures":[{"path":"/home/maelys/Projects/Love2D/3d/objects/carpet/texture.png","name":"texture.png","folder":"carpet","namespace":"","id":"0","particle":false,"visible":true,"mode":"bitmap","saved":true,"uuid":"8fcbb96f-84a5-8132-d586-c7111d97fbfa","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAABACAYAAAB7jnWuAAACeUlEQVRoQ+1ZMU4EMQxcGjpAAtEgXoCERMNnqHkWNR9C4gWIBoEEdDQgR5po4rMTZ7lVtthr7va08YwdexInB7fTze808HPABK5PrwoqTx/P6fny5CL///L5mn4fHx4V7379fLvvenZlQCJwPp2lwW/Te/ruIQIWFknPDuMVBGCshwiHAdFpATNOngKwYoNRIr3AHO1EQMIHI3OIRD1mYGBmAvB8DhGMRdLWnNC5skMgSsTyOgrMGEUZMrsWEckPkBDPNTjyp2YzlyFq2qplj4hHIALMeEUEegWRI9A7Fu8nAsJIvNfhaiVkbQp0xmu9AGaOgKVkVlKxiLQIaGGzMMwyrAHDs2gVaGGrlqGE3ANHcllrhdYBea7ZAQnBKyLgEeCMt8C8BczTBZNAFBxqdz/dFYn/MD3urKSWPmAKd6Q4QkAMamBdfkKklZwS0YJATw1HCPTYK1ZDb87YowiB7gggHC0C4tliOSDGI3mwWBXUCLCsLqoDLRKWDHNEIgpqKqEYGboWrGI17KldvLu3/YCeAuSCfHu7JakYJsD6XhsH8thrJCESQ1YbxkSszYpFQAN4mxxgZgK6vq3NJBOKtG88rVbzIk7nHVHLoDaAiHn5oKfEs58IiL7zKsbMAaQTrrUc63HaJjDXQcDb0XB1LDoFPD9eNejsbuWM1pVqEg4vw+FCNEeGOW90SfbY21qzrTXbWrN1NCY9dRvpjHrsrSMCW2vG26ehRzRbazb0oLKndvfemq3msHrYcX0PsITfO7icfWERPZzwLrF0XxklUhzVto7ma83Lvy+txPic27JoA1qzvY6Ly+FXt1pYaocVi1xez1HBfY35A/pA4W5FQiY4AAAAAElFTkSuQmCC"}]}

BIN
objects/carpet/texture.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

299
objects/flower_pot.obj Normal file
View File

@ -0,0 +1,299 @@
# Made in Blockbench 3.7.4
mtllib flower_pot-.mtl
o cube
v 0.125 0.3125 0.1875
v 0.125 0.3125 -0.125
v 0.125 0 0.1875
v 0.125 0 -0.125
v -0.1875 0.3125 -0.125
v -0.1875 0.3125 0.1875
v -0.1875 0 -0.125
v -0.1875 0 0.1875
vt 0 0.5625
vt 0 0.25
vt 0.3125 0.5625
vt 0 0.25
vt 0.3125 0.25
vt 0.3125 0.5625
vt 0 0.5625
vt 0 0.25
vt 0.3125 0.5625
vt 0 0.25
vt 0.3125 0.25
vt 0.3125 0.5625
vt 0 0.9375
vt 0 0.625
vt 0.3125 0.9375
vt 0 0.625
vt 0.3125 0.625
vt 0.3125 0.9375
vt 0 0.5625
vt 0 0.25
vt 0.3125 0.5625
vt 0 0.25
vt 0.3125 0.25
vt 0.3125 0.5625
vt 0 0.5625
vt 0 0.25
vt 0.3125 0.5625
vt 0 0.25
vt 0.3125 0.25
vt 0.3125 0.5625
vt 0 0.5625
vt 0 0.25
vt 0.3125 0.5625
vt 0 0.25
vt 0.3125 0.25
vt 0.3125 0.5625
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36
o cube
v 0.08351506329462022 0.6875 -0.08253832729865353
v 0.08347086912079607 0.6875 -0.08258252147247767
v 0.08351506329462022 0.3125 -0.08253832729865353
v 0.08347086912079607 0.3125 -0.08258252147247767
v -0.1375 0.6875 0.13838834764831842
v -0.13745580582617586 0.6875 0.1384325418221426
v -0.1375 0.3125 0.13838834764831842
v -0.13745580582617586 0.3125 0.1384325418221426
vt 0 1
vt 0 0.625
vt 0 1
vt 0 0.625
vt 0 0.625
vt 0 1
vt 0 1
vt 0 0.625
vt 0 1
vt 0 0.625
vt 0 0.625
vt 0 1
vt 0 1
vt 0 1
vt 0.3125 1
vt 0 1
vt 0.3125 1
vt 0.3125 1
vt 0 1
vt 0 1
vt 0.3125 1
vt 0 1
vt 0.3125 1
vt 0.3125 1
vt 0.375 0.9375
vt 0.375 0.5625
vt 0.6875 0.9375
vt 0.375 0.5625
vt 0.6875 0.5625
vt 0.6875 0.9375
vt 0.375 0.9375
vt 0.375 0.5625
vt 0.6875 0.9375
vt 0.375 0.5625
vt 0.6875 0.5625
vt 0.6875 0.9375
vn 0.7071067811865475 0 -0.7071067811865476
vn 0.7071067811865475 0 -0.7071067811865476
vn 0.7071067811865475 0 -0.7071067811865476
vn 0.7071067811865475 0 -0.7071067811865476
vn 0.7071067811865475 0 -0.7071067811865476
vn 0.7071067811865475 0 -0.7071067811865476
vn -0.7071067811865475 0 0.7071067811865476
vn -0.7071067811865475 0 0.7071067811865476
vn -0.7071067811865475 0 0.7071067811865476
vn -0.7071067811865475 0 0.7071067811865476
vn -0.7071067811865475 0 0.7071067811865476
vn -0.7071067811865475 0 0.7071067811865476
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0.7071067811865476 0 0.7071067811865475
vn 0.7071067811865476 0 0.7071067811865475
vn 0.7071067811865476 0 0.7071067811865475
vn 0.7071067811865476 0 0.7071067811865475
vn 0.7071067811865476 0 0.7071067811865475
vn 0.7071067811865476 0 0.7071067811865475
vn -0.7071067811865476 0 -0.7071067811865475
vn -0.7071067811865476 0 -0.7071067811865475
vn -0.7071067811865476 0 -0.7071067811865475
vn -0.7071067811865476 0 -0.7071067811865475
vn -0.7071067811865476 0 -0.7071067811865475
vn -0.7071067811865476 0 -0.7071067811865475
usemtl m_0
f 9/37/37 11/38/38 10/39/39
f 11/40/40 12/41/41 10/42/42
usemtl m_0
f 13/43/43 15/44/44 14/45/45
f 15/46/46 16/47/47 14/48/48
usemtl m_0
f 13/49/49 14/50/50 10/51/51
f 14/52/52 9/53/53 10/54/54
usemtl m_0
f 16/55/55 15/56/56 11/57/57
f 15/58/58 12/59/59 11/60/60
usemtl m_0
f 14/61/61 16/62/62 9/63/63
f 16/64/64 11/65/65 9/66/66
usemtl m_0
f 10/67/67 12/68/68 13/69/69
f 12/70/70 15/71/71 13/72/72
o cube
v -0.13477497965033508 0.6875 -0.08262671564630182
v -0.13481917382415923 0.6875 -0.08258252147247767
v -0.13477497965033508 0.3125 -0.08262671564630182
v -0.13481917382415923 0.3125 -0.08258252147247767
v 0.08615169529663685 0.6875 0.13838834764831848
v 0.08619588947046103 0.6875 0.1383441534744943
v 0.08615169529663685 0.3125 0.13838834764831848
v 0.08619588947046103 0.3125 0.1383441534744943
vt 0 1
vt 0 0.625
vt 0 1
vt 0 0.625
vt 0 0.625
vt 0 1
vt 0 1
vt 0 0.625
vt 0 1
vt 0 0.625
vt 0 0.625
vt 0 1
vt 0 1
vt 0 1
vt 0.3125 1
vt 0 1
vt 0.3125 1
vt 0.3125 1
vt 0 1
vt 0 1
vt 0.3125 1
vt 0 1
vt 0.3125 1
vt 0.3125 1
vt 0.375 0.9375
vt 0.375 0.5625
vt 0.6875 0.9375
vt 0.375 0.5625
vt 0.6875 0.5625
vt 0.6875 0.9375
vt 0.375 0.9375
vt 0.375 0.5625
vt 0.6875 0.9375
vt 0.375 0.5625
vt 0.6875 0.5625
vt 0.6875 0.9375
vn -0.7071067811865475 0 -0.7071067811865477
vn -0.7071067811865475 0 -0.7071067811865477
vn -0.7071067811865475 0 -0.7071067811865477
vn -0.7071067811865475 0 -0.7071067811865477
vn -0.7071067811865475 0 -0.7071067811865477
vn -0.7071067811865475 0 -0.7071067811865477
vn 0.7071067811865475 0 0.7071067811865477
vn 0.7071067811865475 0 0.7071067811865477
vn 0.7071067811865475 0 0.7071067811865477
vn 0.7071067811865475 0 0.7071067811865477
vn 0.7071067811865475 0 0.7071067811865477
vn 0.7071067811865475 0 0.7071067811865477
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0.7071067811865477 0 -0.7071067811865475
vn 0.7071067811865477 0 -0.7071067811865475
vn 0.7071067811865477 0 -0.7071067811865475
vn 0.7071067811865477 0 -0.7071067811865475
vn 0.7071067811865477 0 -0.7071067811865475
vn 0.7071067811865477 0 -0.7071067811865475
vn -0.7071067811865477 0 0.7071067811865475
vn -0.7071067811865477 0 0.7071067811865475
vn -0.7071067811865477 0 0.7071067811865475
vn -0.7071067811865477 0 0.7071067811865475
vn -0.7071067811865477 0 0.7071067811865475
vn -0.7071067811865477 0 0.7071067811865475
usemtl none
f 17/73/73 19/74/74 18/75/75
f 19/76/76 20/77/77 18/78/78
usemtl none
f 21/79/79 23/80/80 22/81/81
f 23/82/82 24/83/83 22/84/84
usemtl none
f 21/85/85 22/86/86 18/87/87
f 22/88/88 17/89/89 18/90/90
usemtl none
f 24/91/91 23/92/92 19/93/93
f 23/94/94 20/95/95 19/96/96
usemtl m_0
f 22/97/97 24/98/98 17/99/99
f 24/100/100 19/101/101 17/102/102
usemtl m_0
f 18/103/103 20/104/104 21/105/105
f 20/106/106 23/107/107 21/108/108

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd texture.png
newmtl none

View File

@ -0,0 +1 @@
{"meta":{"format_version":"3.6","creation_time":1615782816,"model_format":"free","box_uv":false},"name":"test","geometry_name":"","visible_box":[1,1,0],"resolution":{"width":16,"height":16},"elements":[{"name":"cube","from":[-3,0,-2],"to":[2,5,3],"autouv":0,"color":7,"locked":false,"origin":[-1,9,0],"faces":{"north":{"uv":[0,7,5,12],"texture":0},"east":{"uv":[0,7,5,12],"texture":0},"south":{"uv":[0,7,5,12],"texture":0},"west":{"uv":[0,7,5,12],"texture":0},"up":{"uv":[0,1,5,6],"texture":0},"down":{"uv":[0,7,5,12],"texture":0}},"uuid":"4d0300ac-09a2-afd9-72ee-36d03e2108f8"},{"name":"cube","from":[-3.2,5,1.7999999999999998],"to":[1.7999999999999998,11,1.7999999999999998],"autouv":0,"color":7,"locked":false,"rotation":[0,45,0],"origin":[-2.2,5,0.8],"faces":{"north":{"uv":[6,1,11,7],"texture":0},"east":{"uv":[0,0,0,6],"texture":0},"south":{"uv":[6,1,11,7],"texture":0},"west":{"uv":[0,0,0,6],"texture":0},"up":{"uv":[0,0,5,0],"texture":0},"down":{"uv":[0,0,5,0],"texture":0}},"uuid":"14571871-9d91-4674-8945-cd178018ffc0"},{"name":"cube","from":[-4.45,5,1.7999999999999998],"to":[0.5499999999999998,11,1.7999999999999998],"autouv":0,"color":7,"locked":false,"rotation":[0,135,0],"origin":[-1.4500000000000002,5,0.8],"faces":{"north":{"uv":[6,1,11,7],"texture":0},"east":{"uv":[0,0,0,6]},"south":{"uv":[6,1,11,7],"texture":0},"west":{"uv":[0,0,0,6]},"up":{"uv":[0,0,5,0]},"down":{"uv":[0,0,5,0]}},"uuid":"3c95e525-722d-ee73-e12f-8875d3877fa9"}],"outliner":["4d0300ac-09a2-afd9-72ee-36d03e2108f8","14571871-9d91-4674-8945-cd178018ffc0","3c95e525-722d-ee73-e12f-8875d3877fa9"],"textures":[{"path":"/home/maelys/Projects/Love2D/ERDD/texture.png","name":"texture.png","folder":"ERDD","namespace":"","id":"0","particle":false,"visible":true,"mode":"bitmap","saved":true,"uuid":"bfdebd64-874a-7025-93b8-ad46de1998a4","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAbElEQVQ4T2NkoBAwCnMx/0c34+23v4wgsf///8PlGBkZwWLogLABIH3//zOQbwDUSrIMAOv9z/CfgZEBq/NB0ni9QJQBOCMBZjM6jaaB0UxJECMWTt17j9PJGLEwagDu+CU2ixAd2rgMHHgDAM24QBFzHzMyAAAAAElFTkSuQmCC"}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

101
objects/ground.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib ground.mtl
o cube
v 0.5 0.0000625 0.5
v 0.5 0.0000625 -0.5
v 0.5 0 0.5
v 0.5 0 -0.5
v -0.5625 0.0000625 -0.5
v -0.5625 0.0000625 0.5
v -0.5625 0 -0.5
v -0.5625 0 0.5
vt 0 1
vt 0 1
vt 1 1
vt 0 1
vt 1 1
vt 1 1
vt 0 1
vt 0 1
vt 1 1
vt 0 1
vt 1 1
vt 1 1
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 1
vt 1 1
vt 0 1
vt 1 1
vt 1 1
vt 0 1
vt 0 1
vt 1 1
vt 0 1
vt 1 1
vt 1 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl none
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl none
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl none
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl none
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd texture
newmtl none

View File

@ -0,0 +1 @@
{"meta":{"format_version":"3.6","creation_time":1615807761,"model_format":"free","box_uv":false},"name":"","geometry_name":"","visible_box":[1,1,0],"resolution":{"width":16,"height":16},"elements":[{"name":"cube","from":[-9,0,-8],"to":[8,0,8],"autouv":1,"color":3,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,16,0]},"east":{"uv":[0,0,16,0]},"south":{"uv":[0,0,16,0]},"west":{"uv":[0,0,16,0]},"up":{"uv":[0,0,16,16],"texture":0},"down":{"uv":[0,0,16,16],"texture":0}},"uuid":"28a077e3-d74e-0c37-296d-aa08fa8ff180"}],"outliner":["28a077e3-d74e-0c37-296d-aa08fa8ff180"],"textures":[{"path":"","name":"texture","folder":"block","namespace":"","id":"0","particle":false,"visible":true,"mode":"bitmap","saved":false,"uuid":"009edd2c-05b2-2b02-3976-13c4215221dc","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAY0lEQVQ4T2MM1uP4L837nwEE/v35Caaff+cA0zCAT54xx5zhPxMLO1jt518o+hi4mSAG4pOnjgGkOBnkImQvgV1AkQGJpuyQEGRgIMrP6GHCSLEBFEcjxQaMpgMGyqNxwNMBADyyqbH2FrfXAAAAAElFTkSuQmCC"}]}

BIN
objects/ground/texture.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

497
objects/stairs.obj Normal file
View File

@ -0,0 +1,497 @@
# Made in Blockbench 3.7.4
mtllib stairs.mtl
o cube
v -0.4277133677773932 0.4883275019814831 0.0625
v -0.4277133677773932 0.4883275019814831 -0.0625
v 0.4592974654008285 0.026578888746449238 0.0625
v 0.4592974654008285 0.026578888746449238 -0.0625
v -0.4854319444317725 0.3774511478342054 -0.0625
v -0.4854319444317725 0.3774511478342054 0.0625
v 0.40157888874644926 -0.08429746540082847 -0.0625
v 0.40157888874644926 -0.08429746540082847 0.0625
vt 0.9375 1
vt 0.9375 0.5
vt 1 1
vt 0.9375 0.5
vt 1 0.5
vt 1 1
vt 0.9375 1
vt 0.9375 0.5
vt 1 1
vt 0.9375 0.5
vt 1 0.5
vt 1 1
vt 0.9375 0.8125
vt 0.9375 0.75
vt 1 0.8125
vt 0.9375 0.75
vt 1 0.75
vt 1 0.8125
vt 0.9375 0.8125
vt 0.9375 0.75
vt 1 0.8125
vt 0.9375 0.75
vt 1 0.75
vt 1 0.8125
vt 0.9375 1
vt 0.9375 0.5
vt 1 1
vt 0.9375 0.5
vt 1 0.5
vt 1 1
vt 0.9375 1
vt 0.9375 0.5
vt 1 1
vt 0.9375 0.5
vt 1 0.5
vt 1 1
vn 0.4617486132350339 0.8870108331782217 0
vn 0.4617486132350339 0.8870108331782217 0
vn 0.4617486132350339 0.8870108331782217 0
vn 0.4617486132350339 0.8870108331782217 0
vn 0.4617486132350339 0.8870108331782217 0
vn 0.4617486132350339 0.8870108331782217 0
vn -0.4617486132350339 -0.8870108331782217 0
vn -0.4617486132350339 -0.8870108331782217 0
vn -0.4617486132350339 -0.8870108331782217 0
vn -0.4617486132350339 -0.8870108331782217 0
vn -0.4617486132350339 -0.8870108331782217 0
vn -0.4617486132350339 -0.8870108331782217 0
vn -0.8870108331782217 0.4617486132350339 0
vn -0.8870108331782217 0.4617486132350339 0
vn -0.8870108331782217 0.4617486132350339 0
vn -0.8870108331782217 0.4617486132350339 0
vn -0.8870108331782217 0.4617486132350339 0
vn -0.8870108331782217 0.4617486132350339 0
vn 0.8870108331782217 -0.4617486132350339 0
vn 0.8870108331782217 -0.4617486132350339 0
vn 0.8870108331782217 -0.4617486132350339 0
vn 0.8870108331782217 -0.4617486132350339 0
vn 0.8870108331782217 -0.4617486132350339 0
vn 0.8870108331782217 -0.4617486132350339 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36
o cube
v -0.1875 0.5 0.5
v -0.1875 0.5 -0.5
v -0.1875 0.4375 0.5
v -0.1875 0.4375 -0.5
v -0.5 0.5 -0.5
v -0.5 0.5 0.5
v -0.5 0.4375 -0.5
v -0.5 0.4375 0.5
vt 0 1
vt 0 0.5
vt 0.15625 1
vt 0 0.5
vt 0.15625 0.5
vt 0.15625 1
vt 0 1
vt 0 0.5
vt 0.15625 1
vt 0 0.5
vt 0.15625 0.5
vt 0.15625 1
vt 0 1
vt 0 0.5
vt 0.15625 1
vt 0 0.5
vt 0.15625 0.5
vt 0.15625 1
vt 0 1
vt 0 0.5
vt 0.15625 1
vt 0 0.5
vt 0.15625 0.5
vt 0.15625 1
vt 0 1
vt 0 0.5
vt 0.15625 1
vt 0 0.5
vt 0.15625 0.5
vt 0.15625 1
vt 0 1
vt 0 0.5
vt 0.15625 1
vt 0 0.5
vt 0.15625 0.5
vt 0.15625 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 9/37/37 11/38/38 10/39/39
f 11/40/40 12/41/41 10/42/42
usemtl m_0
f 13/43/43 15/44/44 14/45/45
f 15/46/46 16/47/47 14/48/48
usemtl m_0
f 13/49/49 14/50/50 10/51/51
f 14/52/52 9/53/53 10/54/54
usemtl m_0
f 16/55/55 15/56/56 11/57/57
f 15/58/58 12/59/59 11/60/60
usemtl m_0
f 14/61/61 16/62/62 9/63/63
f 16/64/64 11/65/65 9/66/66
usemtl m_0
f 10/67/67 12/68/68 13/69/69
f 12/70/70 15/71/71 13/72/72
o cube
v 0.0625 0.375 0.5
v 0.0625 0.375 -0.5
v 0.0625 0.3125 0.5
v 0.0625 0.3125 -0.5
v -0.1875 0.375 -0.5
v -0.1875 0.375 0.5
v -0.1875 0.3125 -0.5
v -0.1875 0.3125 0.5
vt 0.125 1
vt 0.125 0.5
vt 0.28125 1
vt 0.125 0.5
vt 0.28125 0.5
vt 0.28125 1
vt 0.125 1
vt 0.125 0.5
vt 0.28125 1
vt 0.125 0.5
vt 0.28125 0.5
vt 0.28125 1
vt 0.125 1
vt 0.125 0.5
vt 0.28125 1
vt 0.125 0.5
vt 0.28125 0.5
vt 0.28125 1
vt 0.125 1
vt 0.125 0.5
vt 0.28125 1
vt 0.125 0.5
vt 0.28125 0.5
vt 0.28125 1
vt 0.125 1
vt 0.125 0.5
vt 0.28125 1
vt 0.125 0.5
vt 0.28125 0.5
vt 0.28125 1
vt 0.125 1
vt 0.125 0.5
vt 0.28125 1
vt 0.125 0.5
vt 0.28125 0.5
vt 0.28125 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 17/73/73 19/74/74 18/75/75
f 19/76/76 20/77/77 18/78/78
usemtl m_0
f 21/79/79 23/80/80 22/81/81
f 23/82/82 24/83/83 22/84/84
usemtl m_0
f 21/85/85 22/86/86 18/87/87
f 22/88/88 17/89/89 18/90/90
usemtl m_0
f 24/91/91 23/92/92 19/93/93
f 23/94/94 20/95/95 19/96/96
usemtl m_0
f 22/97/97 24/98/98 17/99/99
f 24/100/100 19/101/101 17/102/102
usemtl m_0
f 18/103/103 20/104/104 21/105/105
f 20/106/106 23/107/107 21/108/108
o cube
v 0.3125 0.25 0.5
v 0.3125 0.25 -0.5
v 0.3125 0.1875 0.5
v 0.3125 0.1875 -0.5
v 0.0625 0.25 -0.5
v 0.0625 0.25 0.5
v 0.0625 0.1875 -0.5
v 0.0625 0.1875 0.5
vt 0.25 1
vt 0.25 0.5
vt 0.40625 1
vt 0.25 0.5
vt 0.40625 0.5
vt 0.40625 1
vt 0.25 1
vt 0.25 0.5
vt 0.40625 1
vt 0.25 0.5
vt 0.40625 0.5
vt 0.40625 1
vt 0.25 1
vt 0.25 0.5
vt 0.40625 1
vt 0.25 0.5
vt 0.40625 0.5
vt 0.40625 1
vt 0.25 1
vt 0.25 0.5
vt 0.40625 1
vt 0.25 0.5
vt 0.40625 0.5
vt 0.40625 1
vt 0.25 1
vt 0.25 0.5
vt 0.40625 1
vt 0.25 0.5
vt 0.40625 0.5
vt 0.40625 1
vt 0.25 1
vt 0.25 0.5
vt 0.40625 1
vt 0.25 0.5
vt 0.40625 0.5
vt 0.40625 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 25/109/109 27/110/110 26/111/111
f 27/112/112 28/113/113 26/114/114
usemtl m_0
f 29/115/115 31/116/116 30/117/117
f 31/118/118 32/119/119 30/120/120
usemtl m_0
f 29/121/121 30/122/122 26/123/123
f 30/124/124 25/125/125 26/126/126
usemtl m_0
f 32/127/127 31/128/128 27/129/129
f 31/130/130 28/131/131 27/132/132
usemtl m_0
f 30/133/133 32/134/134 25/135/135
f 32/136/136 27/137/137 25/138/138
usemtl m_0
f 26/139/139 28/140/140 29/141/141
f 28/142/142 31/143/143 29/144/144
o cube
v 0.5 0.125 0.5
v 0.5 0.125 -0.5
v 0.5 0.0625 0.5
v 0.5 0.0625 -0.5
v 0.3125 0.125 -0.5
v 0.3125 0.125 0.5
v 0.3125 0.0625 -0.5
v 0.3125 0.0625 0.5
vt 0.375 1
vt 0.375 0.5
vt 0.53125 1
vt 0.375 0.5
vt 0.53125 0.5
vt 0.53125 1
vt 0.375 1
vt 0.375 0.5
vt 0.53125 1
vt 0.375 0.5
vt 0.53125 0.5
vt 0.53125 1
vt 0.375 1
vt 0.375 0.5
vt 0.53125 1
vt 0.375 0.5
vt 0.53125 0.5
vt 0.53125 1
vt 0.375 1
vt 0.375 0.5
vt 0.53125 1
vt 0.375 0.5
vt 0.53125 0.5
vt 0.53125 1
vt 0.375 1
vt 0.375 0.5
vt 0.53125 1
vt 0.375 0.5
vt 0.53125 0.5
vt 0.53125 1
vt 0.375 1
vt 0.375 0.5
vt 0.53125 1
vt 0.375 0.5
vt 0.53125 0.5
vt 0.53125 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 33/145/145 35/146/146 34/147/147
f 35/148/148 36/149/149 34/150/150
usemtl m_0
f 37/151/151 39/152/152 38/153/153
f 39/154/154 40/155/155 38/156/156
usemtl m_0
f 37/157/157 38/158/158 34/159/159
f 38/160/160 33/161/161 34/162/162
usemtl m_0
f 40/163/163 39/164/164 35/165/165
f 39/166/166 36/167/167 35/168/168
usemtl m_0
f 38/169/169 40/170/170 33/171/171
f 40/172/172 35/173/173 33/174/174
usemtl m_0
f 34/175/175 36/176/176 37/177/177
f 36/178/178 39/179/179 37/180/180

View File

@ -0,0 +1 @@
{"meta":{"format_version":"3.6","creation_time":1615797844,"model_format":"free","box_uv":false},"name":"","geometry_name":"","visible_box":[1,1,0],"resolution":{"width":32,"height":32},"elements":[{"name":"cube","from":[-8,7,-8],"to":[-3,8,8],"autouv":0,"color":4,"locked":false,"origin":[-8,0,7],"faces":{"north":{"uv":[0,0,5,16],"texture":0},"east":{"uv":[0,0,5,16],"texture":0},"south":{"uv":[0,0,5,16],"texture":0},"west":{"uv":[0,0,5,16],"texture":0},"up":{"uv":[0,0,5,16],"texture":0},"down":{"uv":[0,0,5,16],"texture":0}},"uuid":"2cedaf8d-362e-059e-8779-56d5adbe2a01"},{"name":"cube","from":[1,3,-8],"to":[5,4,8],"autouv":0,"color":2,"locked":false,"origin":[4,-2,0],"faces":{"north":{"uv":[8,0,13,16],"texture":0},"east":{"uv":[8,0,13,16],"texture":0},"south":{"uv":[8,0,13,16],"texture":0},"west":{"uv":[8,0,13,16],"texture":0},"up":{"uv":[8,0,13,16],"texture":0},"down":{"uv":[8,0,13,16],"texture":0}},"uuid":"e529f676-fc7e-7204-b503-6fc068454efd"},{"name":"cube","from":[5,1,-8],"to":[8,2,8],"autouv":0,"color":2,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[12,0,17,16],"texture":0},"east":{"uv":[12,0,17,16],"texture":0},"south":{"uv":[12,0,17,16],"texture":0},"west":{"uv":[12,0,17,16],"texture":0},"up":{"uv":[12,0,17,16],"texture":0},"down":{"uv":[12,0,17,16],"texture":0}},"uuid":"3aa91135-750f-80a7-9156-923b7818b822"},{"name":"cube","from":[-3,5,-8],"to":[1,6,8],"autouv":0,"color":2,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[4,0,9,16],"texture":0},"east":{"uv":[4,0,9,16],"texture":0},"south":{"uv":[4,0,9,16],"texture":0},"west":{"uv":[4,0,9,16],"texture":0},"up":{"uv":[4,0,9,16],"texture":0},"down":{"uv":[4,0,9,16],"texture":0}},"uuid":"756b7eb1-6f71-7eaf-2353-433942ce5fa1"},{"name":"cube","from":[5,-1,-1],"to":[7,15,1],"autouv":0,"color":6,"locked":false,"rotation":[0,0,62.5],"origin":[6,0,0],"faces":{"north":{"uv":[30,0,32,16],"texture":0},"east":{"uv":[30,0,32,16],"texture":0},"south":{"uv":[30,0,32,16],"texture":0},"west":{"uv":[30,0,32,16],"texture":0},"up":{"uv":[30,6,32,8],"texture":0},"down":{"uv":[30,6,32,8],"texture":0}},"uuid":"d7529930-b89f-6ba9-e7c2-c24f0b3b3313"}],"outliner":["2cedaf8d-362e-059e-8779-56d5adbe2a01","e529f676-fc7e-7204-b503-6fc068454efd","3aa91135-750f-80a7-9156-923b7818b822","756b7eb1-6f71-7eaf-2353-433942ce5fa1","d7529930-b89f-6ba9-e7c2-c24f0b3b3313"],"textures":[{"path":"","name":"texture","folder":"block","namespace":"","id":"0","particle":false,"visible":true,"mode":"bitmap","saved":false,"uuid":"683a3786-ddcb-48b1-7446-f9766ad24f21","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABE0lEQVRYR2NUUpD7zzAAQPDXIwYBDgYGRpADePkF4U74/PE9A6l8mOa79x9i9YqyojyGuCLTI4YPP6joAFyW4wpcE2lGBmtFduqFADkOUBDhoI4DsFnuoswI9vyeu9iTGFVDgFTfgxzmr8PO8PT9L9qFAKGMBQoBaUG2gXNAvg0Hw9XnPwfOAaA0oi1JpVxAThoAOYBq5QA5DgClAaqVhOQ4IESfk+HBmx8DmwZAOYUqdQE5IQCKApqWhITKAZRESEgxIXlyQgCUBqR5/0OiAGQBOYYQchgx8nAHINfpoPob5iBkNjEGkqoG7ABcltHacnguwBUFdHHA////B6RNCIsqxlEHjIbAaAiMhsBoCAx0CAAAzp9RRvgB8VAAAAAASUVORK5CYII="}]}

View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd texture
newmtl none

BIN
objects/stairs/texture.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

101
objects/wall.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib wall.mtl
o cube
v 0.0000625 1 0.5
v 0.0000625 1 -0.5
v 0.0000625 0 0.5
v 0.0000625 0 -0.5
v 0 1 -0.5
v 0 1 0.5
v 0 0 -0.5
v 0 0 0.5
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl none
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl none
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl none
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl none
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

View File

@ -0,0 +1 @@
{"meta":{"format_version":"3.6","creation_time":1615809646,"model_format":"free","box_uv":false},"name":"","geometry_name":"","visible_box":[1,1,0],"resolution":{"width":16,"height":16},"elements":[{"name":"cube","from":[0,0,-8],"to":[0,16,8],"autouv":1,"color":3,"locked":false,"origin":[0,0,1],"faces":{"north":{"uv":[0,0,0,16]},"east":{"uv":[0,0,16,16],"texture":0},"south":{"uv":[0,0,0,16]},"west":{"uv":[0,0,16,16],"texture":0},"up":{"uv":[0,0,0,16]},"down":{"uv":[0,0,0,16]}},"uuid":"063ae540-6223-a3ae-1505-e3591ab9d4f6"}],"outliner":["063ae540-6223-a3ae-1505-e3591ab9d4f6"],"textures":[{"path":"","name":"texture","folder":"block","namespace":"","id":"0","particle":false,"visible":true,"mode":"bitmap","saved":false,"uuid":"20ad34b4-f554-edc7-f5fe-479a2e424655","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIUlEQVQ4T2P8+PHjfwYKAOP///9HDRgNg9F0wMAwDMIAAHrEP6ecDBTxAAAAAElFTkSuQmCC"}]}

BIN
objects/wall/texture.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

4
objects/wall/wall.mtl Normal file
View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd texture.png
newmtl none