Esempio n. 1
0
        protected override void init()
        {
            GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);

            ball = new Ball();
            ball = new Ball(ballRadius);
            ball.SetLimits(ballLimitLow, ballLimitHigh);
            ballSpeed = new Vector3(
                ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble(),
                ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble(),
                ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble());
            ball.SetSpeed(ballSpeed);
            ball.SetLightPosition(new Vector3(0f, 0f, -1f));

            ball.MoveLimits(new Vector3(0f, 0f, -1f));

            SetupDepthAndCull();
            GL.Disable(EnableCap.CullFace);
            Textures.EnableTextures();
            g_fzNear = 0.1f;
            g_fzFar = 100f;
            reshape();
        }
        protected override void init()
        {
            GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);

            boxLimitLow = new Vector3();
            boxLimitLow = ballLimitLow - new Vector3(ballRadius, ballRadius, ballRadius);
            boxLimitHigh = new Vector3();
            boxLimitHigh = ballLimitHigh + new Vector3(ballRadius, ballRadius, ballRadius);

            paintBox = new PaintBox();
            ball = new Ball(ballRadius);
            ball.SetLimits(ballLimitLow, ballLimitHigh);
            ball.SetSocketControl();
            ballSpeed = new Vector3(
                ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble(),
                ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble(),
                ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble());
            ball.SetSpeed(ballSpeed);
            ball.SetLightPosition(new Vector3(0f, 0f, -1f));

            paintBox.SetLimits(boxLimitLow, boxLimitHigh, new Vector3(epsilon, epsilon, epsilon));
            paintBox.Move(new Vector3(0f, 0f, -1f));
            ball.MoveLimits(new Vector3(0f, 0f, -1f));

            SetupDepthAndCull();
            GL.Disable(EnableCap.CullFace);
            Textures.EnableTextures();
            g_fzNear = 0.5f;
            g_fzFar = 100f;
            reshape();
            paddles = new List<Paddle2>();

            AddPaddle(new Vector3(-1f, -1f, -1f), new Vector3(1f, 1f, -1f));
            paddles[0].SetMouseControl();

            AddPaddle(new Vector3(-1f, -1f, -3f), new Vector3(1f, 1f, -3f));
            paddles[BACK_PADDLE].SetNormal(new Vector3(0f, 0f, 1f));
            paddles[BACK_PADDLE].UseBlock(new Vector3(0.3f, 0.3f, 0.05f));

            AddPaddle(new Vector3(-1f, -1f, -3f), new Vector3(-1f, 1f, -1f));
            paddles[LEFT_PADDLE].SetNormal(new Vector3(1f, 0f, 0f));
            paddles[LEFT_PADDLE].UseBlock(new Vector3(0.05f, 0.3f, 0.3f));

            AddPaddle(new Vector3(1f, -1f, -3f), new Vector3(1f, 1f, -1f));
            paddles[RIGHT_PADDLE].SetNormal(new Vector3(-1f, 0f, 0f));
            paddles[RIGHT_PADDLE].UseBlock(new Vector3(0.05f, 0.3f, 0.3f));

            AddPaddle(new Vector3(-1f, 1f, -3f), new Vector3(1f, 1f, -1f));
            paddles[TOP_PADDLE].SetNormal(new Vector3(0f, -1f, 0f));
            paddles[TOP_PADDLE].UseBlock(new Vector3(0.3f, 0.05f, 0.3f));

            AddPaddle(new Vector3(-1f, -1f, -3f), new Vector3(1f, -1f, -1f));
            paddles[BOTTOM_PADDLE].SetNormal(new Vector3(0f, 1f, 0f));
            paddles[BOTTOM_PADDLE].UseBlock(new Vector3(0.3f, 0.05f, 0.3f));

            mousePostion = new TextClass("MousePosition", 0.4f, 0.04f, staticText);
            mousePostion.SetOffset(new Vector3(-0.75f, -0.75f, -0.5f));
            updateProgram();
            scores = new List<TextClass>();
            AddScore(new Vector3(-0.6f, 0.0f, -1f), new Vector3(0f, 1f, 0f), 45f);
            AddScore(new Vector3(0.6f, 0.0f, -1f), new Vector3(0f, 1f, 0f), -45f);

            AddScore(new Vector3(0.0f, -0.45f, -1f), new Vector3(1.0f, -0f, 0f), 0f);
            AddScore(new Vector3(0.0f, 0.45f, -1f), new Vector3(1.0f, -0f, 0f), 0f);

            AddScore(new Vector3(0.0f, 0.25f, -1f), new Vector3(1.0f, -0f, 0f), 0f);
            AddScore(new Vector3(0.0f, -0.85f, -1f), new Vector3(1.0f, -0f, 0f), 0f);
        }
