From fe94473b6cf4ab9a5667c7fcab9d0cb2c2b93d17 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 11 Sep 2012 09:07:28 -0700 Subject: [PATCH] Added class files for rendering head --- head.cpp | 39 +++++++++++++++++++++++++++++++++++++++ head.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 head.cpp create mode 100644 head.h diff --git a/head.cpp b/head.cpp new file mode 100644 index 0000000000..8cdf13c9ec --- /dev/null +++ b/head.cpp @@ -0,0 +1,39 @@ +// +// head.cpp +// interface +// +// Created by Philip Rosedale on 9/11/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#include +#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(); + +} diff --git a/head.h b/head.h new file mode 100644 index 0000000000..fb51d421db --- /dev/null +++ b/head.h @@ -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 +#include "field.h" +#include "world.h" +#include + +class Head { + float pitch; + float yaw; + float roll; +public: + void setPitch(float); + void getPitch(float); + void render(); + void update(); +}; + +#endif