Esempio n. 1
0
func (self *DefaultRenderer) drawAttachments(renderData *planeRenderData, translucent bool) {
	currentDrawInfo := scenery.NewDrawInfoLocal(renderData.x, renderData.y, renderData.z, renderData.plane.PositionData.Pitch, renderData.plane.PositionData.Heading, renderData.plane.PositionData.Roll)
	for _, currentAttachment := range renderData.plane.CslAircraft.Attachments {
		if currentAttachment.ObjectReference == nil {
			go self.loadAttachment(currentAttachment)
		} else if (translucent && currentAttachment.DrawType == csl.CSL_DRAW_GLASS) || (!translucent && currentAttachment.DrawType != csl.CSL_DRAW_GLASS) {
			scenery.DrawObjects(currentAttachment.ObjectReference, 1, []scenery.DrawInfo{currentDrawInfo}, true, false)
		}

	}
}
func (self *DefaultRenderer) drawObj8Lights(renderData *planeRenderData) {
	if self.greenNavRef == nil {
		self.initObj8Lights()
	}
	lodInfo := calculateLOD(renderData.plane.CslAircraft.ObjInfo, renderData.dist)
	greenNavDrawInfos := make([]scenery.DrawInfo, 0)
	redNavDrawInfos := make([]scenery.DrawInfo, 0)
	strobeDrawInfos := make([]scenery.DrawInfo, 0)
	beaconDrawInfos := make([]scenery.DrawInfo, 0)
	landingDrawInfos := make([]scenery.DrawInfo, 0)
	taxiDrawInfos := make([]scenery.DrawInfo, 0)
	otherDrawInfos := make([]scenery.DrawInfo, 0)
	for _, currentLight := range lodInfo.Lights {
		switch currentLight.LightType {
		case obj7.LightType_GreenNavigation:
			if renderData.lightStatus.NavLights {
				greenNavDrawInfos = appendLight(renderData, currentLight, greenNavDrawInfos)
			}
		case obj7.LightType_RedNavigation:
			if renderData.lightStatus.NavLights {
				redNavDrawInfos = appendLight(renderData, currentLight, redNavDrawInfos)
			}
		case obj7.LightType_Strobe:
			if renderData.lightStatus.StrobeLights {
				strobeDrawInfos = appendLight(renderData, currentLight, strobeDrawInfos)
			}
		case obj7.LightType_Beacon:
			if renderData.lightStatus.BeaconLights {
				beaconDrawInfos = appendLight(renderData, currentLight, beaconDrawInfos)
			}
		case obj7.LightType_Landing:
			if renderData.lightStatus.LandingLights {
				landingDrawInfos = appendLight(renderData, currentLight, landingDrawInfos)
			}
		case obj7.LightType_Taxi:
			if renderData.lightStatus.TaxiLights {
				taxiDrawInfos = appendLight(renderData, currentLight, taxiDrawInfos)
			}
		case obj7.LightType_Other:
			if renderData.lightStatus.NavLights {
				otherDrawInfos = appendLight(renderData, currentLight, otherDrawInfos)
			}
		default:
			otherDrawInfos = appendLight(renderData, currentLight, otherDrawInfos)
		}
	}
	scenery.DrawObjects(self.greenNavRef, len(greenNavDrawInfos), greenNavDrawInfos, true, false)
	scenery.DrawObjects(self.redNavRef, len(redNavDrawInfos), redNavDrawInfos, true, false)
	scenery.DrawObjects(self.strobeRef, len(strobeDrawInfos), strobeDrawInfos, true, false)
	scenery.DrawObjects(self.beaconRef, len(beaconDrawInfos), beaconDrawInfos, true, false)
	scenery.DrawObjects(self.landingRef, len(landingDrawInfos), landingDrawInfos, true, false)
	scenery.DrawObjects(self.taxiRef, len(taxiDrawInfos), taxiDrawInfos, true, false)
	scenery.DrawObjects(self.otherRef, len(otherDrawInfos), otherDrawInfos, true, false)
}