public void getbox() { GLUquadric q = GLU.gluNewQuadric(); color c1 = new color(); GL.glScalef(0.125f, 0.125f, 0.125f); GL.glBegin(GL.GL_QUADS); // Front Face // Front Face GL.glNormal3f(0.0f, 0.0f, 1.0f); GL.glTexCoord2f(0.0f, 0.0f); GL.glVertex3f(-1.0f, -1.0f, 1.0f); GL.glTexCoord2f(1.0f, 0.0f); GL.glVertex3f(1.0f, -1.0f, 1.0f); GL.glTexCoord2f(1.0f, 1.0f); GL.glVertex3f(1.0f, 1.0f, 1.0f); GL.glTexCoord2f(0.0f, 1.0f); GL.glVertex3f(-1.0f, 1.0f, 1.0f); // Back Face GL.glNormal3f(0.0f, 0.0f, -1.0f); GL.glTexCoord2f(1.0f, 0.0f); GL.glVertex3f(-1.0f, -1.0f, -1.0f); GL.glTexCoord2f(1.0f, 1.0f); GL.glVertex3f(-1.0f, 1.0f, -1.0f); GL.glTexCoord2f(0.0f, 1.0f); GL.glVertex3f(1.0f, 1.0f, -1.0f); GL.glTexCoord2f(0.0f, 0.0f); GL.glVertex3f(1.0f, -1.0f, -1.0f); // Top Face GL.glNormal3f(0.0f, 1.0f, 0.0f); GL.glTexCoord2f(0.0f, 1.0f); GL.glVertex3f(-1.0f, 1.0f, -1.0f); GL.glTexCoord2f(0.0f, 0.0f); GL.glVertex3f(-1.0f, 1.0f, 1.0f); GL.glTexCoord2f(1.0f, 0.0f); GL.glVertex3f(1.0f, 1.0f, 1.0f); GL.glTexCoord2f(1.0f, 1.0f); GL.glVertex3f(1.0f, 1.0f, -1.0f); // Bottom Face GL.glNormal3f(0.0f, -1.0f, 0.0f); GL.glTexCoord2f(1.0f, 1.0f); GL.glVertex3f(-1.0f, -1.0f, -1.0f); GL.glTexCoord2f(0.0f, 1.0f); GL.glVertex3f(1.0f, -1.0f, -1.0f); GL.glTexCoord2f(0.0f, 0.0f); GL.glVertex3f(1.0f, -1.0f, 1.0f); GL.glTexCoord2f(1.0f, 0.0f); GL.glVertex3f(-1.0f, -1.0f, 1.0f); // Right face GL.glNormal3f(1.0f, 0.0f, 0.0f); GL.glTexCoord2f(1.0f, 0.0f); GL.glVertex3f(1.0f, -1.0f, -1.0f); GL.glTexCoord2f(1.0f, 1.0f); GL.glVertex3f(1.0f, 1.0f, -1.0f); GL.glTexCoord2f(0.0f, 1.0f); GL.glVertex3f(1.0f, 1.0f, 1.0f); GL.glTexCoord2f(0.0f, 0.0f); GL.glVertex3f(1.0f, -1.0f, 1.0f); // Left Face GL.glNormal3f(-1.0f, 0.0f, 0.0f); GL.glTexCoord2f(0.0f, 0.0f); GL.glVertex3f(-1.0f, -1.0f, -1.0f); GL.glTexCoord2f(1.0f, 0.0f); GL.glVertex3f(-1.0f, -1.0f, 1.0f); GL.glTexCoord2f(1.0f, 1.0f); GL.glVertex3f(-1.0f, 1.0f, 1.0f); GL.glTexCoord2f(0.0f, 1.0f); GL.glVertex3f(-1.0f, 1.0f, -1.0f); GL.glEnd(); GL.glScalef(8, 8, 8); GL.glTranslatef(0, -0.1f, 0.3f); GL.glColor3fv(c1.yellow); lo.LoadTextures1(5); GLU.gluQuadricNormals(q, GLU.GLU_SMOOTH); GLU.gluQuadricTexture(q, 1); GLU.gluDisk(q, 0.01, 0.1, 32, 32); GL.glTranslatef(0, -0.01f, -0.3f); GLU.gluDisk(q, 0.01, 0.1, 32, 32); }
public Tank(float positionX, float positionZ, float initialRotation) { rotation = initialRotation; posX = positionX; posZ = positionZ; destinX = positionX; destinZ = positionZ; reloadCounter = reloadTime; obj = GLU.gluNewQuadric(); }
public Bullet(float positionX, float positionY, float positionZ, float velX, float velZ, float initialRotation) { rotation = initialRotation; originalSpeedX = (float)(velX - System.Math.Sin(System.Math.PI / 180 * (initialRotation))); originalSpeedZ = (float)(velZ - System.Math.Cos(System.Math.PI / 180 * (initialRotation))); originalPositionX = positionX; originalPositionZ = positionZ; speedX = originalSpeedX; speedZ = originalSpeedZ; posX = positionX; posY = positionY; posZ = positionZ; remainingLife = 100; boom = false; boomcolor = 0.5f; obj = GLU.gluNewQuadric(); }
unsafe public void showHolesCylider() { GL.glPushMatrix(); GL.glNewList(2000, GL.GL_COMPILE); GL.glEnable(GL.GL_COLOR_MATERIAL); GL.glColorMaterial(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE); GL.glColor3d(0.5, 0.5, 1); GL.glBegin(GL.GL_POINTS); // GL.glPointSize(3); for (int i = 0; i < holes.Count; i++) { GL.glPushMatrix(); IntPtr pObj; pObj = GLU.gluNewQuadric(); GL.glTranslated(holes[i].X, holes[i].Y, holes[i].Z - 1000); GLU.gluCylinder(pObj, 5, 5, 600, 20, 20); GL.glPopMatrix(); // GL.glVertex3d(holes[i].X, holes[i].Y, holes[i].Z); } GL.glEnd(); GL.glEndList(); GL.glPopMatrix(); }
void makeRectangularPrism(float x1, float y1, float z1, float x2, float y2, float z2) { float width = (x2 - x1) / 2; if (width < 1) { width = -width; } float height = (y2 - y1) / 2; if (height < 1) { height = -height; } float depth = (z2 - z1) / 2; if (depth < 1) { depth = -depth; } GL.glColor3f(0.273f, 0.252f, 0.135f); //army-green light GL.glBegin(GL.GL_QUADS); //Front GL.glNormal3f(0.0f, 0.0f, -1.0f); GL.glVertex3f(-width, -height, depth); GL.glVertex3f(width, -height, depth); GL.glVertex3f(width, height, depth); GL.glVertex3f(-width, height, depth); //Top GL.glNormal3f(0.0f, 1.0f, 0.0f); GL.glVertex3f(-width, height, -depth); GL.glVertex3f(-width, height, depth); GL.glVertex3f(width, height, depth); GL.glVertex3f(width, height, -depth); //Bottom GL.glNormal3f(0.0f, -1.0f, 0.0f); GL.glVertex3f(-width, -height, -depth); GL.glVertex3f(-width, -height, depth); GL.glVertex3f(width, -height, depth); GL.glVertex3f(width, -height, -depth); //Right GL.glNormal3f(1.0f, 0.0f, 0.0f); GL.glVertex3f(width, -height, -depth); GL.glVertex3f(width, height, -depth); GL.glVertex3f(width, height, depth); GL.glVertex3f(width, -height, depth); //Left GL.glNormal3f(-1.0f, 0.0f, 0.0f); GL.glVertex3f(-width, -height, -depth); GL.glVertex3f(-width, -height, depth); GL.glVertex3f(-width, height, depth); GL.glVertex3f(-width, height, -depth); GL.glEnd(); GL.glEnable(GL.GL_TEXTURE_2D); GL.glBindTexture(GL.GL_TEXTURE_2D, cOGL.Textures[2]); GL.glColor3f(1, 1, 1); //white GL.glBegin(GL.GL_QUADS); //Back GL.glNormal3f(0.0f, 0.0f, 1.0f); GL.glTexCoord2f(0, 0); GL.glVertex3f(-width, -height, -depth); GL.glTexCoord2f(0, 1); GL.glVertex3f(-width, height, -depth); GL.glTexCoord2f(1, 1); GL.glVertex3f(width, height, -depth); GL.glTexCoord2f(1, 0); GL.glVertex3f(width, -height, -depth); GL.glEnd(); GLUquadric obj; obj = GLU.gluNewQuadric(); //!!! //barrel GL.glPushMatrix(); GL.glTranslatef(0.0f, 0.025f, -1f); GLU.gluCylinder(obj, 0.05, 0.05, 1.2, 10, 2); GL.glPopMatrix(); GL.glDisable(GL.GL_TEXTURE_2D);//!!! }
void makeRectangularPrismstelth(float x1, float y1, float z1, float x2, float y2, float z2) { float width = (x2 - x1) / 2; if (width < 1) { width = -width; } float height = (y2 - y1) / 2; if (height < 1) { height = -height; } float depth = (z2 - z1) / 2; if (depth < 1) { depth = -depth; } if (TankType == 2) { height = 0.25f * height; GL.glTranslatef(0.0f, -0.3f, 0); } GL.glColor4f(0.2f, 0.2f, 0.2f, 1f); //black stelth GL.glBegin(GL.GL_QUADS); //Front GL.glNormal3f(0.0f, 0.0f, -1.0f); GL.glVertex3f(-width, -height, depth); GL.glVertex3f(width, -height, depth); GL.glVertex3f(width, height, depth); GL.glVertex3f(-width, height, depth); //Top GL.glNormal3f(0.0f, 1.0f, 0.0f); GL.glVertex3f(-width, height, -depth); GL.glVertex3f(-width, height, depth); GL.glVertex3f(width, height, depth); GL.glVertex3f(width, height, -depth); //Bottom GL.glNormal3f(0.0f, -1.0f, 0.0f); GL.glVertex3f(-width, -height, -depth); GL.glVertex3f(-width, -height, depth); GL.glVertex3f(width, -height, depth); GL.glVertex3f(width, -height, -depth); //Right GL.glNormal3f(1.0f, 0.0f, 0.0f); GL.glVertex3f(width, -height, -depth); GL.glVertex3f(width, height, -depth); GL.glVertex3f(width, height, depth); GL.glVertex3f(width, -height, depth); //Left GL.glNormal3f(-1.0f, 0.0f, 0.0f); GL.glVertex3f(-width, -height, -depth); GL.glVertex3f(-width, -height, depth); GL.glVertex3f(-width, height, depth); GL.glVertex3f(-width, height, -depth); GL.glEnd(); GL.glColor4f(0.2f, 0.2f, 0.2f, 1f); //black stelth GL.glBegin(GL.GL_QUADS); //Back GL.glNormal3f(0.0f, 0.0f, 1.0f); GL.glVertex3f(-width, -height, -depth); GL.glVertex3f(-width, height, -depth); GL.glVertex3f(width, height, -depth); GL.glVertex3f(width, -height, -depth); GL.glEnd(); GLUquadric obj; obj = GLU.gluNewQuadric(); //!!! //barrel GL.glPushMatrix(); GL.glTranslatef(0.0f, 0.025f, -1f); GLU.gluCylinder(obj, 0.05, 0.05, 1.2, 10, 2); GL.glPopMatrix(); }