Esempio n. 3
0
        protected override void init()
        {
            stool.Move(new Vector3(0f, -0.03f, -1f));
            ball = new Ball(ballRadius);
            ball.SetLimits(ballLimitLow, ballLimitHigh);
            ballSpeed = new Vector3(0.5f, 0.5f, 0.5f);
            ball.SetSpeed(ballSpeed);
            ball.SetLightPosition(new Vector3(0f, 0f, -1f));
            ball.SetOffset(new Vector3(-0.75f, 0.75f, -1f));
            for (int i = 0; i < 6; i++)
            {
                Can c = new Can();
                c.RotateShape(new Vector3(1f, 0f, 0f), 90f);
                c.SetColor(Colors.BLUE_COLOR);
                switch (i)
                {
                    case 0: c.Move(new Vector3(-xSeparation, 0f, canZ)); break;
                    case 1: c.Move(new Vector3(0f, 0f, canZ)); break;
                    case 2: c.Move(new Vector3(xSeparation, 0f, canZ)); break;
                    case 3: c.Move(new Vector3(-xSeparation/2, ySeparation, canZ)); break;
                    case 4: c.Move(new Vector3(xSeparation/2, ySeparation, canZ)); break;
                    case 5: c.Move(new Vector3(0f, 2*ySeparation, canZ)); break;
                }
                c.SetSpeed(new Vector3(0f, 0f, 0f));
                c.AddPaddle(ball);

                cans.Add(c);
            }
            SetupDepthAndCull();
            updateProgram();
        }
Esempio n. 4
0
        protected override void init()
        {
            GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);

            boxLimitLow = new Vector3();
            boxLimitLow = ballLimitLow - new Vector3(ballRadius, ballRadius, ballRadius);
            boxLimitHigh = new Vector3();
            boxLimitHigh = ballLimitHigh + new Vector3(ballRadius, ballRadius, ballRadius);

            paintBox = new PaintBox();
            ball = new Ball(ballRadius);
            ball.SetLimits(ballLimitLow, ballLimitHigh);
            ballSpeed = new Vector3(0f, 0f, 0f);
            ball.SetSpeed(ballSpeed);
            ball.SetLightPosition(new Vector3(0f, 0f, -1f));

            paintBox.SetLimits(boxLimitLow, boxLimitHigh, new Vector3(epsilon, epsilon, epsilon));
            paintBox.Move(new Vector3(0f, 0f, -1f));
            ball.MoveLimits(new Vector3(0f, 0f, -1f));

            SetupDepthAndCull();
            GL.Disable(EnableCap.CullFace);
            Textures.EnableTextures();
            g_fzNear = 0.5f;
            g_fzFar = 100f;
            reshape();
            paddles = new List<Paddle2>();
            Paddle2 paddle = new Paddle2();
            paddle.SetLimits(new Vector3(-1f, -1f, -0.5f), new Vector3(1f, 1f, -0.5f));
            paddle.SetKeyboardControl();
            paddles.Add(paddle);
            mousePostion = new TextClass("MousePosition", 0.4f, 0.04f, staticText);
            mousePostion.SetOffset(new Vector3(-0.75f, -0.75f, -0.5f));
            updateProgram();
        }