예제 #1
0
        private void AnT_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.W)
            {
                keysDown[0] = true;
            }
            if (e.KeyCode == Keys.S)
            {
                keysDown[1] = true;
            }
            if (e.KeyCode == Keys.A)
            {
                keysDown[2] = true;
            }
            if (e.KeyCode == Keys.D)
            {
                keysDown[3] = true;
            }

            if (e.KeyCode == Keys.Q)
            {
                if (OpenGl.FS)
                {
                    OpenGl.ScreenMode(this, AnT, false);
                }
                else
                {
                    OpenGl.ScreenMode(this, AnT, true);
                }
            }

            if (e.KeyCode == Keys.E)
            {
                if (OpenGl.Light)
                {
                    OpenGl.Light = false;
                    Gl.glDisable(Gl.GL_LIGHTING);
                }
                else
                {
                    OpenGl.Light = true;
                    Gl.glEnable(Gl.GL_LIGHTING);
                }
            }

            if (e.KeyCode == Keys.R)
            {
                if (Camera.cameraPosition < 1)
                {
                    Camera.cameraPosition++;
                }
                else
                {
                    Camera.cameraPosition = 0;
                }

                Camera.SetCamera();
            }
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();
            AnT.InitializeContexts();

            console = new Console();
            console.Show();

            OpenGl.Init(AnT);                           //инициализировать openGl
            OpenGl.ScreenMode(this, AnT, false);        //установить оконный режим

            //событие на движение колесика мышки
            this.MouseWheel += new MouseEventHandler(this.Form1_Wheel);
        }
예제 #3
0
        public Texture(string path, string materialClass, float[] materialDiffuse, float materialTransparency, List <Texture> subMaterial)
        {
            MaterialClass        = materialClass;
            MaterialDiffuse      = materialDiffuse;
            MaterialTransparency = materialTransparency;
            SubMaterial          = subMaterial;

            if (File.Exists(path))
            {
                string[] str = path.Split('.');

                if (str[str.Length - 1] == "tga")
                {
                    TextureId = OpenGl.LoadTGA(path);
                }
                else
                {
                    Bitmap bitmap = new Bitmap(path);
                    TextureId = OpenGl.Add_RGB(bitmap, new Size(bitmap.Width, bitmap.Height));
                }
            }
        }
예제 #4
0
 private void Form1_Resize(object sender, EventArgs e)
 {
     AnT.Size = new Size(Width, Height);
     OpenGl.ReSizeGLScene(AnT, Width, Height);
 }