Merge branch 'master' of github.com:worklist/hifi

This commit is contained in:
Stephen Birarda 2013-03-12 10:15:46 -07:00
commit 0f0cee1a46
5 changed files with 73 additions and 18 deletions

11
.gitignore vendored
View file

@ -23,4 +23,13 @@ profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.hmap
interface/Debug/
interface/external/
interface/hifi.build/
shared/Debug/
shared/hifi.build/
interface/includes/InterfaceConfig.h

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View file

@ -29,11 +29,12 @@ public:
void getInputLoudness(float * lastLoudness, float * averageLoudness);
void updateMixerParams(in_addr_t mixerAddress, in_port_t mixerPort);
void setSourcePosition(glm::vec3 position);
// terminates audio I/O
bool terminate();
private:
bool initialized;
AudioData *audioData;
// protects constructor so that public init method is used

View file

@ -8,10 +8,13 @@
#include <iostream>
#include <glm/glm.hpp>
#include <cstring>
#include "Head.h"
#include "Util.h"
#include "SerialInterface.h"
#include <vector>
#include <lodepng.h>
#include <fstream>
#include <sstream>
using namespace std;
float skinColor[] = {1.0, 0.84, 0.66};
float browColor[] = {210.0/255.0, 105.0/255.0, 30.0/255.0};
@ -28,6 +31,14 @@ float browThickness = 0.16;
const float DECAY = 0.1;
char iris_texture_file[] = "interface.app/Contents/Resources/images/green_eye.png";
vector<unsigned char> iris_texture;
unsigned int iris_texture_width = 512;
unsigned int iris_texture_height = 256;
GLUquadric *sphere = gluNewQuadric();
Head::Head()
{
position.x = position.y = position.z = 0;
@ -64,10 +75,24 @@ Head::Head()
setNoise(0);
hand = new Hand(glm::vec3(skinColor[0], skinColor[1], skinColor[2]));
if (iris_texture.size() == 0) {
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
if (error != 0) {
std::cout << "error " << error << ": " << lodepng_error_text(error) << std::endl;
}
}
}
Head::~Head() {
// all data is primitive, do nothing
if (sphere) {
gluDeleteQuadric(sphere);
}
}
Head* Head::clone() const {
return new Head(*this);
}
Head* Head::clone() const {
@ -218,11 +243,11 @@ void Head::simulate(float deltaTime)
{
SetNewHeadTarget((randFloat()-0.5)*20.0, (randFloat()-0.5)*45.0);
}
if (0)
{
// Pick new target
// Pick new target
PitchTarget = (randFloat() - 0.5)*45;
YawTarget = (randFloat() - 0.5)*22;
}
@ -341,14 +366,29 @@ void Head::render(int faceToFace, int isMine, float * myLocation)
glutSolidSphere(0.25, 30, 30);
}
glPopMatrix();
// Right Pupil
if (!sphere) {
sphere = gluNewQuadric();
gluQuadricTexture(sphere, GL_TRUE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gluQuadricOrientation(sphere, GLU_OUTSIDE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iris_texture_width, iris_texture_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &iris_texture[0]);
}
glPushMatrix();
{
glRotatef(EyeballPitch[1], 1, 0, 0);
glRotatef(EyeballYaw[1] + PupilConverge, 0, 1, 0);
glTranslatef(0,0,.35);
if (!eyeContact) glColor3f(0,0,0); else glColor3f(0.3,0.3,0.3);
//glRotatef(90,0,1,0);
glutSolidSphere(PupilSize, 15, 15);
glRotatef(-75,1,0,0);
glScalef(1.0, 0.4, 1.0);
glEnable(GL_TEXTURE_2D);
gluSphere(sphere, PupilSize, 15, 15);
glDisable(GL_TEXTURE_2D);
}
glPopMatrix();
// Left Eye
@ -364,14 +404,19 @@ void Head::render(int faceToFace, int isMine, float * myLocation)
glPopMatrix();
// Left Pupil
glPushMatrix();
{
glRotatef(EyeballPitch[0], 1, 0, 0);
glRotatef(EyeballYaw[0] - PupilConverge, 0, 1, 0);
glTranslatef(0,0,.35);
if (!eyeContact) glColor3f(0,0,0); else glColor3f(0.3,0.3,0.3);
//glRotatef(90,0,1,0);
glutSolidSphere(PupilSize, 15, 15);
glPopMatrix();
glTranslatef(0, 0, .35);
glRotatef(-75, 1, 0, 0);
glScalef(1.0, 0.4, 1.0);
glEnable(GL_TEXTURE_2D);
gluSphere(sphere, PupilSize, 15, 15);
glDisable(GL_TEXTURE_2D);
}
glPopMatrix();
}
glPopMatrix();

View file

@ -9,7 +9,7 @@
#include "Texture.h"
#include "InterfaceConfig.h"
#include <LodePNG/lodepng.h>
#include <lodepng.h>
#include <vector>
#include <cstdio>