Exemplo n.º 1
0
//Erzeugt einen neuen Test
func NewAircraftTest(multiplayerManager *goplanemp.MultiplayerManager) *AircraftTest {
	result := &AircraftTest{}
	result.multiplayerManager = multiplayerManager
	result.currentTestPlaneId = -1
	result.currentIndex = 0
	result.oldConfigMod = 0
	result.latDataRef, _ = dataAccess.FindDataRef("sim/flightmodel/position/latitude")
	result.lonDataRef, _ = dataAccess.FindDataRef("sim/flightmodel/position/longitude")
	result.elevDataRef, _ = dataAccess.FindDataRef("sim/flightmodel/position/elevation")
	return result
}
Exemplo n.º 2
0
//Aktiviert den MultiplayerManager. Erst nach diesem Aufruf können neue Objekte erzeugt werden.
func (self *MultiplayerManager) Enable() error {
	csl.CslManagerInstance.LoadAndValidatePackages()
	if self.renderer == nil {
		return errors.New("no renderer available")
	}
	texture.TextureManagerInstance.Enable()
	self.wrtDataRef, _ = dataAccess.FindDataRef("sim/graphics/view/world_render_type")
	self.prtDataRef, _ = dataAccess.FindDataRef("sim/graphics/view/plane_render_type")
	self.renderer.Init()
	display.RegisterDrawCallback(self.drawAirplanes, display.Phase_Airplanes, false, nil)
	return nil
}
Exemplo n.º 3
0
func (self *TextureManager) Init(resolution int, lightsFile string, mergeLitTexture, useAnyLitTexture bool) (err error) {
	self.resolution = resolution
	self.mergeLitTextures = mergeLitTexture
	self.useAnyLitTexture = useAnyLitTexture
	self.nightLightingDataRef, _ = dataAccess.FindDataRef("sim/graphics/scenery/percent_lights_on")
	self.lightsFile = lightsFile
	extensions := gl.GoStr(gl.GetString(gl.EXTENSIONS))
	self.texClampAvail = strings.Contains(extensions, "GL_SGI_texture_edge_clamp") || strings.Contains(extensions, "GL_SGIS_texture_edge_clamp") || strings.Contains(extensions, "GL_ARB_texture_edge_clamp") || strings.Contains(extensions, "GL_EXT_texture_edge_clamp")
	return
}
Exemplo n.º 4
0
func (self *DefaultRenderer) Init() {
	var dataRefFound bool
	self.visDataRef, dataRefFound = dataAccess.FindDataRef("sim/graphics/view/visibility_effective_m")
	if !dataRefFound {
		self.visDataRef, dataRefFound = dataAccess.FindDataRef("sim/weather/visibility_effective_m")
		if !dataRefFound {
			logging.Warning("Default renderer could not find effective visibility in the sim.")
		}
	}
	self.altitudeDataRef, _ = dataAccess.FindDataRef("sim/flightmodel/position/elevation")
	self.fovDataRef, _ = dataAccess.FindDataRef("sim/graphics/view/field_of_view_deg")
	if self.configuration.EnableRenderStatistics {
		accessors := dataAccess.DataRefAccessors{}
		accessors.ReadInt = getRenderStat
		dataAccess.RegisterDataAccessor("hack/renderer/planes", dataAccess.TypeInt, false, accessors, &self.totalPlanes, nil)
		dataAccess.RegisterDataAccessor("hack/renderer/objects7", dataAccess.TypeInt, false, accessors, &self.obj7Planes, nil)
		dataAccess.RegisterDataAccessor("hack/renderer/objects8", dataAccess.TypeInt, false, accessors, &self.obj8Planes, nil)
		dataAccess.RegisterDataAccessor("hack/renderer/drawTime", dataAccess.TypeDouble, false, accessors, &self.drawTime, nil)
		extra.RegisterDataRefToDataRefEditor("hack/renderer/planes", "hack/renderer/objects7", "hack/renderer/objects8", "hack/renderer/drawTime")
	}
	registerMultiplayerDataRefs()
}