Exemplo n.º 1
0
        public void draw_sun()
        {
            GL.glPushMatrix();
            GL.glColor3d(1, 1, 1);

            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[6]);


            quad = GLU.gluNewQuadric();
            GLU.gluQuadricTexture(quad, 40);

            GL.glTranslatef(pos[0], pos[1], pos[2]);

            // rotating sun as well as all planets to Y axis
            GL.glTranslatef(0.0f, 0.0f + (float)-speed * 0.03f, 0.0f);  //y - up down
            GL.glTranslatef(0.0f, 0.0f, 0.0f + (float)-speed * 0.01f);  //z - back forward

            GL.glRotatef((float)moon, 0.0f, 1.0f, 0.0f);

            GLU.gluSphere(quad, 45, 1000, 1000);



            GL.glPopMatrix();


            moon += 0.04f;
        }
Exemplo n.º 2
0
        public void draw_moon()
        {
            GL.glPushMatrix();

            GL.glColor3d(1, 1, 1);
            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[1]);


            quad = GLU.gluNewQuadric();
            GLU.gluQuadricTexture(quad, 40);


            GL.glTranslatef(-200, 200, -300);

            // rotating moon as well as all planets to Y axis
            GL.glTranslatef(0.0f + (float)speed * 0.01f, 0.0f, 0.0f);
            GL.glTranslatef(0.0f, 0.0f + (float)speed * 0.01f, 0.0f);

            GL.glRotatef((float)moon++ *0.5f, 1.0f, 1.0f, 0.0f);


            GLU.gluSphere(quad, 18, 200, 200);

            GL.glPopMatrix();
        }
Exemplo n.º 3
0
        private void DrawIsland()
        {
            float moveSphere = GlobalProperties.islandRadius - GlobalProperties.islandHeight;
            float rotate     = 45.0f;

            GL.glEnable(GL.GL_CLIP_PLANE0);
            double[] clipPalane0 = { 0.0, 0.0, 1.0, 0.0 };
            GL.glClipPlane(GL.GL_CLIP_PLANE0, clipPalane0);

            GL.glTranslatef(0.0f, 0.0f, -moveSphere);


            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glColor3f(1.0f, 1.0f, 1.0f);
            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[1]);


            GL.glRotatef(rotate, 1.0f, 1.0f, 0.0f);
            GLUquadric obj = GLU.gluNewQuadric();

            GLU.gluQuadricTexture(obj, 1);
            GLU.gluSphere(obj, GlobalProperties.islandRadius, 32, 32);
            GLU.gluDeleteQuadric(obj);
            GL.glRotatef(-rotate, 1.0f, 1.0f, 0.0f);

            GL.glDisable(GL.GL_TEXTURE_2D);

            GL.glTranslatef(0.0f, 0.0f, moveSphere);

            GL.glDisable(GL.GL_CLIP_PLANE0);
        }
Exemplo n.º 4
0
        public cOGL(Control pb)
        {
            p      = pb;
            Width  = p.Width;
            Height = p.Height;
            InitializeGL();
            obj = GLU.gluNewQuadric(); //!!!
            //3D model b1
            ch        = new Character("ninja.ms3d");
            ch1       = new Character("ninja.ms3d");
            isAnimate = false;
            isInside  = false;
            isBounds  = false;
            viewAngle = 45;
            Xangl     = 0;
            Yangl     = 0;
            Zangl     = 0;

            intOptionA = 1;

            ground[0, 0] = 1;
            ground[0, 1] = 1;
            ground[0, 2] = 0;

            ground[1, 0] = 0;
            ground[1, 1] = 1;
            ground[1, 2] = 0;

            ground[2, 0] = 1;
            ground[2, 1] = 0;
            ground[2, 2] = 0;


            isSolid = true;
        }
Exemplo n.º 5
0
 public Robot(uint texture)
 {
     this.headTexture = texture;
     gun1             = new Milkshape.Character("mauser_red9.ms3d");
     gun2             = new Milkshape.Character("hk-mp7.ms3d");
     sword            = new Milkshape.Character("katana.ms3d");
     obj = GLU.gluNewQuadric(); //!!!
 }
