Ejemplo n.º 1
0
        public NeigeOpenGL(OpenGL gl)
            : base(VIEWPORT_X, VIEWPORT_Y, VIEWPORT_Z, 100)
        {
            _xRotation = _tailleCubeX * 0.75f;

            _flocons = new Flocon[NB_FLOCONS];
            for (int i = 0; i < NB_FLOCONS; i++)
            {
                _flocons[i] = new Flocon();

                _flocons[i].x = FloatRandom(-_tailleCubeX * 50, _tailleCubeX * 50);
                _flocons[i].z = FloatRandom(-_tailleCubeZ * 5, _zCamera);
                _flocons[i].y = FloatRandom(-_tailleCubeY * 16, _tailleCubeY * 16);

                _flocons[i].vx = FloatRandom(-0.1f, 0.1f);
                _flocons[i].vy = FloatRandom(VITESSE_Y * 0.75f, VITESSE_Y * 1.5f);
                _flocons[i].vz = FloatRandom(-0.1f, 0.1f);

                _flocons[i].ax   = FloatRandom(0, 360);
                _flocons[i].ay   = FloatRandom(0, 360);
                _flocons[i].az   = FloatRandom(0, 360);
                _flocons[i].type = r.Next(0, NB_TYPES_FLOCONS);
            }

            texture[0] = new Texture();
            texture[0].Create(gl, Resources.flocon1);
            texture[1] = new Texture();
            texture[1].Create(gl, Resources.flocon2);
            texture[2] = new Texture();
            texture[2].Create(gl, Resources.flocon3);
        }
Ejemplo n.º 2
0
        private void NouveauFlocon(ref Flocon f)
        {
            if (f == null)
            {
                f = new Flocon();
            }

            f.x = FloatRandom(-_tailleCubeX * 50, _tailleCubeX * 50);
            f.z = FloatRandom(-_tailleCubeZ * 5, _zCamera);
            f.y = VIEWPORT_Y * 16;

            f.vx = FloatRandom(-0.1f, 0.1f);
            f.vy = FloatRandom(VITESSE_Y * 0.75f, VITESSE_Y * 1.5f);
            f.vz = FloatRandom(-0.1f, 0.1f);

            f.ax   = FloatRandom(0, 360);
            f.ay   = FloatRandom(0, 360);
            f.az   = FloatRandom(0, 360);
            f.type = r.Next(0, NB_TYPES_FLOCONS);
        }