Check this out
category: code [glöplog]
This code:
creates this image: imgur com/a/bftZnkz
Code:
drawTriangle("", 0,0,0, 1,0,0, 0,1,0, 0, 0, 255, 255)
const meshesFile = "/home/constantine/Documents/mesh.obj"
const meshes = globalArrayNew8Bit("meshes", meshImporterGetMeshesCount(meshesFile) * 8)
if (getCurrentFrame() == 0) {
for (var i = 0; i < meshImporterGetMeshesCount(meshesFile); i += 1) {
pointerSetRaw64Bit(meshes, i * 8, meshNew(numberToString(i)))
meshImporterGetMesh(meshesFile, i, pointerGetRaw64Bit(meshes, i * 8))
}
for (var i = 0; i < meshImporterGetMeshesCount(meshesFile); i += 1) {
const m = pointerGetRaw64Bit(meshes, i * 8)
const mv = meshGetVerticesPointer(m)
for (var v = 0; v < meshGetVerticesCount(m); v += 1) {
const x = pointerGetNumber(mv, v * 3 + 0)
const y = pointerGetNumber(mv, v * 3 + 1)
const z = pointerGetNumber(mv, v * 3 + 2)
const cameraPos = defaultCameraGetVector()
const rdx = cameraPos[0] - x - 25
const rdy = cameraPos[1] - y
const rdz = cameraPos[2] - z
const gdx = cameraPos[0] - x + 25
const gdy = cameraPos[1] - y
const gdz = cameraPos[2] - z
const bdx = cameraPos[0] - x
const bdy = cameraPos[1] - y
const bdz = cameraPos[2] - z
const r = 1 / (sqrt(rdx*rdx + rdy*rdy + rdz*rdz) * 0.1)
const g = 1 / (sqrt(gdx*gdx + gdy*gdy + gdz*gdz) * 0.1)
const b = 1 / (sqrt(bdx*bdx + bdy*bdy + bdz*bdz) * 0.1)
meshAddColor(m, r, g, b, 255)
}
}
}
for (var i = 0; i < meshImporterGetMeshesCount(meshesFile); i += 1) {
meshDraw(pointerGetRaw64Bit(meshes, i * 8), 0, 1,1,1, 0,0,0, 0,0,0,0)
}
defaultCameraSetMoveSpeed(10)
creates this image: imgur com/a/bftZnkz
Bananas, if you ask me.
What a shocker, loading and drawing a mesh draws a mesh!
@w00t! yeah, it's always a question of *how* it's done. Per example: plurk com/m/p/omz0pr
sry, not @w00t!, I meant @Sesse :)
Or the recent example of epic games giving a megagrant to ryan gordon to write a vulkan/d3d12 wrapper, or you being a genetic clone of your parents, but how you act and how you will mutate in spacetime differentiates you, etc.
mom can we get Swift Playgrounds?... youtube.com/watch?v=gBFXum9mQl8