Exemple #1
0
        void InitScene()
        {
            hdc = (uint)pnlViewPort.Handle;
            string error = "";

            OpenGLControl.OpenGLInit(ref hdc, pnlViewPort.Width, pnlViewPort.Height, ref error);


            if (error != "")
            {
                MessageBox.Show(error);
            }

            scene.Camera.InitCamera();

            float[] materialAmbient      = { 0.5F, 0.5F, 0.5F, 1.0F };
            float[] materialDiffuse      = { 1f, 1f, 1f, 1.0f };
            float[] materialShininess    = { 10.0F };                     // brillo
            float[] ambientLightPosition = { 0F, 0F, 0F, 1.0F };          // posicion
            float[] lightAmbient         = { 0.85F, 0.85F, 0.85F, 0.0F }; // intensidad de la luz

            Lighting.MaterialAmbient      = materialAmbient;
            Lighting.MaterialDiffuse      = materialDiffuse;
            Lighting.MaterialShininess    = materialShininess;
            Lighting.AmbientLightPosition = ambientLightPosition;
            Lighting.LightAmbient         = lightAmbient;

            Lighting.SetupLighting();

            ContentManager.SetTextureList("texturas\\");
            ContentManager.LoadTextures();
            scene.CreateScene();
            Gl.glClearColor(0, 0, 0, 1);//red green blue alpha
        }
Exemple #2
0
        int[] betValue = new int[3];                           //betvalue for betters
        public MainForm()
        {
            InitializeComponent();

            hdc = (uint)this.Handle;
            string error = "";

            OpenGLControl.OpenGLInit(ref hdc, this.Width, this.Height, ref error);

            control.Camara.SetPerspective();
            if (error != "")
            {
                MessageBox.Show("an error occurred ");
                this.Close();
            }


            //float[] lightAmbient = { 0.15F, 0.15F, 0.15F, 0.0F };

            //Lighting.LightAmbient = lightAmbient;

            Lighting.SetupLighting();

            ContentManager.SetTextureList("texturas\\");
            ContentManager.LoadTextures();
            ContentManager.SetModelList("modelos\\");
            ContentManager.LoadModels();
            control.CreateObjects();

            //Gl.glPolygonMode(Gl.GL_FRONT_AND_BACK, Gl.GL_LINE);
        }
Exemple #3
0
        public GameForm()
        {
            InitializeComponent();

            redrawTimer          = new Timer();
            redrawTimer.Enabled  = true;
            redrawTimer.Interval = 25;
            redrawTimer.Tick    += new EventHandler(redraw);


            hdc = (uint)this.Handle;
            string error = "";

            OpenGLControl.OpenGLInit(ref hdc, this.Width, this.Height, ref error);
            control.Cam.SetPerspective();
            Lighting.SetupLighting();

            ContentManager.SetTextureList("textures\\");
            ContentManager.LoadTextures();
            ContentManager.SetModelList("models\\");
            ContentManager.LoadModels();

            control.CreateObjects();
            GameControl.StartedRace = true;
        }
Exemple #4
0
        public Ventana()
        {
            InitializeComponent();
            //identificador del lugar en donde voy a dibujar
            hdc = (uint)this.Handle;
            //toma el error que sucedio
            string error = "";

            //Comando de inicializacion de la ventana grafica
            OpenGLControl.OpenGLInit(ref hdc, this.Width, this.Height, ref error);

            if (error != "")
            {
                MessageBox.Show("Ocurrio un error al inicializar OpenGl");
            }

            //inicia la posicion de la camara asi como define en angulo de perspectiva,etc etc
            //controladora.Camara.EstablecerPerspectiva();
            controladora.Camara.InitCamara();

            //Habilita las luces
            Lighting.SetupLighting();
            ContentManager.SetTextureList("texturas\\"); //especifico la ubicacion de las texturas
            ContentManager.LoadTextures();               //las cargo
            ContentManager.SetModelList("modelo\\");     // especifico la ubicacion de la oficina
            ContentManager.LoadModels();                 // la cargo
            AudioPlayback.SoundDir = "sonidos\\";
            AudioPlayback.LoadSounds();

            //Color de fondo
            Gl.glClearColor(0.3f, 0.6f, 1, 1);//red green blue alpha

            controladora.CrearObjetos();
        }
