Визуальное моделирование местности с мельницами и лопастями - Курсовая работа

бесплатно 0
4.5 112
Сущность и особенности использования языка программирования C#. Общие сведения, назначение, условия применения и параметры программы Визуальное моделирование местности с мельницами и крутящимися лопастями. Программа и методика испытаний программы.


Аннотация к работе
1. Описание программы 1.1 Общие сведения 1.2 Функциональное назначение 1.3 Описание алгоритма функционирования программы 1.4 Логическая структура 1.5 Используемые технические и программные средства 1.6 Вызов и загрузка 1.7 Входные данные 1.8 Выходные данные 2. Задачи Задача 1 Задача 2 Задача 3 Задача 4 Задача 5 Задача 6 Задача 7 Задача 8 Заключение Список используемых источников Приложение 1 Листинг программы ВВЕДЕНИЕ C# (произносится си шарп) - объектно-ориентированный /// This is the main type for your game /// public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Matrix worldMatrix; Matrix viewMatrix; Matrix projectionMatrix; BasicEffect effect; Matrix [] worldMel = new Matrix[10]; //Мельница Matrix [] worldLop = new Matrix[10]; //Лопости Мельницы Model modelMel; //Модель Мельницы Model modelLop; //Модель Лопости Texture2D e; Texture2D n; Texture2D s; Texture2D w; Texture2D up; VertexPositionTexture[] e1; int[] ind; int[] indz; BoundingBox b; bool d1 = false; bool d2 = false; float[] a = new float[4]; float[] b1 = new float[4]; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = Content; } /// protected override void Initialize() { // TODO: Add your initialization logic here GraphicsDevice.RenderState.CullMode = CullMode.None; //Показывать плоскости с двух сторон effect = new BasicEffect(GraphicsDevice, new EffectPool()); Random r = new Random(); for (int i = 0; i /// LoadContent will be called once per game and is the place to load /// all of your content. /// protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); float aspectRatio; aspectRatio = (float)graphics.GraphicsDevice.Viewport.Width / (float)graphics.GraphicsDevice.Viewport.Height /1.3f; float FOV = MathHelper.PiOver4; projectionMatrix = Matrix.CreatePerspectiveFieldOfView(FOV, aspectRatio, 1f, 1000f); modelMel = Content.Load(2); modelLop = Content.Load(1); // TODO: use this.Content to load your game content here e = Content.Load(e1); n = Content.Load(n1); s = Content.Load(s1); w = Content.Load(w1); up = Content.Load(up); } /// /// UnloadContent will be called once per game and is the place to unload /// all content. /// protected override void UnloadContent() { // TODO: Unload any non ContentManager content here\ Content.Unload(); } /// /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// /// Provides a snapshot of timing values. protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); for (int i = 0; i /// This is called when the game should draw itself. /// /// Provides a snapshot of timing values. protected override void Draw(GameTime gameTime) { // TODO: Add your drawing code here if(d2) //Фон красный, если наблюдатель близко к объекту 1 GraphicsDevice.Clear(Color.Red); else if (d1) //Фон желтый, если наблюдатель направлен на объект 1 (попадет при выстреле) GraphicsDevice.Clear(Color.Yellow); else //Фон синий, если не попадет в объект 1 и не близко GraphicsDevice.Clear(Color.CornflowerBlue); //Задаем учет глубины graphics.GraphicsDevice.RenderState.DepthBufferEnable = true; for (int i = 0; i 0) { effect.View = viewMatrix; effect.Projection = projectionMatrix; effect.World = worldMatrix; effect.Texture = e; effect.TextureEnabled = true; effect.Begin(); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Begin(); GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionTexture.VertexElements); GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, e1, 0, e1.Length, indz, 0, indz.Length / 3); pass.End(); } effect.End(); } //Рисование объекта 5 (стена перпендикулярно направлению взгляда) if (indz.Length > 0) { effect.View = viewMatrix; effect.Projection = projectionMatrix; effect.World = worldMatrix * Matrix.CreateRotationY(MathHelper.Pi); effect.Texture = w; effect.TextureEnabled = true; effect.Begin(); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Begin(); GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionTexture.VertexElements); GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, e1, 0, e1.Length, indz, 0, indz.Length / 3); pass.End(); } effect.End(); } //Рисование объекта 6 (стена перпендикулярно направлению взгляда) if (indz.Length > 0) { effect.View = viewMatrix; effect.Projection = projectionMatrix; effect.World = worldMatrix * Matrix.CreateRotationY(MathHelper.PiOver2); effect.Texture = s; effect.TextureEnabled = true; effect.Begin(); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Begin(); GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionTexture.VertexElements); GraphicsDevice.DrawU
Заказать написание новой работы



Дисциплины научных работ



Хотите, перезвоним вам?