Exemplo n.º 1
0
        public static void Pyramid(int it, float x, float y, float z, float size, float rotAngle, OpenTK.Vector3 rotAxis, Texture tRef, Scheme Tint, Transparency transparancy)
        {//Creates Pyramid Object
            //Adjusts object position for centering
            x += size / 2;
            x *= -1;
            y += size / 2;
            z += size / 2;

            rotAngle *= it;//sets rotation angle

            GL.PushMatrix();
            GL.Translate(x, y, z);                                                                           //Moves object

            GL.Rotate(-rotAngle, rotAxis.X, rotAxis.Y, rotAxis.Z);                                           //Rotates object
            //Bottom
            GL.BindTexture(TextureTarget.Texture2D, tRef.getBottom());                                       //Get texture
            GL.Begin(PrimitiveType.Quads);
            GL.Color4(Tint.getBottom().R, Tint.getBottom().G, Tint.getBottom().B, transparancy.getBottom()); //Set color and transparancy
            GL.TexCoord2(0.0f, 1.0f); GL.Vertex3(-size / 2, -size / 2, size / 2);                            //Create Plane
            GL.TexCoord2(1.0f, 1.0f); GL.Vertex3(-size / 2, -size / 2, -size / 2);
            GL.TexCoord2(1.0f, 0.0f); GL.Vertex3(size / 2, -size / 2, -size / 2);
            GL.TexCoord2(0.0f, 0.0f); GL.Vertex3(size / 2, -size / 2, size / 2);
            GL.End();

            //Front
            GL.BindTexture(TextureTarget.Texture2D, tRef.getFront());
            GL.Begin(PrimitiveType.Triangles);
            GL.Color4(Tint.getFront().R, Tint.getFront().G, Tint.getFront().B, transparancy.getFront());
            GL.TexCoord2(0.0f, 1.0f); GL.Vertex3(-size / 2, -size / 2, size / 2);
            GL.TexCoord2(1.0f, 1.0f); GL.Vertex3(size / 2, -size / 2, size / 2);
            GL.TexCoord2(1.0f, 0.0f); GL.Vertex3(0, size / 2, 0);
            GL.End();

            //Back
            GL.BindTexture(TextureTarget.Texture2D, tRef.getBack());
            GL.Begin(PrimitiveType.Triangles);
            GL.Color4(Tint.getBack().R, Tint.getBack().G, Tint.getBack().B, transparancy.getBack());
            GL.TexCoord2(0.0f, 1.0f); GL.Vertex3(size / 2, -size / 2, -size / 2);
            GL.TexCoord2(1.0f, 1.0f); GL.Vertex3(-size / 2, -size / 2, -size / 2);
            GL.TexCoord2(1.0f, 0.0f); GL.Vertex3(0, size / 2, 0);
            GL.End();

            //Left
            GL.BindTexture(TextureTarget.Texture2D, tRef.getLeft());
            GL.Begin(PrimitiveType.Triangles);
            GL.Color4(Tint.getLeft().R, Tint.getLeft().G, Tint.getLeft().B, transparancy.getLeft());
            GL.TexCoord2(0.0f, 1.0f); GL.Vertex3(-size / 2, -size / 2, -size / 2);
            GL.TexCoord2(1.0f, 1.0f); GL.Vertex3(-size / 2, -size / 2, size / 2);
            GL.TexCoord2(1.0f, 0.0f); GL.Vertex3(0, size / 2, 0);
            GL.End();

            //Right
            GL.BindTexture(TextureTarget.Texture2D, tRef.getRight());
            GL.Begin(PrimitiveType.Triangles);
            GL.Color4(Tint.getRight().R, Tint.getRight().G, Tint.getRight().B, transparancy.getRight());
            GL.TexCoord2(0.0f, 1.0f); GL.Vertex3(size / 2, -size / 2, size / 2);
            GL.TexCoord2(1.0f, 1.0f); GL.Vertex3(size / 2, -size / 2, -size / 2);
            GL.TexCoord2(1.0f, 0.0f); GL.Vertex3(0, size / 2, 0);
            GL.End();



            GL.PopMatrix();
        }