Exemple #5
0
        public MainForm()
        {
            InitializeComponent();
            //identificador del lugar en donde voy a dibujar
            hdc = (uint)this.Handle;
            //toma el error que sucedio
            string error = "";

            //Comando de inicializacion de la ventana grafica
            OpenGLControl.OpenGLInit(ref hdc, this.Width, this.Height, ref error);

            //inicia la posicion de la camara asi como define en angulo de perspectiva,etc etc
            control.Camara.SetPerspective();
            if (error != "")
            {
                MessageBox.Show("Ocurrio un error al inicializar openGL");
                this.Close();
            }

            //Habilita las luces

            //float[] lightAmbient = { 0.15F, 0.15F, 0.15F, 0.0F };

            //Lighting.LightAmbient = lightAmbient;

            Lighting.SetupLighting();  // encapsulado en el sahdow engine

            ContentManager.SetTextureList("texturas\\");
            ContentManager.LoadTextures();
            ContentManager.SetModelList("modelos\\");
            ContentManager.LoadModels();
            control.CreateObjects();

            //Gl.glPolygonMode(Gl.GL_FRONT_AND_BACK, Gl.GL_LINE);
        }
Exemple #6
0
        public Main()
        {
            InitializeComponent();
            hdc = (uint)pnlViewPort.Handle;
            string error = "";

            //Comando de inicializacion de la ventana grafica
            OpenGLControl.OpenGLInit(ref hdc, pnlViewPort.Width, pnlViewPort.Height, ref error);
            //inicia la posicion de la camara asi como define en angulo de perspectiva,etc etc
            controladora.Camara.SetPerspective();
            if (error != "")
            {
                MessageBox.Show("Something happened");
            }

            #region lights

            //Configuracion de las luces
            float[] materialAmbient  = { 0.5F, 0.5F, 0.5F, 1.0F };
            float[] materialDiffuse  = { 1f, 1f, 1f, 1.0f };
            float[] materialSpecular = { 1.0F, 1.0F, 1.0F, 1.0F };
            //brillo del material
            float[] materialShininess = { 1.0F };
            //posicion de la luz
            float[] ambientLightPosition = { 10F, -10F, 10F, 1.0F };
            // intensidad de la luz en RGB
            float[] lightAmbient = { 0.85F, 0.85F, 0.85F, 1.0F };

            Lighting.MaterialAmbient      = materialAmbient;
            Lighting.MaterialDiffuse      = materialDiffuse;
            Lighting.MaterialSpecular     = materialSpecular;
            Lighting.MaterialShininess    = materialShininess;
            Lighting.AmbientLightPosition = ambientLightPosition;
            Lighting.LightAmbient         = lightAmbient;

            #endregion

            //Habilita las luces
            Lighting.SetupLighting();
            //cargar texturas
            ContentManager.SetModelList("modelos\\");
            ContentManager.LoadModels();
            ContentManager.SetTextureList("texturas\\");
            ContentManager.LoadTextures();
            //AudioPlayback.SoundDir = "sonidos\\";
            //AudioPlayback.LoadSounds();
            controladora.CreateObjects();
            //Color de fondo
            Gl.glClearColor(0, 0, 0, 1);//red green blue alpha
            Gl.glShadeModel(Gl.GL_SMOOTH);
        }
Exemple #7
0
        public Main()
        {
            InitializeComponent();
            hdc = (uint)pnlViewPort.Handle;
            string error = "";

            //Graph window initialization command
            OpenGLControl.OpenGLInit(ref hdc, pnlViewPort.Width, pnlViewPort.Height, ref error);
            //Initiates the position of the camera as well as defines in perspective angle, etc. etc.
            con.Camara.SetPerspective();
            if (error != "")
            {
                MessageBox.Show("Something happened");
            }

            #region lights

            //Setting lights
            float[] materialAmbient  = { 0.5F, 0.5F, 0.5F, 1.0F };
            float[] materialDiffuse  = { 1f, 1f, 1f, 1.0f };
            float[] materialSpecular = { 1.0F, 1.0F, 1.0F, 1.0F };
            //Material brightness
            float[] materialShininess = { 1.0F };
            //Position of light
            float[] ambientLightPosition = { 10F, -10F, 10F, 1.0F };
            //Light intensity in RGB
            float[] lightAmbient = { 0.85F, 0.85F, 0.85F, 1.0F };

            Lighting.MaterialAmbient      = materialAmbient;
            Lighting.MaterialDiffuse      = materialDiffuse;
            Lighting.MaterialSpecular     = materialSpecular;
            Lighting.MaterialShininess    = materialShininess;
            Lighting.AmbientLightPosition = ambientLightPosition;
            Lighting.LightAmbient         = lightAmbient;

            #endregion

            //Enable lights
            Lighting.SetupLighting();
            //load textures
            ContentManager.SetModelList("models\\");
            ContentManager.LoadModels();
            ContentManager.SetTextureList("textures\\");
            ContentManager.LoadTextures();
            con.CreateObjects();
            //Background color
            Gl.glClearColor(0, 0, 0, 1);//red green blue alpha
            Gl.glShadeModel(Gl.GL_SMOOTH);
        }
