krazy lites
This commit is contained in:
@ -6,10 +6,7 @@ import com.badlogic.gdx.graphics.*
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g3d.*
|
||||
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute
|
||||
import com.badlogic.gdx.graphics.g3d.attributes.FloatAttribute
|
||||
import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute
|
||||
import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute
|
||||
import com.badlogic.gdx.graphics.g3d.attributes.*
|
||||
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight
|
||||
import com.badlogic.gdx.graphics.g3d.environment.PointLight
|
||||
import com.badlogic.gdx.graphics.g3d.model.data.*
|
||||
@ -35,6 +32,7 @@ class Game: ApplicationAdapter()
|
||||
|
||||
private lateinit var colin: Colin
|
||||
private var jolkRot = 0.0f
|
||||
private var lightTheta = 0.0f
|
||||
|
||||
private lateinit var cubeInstance: ModelInstance
|
||||
private lateinit var floorInstance: ModelInstance
|
||||
@ -205,6 +203,7 @@ class Game: ApplicationAdapter()
|
||||
{
|
||||
colin.update(deltaTime)
|
||||
|
||||
lightTheta += deltaTime
|
||||
jolkRot += 15.0f * deltaTime
|
||||
}
|
||||
|
||||
@ -215,6 +214,28 @@ class Game: ApplicationAdapter()
|
||||
|
||||
ScreenUtils.clear(XnaColor.CornflowerBlue, true)
|
||||
|
||||
env.get(PointLightsAttribute.Type)?.let { it as PointLightsAttribute
|
||||
var thetaa = lightTheta * 6.0f * 0.12f
|
||||
var thetab = lightTheta * 6.0f * 0.011f
|
||||
var thetac = lightTheta * 6.0f * 0.056f
|
||||
|
||||
for (light in it.lights)
|
||||
{
|
||||
val x = 4.0f + 6.0f * MathUtils.cos(thetaa)
|
||||
val z = -6.0f + 3.0f * MathUtils.sin(thetaa * 2.0f)
|
||||
val y = 0.33f + 0.33f * MathUtils.sin(thetab)
|
||||
val i = 3.1f + 1.53f * MathUtils.cos(thetac)
|
||||
|
||||
val spacing = 0.5f * MathUtils.PI * (2.0f / 3.0f)
|
||||
thetaa += spacing
|
||||
thetab += spacing * 0.98f
|
||||
thetac += spacing * 0.5566f
|
||||
|
||||
light.setPosition(x, y, z)
|
||||
light.setIntensity(i)
|
||||
}
|
||||
}
|
||||
|
||||
val jolkPos = Vector3(0.0f, 1.0f + MathUtils.sin(jolkRot * 0.25f) * 0.25f, -4.0f)
|
||||
val world = Matrix4()
|
||||
.setTranslation(jolkPos)
|
||||
|
Reference in New Issue
Block a user