Added setting to control hologram flicker frequency.

This commit is contained in:
Florian Nücke 2014-06-09 21:05:49 +02:00
parent 9d430b1869
commit f288a02296
3 changed files with 8 additions and 2 deletions

View File

@ -66,6 +66,11 @@ opencomputers {
# hologram projector when at maximum scale. Render distance is scaled
# down with the actual scale of the hologram.
hologramRenderDistance: 64
# This controls how often holograms 'flicker'. This is the chance that it
# flickers for *each frame*, meaning if you're running at high FPS you
# may want to lower this a bit, to avoid it flickering too much.
hologramFlickerFrequency: 0.025
}
# Computer related settings, concerns server performance and security.

View File

@ -32,6 +32,7 @@ class Settings(config: Config) {
val soundVolume = config.getDouble("client.soundVolume").toFloat max 0 min 2
val fontCharScale = config.getDouble("client.fontCharScale") max 0.5 min 2
val hologramRenderDistance = config.getDouble("client.hologramRenderDistance") max 0
val hologramFlickerFrequency = config.getDouble("client.hologramFlickerFrequency") max 0
// ----------------------------------------------------------------------- //
// computer

View File

@ -12,7 +12,7 @@ import net.minecraft.client.renderer.{GLAllocation, Tessellator}
import net.minecraft.tileentity.TileEntity
import org.lwjgl.opengl.GL11
import scala.util.Random
import org.lwjgl.input.Keyboard
import li.cil.oc.Settings
object HologramRenderer extends TileEntitySpecialRenderer with Callable[Int] with RemovalListener[TileEntity, Int] with ITickHandler {
val random = new Random()
@ -41,7 +41,7 @@ object HologramRenderer extends TileEntitySpecialRenderer with Callable[Int] wit
GL11.glTranslated(-1.5 * hologram.scale, 0, -1.5 * hologram.scale)
// Do a bit of flickering, because that's what holograms do!
if (random.nextDouble() < 0.025) {
if (Settings.get.hologramFlickerFrequency > 0 && random.nextDouble() < Settings.get.hologramFlickerFrequency) {
GL11.glScaled(1 + random.nextGaussian() * 0.01, 1 + random.nextGaussian() * 0.001, 1 + random.nextGaussian() * 0.01)
GL11.glTranslated(random.nextGaussian() * 0.01, random.nextGaussian() * 0.01, random.nextGaussian() * 0.01)
}