Exemple #8
0
        public MainForm()
        {
            InitializeComponent();
            //identificador del lugar en donde voy a dibujar
            hdc = (uint)this.Handle;
            //toma el error que sucedio
            string error = "";

            //Comando de inicializacion de la ventana grafica
            OpenGLControl.OpenGLInit(ref hdc, this.Width, this.Height, ref error);

            if (error != "")
            {
                MessageBox.Show("Ocurrio un error al inicializar OpenGl");
            }

            //Habilita las luces
            Lighting.SetupLighting();
            ContentManager.SetTextureList("texturas_low\\"); //especifico la ubicacion de las texturas
            ContentManager.LoadTextures();                   //las cargo
            ContentManager.SetModelList("modelo\\");         // especifico la ubicacion de la oficina
            ContentManager.LoadModels();                     // la cargo
            AudioPlayback.SoundDir = "sonidos\\";
            AudioPlayback.LoadSounds();

            //Color de fondo
            Gl.glClearColor(0.3f, 0.6f, 1, 1);//red green blue alpha

            controladora.Create();
            //controladora.Camara.EstablecerPerspectiva();
            controladora.Camara.SetCamara(1);

            //formularios
            PracticaForm.Instancia      = new PracticaForm();
            AcercaDeForm.Instancia      = new AcercaDeForm();
            DatosPracticaForm.Instancia = new DatosPracticaForm();

            Ayuda.Instancia = new Ayuda();

            instancia = this;

            this.MouseWheel += new MouseEventHandler(MainForm_MouseWheel);
            this.MouseMove  += new MouseEventHandler(MainForm_MouseWheel);
        }
Exemple #9
0
        public MainForm()
        {
            InitializeComponent();
            hdc = (uint)pnlViewPort.Handle;
            string error = "";

            //Comando de inicializacion de la ventana grafica
            OpenGLControl.OpenGLInit(ref hdc, pnlViewPort.Width, pnlViewPort.Height, ref error);
            //inicia la posicion de la camara asi como define en angulo de perspectiva,etc etc

            if (error != "")
            {
                MessageBox.Show(error);
            }

            sistema.Camara.InitCamara();
            //Habilita las luces


            float[] materialAmbient      = { 0.5F, 0.5F, 0.5F, 1.0F };
            float[] materialDiffuse      = { 1f, 1f, 1f, 1.0f };
            float[] materialSpecular     = { 1.0F, 1.0F, 1.0F, 1.0F };
            float[] materialShininess    = { 10.0F };                     // brillo
            float[] ambientLightPosition = { 0F, 0F, 0F, 1.0F };          // posicion
            float[] lightAmbient         = { 0.85F, 0.85F, 0.85F, 0.0F }; // intensidad de la luz

            Lighting.MaterialAmbient      = materialAmbient;
            Lighting.MaterialDiffuse      = materialDiffuse;
            Lighting.MaterialShininess    = materialShininess;
            Lighting.AmbientLightPosition = ambientLightPosition;
            Lighting.LightAmbient         = lightAmbient;

            Lighting.SetupLighting();

            //cargar texturas
            ContentManager.SetTextureList("texturas\\");
            ContentManager.LoadTextures();
            sistema.CreateScene();
            Camara.CenterMouse();
            //Color de fondo
            Gl.glClearColor(0, 0, 0, 1);//red green blue alpha
        }