Exemplo n.º 6
0
 public Robot(uint texture)
 {
     this.headTexture = texture;
     gun1 = new Milkshape.Character("mauser_red9.ms3d");
     gun2 = new Milkshape.Character("hk-mp7.ms3d");
     sword = new Milkshape.Character("katana.ms3d");
     obj = GLU.gluNewQuadric(); //!!!
 }
Exemplo n.º 7
0
 public cOGL(Control pb)
 {
     p=pb;
     Width = p.Width;
     Height = p.Height;
     InitializeGL();
     obj = GLU.gluNewQuadric(); //!!!
     PrepareLists();
 }
Exemplo n.º 8
0
 public cOGL(Control pb)
 {
     p      = pb;
     Width  = p.Width;
     Height = p.Height;
     InitializeGL();
     Bullet.bulletsize = 0.06f;
     obj = GLU.gluNewQuadric(); //!!!
 }
Exemplo n.º 9
0
 public cOGL(Control pb)
 {
     p      = pb;
     Width  = p.Width;
     Height = p.Height;
     InitializeGL();
     obj = GLU.gluNewQuadric(); //!!!
     PrepareLists();
 }
Exemplo n.º 10
0
        private void drawHandle(float i_Height)
        {
            GLUquadric obj = GLU.gluNewQuadric();

            GL.glTranslatef(0.5f, 0.0f + i_Height, 0.5f);
            GL.glRotatef(-90, 1, 0, 0);
            GLU.gluCylinder(obj, 0.1, 0.1, 0.5, 16, 16);
            GL.glTranslatef(-0.5f, -1 * i_Height, -0.5f);

            GLU.gluDeleteQuadric(obj);
        }
Exemplo n.º 11
0
 public cOGL(Control pb)
 {
     network.Hide();
     p      = pb;
     Width  = p.Width;
     Height = p.Height;
     InitializeGL();
     Bullet.bulletsize = 0.06f;
     tank.RandomPosition(worldsize);
     obj        = GLU.gluNewQuadric(); //!!!
     fullscreen = true;
 }
Exemplo n.º 12
0
        private void DrawPillar(double baseRadius, double topRadius, double height)
        {
            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glColor3f(1.0f, 1.0f, 1.0f);
            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[2]);

            GLUquadric obj = GLU.gluNewQuadric();

            GLU.gluQuadricTexture(obj, 2);
            GLU.gluCylinder(obj, baseRadius, topRadius, height, 32, 32);
            GLU.gluDeleteQuadric(obj);

            GL.glDisable(GL.GL_TEXTURE_2D);
        }
Exemplo n.º 13
0
        public cOGL(Control pb)
        {
            p      = pb;
            Width  = p.Width;
            Height = p.Height;
            obj    = GLU.gluNewQuadric();

            InitializeGL();

            //3 points of ground plane
            ground[0, 0] = 1;
            ground[0, 1] = 0;
            ground[0, 2] = 0;

            ground[1, 0] = -1;
            ground[1, 1] = 0;
            ground[1, 2] = 0;

            ground[2, 0] = 0;
            ground[2, 1] = 0;
            ground[2, 2] = -1;

            //light position

            pos[0] = light_position[0] = ScrollValue[9];
            pos[1] = light_position[1] = ScrollValue[10];
            pos[2] = light_position[2] = ScrollValue[11];
            pos[3] = light_position[3] = 0;


            light_position_reflected[0] = -ScrollValue[9];
            light_position_reflected[1] = -ScrollValue[10];
            light_position_reflected[2] = -ScrollValue[11];
            light_position_reflected[3] = 0;


            GL.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, light_ambient);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, light_diffuse);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, light_specular);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, light_position);

            GL.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, light_ambient);
            GL.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, light_diffuse);
            GL.glLightfv(GL.GL_LIGHT1, GL.GL_SPECULAR, light_specular);
            GL.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, light_position_reflected);
            GL.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
        }
