The Skung Rockification of Ziggy Skungdust and the SIMD's
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import JolkEngine
|
||||
import Foundation
|
||||
import Maths
|
||||
import simd
|
||||
|
||||
|
||||
@ -57,18 +58,18 @@ struct Scene1: Scene
|
||||
try loadWorld(&content)
|
||||
cube = try content.create(mesh: .init(
|
||||
vertices: [
|
||||
.init(position: Vec3f(-1, -1, 1), normal: .forward, texCoord: Vec2f(0, 0)),
|
||||
.init(position: Vec3f( 1, -1, 1), normal: .forward, texCoord: Vec2f(1, 0)),
|
||||
.init(position: Vec3f(-1, 1, 1), normal: .forward, texCoord: Vec2f(0, 1)),
|
||||
.init(position: Vec3f( 1, 1, 1), normal: .forward, texCoord: Vec2f(1, 1)),
|
||||
.init(position: Vec3f(-1, -1, 1), normal: .back, texCoord: Vec2f(0, 0)),
|
||||
.init(position: Vec3f( 1, -1, 1), normal: .back, texCoord: Vec2f(1, 0)),
|
||||
.init(position: Vec3f(-1, 1, 1), normal: .back, texCoord: Vec2f(0, 1)),
|
||||
.init(position: Vec3f( 1, 1, 1), normal: .back, texCoord: Vec2f(1, 1)),
|
||||
.init(position: Vec3f( 1, -1, 1), normal: .right, texCoord: Vec2f(0, 0)),
|
||||
.init(position: Vec3f( 1, -1, -1), normal: .right, texCoord: Vec2f(1, 0)),
|
||||
.init(position: Vec3f( 1, 1, 1), normal: .right, texCoord: Vec2f(0, 1)),
|
||||
.init(position: Vec3f( 1, 1, -1), normal: .right, texCoord: Vec2f(1, 1)),
|
||||
.init(position: Vec3f( 1, -1, -1), normal: .back, texCoord: Vec2f(0, 0)),
|
||||
.init(position: Vec3f(-1, -1, -1), normal: .back, texCoord: Vec2f(1, 0)),
|
||||
.init(position: Vec3f( 1, 1, -1), normal: .back, texCoord: Vec2f(0, 1)),
|
||||
.init(position: Vec3f(-1, 1, -1), normal: .back, texCoord: Vec2f(1, 1)),
|
||||
.init(position: Vec3f( 1, -1, -1), normal: .forward, texCoord: Vec2f(0, 0)),
|
||||
.init(position: Vec3f(-1, -1, -1), normal: .forward, texCoord: Vec2f(1, 0)),
|
||||
.init(position: Vec3f( 1, 1, -1), normal: .forward, texCoord: Vec2f(0, 1)),
|
||||
.init(position: Vec3f(-1, 1, -1), normal: .forward, texCoord: Vec2f(1, 1)),
|
||||
.init(position: Vec3f(-1, -1, -1), normal: .left, texCoord: Vec2f(0, 0)),
|
||||
.init(position: Vec3f(-1, -1, 1), normal: .left, texCoord: Vec2f(1, 0)),
|
||||
.init(position: Vec3f(-1, 1, -1), normal: .left, texCoord: Vec2f(0, 1)),
|
||||
@ -158,37 +159,33 @@ struct Scene1: Scene
|
||||
// Draw world
|
||||
for s in worldMesh.subMeshes
|
||||
{
|
||||
//render.setMaterial(Material(
|
||||
// specular: XnaColour.BlanchedAlmond.mix(with: .black, 0.12),
|
||||
// texture: texture.id))
|
||||
if s.material != -1
|
||||
{
|
||||
render.setMaterial(worldMesh.materials[s.material])
|
||||
}
|
||||
else
|
||||
{
|
||||
render.setMaterial(.init())
|
||||
}
|
||||
let material = s.material != -1
|
||||
? worldMesh.materials[s.material]
|
||||
: .init(specular: XnaColour.BlanchedAlmond.mix(with: .black, 0.12))
|
||||
render.setMaterial(material)
|
||||
render.draw(mesh: worldMesh, subMesh: s, environment: env)
|
||||
}
|
||||
|
||||
// Draw jolked up shit
|
||||
render.setMaterial(Material(
|
||||
specular: XnaColour.Gray,
|
||||
gloss: 20.0,
|
||||
gloss: 28.0,
|
||||
texture: jolkTex.id))
|
||||
render.draw(mesh: cube, model: jolkCube.transform, environment: env)
|
||||
|
||||
render.setMaterial(Material(texture: suzanneDiffuse.id))
|
||||
render.draw(mesh: suzanne, model: .translate(.up + Vec3f(3.0, 0.0, -3.5) * 2.5), environment: env)
|
||||
render.setMaterial(Material(
|
||||
specular: .init(grey: 0.5),
|
||||
gloss: 15.0,
|
||||
texture: suzanneDiffuse.id))
|
||||
let suzannePos = .up + Vec3f(3.0, 0.0, -3.5) * 2.5
|
||||
render.draw(mesh: suzanne, model:
|
||||
.translate(suzannePos) *
|
||||
.lookAt(from: suzannePos, to: colin.position + .up) * .rotate(y: .pi), environment: env)
|
||||
|
||||
render.draw(mesh: toybox,
|
||||
model: .translate(Vec3f(6.0, 0.667, -3.5) * Vec3f(2.5, 1, 2.5))
|
||||
* .rotate(y: lightTheta * 0.5) * .scale(scalar: 0.25), environment: env)
|
||||
|
||||
if drawEdges
|
||||
{
|
||||
world.draw(render, position: colin.position)
|
||||
}
|
||||
if drawEdges { world.draw(render, position: colin.position) }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user