예제 #1
0
        public static void BoxScene(int it, OpenTK.Vector3 coor1, OpenTK.Vector3 coor2, int scheme)
        {                       //Draws Frame and Floor for a specified area
            float rotSpeed = 0; //sets the angle of Rotation

            OpenTK.Vector3 rotAxis = Main.rotAxis;
            float[]        TP      = new float[6] {
                1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
            };
            Texture texture = new Texture("Wood");
            Scheme  Basic   = Main.Colors[scheme];

            OpenTK.Vector3 distance = coor1.distanceTo(coor2);
            int            xcount;
            int            ycount;
            int            zcount;

            if (distance.X == 0)
            {
                xcount = 1;
            }
            else
            {
                xcount = (int)(distance.X / Math.Abs(distance.X));
            }

            if (distance.Y == 0)
            {
                ycount = 1;
            }
            else
            {
                ycount = (int)(distance.Y / Math.Abs(distance.Y));
            }

            if (distance.Z == 0)
            {
                zcount = 1;
            }
            else
            {
                zcount = (int)(distance.Z / Math.Abs(distance.Z));
            }



            //Base
            DrawRect(it,
                     -(coor1.X - .6f * xcount), (coor1.Y - .6f * ycount), (coor1.Z - .6f * zcount),
                     -distance.X - xcount * 1.2f, 0.1f, 0.1f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X - .6f * xcount), (coor1.Y - .6f * ycount), (coor1.Z - .6f * zcount),
                     0.1f, 0.1f, distance.Z + zcount * 1.2f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X + distance.X + .6f * xcount), (coor1.Y - .6f * ycount), (coor1.Z + distance.Z + .6f * zcount),
                     distance.X + xcount * 1.2f, 0.1f, 0.1f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X + distance.X + .6f * xcount), (coor1.Y - .6f * ycount), (coor1.Z + distance.Z + .6f * zcount),
                     0.1f, 0.1f, -distance.Z - zcount * 1.2f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);

            //Walls
            DrawRect(it,
                     -(coor1.X - .6f * xcount), (coor1.Y + distance.Y + .6f * ycount), (coor1.Z - .6f * zcount),
                     0.1f, -(distance.Y + ycount * 1.2f), 0.1f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X + distance.X + .6f * xcount), (coor1.Y + distance.Y + .6f * ycount), (coor1.Z + distance.Z + .6f * zcount),
                     0.1f, -(distance.Y + ycount * 1.2f), 0.1f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X - .6f * xcount), (coor1.Y + distance.Y + .6f * ycount), (coor1.Z + distance.Z + .6f * zcount),
                     0.1f, -(distance.Y + ycount * 1.2f), 0.1f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X + distance.X + .6f * xcount), (coor1.Y + distance.Y + .6f * ycount), (coor1.Z - .6f * zcount),
                     0.1f, -(distance.Y + ycount * 1.2f), 0.1f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            //Top
            DrawRect(it,
                     -(coor1.X - .6f * xcount), (coor1.Y + distance.Y + .6f * ycount), (coor1.Z - .6f * zcount),
                     -distance.X - xcount * 1.2f, 0.1f, 0.1f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X - .6f * xcount), (coor1.Y + distance.Y + .6f * ycount), (coor1.Z - .6f * zcount),
                     0.1f, 0.1f, distance.Z + zcount * 1.2f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X + distance.X + .6f * xcount), (coor1.Y + distance.Y + .6f * ycount), (coor1.Z + distance.Z + .6f * zcount),
                     distance.X + xcount * 1.2f, 0.1f, 0.1f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);
            DrawRect(it,
                     -(coor1.X + distance.X + .6f * xcount), (coor1.Y + distance.Y + .6f * ycount), (coor1.Z + distance.Z + .6f * zcount),
                     0.1f, 0.1f, -distance.Z - zcount * 1.2f,
                     rotSpeed, rotAxis,
                     texture, Basic, TP);

            //BasePlane
            //DrawRect(it, 0, 0, 0, coor.X, 0, coor.Z, rotSpeed, rotAxis, floor, Basic, TP);
        }