Exemplo n.º 14
0
        private void DrawLightBeam()
        {
            float length = GlobalProperties.LightBeamLength;
            Color c      = GlobalProperties.LightBeamColor;

            GL.glColor4ub(c.R, c.G, c.B, (byte)GlobalProperties.LightBeamIntesity);

            //GL.glEnable(GL.GL_DEPTH_TEST);
            //GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_Hint, GL.GL_NICEST);
            //GL.glShadeModel(GL.GL_SMOOTH);
            //GL.glEnable(GL.GL_LIGHT0);

            GLUquadric obj = GLU.gluNewQuadric();

            GLU.gluCylinder(obj, 0.05, length * 0.05, length, 32, 32);
            GLU.gluDeleteQuadric(obj);
        }
Exemplo n.º 15
0
        private void DrawBackground()
        {
            GL.glDisable(GL.GL_LIGHTING);
            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glColor4f(1.0f, 1.0f, 1.0f, 0.5f);

            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[4]);

            float cor = GlobalProperties.seaSize / 2;

            GLUquadric obj = GLU.gluNewQuadric();

            GLU.gluQuadricTexture(obj, 4);
            GLU.gluCylinder(obj, cor, cor, cor, 32, 32);
            GLU.gluDeleteQuadric(obj);

            GL.glDisable(GL.GL_TEXTURE_2D);
            GL.glEnable(GL.GL_LIGHTING);
        }
Exemplo n.º 16
0
        private void DrawWindow()
        {
            float windowRadius = GlobalProperties.windowRadius,
                  wondowHeight = GlobalProperties.windowHeight;

            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glColor3f(1.0f, 1.0f, 1.0f);
            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[5]);

            GLUquadric obj = GLU.gluNewQuadric();

            GLU.gluQuadricTexture(obj, 5);
            GLU.gluCylinder(obj, windowRadius, windowRadius, wondowHeight, 32, 32);
            GL.glTranslatef(0.0f, 0.0f, wondowHeight);
            GLU.gluCylinder(obj, windowRadius, 0, wondowHeight * 2 / 3, 32, 32);
            GL.glTranslatef(0.0f, 0.0f, -wondowHeight / 2);

            GLU.gluDeleteQuadric(obj);

            GL.glDisable(GL.GL_TEXTURE_2D);
        }
Exemplo n.º 17
0
        private void DrawDisk(double diskHeight, double diskRadius)
        {
            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glColor3f(1.0f, 1.0f, 1.0f);
            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[3]);

            GL.glPushMatrix();

            GLUquadric obj = GLU.gluNewQuadric();

            GLU.gluQuadricTexture(obj, 3);
            GLU.gluDisk(obj, 0, diskRadius, 60, 20);
            GLU.gluCylinder(obj, diskRadius, diskRadius, diskHeight, 32, 32);
            GL.glTranslatef(0.0f, 0.0f, (float)diskHeight);
            GLU.gluDisk(obj, 0, diskRadius, 60, 20);
            GL.glPopMatrix();
            // GL.glTranslatef(0.0f, 0.0f, -(float)diskHeight);

            GLU.gluDeleteQuadric(obj);

            GL.glDisable(GL.GL_TEXTURE_2D);
        }
Exemplo n.º 18
0
        public cOGL(Control pb)
        {
            p      = pb;
            Width  = p.Width;
            Height = p.Height;


            ground[0, 0] = 1;
            ground[0, 1] = 1;
            ground[0, 2] = -0.5f;

            ground[1, 0] = 0;
            ground[1, 1] = 1;
            ground[1, 2] = -0.5f;

            ground[2, 0] = 1;
            ground[2, 1] = 0;
            ground[2, 2] = -0.5f;

            pos[0] = -4;
            pos[1] = -4;
            pos[2] = 15;
            pos[3] = 1;


            Random rnd = new Random();

            for (int i = 0; i < 20; i++)
            {
                arr[i].setX(rnd.Next(-50, 50));
                arr[i].setY(rnd.Next(-50, 50));
                arr[i].toDraw = true;
            }


            InitializeGL();
            obj = GLU.gluNewQuadric(); //!!!
        }
