public virtual void PrepareLighting() { var adv = (Light?.LightMap) ?? OutsidePx; var advDir = (Light?.LightMapDirection) ?? TextureGenerator.GetDefaultAdv(Device); var amb = AmbientLight ?? TextureGenerator.GetPxWhite(Device); WorldContent._2DWorldBatchEffect.Parameters["advancedLight"].SetValue(adv); //WorldContent._2DWorldBatchEffect.Parameters["advancedDirection"].SetValue(advDir); WorldContent.GrassEffect.Parameters["advancedLight"].SetValue(adv); WorldContent._2DWorldBatchEffect.Parameters["ambientLight"].SetValue(amb); WorldContent.RCObject.Parameters["advancedLight"].SetValue(adv); WorldContent.RCObject.Parameters["advancedDirection"].SetValue(advDir); WorldContent.ParticleEffect.Parameters["advancedLight"]?.SetValue(adv); Avatar.Effect.Parameters["advancedLight"].SetValue(adv); Avatar.Effect.Parameters["advancedDirection"].SetValue(advDir); var frontDir = WorldCamera.FrontDirection(); var lightOffset = new Vector2(frontDir.X / (6 * 75), frontDir.Z / (6 * 75)); if (Light != null) { lightOffset *= Light.InvMapLayout; } WorldContent._2DWorldBatchEffect.Parameters["LightOffset"].SetValue(lightOffset); WorldContent.GrassEffect.Parameters["LightOffset"].SetValue(lightOffset); Avatar.Effect.Parameters["LightOffset"].SetValue(lightOffset); WorldContent.RCObject.Parameters["LightOffset"].SetValue(lightOffset); WorldContent.ParticleEffect.Parameters["LightOffset"].SetValue(lightOffset); WorldContent._2DWorldBatchEffect.Parameters["MaxFloor"].SetValue((float)Level - 0.999f); }
public override void PrepareLighting() { base.PrepareLighting(); var frontDir = WorldCamera.FrontDirection(); var lightOffset = -GetWallOffset() * 6 / (6 * 75); if (Light != null) { lightOffset *= Light.InvMapLayout; } WorldContent._2DWorldBatchEffect.Parameters["LightOffset"].SetValue(lightOffset); WorldContent.GrassEffect.Parameters["LightOffset"].SetValue(lightOffset); Avatar.Effect.Parameters["LightOffset"].SetValue(lightOffset); WorldContent.RCObject.Parameters["LightOffset"].SetValue(lightOffset); }