protected void ModifyBasicEffect(BasicEffect effect, GamePrimitive primitive) { ModifyBasicEffect(effect: effect, obj: primitive as IGameObject); effect.TextureEnabled = true; effect.Texture = GetTexture(primitive); }
/// <summary> /// Zeichnet das Spielmodell model mit diesem Rendereffekt. /// </summary> public virtual void DrawPrimitive(GamePrimitive primitive, GameTime time) { // Setze den Viewport auf den der aktuellen Spielwelt Viewport original = Screen.Viewport; Screen.Viewport = primitive.World.Viewport; if (basicEffectForPrimitives == null) { basicEffectForPrimitives = new BasicEffect(Screen.GraphicsDevice); RegisterEffect(basicEffectForPrimitives); } ModifyBasicEffect(effect: basicEffectForPrimitives, primitive: primitive); primitive.Primitive.Draw(effect: basicEffectForPrimitives); // Setze den Viewport wieder auf den ganzen Screen Screen.Viewport = original; }