Exemplo n.º 19
0
        public cOGL(Control pb)
        {
            p         = pb;
            Width     = p.Width;
            Height    = p.Height;
            objFinger = GLU.gluNewQuadric();
            objShpere = GLU.gluNewQuadric();

            InitializeGL();
            PrepareLists();

            ground[0, 0] = 1;
            ground[0, 1] = 1;
            ground[0, 2] = -0.5f;

            ground[1, 0] = 0;
            ground[1, 1] = 1;
            ground[1, 2] = -0.5f;

            ground[2, 0] = 1;
            ground[2, 1] = 0;
            ground[2, 2] = -0.5f;
        }
Exemplo n.º 20
0
        public cOGL(Control pb)
        {
            m_DisplayPanel = pb;
            InitializeGL();
            obj = GLU.gluNewQuadric(); //!!!

            PrepareLists();
            teddyBear             = new TeddyBear(TEDDY_BEAR_LIST, TEDDY_BEAR_SHADOW_LIST, 7, "toy.obj");
            toyCar                = new ToyCar(CAR_LIST, CAR_SHADOW_LIST, 2, "car.obj");
            claw                  = new Claw(obj, CLAW_LIST, CLAW_SHADOW_LIST);
            ClawMachine           = new ClawMachine(obj, CLAW_MACHINE_LIST, SHADOW_LIST, teddyBear, claw);
            MainLightSource       = new LightSource(0, 0, 0);
            StaticRedLightSource  = new LightSource(10, 8, 10);
            StaticBlueLightSource = new LightSource(-10, 8, -10);
            m_SideMachine         = new SideMachine(SIDE_MACHINE_LIST, SIDE_MACHINE_SHADOW_LIST);
            mainShadowManager     = new ShadowUtills(MainLightSource);
            redShadowManager      = new ShadowUtills(StaticRedLightSource);
            blueShadowManager     = new ShadowUtills(StaticBlueLightSource);
            ground[0, 0]          = 1;
            ground[0, 1]          = -3f;
            ground[0, 2]          = 0f;

            ground[1, 0] = 0;
            ground[1, 1] = -3f;
            ground[1, 2] = 1f;

            ground[2, 0] = 1;
            ground[2, 1] = -3f;
            ground[2, 2] = 1f;

            //----------banner light position-----------
            bannerLightPos[0]    = 0;
            bannerLightPos[1]    = 5.9f;
            bannerLightPos[2]    = 2.7f;
            bannerLightPos[3]    = 1f;
            bannerLightDirection = "RIGHT";
        }
Exemplo n.º 21
0
 public static extern void gluQuadricDrawStyle(GLUquadric quadObject, uint drawStyle);
Exemplo n.º 22
0
 public static extern void gluQuadricCallback(GLUquadric qobj, uint which, IntPtr fn);
Exemplo n.º 23
0
 public static extern void gluPartialDisk(GLUquadric qobj, double innerRadius, double outerRadius, int slices, int loops, double startAngle, double sweepAngle);
Exemplo n.º 24
0
 /// <summary>
 /// Initializes a new quadric.
 /// </summary>
 private static void InitQuadObj()
 {
     quadObj = GLU.gluNewQuadric();
 }
