func InitCameras() {
	var vao uint32
	gl.GenVertexArrays(1, &vao)
	gl.BindVertexArray(vao)
	var vbo uint32
	gl.GenBuffers(1, &vbo)
	gl.BindBuffer(gl.ARRAY_BUFFER, vbo)
	BindLineVertexAttributes(Renderer.lineShader.Program())
	gl.BindVertexArray(0)

	FirstPerson = &camera{
		position:                       mgl32.Vec3{0, 40, 0},
		horizontalAngle:                0,
		verticalAngle:                  0,
		sensitivity:                    0.001,
		speed:                          20,
		vao:                            vao,
		vbo:                            vbo,
		renderCascade1:                 false,
		renderCascade2:                 false,
		renderCascade3:                 false,
		renderCascadeCenters:           false,
		renderFrustum:                  false,
		renderCascade1ShadowFrustum:    false,
		renderCascade2ShadowFrustum:    false,
		renderCascade3ShadowFrustum:    false,
		renderCascadeShadowFrustumEyes: false,
	}

	ThirdPerson = &camera{
		position:        mgl32.Vec3{-10, 60, -10},
		horizontalAngle: -pi4,
		verticalAngle:   -pi4,
		sensitivity:     0.001,
		speed:           20,
	}
	ActiveCamera = FirstPerson
	messagebus.RegisterType("key", func(m *messagebus.Message) {
		direction := mgl32.Vec3{0, 0, 0}
		pressedKeys := m.Data1.([]glfw.Key)
		for _, key := range pressedKeys {
			switch key {
			case glfw.KeyW:
				direction = direction.Add(ActiveCamera.GetForward())
			case glfw.KeyS:
				direction = direction.Sub(ActiveCamera.GetForward())
			case glfw.KeyD:
				direction = direction.Add(ActiveCamera.GetRight())
			case glfw.KeyA:
				direction = direction.Sub(ActiveCamera.GetRight())
			}
		}
		ActiveCamera.direction = direction
	})
	messagebus.RegisterType("key", func(m *messagebus.Message) {
		pressedKeysThisFrame := m.Data2.([]glfw.Key)
		for _, key := range pressedKeysThisFrame {
			switch key {
			case glfw.KeyC:
				if ActiveCamera == FirstPerson {
					ActiveCamera = ThirdPerson
				} else {
					ActiveCamera = FirstPerson
				}
			case glfw.KeyKP0:
				FirstPerson.renderFrustum = !FirstPerson.renderFrustum
			case glfw.KeyKP1:
				FirstPerson.renderCascade1 = !FirstPerson.renderCascade1
			case glfw.KeyKP2:
				FirstPerson.renderCascade2 = !FirstPerson.renderCascade2
			case glfw.KeyKP3:
				FirstPerson.renderCascade3 = !FirstPerson.renderCascade3
			case glfw.KeyKPDecimal:
				FirstPerson.renderCascadeCenters = !FirstPerson.renderCascadeCenters
			case glfw.KeyKP4:
				FirstPerson.renderCascade1ShadowFrustum = !FirstPerson.renderCascade1ShadowFrustum
			case glfw.KeyKP5:
				FirstPerson.renderCascade2ShadowFrustum = !FirstPerson.renderCascade2ShadowFrustum
			case glfw.KeyKP6:
				FirstPerson.renderCascade3ShadowFrustum = !FirstPerson.renderCascade3ShadowFrustum
			case glfw.KeyKPAdd:
				FirstPerson.renderCascadeShadowFrustumEyes = !FirstPerson.renderCascadeShadowFrustumEyes
			}
		}
	})
	messagebus.RegisterType("mouse", func(m *messagebus.Message) {
		mouseInput := m.Data1.(input.MouseInput)
		ActiveCamera.verticalAngle -= ActiveCamera.sensitivity * float32(mouseInput.Y-float64(Window.Height)/2)
		if ActiveCamera.verticalAngle < -pi2 {
			ActiveCamera.verticalAngle = float32(-pi2 + 0.0001)
		}
		if ActiveCamera.verticalAngle > pi2 {
			ActiveCamera.verticalAngle = float32(pi2 - 0.0001)
		}
		ActiveCamera.horizontalAngle -= ActiveCamera.sensitivity * float32(mouseInput.X-float64(Window.Width)/2)
		for ActiveCamera.horizontalAngle < 0 {
			ActiveCamera.horizontalAngle += float32(2 * math.Pi)
		}
		for ActiveCamera.horizontalAngle > float32(2*math.Pi) {
			ActiveCamera.horizontalAngle -= float32(2 * math.Pi)
		}
	})

	go updateConsoleOnTimer()
}
// InitCameras instantiates new cameras into the package first and third person package variables.
InitCameras instantiates new cameras into the package first and third person package variables.
// InitCameras instantiates new cameras into the package first and third person package variables .
func InitCameras() {
	var vao uint32
	gl.GenVertexArrays(1, &vao)
	gl.BindVertexArray(vao)
	var vbo uint32
	gl.GenBuffers(1, &vbo)
	gl.BindBuffer(gl.ARRAY_BUFFER, vbo)
	BindLineVertexAttributes(Renderer.lineShader.Program())
	gl.BindVertexArray(0)
	FirstPerson = &camera{
		position:                       mgl32.Vec3{0, 40, 0},
		horizontalAngle:                0,
		verticalAngle:                  0,
		sensitivity:                    0.001,
		speed:                          20,
		vao:                            vao,
		vbo:                            vbo,
		renderCascade1:                 false,
		renderCascade2:                 false,
		renderCascade3:                 false,
		renderCascadeCenters:           false,
		renderFrustum:                  false,
		renderCascade1ShadowFrustum:    false,
		renderCascade2ShadowFrustum:    false,
		renderCascade3ShadowFrustum:    false,
		renderCascadeShadowFrustumEyes: false,
	}
	ThirdPerson = &camera{
		position:        mgl32.Vec3{-10, 60, -10},
		horizontalAngle: -pi4,
		verticalAngle:   -pi4,
		sensitivity:     0.001,
		speed:           20,
	}
	ActiveCamera = FirstPerson
	messagebus.RegisterType("key", func(m *messagebus.Message) {
		direction := mgl32.Vec3{0, 0, 0}
		pressedKeys := m.Data1.([]glfw.Key)
		for _, key := range pressedKeys {
			switch key {
			case glfw.KeyW:
				direction = direction.Add(ActiveCamera.GetForward())
			case glfw.KeyS:
				direction = direction.Sub(ActiveCamera.GetForward())
			case glfw.KeyD:
				direction = direction.Add(ActiveCamera.GetRight())
			case glfw.KeyA:
				direction = direction.Sub(ActiveCamera.GetRight())
			}
		}
		ActiveCamera.direction = direction
	})
	messagebus.RegisterType("key", func(m *messagebus.Message) {
		pressedKeysThisFrame := m.Data2.([]glfw.Key)
		for _, key := range pressedKeysThisFrame {
			switch key {
			case glfw.KeyC:
				if ActiveCamera == FirstPerson {
					ActiveCamera = ThirdPerson
				} else {
					ActiveCamera = FirstPerson
				}
			case glfw.KeyKP0:
				FirstPerson.renderFrustum = !FirstPerson.renderFrustum
			case glfw.KeyKP1:
				FirstPerson.renderCascade1 = !FirstPerson.renderCascade1
			case glfw.KeyKP2:
				FirstPerson.renderCascade2 = !FirstPerson.renderCascade2
			case glfw.KeyKP3:
				FirstPerson.renderCascade3 = !FirstPerson.renderCascade3
			case glfw.KeyKPDecimal:
				FirstPerson.renderCascadeCenters = !FirstPerson.renderCascadeCenters
			case glfw.KeyKP4:
				FirstPerson.renderCascade1ShadowFrustum = !FirstPerson.renderCascade1ShadowFrustum
			case glfw.KeyKP5:
				FirstPerson.renderCascade2ShadowFrustum = !FirstPerson.renderCascade2ShadowFrustum
			case glfw.KeyKP6:
				FirstPerson.renderCascade3ShadowFrustum = !FirstPerson.renderCascade3ShadowFrustum
			case glfw.KeyKPAdd:
				FirstPerson.renderCascadeShadowFrustumEyes = !FirstPerson.renderCascadeShadowFrustumEyes
			}
		}
	})
	messagebus.RegisterType("mouse", func(m *messagebus.Message) {
		mouseInput := m.Data1.(input.MouseInput)
		ActiveCamera.verticalAngle -= ActiveCamera.sensitivity * float32(mouseInput.Y-float64(Window.Height)/2)
		if ActiveCamera.verticalAngle < -pi2 {
			ActiveCamera.verticalAngle = float32(-pi2 + 0.0001)
		}
		if ActiveCamera.verticalAngle > pi2 {
			ActiveCamera.verticalAngle = float32(pi2 - 0.0001)
		}
		ActiveCamera.horizontalAngle -= ActiveCamera.sensitivity * float32(mouseInput.X-float64(Window.Width)/2)
		for ActiveCamera.horizontalAngle < 0 {
			ActiveCamera.horizontalAngle += float32(2 * math.Pi)
		}
		for ActiveCamera.horizontalAngle > float32(2*math.Pi) {
			ActiveCamera.horizontalAngle -= float32(2 * math.Pi)
		}
	})
	go updateConsoleOnTimer()
}
func InitCameras ( ) { var vao uint32 gl . GenVertexArrays ( 1 , & vao ) gl . BindVertexArray ( vao ) var vbo uint32 gl . GenBuffers ( 1 , & vbo ) gl . BindBuffer ( gl . ARRAY_BUFFER , vbo ) BindLineVertexAttributes ( Renderer . lineShader . Program ( ) ) gl . BindVertexArray ( 0 ) FirstPerson = & camera { position : mgl32 . Vec3 { 0 , 40 , 0 } , horizontalAngle : 0 , verticalAngle : 0 , sensitivity : 0.001 , speed : 20 , vao : vao , vbo : vbo , renderCascade1 : false , renderCascade2 : false , renderCascade3 : false , renderCascadeCenters : false , renderFrustum : false , renderCascade1ShadowFrustum : false , renderCascade2ShadowFrustum : false , renderCascade3ShadowFrustum : false , renderCascadeShadowFrustumEyes : false , } ThirdPerson = & camera { position : mgl32 . Vec3 { - 10 , 60 , - 10 } , horizontalAngle : - pi4 , verticalAngle : - pi4 , sensitivity : 0.001 , speed : 20 , } ActiveCamera = FirstPerson messagebus . RegisterType ( " " , func ( m * messagebus . Message ) { direction := mgl32 . Vec3 { 0 , 0 , 0 } pressedKeys := m . Data1 . ( [ ] glfw . Key ) for _ , key := range pressedKeys { switch key { case glfw . KeyW : direction = direction . Add ( ActiveCamera . GetForward ( ) ) case glfw . KeyS : direction = direction . Sub ( ActiveCamera . GetForward ( ) ) case glfw . KeyD : direction = direction . Add ( ActiveCamera . GetRight ( ) ) case glfw . KeyA : direction = direction . Sub ( ActiveCamera . GetRight ( ) ) } } ActiveCamera . direction = direction } ) messagebus . RegisterType ( " " , func ( m * messagebus . Message ) { pressedKeysThisFrame := m . Data2 . ( [ ] glfw . Key ) for _ , key := range pressedKeysThisFrame { switch key { case glfw . KeyC : if ActiveCamera == FirstPerson { ActiveCamera = ThirdPerson } else { ActiveCamera = FirstPerson } case glfw . KeyKP0 : FirstPerson . renderFrustum = ! FirstPerson . renderFrustum case glfw . KeyKP1 : FirstPerson . renderCascade1 = ! FirstPerson . renderCascade1 case glfw . KeyKP2 : FirstPerson . renderCascade2 = ! FirstPerson . renderCascade2 case glfw . KeyKP3 : FirstPerson . renderCascade3 = ! FirstPerson . renderCascade3 case glfw . KeyKPDecimal : FirstPerson . renderCascadeCenters = ! FirstPerson . renderCascadeCenters case glfw . KeyKP4 : FirstPerson . renderCascade1ShadowFrustum = ! FirstPerson . renderCascade1ShadowFrustum case glfw . KeyKP5 : FirstPerson . renderCascade2ShadowFrustum = ! FirstPerson . renderCascade2ShadowFrustum case glfw . KeyKP6 : FirstPerson . renderCascade3ShadowFrustum = ! FirstPerson . renderCascade3ShadowFrustum case glfw . KeyKPAdd : FirstPerson . renderCascadeShadowFrustumEyes = ! FirstPerson . renderCascadeShadowFrustumEyes } } } ) messagebus . RegisterType ( " " , func ( m * messagebus . Message ) { mouseInput := m . Data1 . ( input . MouseInput ) ActiveCamera . verticalAngle -= ActiveCamera . sensitivity * float32 ( mouseInput . Y - float64 ( Window . Height ) / 2 ) if ActiveCamera . verticalAngle < - pi2 { ActiveCamera . verticalAngle = float32 ( - pi2 + 0.0001 ) } if ActiveCamera . verticalAngle > pi2 { ActiveCamera . verticalAngle = float32 ( pi2 - 0.0001 ) } ActiveCamera . horizontalAngle -= ActiveCamera . sensitivity * float32 ( mouseInput . X - float64 ( Window . Width ) / 2 ) for ActiveCamera . horizontalAngle < 0 { ActiveCamera . horizontalAngle += float32 ( 2 * math . Pi ) } for ActiveCamera . horizontalAngle > float32 ( 2 * math . Pi ) { ActiveCamera . horizontalAngle -= float32 ( 2 * math . Pi ) } } ) go updateConsoleOnTimer ( ) }
InitCameras instantiates new cameras into the package first and third person package variables.
InitCameras instantiates new cameras into the package first and third person package variables .