Exemple #10
0
        public FrmVista()
        {
            InitializeComponent();
            control = new Controlador();
            //identificador del lugar en donde voy a dibujar
            hdc = (uint)this.Handle;
            //toma el error que sucedio
            string error = "";

            //Comando de inicializacion de la ventana grafica
            OpenGLControl.OpenGLInit(ref hdc, this.Width, this.Height, ref error);

            //inicia la posicion de la camara asi como define en angulo de perspectiva,etc etc
            control.Camara.EstablecerPerspectiva();
            if (error != "")
            {
                MessageBox.Show("Ocurrio un error al inicializar openGL");
                this.Close();
            }

            //Habilita las luces

            //float[] lightAmbient = { 0.15F, 0.15F, 0.15F, 0.0F };

            //Lighting.LightAmbient = lightAmbient;

            Lighting.SetupLighting();  // encapsulado en el sahdow engine

            ContentManager.SetTextureList("texturas\\");
            ContentManager.LoadTextures();
            ContentManager.SetModelList("modelos\\");
            ContentManager.LoadModels();
            control.CrearObjetos();

            //Gl.glPolygonMode(Gl.GL_FRONT_AND_BACK, Gl.GL_LINE);

            wplayer.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wplayer_PlayStateChange);
            wplayer.URL              = "sonidos/car_drift.mp3";
            wplayer.controls.stop();
        }
        public MainForm()
        {
            InitializeComponent();
            hdc = (uint)pnlViewPort.Handle;
            string error = "";

            OpenGLControl.OpenGLInit(ref hdc, pnlViewPort.Width, pnlViewPort.Height, ref error);

            if (error != "")
            {
                MessageBox.Show(error);
            }
            controladora.Camara.InitCamara();
            //lights
            Lighting.SetupLighting();
            ContentManager.SetTextureList("texturas\\"); //specify texture location
            ContentManager.LoadTextures();               //load it
            ContentManager.SetModelList("modelo\\");     // specify model location
            ContentManager.LoadModels();                 //load it
            AudioPlayback.SoundDir = "sonidos\\";

            Camera.CenterMouse();
            controladora.CrearObjetos();
        }
        public SkyMap()
        {
            Thread ThreadT = new Thread(new ThreadStart(LoadLoadingScreen));

            Globals.Status = "Loading, please wait...";
            ThreadT.Start();


            InitializeComponent();

            Screen[] sc;
            sc = Screen.AllScreens;

            if (!Globals.testing && sc.Length > 2)
            {
                this.WindowState = FormWindowState.Normal;

                this.Left          = sc[3].Bounds.Left;
                this.Top           = sc[3].Bounds.Top;
                this.StartPosition = FormStartPosition.Manual;
                this.WindowState   = FormWindowState.Maximized;
            }

            // richTextBox3.Text = this.Location.X.ToString() + " " + this.Location.Y.ToString();

            //richTextBox1.Text = "initialised";

            Globals.Status       = "Initialising sky map";
            Globals.LoadProgress = 10;

            if (!Globals.testing)
            {
                hdc = (uint)pnlViewPort.Handle;
                string error = "";
                OpenGLControl.OpenGLInit(ref hdc, pnlViewPort.Width, pnlViewPort.Height, ref error);

                if (error != "")
                {
                    MessageBox.Show(error);
                }

                Camara.InitCamara();
                string[] split;
                int      n = 0;
                clinesl = File.ReadAllLines(@"catalogs\constlines.dat").Length;
                StreamReader reader = File.OpenText(@"catalogs\constlines.dat");

                clines = new double[clinesl, 4];
                while (!reader.EndOfStream)
                {
                    split        = reader.ReadLine().Split(',');
                    clines[n, 0] = Convert.ToDouble(split[0]) / 57.2957795;
                    clines[n, 1] = Convert.ToDouble(split[1]) / 57.2957795;
                    clines[n, 2] = Convert.ToDouble(split[2]) / 57.2957795;
                    clines[n, 3] = Convert.ToDouble(split[3]) / 57.2957795;
                    n++;
                }
                reader.Dispose();
                n      = 0;
                s1l    = File.ReadAllLines(@"catalogs\s1.dat").Length;
                reader = File.OpenText(@"catalogs\s1.dat");

                s1 = new double[s1l, 3];
                while (!reader.EndOfStream)
                {
                    split    = reader.ReadLine().Split(',');
                    s1[n, 0] = Convert.ToDouble(split[1]) / 57.2957795;
                    s1[n, 1] = Convert.ToDouble(split[2]) / 57.2957795;
                    s1[n, 2] = Convert.ToDouble(split[6]);
                    n++;
                }
                reader.Dispose();
                n      = 0;
                s3l    = File.ReadAllLines(@"catalogs\s3.dat").Length;
                reader = File.OpenText(@"catalogs\s3.dat");

                s3 = new double[s3l, 3];
                while (!reader.EndOfStream)
                {
                    split    = reader.ReadLine().Split(',');
                    s3[n, 0] = Convert.ToDouble(split[1]) / 57.2957795;
                    s3[n, 1] = Convert.ToDouble(split[2]) / 57.2957795;
                    s3[n, 2] = Convert.ToDouble(split[6]);
                    n++;
                }
                reader.Dispose();
                n      = 0;
                s6l    = File.ReadAllLines(@"catalogs\s6.dat").Length;
                reader = File.OpenText(@"catalogs\s6.dat");

                s6 = new double[s6l, 3];
                while (!reader.EndOfStream)
                {
                    split    = reader.ReadLine().Split(',');
                    s6[n, 0] = Convert.ToDouble(split[1]) / 57.2957795;
                    s6[n, 1] = Convert.ToDouble(split[2]) / 57.2957795;
                    s6[n, 2] = Convert.ToDouble(split[6]);
                    n++;
                }
                reader.Dispose();

                //bg color
                Gl.glClearColor(0, 0, 0, 1);
            }
            Globals.Status       = "Loading dome window";
            Globals.LoadProgress = 30;

            //   Timer = new System.Threading.Timer(TimerCallback, null, 0, 1000);
        }