Exemplo n.º 25
0
        /*
         *
         * Constructor
         *
         */
        public cOGL(Control pb)
        {
            p      = pb;
            Width  = p.Width;
            Height = p.Height;
            InitializeGL();
            obj = GLU.gluNewQuadric();

            //Display lists declaration
            TREE_LIST = GL.glGenLists(MAX_NUMBER_OF_TREES);
            STEM_LIST = GL.glGenLists(MAX_NUMBER_OF_TREES);
            LEAF_LIST = GL.glGenLists(MAX_NUMBER_OF_TREES);
            //APPLE_LIST= GL.glGenLists(MAX_NUMBER_OF_TREES);
            APPLE_LIST          = GL.glGenLists(1);
            STEM_AND_LEAVS_LIST = GL.glGenLists(MAX_NUMBER_OF_TREES);
            TREE_MAT            = GL.glGenLists(4);
            LEAF_MAT            = TREE_MAT + 1;
            WATER_MAT           = TREE_MAT + 3;
            APPLE_MAT           = TREE_MAT + 2;


            //3 points of ground plane
            ground[0, 0] = 1;
            ground[0, 1] = 0f;
            ground[0, 2] = 0;

            ground[1, 0] = -1;
            ground[1, 1] = 0f;
            ground[1, 2] = 0;

            ground[2, 0] = 0;
            ground[2, 1] = 0f;
            ground[2, 2] = -1;

            //light position

            pos[0] = light_position[0] = ScrollValue[9];
            pos[1] = light_position[1] = ScrollValue[10];
            pos[2] = light_position[2] = ScrollValue[11];
            pos[3] = light_position[3] = 0;

            //light0 default properties
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, light_ambient);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, light_diffuse);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, light_specular);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, light_position);
            GL.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);

            randX = new int[MAX_NUMBER_OF_TREES];
            randZ = new int[MAX_NUMBER_OF_TREES];

            locationX       = new double[MAX_NUMBER_OF_TREES];
            locationZ       = new double[MAX_NUMBER_OF_TREES];
            locationRotateY = new double[MAX_NUMBER_OF_TREES];

            randX[0] = 0;
            randZ[0] = 0;

            //rand position for trees,or default value 0 for tree locations.
            for (int i = 0; i < MAX_NUMBER_OF_TREES; i++)
            {
                randX[i]           = rand.Next(-90, 90);
                randZ[i]           = rand.Next(-90, 90);
                locationX[i]       = 0;
                locationZ[i]       = 0;
                locationRotateY[i] = 0;
            }
        }
Exemplo n.º 26
0
 public static extern void gluQuadricTexture(GLUquadric quadObject, uint textureCoords);
Exemplo n.º 27
0
 public static extern void gluCylinder(GLUquadric qobj, double baseRadius, double topRadius, double height, int slices, int stacks);
Exemplo n.º 28
0
 public Mirror()
 {
     obj = GLU.gluNewQuadric(); //!!!
 }
Exemplo n.º 29
0
 public static extern void gluQuadricCallback(GLUquadric qobj, uint which, IntPtr fn);
Exemplo n.º 30
0
 public static extern void gluSphere(GLUquadric qobj, double radius, int slices, int stacks);
Exemplo n.º 31
0
 public static extern void gluQuadricNormals(GLUquadric quadObject, uint normals);
Exemplo n.º 32
0
 public Mirror()
 {
     obj = GLU.gluNewQuadric(); //!!!
 }
Exemplo n.º 33
0
 public static extern void gluQuadricOrientation(GLUquadric quadObject, uint orientation);
Exemplo n.º 34
0
 public static extern void gluQuadricDrawStyle(GLUquadric quadObject, uint drawStyle);
Exemplo n.º 35
0
 public static extern void gluSphere(GLUquadric qobj, double radius, int slices, int stacks);
Exemplo n.º 36
0
 public static extern void gluQuadricNormals(GLUquadric quadObject, uint normals);
Exemplo n.º 37
0
 public static extern void gluQuadricOrientation(GLUquadric quadObject, uint orientation);
Exemplo n.º 38
0
 public static extern void gluDisk(GLUquadric qobj, double innerRadius, double outerRadius, int slices, int loops);
Exemplo n.º 39
0
 public static extern void gluQuadricTexture(GLUquadric quadObject, byte textureCoords);
Exemplo n.º 40
0
 public static extern void gluPartialDisk(GLUquadric qobj, double innerRadius, double outerRadius, int slices, int loops, double startAngle, double sweepAngle);
Exemplo n.º 41
0
 public static extern void gluCylinder(GLUquadric qobj, double baseRadius, double topRadius, double height, int slices, int stacks);
Exemplo n.º 42
0
 public static extern void gluDisk(GLUquadric qobj, double innerRadius, double outerRadius, int slices, int loops);
Exemplo n.º 43
0
 public static extern void gluDeleteQuadric(GLUquadric state);
Exemplo n.º 44
0
 public static extern void gluDeleteQuadric(GLUquadric state);