public override void DrawModel(GameModel model, GameTime time) { // Setze den Viewport auf den der aktuellen Spielwelt Viewport original = Screen.Viewport; Screen.Viewport = model.World.Viewport; Camera camera = model.World.Camera; //lightDirection = new Vector4 (-Vector3.Cross (Vector3.Normalize (camera.TargetDirection), camera.UpVector), 1); pascalEffect.Parameters ["World"].SetValue (model.WorldMatrix * camera.WorldMatrix); pascalEffect.Parameters ["View"].SetValue (camera.ViewMatrix); pascalEffect.Parameters ["Projection"].SetValue (camera.ProjectionMatrix); pascalEffect.Parameters ["color1"].SetValue (Color.Yellow.ToVector4 ()); pascalEffect.Parameters ["color2"].SetValue (Color.Red.ToVector4 ()); pascalEffect.CurrentTechnique = pascalEffect.Techniques ["Technique1"]; foreach (ModelMesh mesh in model.Model.Meshes) { mesh.Draw (); } // Setze den Viewport wieder auf den ganzen Screen Screen.Viewport = original; }
public override void DrawModel(GameModel model, GameTime time) { if (queuedModels + 1 >= modelQueue.Length) { Array.Resize (ref modelQueue, modelQueue.Length + 100); } modelQueue [queuedModels++] = model; }
public override void DrawModel(GameModel model, GameTime time) { // Setze den Viewport auf den der aktuellen Spielwelt Viewport original = Screen.Viewport; Screen.Viewport = model.World.Viewport; Camera camera = model.World.Camera; zNebulaEffect.Parameters ["World"].SetValue (model.WorldMatrix * camera.WorldMatrix); zNebulaEffect.Parameters ["View"].SetValue (camera.ViewMatrix); zNebulaEffect.Parameters ["Projection"].SetValue (camera.ProjectionMatrix); zNebulaEffect.CurrentTechnique = zNebulaEffect.Techniques ["Simplest"]; foreach (ModelMesh mesh in model.Model.Meshes) { mesh.Draw (); } // Setze den Viewport wieder auf den ganzen Screen Screen.Viewport = original; }
protected void ModifyBasicEffect(BasicEffect effect, GameModel model) { ModifyBasicEffect (effect: effect, obj: model as IGameObject); // colors if (!model.Coloring.IsTransparent) { effect.DiffuseColor = model.Coloring.MixedColor.ToVector3 (); } effect.Alpha = model.Coloring.Alpha; }
/// <summary> /// Zeichnet das Spielmodell model mit diesem Rendereffekt. /// </summary> public virtual void DrawModel(GameModel model, GameTime time) { // Setze den Viewport auf den der aktuellen Spielwelt Viewport original = Screen.Viewport; Screen.Viewport = model.World.Viewport; foreach (ModelMesh mesh in model.Model.Meshes) { foreach (ModelMeshPart part in mesh.MeshParts) { if (part.Effect is BasicEffect) { ModifyBasicEffect (effect: part.Effect as BasicEffect, model: model); } } } foreach (ModelMesh mesh in model.Model.Meshes) { mesh.Draw (); } // Setze den Viewport wieder auf den ganzen Screen Screen.Viewport = original; }
public override void DrawModel(GameModel model, GameTime time) { // Setze den Viewport auf den der aktuellen Spielwelt Viewport original = Screen.Viewport; Screen.Viewport = model.World.Viewport; SetShaderParameters (obj: model, time: time); foreach (ModelMesh mesh in model.Model.Meshes) { mesh.Draw (); } // Setze den Viewport wieder auf den ganzen Screen Screen.Viewport = original; }
protected void ModifyBasicEffect(BasicEffect effect, GameModel model) { }
/// <summary> /// Zeichnet das Spielmodell model mit diesem Rendereffekt. /// </summary> public virtual void DrawModel(GameModel model, GameTime time) { // Setze den Viewport auf den der aktuellen Spielwelt Viewport original = screen.Viewport; screen.Viewport = model.World.Viewport; // hier würde das Modell gezeichnet werden // Setze den Viewport wieder auf den ganzen Screen screen.Viewport = original; }
/// <summary> /// Zeichnet das Spielmodell model mit dem Cel-Shading-Effekt. /// Eine Anwendung des NVIDIA-Toon-Shaders. /// </summary> public override void DrawModel(GameModel model, GameTime time) { // Setze den Viewport auf den der aktuellen Spielwelt Viewport original = Screen.Viewport; Screen.Viewport = model.World.Viewport; Camera camera = model.World.Camera; lightDirection = new Vector4 (-Vector3.Cross (Vector3.Normalize (camera.PositionToTargetDirection), camera.UpVector), 1); celShader.Parameters ["LightDirection"].SetValue (lightDirection); celShader.Parameters ["World"].SetValue (model.WorldMatrix * camera.WorldMatrix); celShader.Parameters ["InverseWorld"].SetValue (Matrix.Invert (model.WorldMatrix * camera.WorldMatrix)); celShader.Parameters ["View"].SetValue (camera.ViewMatrix); celShader.Parameters ["Projection"].SetValue (camera.ProjectionMatrix); celShader.CurrentTechnique = celShader.Techniques ["ToonShader"]; if (!model.Coloring.IsTransparent) { Color = model.Coloring.MixedColor; } foreach (ModelMesh mesh in model.Model.Meshes) { mesh.Draw (); } // Setze den Viewport wieder auf den ganzen Screen Screen.Viewport = original; }