Exemplo n.º 2
0
        public static void loadVar()
        {//LOAD VARIABLES FOR PROGRAM
         //alpha = alpha.setXYZ("<(123, 423, 0123)]>");

            path[0] = "C:\\Users\\Micah Richards\\Dropbox\\Programing\\C#\\NextGen\\DTView\\WindowsFormsApplication4";


            //Create Archive
            List <String> SD = File.Read(path[0] + "\\Resources\\Archive.txt");

            for (int i = 0; i < SD.Count; i += 9)
            {
                Archives.Add(new Archive(SD[i + 0], SD[i + 1], SD[i + 2], SD[i + 3], SD[i + 4], SD[i + 5], SD[i + 6], SD[i + 7]));
            }
            //0)Selection
            //1)Empty
            //2)Character
            //3)Dirt
            //4)Grass
            //5)Stone
            //6)Dark_Stone
            //7)Sand
            //8)Log
            //9)Leaves
            //10)Clouds
            //11)Water
            //12)Lava



            // Load textures
            //Textures[0] = new Texture("Wood");
            //Textures[1] = new Texture("Dirt");
            //Textures[2] = new Texture("Grass", "Dirt", "GDirt", "GDirt", "GDirt", "GDirt");
            //Textures[3] = new Texture("Stone");
            //Textures[4] = new Texture("DStone");
            //Textures[5] = new Texture("Sand");
            //Textures[6] = new Texture("Water");
            //Textures[7] = new Texture("Cloud");
            //Textures[8] = new Texture("SSide", "SSide", "Slime", "SSide", "SSide", "SSide");
            //Textures[9] = new Texture("TRings", "TRings", "Trunk", "Trunk", "Trunk", "Trunk");
            //Textures[10] = new Texture("Leaves");
            //Textures[11] = new Texture("Lava");
            //Textures[12] = new Texture("CCube");
            //Textures[13] = new Texture("Select");
            //Hey Micah, don't be stupid. If you add another texture, change that ^^^^^^^^^


            //Set Colors
            Colors[0] = new Scheme(Color.FromArgb(255, 255, 255, 255)); // White
            Colors[1] = new Scheme(Color.FromArgb(255, 0, 255, 255));   // Teal
            Colors[2] = new Scheme(Color.FromArgb(255, 255, 0, 255));   // Purple
            Colors[3] = new Scheme(Color.FromArgb(255, 255, 255, 0));   // Yellow
            Colors[4] = new Scheme(Color.FromArgb(255, 0, 0, 255));     // Blue
            Colors[5] = new Scheme(Color.FromArgb(255, 255, 0, 0));     // Red
            Colors[6] = new Scheme(Color.FromArgb(255, 0, 255, 0));     // Green
            Colors[7] = new Scheme(Color.FromArgb(255, 0, 0, 0));       // Black

            //Set Transparency
            //TransP[0] = new Transparency(0);
            //TransP[1] = new Transparency(.1f);
            //TransP[2] = new Transparency(.2f);
            //TransP[3] = new Transparency(.3f);
            //TransP[4] = new Transparency(.4f);
            //TransP[5] = new Transparency(.5f);
            //TransP[6] = new Transparency(.6f);
            //TransP[7] = new Transparency(.7f);
            //TransP[8] = new Transparency(.8f);
            //TransP[9] = new Transparency(.9f);
            //TransP[10] = new Transparency(1);

            //Rotation Axis
            //rotAxis = rotAxis.setXYZ(0, 1, 0);
            Scene = convertToRoom(File.Read(path[0] + "\\parts\\Tree.ngs"));
            createRoom();
            potato = new Intelligence(alpha.setXYZ(-1, -1, -1), -1, -1, -1, -1, -1, -1, -1, -1);
        }
Exemplo n.º 3
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", 64);
            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);
        }