public void Render() { if (!gameProperties.ShowAreaTriggers) { return; } foreach (var areaTrigger in areaTriggerStore) { if (areaTrigger.ContinentId != gameContext.CurrentMap.Id) { continue; } var areaTriggerPosition = new Vector3(areaTrigger.X, areaTrigger.Y, areaTrigger.Z); if ((cameraManager.Position - areaTriggerPosition.ToOpenGlPosition()).LengthSquared() > AreaTriggerVisibilityDistanceSquare) { continue; } t.Position = areaTriggerPosition.ToOpenGlPosition(); float height = 0; if (areaTrigger.Shape == AreaTriggerShape.Box) { height = areaTrigger.BoxHeight / 2; t.Scale = new Vector3(areaTrigger.BoxWidth / 2, areaTrigger.BoxHeight / 2, areaTrigger.BoxLength / 2); t.Rotation = Quaternion.FromEuler(0, MathUtil.RadiansToDegrees(-areaTrigger.BoxYaw), 0.0f); renderManager.Render(boxMesh, transcluentMaterial, 0, t); renderManager.Render(boxMesh, wireframe, 0, t); renderManager.Render(boxMesh, wireframeBehind, 0, t); } else if (areaTrigger.Shape == AreaTriggerShape.Sphere) { t.Scale = new Vector3(areaTrigger.Radius); height = areaTrigger.Radius; renderManager.Render(sphereMesh, transcluentMaterial, 0, t); renderManager.Render(sphereMesh, wireframe, 0, t); renderManager.Render(sphereMesh, wireframeBehind, 0, t); } uiManager.DrawWorldText("calibri", new Vector2(0.5f, 1f), "Areatrigger " + areaTrigger.Id, 2.5f, Matrix.TRS(t.Position + Vector3.Up * height, in Quaternion.Identity, in Vector3.One)); } }
public void Render() { Time time = timeManager.Time; if (bestLight != null) { //-30, 225 float preciseMinutes = (timeManager.Time.TotalMinutes + timeManager.MinuteFraction); float timeOfDay = preciseMinutes / 1440.0f; float timeOfDayHalf = ((preciseMinutes + 1440 / 2.0f) % 1440) / 1440.0f; var top = bestLight.NormalWeather.GetLightParameter(LightIntParamType.SkyTopMost).GetColorAtTime(time); var middle = bestLight.NormalWeather.GetLightParameter(LightIntParamType.SkyMiddle).GetColorAtTime(time); var towardsHorizon = bestLight.NormalWeather.GetLightParameter(LightIntParamType.SkyToHorizon).GetColorAtTime(time); var horizon = bestLight.NormalWeather.GetLightParameter(LightIntParamType.SkyHorizon).GetColorAtTime(time); var justAboveHorizon = bestLight.NormalWeather.GetLightParameter(LightIntParamType.SkyJustAboveHorizon).GetColorAtTime(time); var sunColor = bestLight.NormalWeather.GetLightParameter(LightIntParamType.SunColor).GetColorAtTime(time); var cloudsColor1 = bestLight.NormalWeather.GetLightParameter(LightIntParamType.Clouds1).GetColorAtTime(time); var cloudsDensity = bestLight.NormalWeather.GetLightParameter(LightFloatParamType.CloudDensity).GetAtTime(time); skyMaterial.BlendingEnabled = true; skyMaterial.SourceBlending = Blending.SrcAlpha; skyMaterial.DestinationBlending = Blending.OneMinusSrcAlpha; skyMaterial.SetUniform("top", top.ToRgbaVector()); skyMaterial.SetUniform("middle", middle.ToRgbaVector()); skyMaterial.SetUniform("horizon", horizon.ToRgbaVector()); skyMaterial.SetUniform("towardsHorizon", towardsHorizon.ToRgbaVector()); skyMaterial.SetUniform("justAboveHorizon", justAboveHorizon.ToRgbaVector()); skyMaterial.SetUniform("sunColor", sunColor.ToRgbaVector()); skyMaterial.SetUniform("cloudsColor1", cloudsColor1.ToRgbaVector()); skyMaterial.SetUniform("timeOfDay", timeOfDay); skyMaterial.SetUniform("timeOfDayHalf", timeOfDayHalf); skyMaterial.SetUniform("cloudsDensity", cloudsDensity); var t = new Transform(); t.Scale = Vector3.One * 10000f; renderManager.Render(skySphereMesh, skyMaterial, 0, t); } }
private void Render(object sender, FrameEventArgs e) { _renderManager.Render(_renderables.ToArray()); }