Added class files for rendering head

This commit is contained in:
Philip Rosedale 2012-09-11 09:07:28 -07:00
parent 908a853223
commit fe94473b6c
2 changed files with 67 additions and 0 deletions

39
head.cpp Normal file
View file

@ -0,0 +1,39 @@
//
// head.cpp
// interface
//
// Created by Philip Rosedale on 9/11/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#include <iostream>
#include "head.h"
void Head::render()
{
glDisable(GL_DEPTH_TEST);
glPushMatrix();
glTranslatef(0.f, -4.f, -15.f);
glRotatef(yaw/2.0, 0, 1, 0);
glRotatef(pitch/2.0, 1, 0, 0);
glScalef(0.5, 1.0, 1.1);
glColor3f(1.0, 0.84, 0.66);
glutSolidSphere(1.f, 15, 15); // Head
glTranslatef(1.f, 0.f, 0.f);
glPushMatrix();
glScalef(0.5, 0.75, 1.0);
glutSolidSphere(0.5f, 15, 15); // Ears
glPopMatrix();
glTranslatef(-2.f, 0.f, 0.f);
glPushMatrix();
glScalef(0.5, 0.75, 1.0);
glutSolidSphere(0.5f, 15, 15);
glPopMatrix();
glTranslatef(1.f, 1.f, 0.f);
glScalef(2.5, 0.5, 2.2);
glColor3f(0.5, 0.5, 0.5);
glutSolidSphere(0.25f, 15, 15); // Beanie
glPopMatrix();
}

28
head.h Normal file
View file

@ -0,0 +1,28 @@
//
// head.h
// interface
//
// Created by Philip Rosedale on 9/11/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#ifndef interface_head_h
#define interface_head_h
#include <iostream>
#include "field.h"
#include "world.h"
#include <GLUT/glut.h>
class Head {
float pitch;
float yaw;
float roll;
public:
void setPitch(float);
void getPitch(float);
void render();
void update();
};
#endif