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);
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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();
        }