Exemple #1
0
func init() {
	for _, ty := range soundCategories {
		volVars[ty] = console.NewIntVar("mu_vol_"+string(ty), 100, console.Serializable, console.Mutable).
			Doc(fmt.Sprintf(genericSoundDoc, ty)).Callback(refreshSound)
	}
	muVolMaster.Callback(refreshSound)
}
Exemple #2
0
	"github.com/thinkofdeath/steven/console"
	"github.com/thinkofdeath/steven/render/gl"
	"github.com/thinkofdeath/steven/render/glsl"
	"github.com/thinkofdeath/steven/type/direction"
	"github.com/thinkofdeath/steven/type/vmath"
)

var (
	chunkProgram  gl.Program
	shaderChunk   *chunkShader
	chunkProgramT gl.Program
	shaderChunkT  *chunkShader
	lineProgram   gl.Program
	shaderLine    *lineShader

	FOV = console.NewIntVar("r_fov", 90, console.Mutable, console.Serializable).Doc(`
r_fov controls the field of view of the camera. Measured
in degrees.
`)
	lastFOV               int = 90
	lastWidth, lastHeight int = -1, -1
	perspectiveMatrix         = mgl32.Mat4{}
	cameraMatrix              = mgl32.Mat4{}
	frustum                   = vmath.NewFrustum()

	syncChan = make(chan func(), 500)

	glTexture       gl.Texture
	textureDepth    int
	texturesCreated bool
Exemple #3
0
	mainFramebuffer  gl.Framebuffer
	fbColor          gl.Texture
	fbDepth          gl.Texture
	transFramebuffer gl.Framebuffer
	accum            gl.Texture
	revealage        gl.Texture
	transDepth       gl.Texture
	transCreated     bool
	transState       = struct {
		program gl.Program
		shader  *transShader
		array   gl.VertexArray
		buffer  gl.Buffer
	}{}

	rSamples = console.NewIntVar("r_samples", 1, console.Serializable, console.Mutable).Doc(`
r_samples controls the number of samples taken whilst rendering. 
Increasing this will increase the amount of AA used but decrease
performance.
`).Callback(func() { lastWidth = -1; lastHeight = -1 })
)

func initTrans() {
	if transCreated {
		accum.Delete()
		revealage.Delete()
		transFramebuffer.Delete()
		fbColor.Delete()
		fbDepth.Delete()
		mainFramebuffer.Delete()
	}
Exemple #4
0
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package steven

import (
	"errors"
	"fmt"

	"github.com/thinkofdeath/steven/console"
	"github.com/thinkofdeath/steven/protocol"
	"github.com/thinkofdeath/steven/protocol/mojang"
)

var networkLog = console.NewIntVar("cl_packet_log", 0, console.Mutable, console.Serializable).Doc(`
cl_packet_log controls the log level of packets.
0 - No logging
1 - Log all reads apart from chunk packets
2 - Log all reads/writes apart from chunk packets
3 - Log everything
Must be done before the connection starts.
`)

type networkManager struct {
	conn      *protocol.Conn
	writeChan chan protocol.Packet
	readChan  chan protocol.Packet
	errorChan chan error
	closeChan chan struct{}
}
Exemple #5
0
)

var window *glfw.Window

func init() {
	runtime.LockOSThread()
}

var (
	renderVSync = console.NewBoolVar("r_vsync", true, console.Mutable, console.Serializable).
			Doc(`
r_vsync controls whether vsync is enabled. VSync tries to
keep the refreshing of the game in sync with the monitor's
refresh rate.
`)
	mouseSensitivity = console.NewIntVar("cl_mouse_speed", 8000, console.Mutable, console.Serializable).
				Doc(`
cl_mouse_speed controls how fast you rotate when moving 
the mouse. Higher values means faster rotation.
`)
)

func init() {
	renderVSync.Callback(func() {
		if glfw.GetCurrentContext() == nil {
			return
		}
		if renderVSync.Value() {
			glfw.SwapInterval(1)
		} else {
			glfw.SwapInterval(0)
Exemple #6
0
	sndRecord  soundCategory = "record"

	genericSoundDoc = `
mu_vol_%[1]s controls the volume of sounds with the type of %[1]s.
The value should be between 0 and 100.
`
)

var (
	loadedSounds = map[pluginKey]audio.SoundBuffer{}
	soundList    []audio.Sound
	soundInfo    = map[string]soundData{}
	soundRandom  = rand.New(rand.NewSource(time.Now().Unix()))
	currentMusic []music

	muVolMaster = console.NewIntVar("mu_vol_master", 100, console.Serializable, console.Mutable).
			Doc(`
mu_vol_master controls the master volume. This value effects
all types of sounds. The value should be between 0 and 100.
`)
	volVars = map[soundCategory]*console.IntVar{}

	soundCategories = []soundCategory{
		sndMusic,
		sndRecord,
		sndWeather,
		sndBlock,
		sndHostile,
		sndNeutral,
		sndPlayer,
		sndAmbient,