mirror of
https://github.com/lubosz/overte.git
synced 2025-04-26 22:35:27 +02:00
remove duplicate sources directory
This commit is contained in:
parent
03db6f0a9b
commit
8a7db1f63c
42 changed files with 163 additions and 12627 deletions
Source
Sources
SerialInterface.cppSerialInterface.hagent.cppagent.haudio.cppaudio.hcloud.cppcloud.hcube.cppcube.hfield.cppfield.hfinger.cppfinger.hhand.cpphand.h
hardware/head_hand
head.cpphead.hlattice.cpplattice.hlodepng.cpplodepng.hmain.cppmarker_acquisition_view.cppmarker_acquisition_view.hmarkers.cppmarkers.hnetwork.cppnetwork.hparticle.cppparticle.htexture.cpptexture.hutil.cpputil.hworld.hinterface.xcodeproj
|
@ -1,10 +1,10 @@
|
|||
//
|
||||
// audio.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Seiji Emery on 9/2/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
//
|
||||
// audio.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Seiji Emery on 9/2/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file audio.cpp
|
||||
|
@ -19,13 +19,14 @@
|
|||
#include <cstring>
|
||||
#include "audio.h"
|
||||
|
||||
// static member definitions
|
||||
// (required – will cause linker errors if left out...):
|
||||
// static member definitions
|
||||
// (required – will cause linker errors if left out...):
|
||||
bool Audio::initialized;
|
||||
Audio::AudioData *Audio::data;
|
||||
PaStream *Audio::stream;
|
||||
PaError Audio::err;
|
||||
float Audio::AudioData::inputGain;
|
||||
|
||||
/**
|
||||
* Audio callback used by portaudio.
|
||||
* Communicates with Audio via a shared pointer to Audio::data.
|
||||
|
@ -45,6 +46,7 @@ float Audio::AudioData::inputGain;
|
|||
* @return Should be of type PaStreamCallbackResult. Return paComplete to end the stream, or paContinue to continue (default).
|
||||
Can be used to end the stream from within the callback.
|
||||
*/
|
||||
|
||||
int audioCallback (const void *inputBuffer,
|
||||
void *outputBuffer,
|
||||
unsigned long frames,
|
||||
|
@ -58,10 +60,10 @@ int audioCallback (const void *inputBuffer,
|
|||
|
||||
#if WRITE_AUDIO_INPUT_TO_OUTPUT
|
||||
if (input != NULL) {// && Audio::writeAudioInputToOutput) {
|
||||
// combine input into data buffer
|
||||
|
||||
// temp variables (frames and bufferPos need to remain untouched so they can be used in the second block of code)
|
||||
unsigned int f = (unsigned int)frames,
|
||||
// combine input into data buffer
|
||||
|
||||
// temp variables (frames and bufferPos need to remain untouched so they can be used in the second block of code)
|
||||
unsigned int f = (unsigned int)frames,
|
||||
p = data->bufferPos;
|
||||
for (; p < data->bufferLength && f > 0; --f, ++p) {
|
||||
#if WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
|
@ -75,7 +77,7 @@ int audioCallback (const void *inputBuffer,
|
|||
#endif
|
||||
}
|
||||
if (f > 0) {
|
||||
// handle data->buffer wraparound
|
||||
// handle data->buffer wraparound
|
||||
for (p = 0; f > 0; --f, ++p) {
|
||||
#if WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
data->buffer[p].l +=
|
||||
|
@ -88,7 +90,8 @@ int audioCallback (const void *inputBuffer,
|
|||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#elif WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
if (input != NULL) {// && Audio::writeAudioInputToBuffer) {
|
||||
unsigned int f = (unsigned int)frames,
|
||||
|
@ -106,6 +109,7 @@ int audioCallback (const void *inputBuffer,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Write data->buffer into outputBuffer
|
||||
if (data->bufferPos + frames >= data->bufferLength) {
|
||||
// wraparound: write first section (end of buffer) first
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//
|
||||
// audio.h
|
||||
// interface
|
||||
//
|
||||
// Created by Seiji Emery on 9/2/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
//
|
||||
// audio.h
|
||||
// interface
|
||||
//
|
||||
// Created by Seiji Emery on 9/2/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_audio_h
|
||||
#define interface_audio_h
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <iostream>
|
||||
#include "head.h"
|
||||
#include "util.h"
|
||||
#include "glm/gtx/vector_angle.hpp"
|
||||
#include "vector_angle.hpp"
|
||||
|
||||
float skinColor[] = {1.0, 0.84, 0.66};
|
||||
float browColor[] = {210.0/255.0, 105.0/255.0, 30.0/255.0};
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include "glm.hpp"
|
||||
#include <portaudio.h>
|
||||
#include "portaudio.h"
|
||||
|
||||
// Bring in OpenCV
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
@ -62,7 +62,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
int audio_on = 0; // Whether to turn on the audio support
|
||||
int audio_on = 1; // Whether to turn on the audio support
|
||||
int simulate_on = 1;
|
||||
|
||||
// Network Socket Stuff
|
||||
|
|
|
@ -1,110 +0,0 @@
|
|||
//
|
||||
// SerialInterface.cpp
|
||||
//
|
||||
// Used to read Arduino/Maple ADC data from an external device using a serial port (over USB)
|
||||
//
|
||||
|
||||
#include "SerialInterface.h"
|
||||
#include <iostream>
|
||||
|
||||
// These includes are for serial port reading/writing
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
|
||||
|
||||
int serial_fd;
|
||||
|
||||
const int MAX_BUFFER = 100;
|
||||
char serial_buffer[MAX_BUFFER];
|
||||
int serial_buffer_pos = 0;
|
||||
|
||||
// For accessing the serial port
|
||||
int init_port(int baud)
|
||||
{
|
||||
serial_fd = open(SERIAL_PORT_NAME, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
|
||||
if (serial_fd == -1) return -1; // Failed to open port
|
||||
|
||||
struct termios options;
|
||||
tcgetattr(serial_fd,&options);
|
||||
switch(baud)
|
||||
{
|
||||
case 9600: cfsetispeed(&options,B9600);
|
||||
cfsetospeed(&options,B9600);
|
||||
break;
|
||||
case 19200: cfsetispeed(&options,B19200);
|
||||
cfsetospeed(&options,B19200);
|
||||
break;
|
||||
case 38400: cfsetispeed(&options,B38400);
|
||||
cfsetospeed(&options,B38400);
|
||||
break;
|
||||
case 115200: cfsetispeed(&options,B115200);
|
||||
cfsetospeed(&options,B115200);
|
||||
break;
|
||||
default:cfsetispeed(&options,B9600);
|
||||
cfsetospeed(&options,B9600);
|
||||
break;
|
||||
}
|
||||
options.c_cflag |= (CLOCAL | CREAD);
|
||||
options.c_cflag &= ~PARENB;
|
||||
options.c_cflag &= ~CSTOPB;
|
||||
options.c_cflag &= ~CSIZE;
|
||||
options.c_cflag |= CS8;
|
||||
tcsetattr(serial_fd,TCSANOW,&options);
|
||||
|
||||
return 0; // Success!
|
||||
}
|
||||
|
||||
int read_sensors(int first_measurement, float * avg_adc_channels, int * adc_channels, int * samples_averaged, int * LED_state)
|
||||
{
|
||||
// Channels:
|
||||
// 0, 1 = Head Pitch and Yaw
|
||||
// 2,3,4 = Head X,Y,Z Acceleration
|
||||
//
|
||||
int samples_read = 0;
|
||||
const float AVG_RATE[] = {0.001, 0.001, 0.001, 0.001, 0.001, 0.001};
|
||||
char bufchar[1];
|
||||
while (read(serial_fd, bufchar, 1) > 0)
|
||||
{
|
||||
serial_buffer[serial_buffer_pos] = bufchar[0];
|
||||
serial_buffer_pos++;
|
||||
// Have we reached end of a line of input?
|
||||
if ((bufchar[0] == '\n') || (serial_buffer_pos >= MAX_BUFFER))
|
||||
{
|
||||
samples_read++;
|
||||
// At end - Extract value from string to variables
|
||||
if (serial_buffer[0] != 'p')
|
||||
{
|
||||
sscanf(serial_buffer, "%d %d %d %d %d %d %d %d", /* Needs to match Num Channels */
|
||||
&adc_channels[0],
|
||||
&adc_channels[1],
|
||||
&adc_channels[2],
|
||||
&adc_channels[3],
|
||||
&adc_channels[4],
|
||||
&adc_channels[5],
|
||||
samples_averaged,
|
||||
LED_state
|
||||
);
|
||||
for (int i = 0; i < NUM_CHANNELS; i++)
|
||||
{
|
||||
if (!first_measurement)
|
||||
avg_adc_channels[i] = (1.f - AVG_RATE[i])*avg_adc_channels[i] +
|
||||
AVG_RATE[i]*(float)adc_channels[i];
|
||||
else
|
||||
{
|
||||
avg_adc_channels[i] = (float)adc_channels[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Clear rest of string for printing onscreen
|
||||
while(serial_buffer_pos++ < MAX_BUFFER) serial_buffer[serial_buffer_pos] = ' ';
|
||||
serial_buffer_pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return samples_read;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// SerialInterface.h
|
||||
//
|
||||
|
||||
|
||||
#ifndef interface_SerialInterface_h
|
||||
#define interface_SerialInterface_h
|
||||
|
||||
int init_port (int baud);
|
||||
int read_sensors(int first_measurement, float * avg_adc_channels, int * adc_channels, int * samples_averaged, int * LED_state);
|
||||
|
||||
#define NUM_CHANNELS 6
|
||||
#define SERIAL_PORT_NAME "/dev/tty.usbmodem1411"
|
||||
|
||||
// Acceleration sensors, in screen/world coord system (X = left/right, Y = Up/Down, Z = fwd/back)
|
||||
#define ACCEL_X 4
|
||||
#define ACCEL_Y 5
|
||||
#define ACCEL_Z 3
|
||||
|
||||
// Gyro sensors, in coodinate system of head/airplane
|
||||
#define PITCH_RATE 0
|
||||
#define YAW_RATE 1
|
||||
#define ROLL_RATE 2
|
||||
|
||||
#endif
|
|
@ -1,111 +0,0 @@
|
|||
//
|
||||
// agent.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 11/20/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include "agent.h"
|
||||
#include "head.h"
|
||||
|
||||
// Structure to hold references to other agents that are nearby
|
||||
|
||||
const int MAX_AGENTS = 100;
|
||||
struct AgentList {
|
||||
in_addr sin_addr;
|
||||
Head head;
|
||||
} agents[MAX_AGENTS];
|
||||
int num_agents = 0;
|
||||
|
||||
//
|
||||
// Process an incoming spaceserver packet telling you about other nearby agents
|
||||
//
|
||||
void update_agents(char * data, int length) {
|
||||
std::string packet(data, length);
|
||||
std::cout << " Update Agents, string: " << packet << "\n";
|
||||
size_t spot;
|
||||
size_t start_spot = 0;
|
||||
spot = packet.find_first_of (",", 0);
|
||||
while (spot != std::string::npos) {
|
||||
std::string IPstring = packet.substr(start_spot, spot-start_spot);
|
||||
//std::cout << "Found " << num_agents <<
|
||||
//" with IP " << IPstring << " from " << start_spot << " to " << spot << "\n";
|
||||
// Add the IP address to the agent table
|
||||
add_agent(&IPstring);
|
||||
start_spot = spot + 1;
|
||||
if (start_spot < packet.length())
|
||||
spot = packet.find_first_of (",", start_spot);
|
||||
else spot = std::string::npos;
|
||||
}
|
||||
}
|
||||
|
||||
void render_agents() {
|
||||
for (int i = 0; i < num_agents; i++) {
|
||||
glm::vec3 pos = agents[i].head.getPos();
|
||||
glPushMatrix();
|
||||
glTranslatef(pos.x, pos.y, pos.z);
|
||||
agents[i].head.render();
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update a single agent with data received from that agent's IP address
|
||||
//
|
||||
void update_agent(in_addr addr, char * data, int length)
|
||||
{
|
||||
std::cout << "Looking for agent: " << inet_ntoa(addr) << "\n";
|
||||
for (int i = 0; i < num_agents; i++) {
|
||||
if (agents[i].sin_addr.s_addr == addr.s_addr) {
|
||||
// Update the agent
|
||||
agents[i].head.recvBroadcastData(data, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Look for an agent by it's IP number, add if it does not exist in local list
|
||||
//
|
||||
int add_agent(std::string * IP) {
|
||||
in_addr_t addr = inet_addr(IP->c_str());
|
||||
//std::cout << "Checking for " << IP->c_str() << " ";
|
||||
for (int i = 0; i < num_agents; i++) {
|
||||
if (agents[i].sin_addr.s_addr == addr) {
|
||||
//std::cout << "Found!\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (num_agents < MAX_AGENTS) {
|
||||
agents[num_agents].sin_addr.s_addr = addr;
|
||||
std::cout << "Added Agent # " << num_agents << " with IP " <<
|
||||
inet_ntoa(agents[num_agents].sin_addr) << "\n";
|
||||
num_agents++;
|
||||
return 1;
|
||||
} else {
|
||||
std::cout << "Max agents reached fail!\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Broadcast data to all the other agents you are aware of, returns 1 for success
|
||||
//
|
||||
int broadcast_to_agents(int handle, char * data, int length) {
|
||||
sockaddr_in dest_address;
|
||||
dest_address.sin_family = AF_INET;
|
||||
dest_address.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
|
||||
int sent_bytes;
|
||||
for (int i = 0; i < num_agents; i++) {
|
||||
dest_address.sin_addr.s_addr = agents[i].sin_addr.s_addr;
|
||||
sent_bytes = sendto( handle, (const char*)data, length,
|
||||
0, (sockaddr*)&dest_address, sizeof(sockaddr_in) );
|
||||
if (sent_bytes != length) {
|
||||
std::cout << "Broadcast packet fail!\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
//
|
||||
// agent.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 11/20/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_agent_h
|
||||
#define interface_agent_h
|
||||
|
||||
#include "glm.hpp"
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include "network.h"
|
||||
|
||||
void update_agents(char * data, int length);
|
||||
int add_agent(std::string * IP);
|
||||
int broadcast_to_agents(int handle, char * data, int length);
|
||||
void update_agent(in_addr addr, char * data, int length);
|
||||
void render_agents();
|
||||
|
||||
#endif
|
|
@ -1,391 +0,0 @@
|
|||
//
|
||||
// audio.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Seiji Emery on 9/2/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file audio.cpp
|
||||
* Low level audio i/o portaudio wrapper.
|
||||
*
|
||||
* @author Seiji Emery
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include "audio.h"
|
||||
|
||||
// static member definitions
|
||||
// (required – will cause linker errors if left out...):
|
||||
bool Audio::initialized;
|
||||
Audio::AudioData *Audio::data;
|
||||
PaStream *Audio::stream;
|
||||
PaError Audio::err;
|
||||
float Audio::AudioData::inputGain;
|
||||
|
||||
/**
|
||||
* Audio callback used by portaudio.
|
||||
* Communicates with Audio via a shared pointer to Audio::data.
|
||||
* Writes input audio channels (if they exist) into Audio::data->buffer,
|
||||
multiplied by Audio::data->inputGain.
|
||||
* Then writes Audio::data->buffer into output audio channels, and clears
|
||||
the portion of Audio::data->buffer that has been read from for reuse.
|
||||
*
|
||||
* @param[in] inputBuffer A pointer to an internal portaudio data buffer containing data read by portaudio.
|
||||
* @param[out] outputBuffer A pointer to an internal portaudio data buffer to be read by the configured output device.
|
||||
* @param[in] frames Number of frames that portaudio requests to be read/written.
|
||||
(Valid size of input/output buffers = frames * number of channels (2) * sizeof data type (float)).
|
||||
* @param[in] timeInfo Portaudio time info. Currently unused.
|
||||
* @param[in] statusFlags Portaudio status flags. Currently unused.
|
||||
* @param[in] userData Pointer to supplied user data (in this case, a pointer to Audio::data).
|
||||
Used to communicate with external code (since portaudio calls this function from another thread).
|
||||
* @return Should be of type PaStreamCallbackResult. Return paComplete to end the stream, or paContinue to continue (default).
|
||||
Can be used to end the stream from within the callback.
|
||||
*/
|
||||
int audioCallback (const void *inputBuffer,
|
||||
void *outputBuffer,
|
||||
unsigned long frames,
|
||||
const PaStreamCallbackTimeInfo *timeInfo,
|
||||
PaStreamCallbackFlags statusFlags,
|
||||
void *userData)
|
||||
{
|
||||
Audio::AudioData *data = (Audio::AudioData*)userData;
|
||||
float *input = (float*)inputBuffer;
|
||||
float *output = (float*)outputBuffer;
|
||||
|
||||
#if WRITE_AUDIO_INPUT_TO_OUTPUT
|
||||
if (input != NULL) {// && Audio::writeAudioInputToOutput) {
|
||||
// combine input into data buffer
|
||||
|
||||
// temp variables (frames and bufferPos need to remain untouched so they can be used in the second block of code)
|
||||
unsigned int f = (unsigned int)frames,
|
||||
p = data->bufferPos;
|
||||
for (; p < data->bufferLength && f > 0; --f, ++p) {
|
||||
#if WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
data->buffer[p].l +=
|
||||
data->inputBuffer[p].l = (*input++) * data->inputGain;
|
||||
data->buffer[p].r +=
|
||||
data->inputBuffer[p].r = (*input++) * data->inputGain;
|
||||
#else
|
||||
data->buffer[p].l += (*input++) * data->inputGain;
|
||||
data->buffer[p].r += (*input++) * data->inputGain;
|
||||
#endif
|
||||
}
|
||||
if (f > 0) {
|
||||
// handle data->buffer wraparound
|
||||
for (p = 0; f > 0; --f, ++p) {
|
||||
#if WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
data->buffer[p].l +=
|
||||
data->inputBuffer[p].l = (*input++) * data->inputGain;
|
||||
data->buffer[p].r +=
|
||||
data->inputBuffer[p].r = (*input++) * data->inputGain;
|
||||
#else
|
||||
data->buffer[p].l += (*input++) * data->inputGain;
|
||||
data->buffer[p].r += (*input++) * data->inputGain;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
if (input != NULL) {// && Audio::writeAudioInputToBuffer) {
|
||||
unsigned int f = (unsigned int)frames,
|
||||
p = data->bufferPos;
|
||||
for (; p < data->bufferLength && f > 0; --f, ++p) {
|
||||
data->inputBuffer[p].l = (*input++) * data->inputGain;
|
||||
data->inputBuffer[p].r = (*input++) * data->inputGain;
|
||||
}
|
||||
if (f > 0) {
|
||||
// handle data->buffer wraparound
|
||||
for (p = 0; f > 0; --f, ++p) {
|
||||
data->inputBuffer[p].l = (*input++) * data->inputGain;
|
||||
data->inputBuffer[p].r = (*input++) * data->inputGain;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Write data->buffer into outputBuffer
|
||||
if (data->bufferPos + frames >= data->bufferLength) {
|
||||
// wraparound: write first section (end of buffer) first
|
||||
|
||||
// note: buffer is just an array of a struct of floats, so it can be typecast to float*
|
||||
memcpy(output, (float*)(data->buffer + data->bufferPos), // write data buffer
|
||||
(data->bufferLength - data->bufferPos) * 2 * sizeof(float));
|
||||
memset((float*)(data->buffer + data->bufferPos), 0, // clear data buffer
|
||||
(data->bufferLength - data->bufferPos) * 2 * sizeof(float));
|
||||
frames -= (data->bufferLength - data->bufferPos); // adjust frames to be written
|
||||
data->bufferPos = 0; // reset position to start
|
||||
}
|
||||
|
||||
memcpy(output, (float*)(data->buffer + data->bufferPos), // write data buffer
|
||||
frames * 2 * sizeof(float));
|
||||
memset((float*)(data->buffer + data->bufferPos), 0, // clear data buffer
|
||||
frames * 2 * sizeof(float));
|
||||
data->bufferPos += frames; // update position
|
||||
|
||||
return paContinue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize portaudio and start an audio stream.
|
||||
* Should be called at the beginning of program exection.
|
||||
* @seealso Audio::terminate
|
||||
* @return Returns true if successful or false if an error occurred.
|
||||
Use Audio::getError() to retrieve the error code.
|
||||
*/
|
||||
bool Audio::init()
|
||||
{
|
||||
initialized = true;
|
||||
|
||||
data = new AudioData();
|
||||
|
||||
err = Pa_Initialize();
|
||||
if (err != paNoError) goto error;
|
||||
|
||||
err = Pa_OpenDefaultStream(&stream,
|
||||
1, // input channels
|
||||
1, // output channels
|
||||
paFloat32, // sample format
|
||||
22050, // sample rate (hz)
|
||||
512, // frames per buffer
|
||||
audioCallback, // callback function
|
||||
(void*)data); // user data to be passed to callback
|
||||
if (err != paNoError) goto error;
|
||||
|
||||
err = Pa_StartStream(stream);
|
||||
if (err != paNoError) goto error;
|
||||
|
||||
return paNoError;
|
||||
error:
|
||||
fprintf(stderr, "-- Failed to initialize portaudio --\n");
|
||||
fprintf(stderr, "PortAudio error (%d): %s\n", err, Pa_GetErrorText(err));
|
||||
initialized = false;
|
||||
delete[] data;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the running audio stream, and deinitialize portaudio.
|
||||
* Should be called at the end of program execution.
|
||||
* @return Returns true if the initialization was successful, or false if an error occured.
|
||||
The error code may be retrieved by Audio::getError().
|
||||
*/
|
||||
bool Audio::terminate ()
|
||||
{
|
||||
if (!initialized)
|
||||
return true;
|
||||
initialized = false;
|
||||
// err = Pa_StopStream(stream);
|
||||
// if (err != paNoError) goto error;
|
||||
|
||||
err = Pa_CloseStream(stream);
|
||||
if (err != paNoError) goto error;
|
||||
|
||||
delete data;
|
||||
|
||||
err = Pa_Terminate();
|
||||
if (err != paNoError) goto error;
|
||||
|
||||
return true;
|
||||
error:
|
||||
fprintf(stderr, "-- portaudio termination error --\n");
|
||||
fprintf(stderr, "PortAudio error (%d): %s\n", err, Pa_GetErrorText(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a stereo audio stream (float*) to the audio buffer.
|
||||
* Values should be clamped between -1.0f and 1.0f.
|
||||
* @param[in] offset Write offset from the start of the audio buffer.
|
||||
* @param[in] length Length of audio channels to be read.
|
||||
* @param[in] left Left channel of the audio stream.
|
||||
* @param[in] right Right channel of the audio stream.
|
||||
*/
|
||||
void Audio::writeAudio (unsigned int offset, unsigned int length, float const *left, float const *right) {
|
||||
if (data->buffer == NULL)
|
||||
return;
|
||||
if (length > data->bufferLength) {
|
||||
fprintf(stderr, "Audio::writeAudio length exceeded (%d). Truncating to %d.\n", length, data->bufferLength);
|
||||
length = data->bufferLength;
|
||||
}
|
||||
unsigned int p = data->bufferPos + offset;
|
||||
if (p > data->bufferLength)
|
||||
p -= data->bufferLength;
|
||||
for (; p < data->bufferLength && length > 0; --length, ++p) {
|
||||
data->buffer[p].l = *left++;
|
||||
data->buffer[p].r = *right++;
|
||||
}
|
||||
if (length > 0) {
|
||||
p = 0;
|
||||
for (; length > 0; --length, ++p) {
|
||||
data->buffer[p].l = *left++;
|
||||
data->buffer[p].r = *right++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a repeated stereo sample (float) to the audio buffer.
|
||||
* Values should be clamped between -1.0f and 1.0f.
|
||||
* @param[in] offset Write offset from the start of the audio buffer.
|
||||
* @param[in] length Length of tone.
|
||||
* @param[in] left Left component.
|
||||
* @param[in] right Right component.
|
||||
*/
|
||||
void Audio::writeTone (unsigned int offset, unsigned int length, float const left, float const right) {
|
||||
if (data->buffer == NULL)
|
||||
return;
|
||||
if (length > data->bufferLength) {
|
||||
fprintf(stderr, "Audio::writeTone length exceeded (%d). Truncating to %d.\n", length, data->bufferLength);
|
||||
length = data->bufferLength;
|
||||
}
|
||||
unsigned int p = data->bufferPos + offset;
|
||||
if (p > data->bufferLength)
|
||||
p -= data->bufferLength;
|
||||
for (; p < data->bufferLength && length > 0; --length, ++p) {
|
||||
data->buffer[p].l = left;
|
||||
data->buffer[p].r = right;
|
||||
}
|
||||
if (length > 0) {
|
||||
p = 0;
|
||||
for (; length > 0; --length, ++p) {
|
||||
data->buffer[p].l = left;
|
||||
data->buffer[p].r = right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a stereo audio stream (float*) to the audio buffer.
|
||||
* Audio stream is added to the existing contents of the audio buffer.
|
||||
* Values should be clamped between -1.0f and 1.0f.
|
||||
* @param[in] offset Write offset from the start of the audio buffer.
|
||||
* @param[in] length Length of audio channels to be read.
|
||||
* @param[in] left Left channel of the audio stream.
|
||||
* @param[in] right Right channel of the audio stream.
|
||||
*/
|
||||
void Audio::addAudio (unsigned int offset, unsigned int length, float const *left, float const *right) {
|
||||
if (data->buffer == NULL)
|
||||
return;
|
||||
if (length > data->bufferLength) {
|
||||
fprintf(stderr, "Audio::addAudio length exceeded (%d). Truncating to %d.\n", length, data->bufferLength);
|
||||
length = data->bufferLength;
|
||||
}
|
||||
unsigned int p = data->bufferPos + offset;
|
||||
if (p > data->bufferLength)
|
||||
p -= data->bufferLength;
|
||||
for (; p < data->bufferLength && length > 0; --length, ++p) {
|
||||
data->buffer[p].l += *left++;
|
||||
data->buffer[p].r += *right++;
|
||||
}
|
||||
if (length > 0) {
|
||||
p = 0;
|
||||
for (; length > 0; --length, ++p) {
|
||||
data->buffer[p].l += *left++;
|
||||
data->buffer[p].r += *right++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a repeated stereo sample (float) to the audio buffer.
|
||||
* Sample is added to the existing contents of the audio buffer.
|
||||
* Values should be clamped between -1.0f and 1.0f.
|
||||
* @param[in] offset Write offset from the start of the audio buffer.
|
||||
* @param[in] length Length of tone.
|
||||
* @param[in] left Left component.
|
||||
* @param[in] right Right component.
|
||||
*/
|
||||
void Audio::addTone (unsigned int offset, unsigned int length, float const left, float const right) {
|
||||
if (data->buffer == NULL)
|
||||
return;
|
||||
if (length > data->bufferLength) {
|
||||
fprintf(stderr, "Audio::writeTone length exceeded (%d). Truncating to %d.\n", length, data->bufferLength);
|
||||
length = data->bufferLength;
|
||||
}
|
||||
unsigned int p = data->bufferPos + offset;
|
||||
if (p > data->bufferLength)
|
||||
p -= data->bufferLength;
|
||||
for (; p < data->bufferLength && length > 0; --length, ++p) {
|
||||
data->buffer[p].l += left;
|
||||
data->buffer[p].r += right;
|
||||
}
|
||||
if (length > 0) {
|
||||
p = 0;
|
||||
for (; length > 0; --length, ++p) {
|
||||
data->buffer[p].l += left;
|
||||
data->buffer[p].r += right;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Clear a section of the audio buffer.
|
||||
* @param[in] offset Offset from the start of the audio buffer.
|
||||
* @param[in] length Length of section to clear.
|
||||
*/
|
||||
void Audio::clearAudio(unsigned int offset, unsigned int length) {
|
||||
if (data->buffer == NULL)
|
||||
return;
|
||||
if (length > data->bufferLength) {
|
||||
fprintf(stderr, "Audio::clearAudio length exceeded (%d). Truncating to %d.\n", length, data->bufferLength);
|
||||
length = data->bufferLength;
|
||||
}
|
||||
unsigned int p = data->bufferPos + offset;
|
||||
if (p > data->bufferLength)
|
||||
p -= data->bufferLength;
|
||||
if (length + p < data->bufferLength) {
|
||||
memset((float*)(data->buffer + p), 0,
|
||||
sizeof(float) * 2 * length);
|
||||
} else {
|
||||
memset((float*)(data->buffer + p), 0,
|
||||
sizeof(float) * 2 * (data->bufferLength - p));
|
||||
memset((float*)(data->buffer + p), 0,
|
||||
sizeof(float) * 2 * (data->bufferLength + p - data->bufferLength));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read audio input into the target buffer.
|
||||
* @param[in] offset Offset from the start of the input audio buffer to read from.
|
||||
* @param[in] length Length of the target buffer.
|
||||
* @param[out] left Left channel of the target buffer.
|
||||
* @param[out] right Right channel of the target buffer.
|
||||
*/
|
||||
void Audio::readAudioInput (unsigned int offset, unsigned int length, float *left, float *right) {
|
||||
#if WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
if (data->inputBuffer == NULL)
|
||||
return;
|
||||
if (length + offset > data->bufferLength) {
|
||||
fprintf(stderr, "Audio::readAudioInput length exceeded (%d + %d). Truncating to %d + %d.\n", offset, length, offset, data->bufferLength - offset);
|
||||
length = data->bufferLength - offset;
|
||||
}
|
||||
unsigned int p = data->bufferPos + offset;
|
||||
if (p > data->bufferLength)
|
||||
p -= data->bufferLength;
|
||||
for (; p < data->bufferLength && length > 0; --length, ++p) {
|
||||
*left++ = data->inputBuffer[p].l;
|
||||
*right++ = data->inputBuffer[p].r;
|
||||
}
|
||||
if (length > 0) {
|
||||
p = 0;
|
||||
for (; length > 0; --length, ++p) {
|
||||
*left++ = data->inputBuffer[p].l;
|
||||
*right++ = data->inputBuffer[p].r;
|
||||
}
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
151
Sources/audio.h
151
Sources/audio.h
|
@ -1,151 +0,0 @@
|
|||
//
|
||||
// audio.h
|
||||
// interface
|
||||
//
|
||||
// Created by Seiji Emery on 9/2/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_audio_h
|
||||
#define interface_audio_h
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
// Note: main documentation in audio.cpp
|
||||
|
||||
/**
|
||||
* If enabled, direct the audio callback to write the audio input buffer
|
||||
* directly into the audio output buffer.
|
||||
*/
|
||||
#define WRITE_AUDIO_INPUT_TO_OUTPUT 1
|
||||
/**
|
||||
* If enabled, create an additional buffer to store audio input
|
||||
* and direct the audio callback to write the audio input to this buffer.
|
||||
*/
|
||||
#define WRITE_AUDIO_INPUT_TO_BUFFER 0
|
||||
|
||||
// Note: I initially used static const bools within the Audio class and normal
|
||||
// 'if' blocks instead of preprocessor - under the assumption that the compiler
|
||||
// would optimize out the redundant code.
|
||||
// However, as that apparently did not work (for some reason or another - even
|
||||
// with full compiler optimization turned on), I've switched to using preprocessor
|
||||
// macros instead (which is probably faster anyways (at compile-time)).
|
||||
|
||||
/**
|
||||
* Low level audio interface.
|
||||
*
|
||||
* Contains static methods that write to an internal audio buffer, which
|
||||
is read from by a portaudio callback.
|
||||
* Responsible for initializing and terminating portaudio. Audio::init()
|
||||
and Audio::terminate() should be called at the beginning and end of
|
||||
program execution.
|
||||
*/
|
||||
class Audio {
|
||||
public:
|
||||
// Initializes portaudio. Should be called at the beginning of program execution.
|
||||
static bool init ();
|
||||
// Deinitializes portaudio. Should be called at the end of program execution.
|
||||
static bool terminate ();
|
||||
|
||||
// Write methods: write to internal audio buffer.
|
||||
static void writeAudio (unsigned int offset, unsigned int length, float const *left, float const *right);
|
||||
static void addAudio (unsigned int offset, unsigned int length, float const *left, float const *right);
|
||||
static void writeTone (unsigned int offset, unsigned int length, float const left, float const right);
|
||||
static void addTone (unsigned int offset, unsigned int length, float const left, float const right);
|
||||
static void clearAudio (unsigned int offset, unsigned int length);
|
||||
|
||||
// Read data from internal 'input' audio buffer to an external audio buffer.
|
||||
// (*only* works if WRITE_AUDIO_INPUT_TO_BUFFER is enabled).
|
||||
static void readAudioInput (unsigned int offset, unsigned int length, float *left, float *right);
|
||||
|
||||
/**
|
||||
* Set the audio input gain. (multiplier applied to mic input)
|
||||
*/
|
||||
static void setInputGain (float gain) {
|
||||
data->inputGain = gain;
|
||||
}
|
||||
/**
|
||||
* Get the internal portaudio error code (paNoError if none).
|
||||
* Use in conjunction with Audio::init() or Audio::terminate(), as it is not
|
||||
impacted by any other methods.
|
||||
*/
|
||||
const PaError getError () { return err; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Set to true by Audio::init() and false by Audio::terminate().
|
||||
* Used to prevent Audio::terminate() from deleting uninitialized memory.
|
||||
*/
|
||||
static bool initialized;
|
||||
|
||||
/**
|
||||
* Internal audio data.
|
||||
* Used to communicate with the audio callback code via a shared pointer.
|
||||
*/
|
||||
static struct AudioData {
|
||||
/**
|
||||
* Internal (stereo) audio buffer.
|
||||
* Written to by Audio I/O methods and the audio callback.
|
||||
* As this is a ring buffer, it should not be written to directly – thus methods
|
||||
like Audio::writeAudio are provided.
|
||||
*/
|
||||
struct BufferFrame{
|
||||
float l, r;
|
||||
} *buffer, *inputBuffer;
|
||||
/**
|
||||
* Length of the audio buffer.
|
||||
*/
|
||||
const static unsigned int bufferLength = 1000;
|
||||
/**
|
||||
* Current position (start) within the ring buffer.
|
||||
* Updated by the audio callback.
|
||||
*/
|
||||
unsigned int bufferPos;
|
||||
/**
|
||||
* Audio input gain (multiplier applied to the incoming audio stream).
|
||||
* Use Audio::setInputGain() to modify this.
|
||||
*/
|
||||
static float inputGain;// = 1.f;
|
||||
|
||||
AudioData () : bufferPos(0) {
|
||||
inputGain = 1.0f;
|
||||
buffer = new BufferFrame[bufferLength];
|
||||
memset((float*)buffer, 0, sizeof(float) * bufferLength * 2);
|
||||
#if WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
inputBuffer = new BufferFrame[bufferLength];
|
||||
memset((float*)inputBuffer, 0, sizeof(float) * bufferLength * 2);
|
||||
#else
|
||||
inputBuffer = NULL;
|
||||
#endif
|
||||
}
|
||||
~AudioData () {
|
||||
delete[] buffer;
|
||||
#if WRITE_AUDIO_INPUT_TO_BUFFER
|
||||
delete[] inputBuffer;
|
||||
#endif
|
||||
}
|
||||
}*data;
|
||||
/**
|
||||
* Internal audio stream handle.
|
||||
*/
|
||||
static PaStream *stream;
|
||||
/**
|
||||
* Internal error code (used only by Audio::init() and Audio::terminate()).
|
||||
*/
|
||||
static PaError err;
|
||||
|
||||
Audio (); // prevent instantiation (private constructor)
|
||||
|
||||
friend int audioCallback (const void*, void*, unsigned long, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags, void*);
|
||||
};
|
||||
|
||||
// Audio callback called by portaudio.
|
||||
int audioCallback (const void *inputBuffer,
|
||||
void *outputBuffer,
|
||||
unsigned long framesPerBuffer,
|
||||
const PaStreamCallbackTimeInfo *timeInfo,
|
||||
PaStreamCallbackFlags statusFlags,
|
||||
void *userData);
|
||||
|
||||
|
||||
#endif
|
|
@ -1,136 +0,0 @@
|
|||
//
|
||||
// cloud.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 11/17/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include "cloud.h"
|
||||
#include "util.h"
|
||||
|
||||
#define COLOR_MIN 0.2f // minimum R/G/B value at 0,0,0 - also needs setting in field.cpp
|
||||
|
||||
Cloud::Cloud(int num,
|
||||
glm::vec3 box,
|
||||
int wrap) {
|
||||
// Create and initialize particles
|
||||
int i;
|
||||
bounds = box;
|
||||
count = num;
|
||||
wrapBounds = wrap;
|
||||
particles = new Particle[count];
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
float x = randFloat()*box.x;
|
||||
float y = randFloat()*box.y;
|
||||
float z = randFloat()*box.z;
|
||||
particles[i].position.x = x;
|
||||
particles[i].position.y = y;
|
||||
particles[i].position.z = z;
|
||||
|
||||
particles[i].velocity.x = randFloat() - 0.5;
|
||||
particles[i].velocity.y = randFloat() - 0.5;
|
||||
particles[i].velocity.z = randFloat() - 0.5;
|
||||
|
||||
float color_mult = 1 - COLOR_MIN;
|
||||
particles[i].color = glm::vec3(x*color_mult/WORLD_SIZE + COLOR_MIN,
|
||||
y*color_mult/WORLD_SIZE + COLOR_MIN,
|
||||
z*color_mult/WORLD_SIZE + COLOR_MIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Cloud::render() {
|
||||
|
||||
float particle_attenuation_quadratic[] = { 0.0f, 0.0f, 2.0f };
|
||||
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, particle_attenuation_quadratic );
|
||||
|
||||
float maxSize = 0.0f;
|
||||
glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maxSize );
|
||||
glPointSize( maxSize );
|
||||
glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, maxSize );
|
||||
glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, 0.001f );
|
||||
|
||||
glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
|
||||
glEnable( GL_POINT_SPRITE_ARB );
|
||||
glBegin( GL_POINTS );
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
glColor3f(particles[i].color.x,
|
||||
particles[i].color.y,
|
||||
particles[i].color.z);
|
||||
glVertex3f(particles[i].position.x,
|
||||
particles[i].position.y,
|
||||
particles[i].position.z);
|
||||
}
|
||||
glEnd();
|
||||
glDisable( GL_POINT_SPRITE_ARB );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
}
|
||||
|
||||
void Cloud::simulate (float deltaTime) {
|
||||
int i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
|
||||
// Update position
|
||||
particles[i].position += particles[i].velocity*deltaTime;
|
||||
//particles[i].position += particles[i].velocity;
|
||||
|
||||
// Decay Velocity (Drag)
|
||||
const float CONSTANT_DAMPING = 0.5;
|
||||
particles[i].velocity *= (1.f - CONSTANT_DAMPING*deltaTime);
|
||||
|
||||
// Interact with Field
|
||||
const float FIELD_COUPLE = 0.005; //0.0000001;
|
||||
field_interact(deltaTime, &particles[i].position, &particles[i].velocity, &particles[i].color, FIELD_COUPLE);
|
||||
|
||||
// Update color to velocity
|
||||
particles[i].color = (glm::normalize(particles[i].velocity)*0.5f);
|
||||
particles[i].color += 0.5f;
|
||||
|
||||
|
||||
// Bounce or Wrap
|
||||
if (wrapBounds) {
|
||||
// wrap around bounds
|
||||
if (particles[i].position.x > bounds.x)
|
||||
particles[i].position.x -= bounds.x;
|
||||
else if (particles[i].position.x < 0.0f)
|
||||
particles[i].position.x += bounds.x;
|
||||
|
||||
if (particles[i].position.y > bounds.y)
|
||||
particles[i].position.y -= bounds.y;
|
||||
else if (particles[i].position.y < 0.0f)
|
||||
particles[i].position.y += bounds.y;
|
||||
|
||||
if (particles[i].position.z > bounds.z)
|
||||
particles[i].position.z -= bounds.z;
|
||||
else if (particles[i].position.z < 0.0f)
|
||||
particles[i].position.z += bounds.z;
|
||||
} else {
|
||||
// Bounce at bounds
|
||||
if (particles[i].position.x > bounds.x
|
||||
|| particles[i].position.x < 0.f) {
|
||||
if (particles[i].position.x > bounds.x) particles[i].position.x = bounds.x;
|
||||
else particles[i].position.x = 0.f;
|
||||
particles[i].velocity.x *= -1;
|
||||
}
|
||||
if (particles[i].position.y > bounds.y
|
||||
|| particles[i].position.y < 0.f) {
|
||||
if (particles[i].position.y > bounds.y) particles[i].position.y = bounds.y;
|
||||
else particles[i].position.y = 0.f;
|
||||
particles[i].velocity.y *= -1;
|
||||
}
|
||||
if (particles[i].position.z > bounds.z
|
||||
|| particles[i].position.z < 0.f) {
|
||||
if (particles[i].position.z > bounds.z) particles[i].position.z = bounds.z;
|
||||
else particles[i].position.z = 0.f;
|
||||
particles[i].velocity.z *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// cloud.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 11/17/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_cloud_h
|
||||
#define interface_cloud_h
|
||||
|
||||
#include "field.h"
|
||||
|
||||
class Cloud {
|
||||
public:
|
||||
Cloud(int num,
|
||||
glm::vec3 box,
|
||||
int wrap);
|
||||
|
||||
void simulate(float deltaTime);
|
||||
void render();
|
||||
|
||||
private:
|
||||
struct Particle {
|
||||
glm::vec3 position, velocity, color;
|
||||
} *particles;
|
||||
unsigned int count;
|
||||
glm::vec3 bounds;
|
||||
bool wrapBounds;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,82 +0,0 @@
|
|||
//
|
||||
// cube.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip on 12/31/12.
|
||||
// Copyright (c) 2012 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#include "cube.h"
|
||||
|
||||
#define MAX_CUBES 250000
|
||||
#define SMALLEST_CUBE 0.005
|
||||
|
||||
float cubes_position[MAX_CUBES*3];
|
||||
float cubes_scale[MAX_CUBES];
|
||||
float cubes_color[MAX_CUBES*3];
|
||||
int cube_count = 0;
|
||||
|
||||
void makeCubes2D(float location[3], float scale, int * index,
|
||||
float * cubes_position, float * cubes_scale, float * cubes_color) {
|
||||
int i;
|
||||
float spot[3];
|
||||
float distance = powf(location[0]*location[0] + location[2]*location[2], 0.5);
|
||||
|
||||
if (*index >= MAX_CUBES) return;
|
||||
if ((scale <= SMALLEST_CUBE) || (scale/distance < 0.025) || ((scale < 0.1) && (randFloat()<0.01))) {
|
||||
// Make a cube
|
||||
for (i = 0; i < 3; i++) cubes_position[*index*3 + i] = location[i]+scale/2.0;
|
||||
//glm::vec2 noisepoint(location[0], location[2]);
|
||||
//float color = glm::noise(noisepoint);
|
||||
float color = 0.3 + randFloat()*0.7;
|
||||
cubes_scale[*index] = scale;
|
||||
cubes_color[*index*3] = color;
|
||||
cubes_color[*index*3 + 1] = color;
|
||||
cubes_color[*index*3 + 2] = color;
|
||||
*index += 1;
|
||||
} else {
|
||||
for (i = 0; i < 4; i++) {
|
||||
spot[0] = location[0] + (i%2)*scale/2.0;
|
||||
spot[2] = location[2] + ((i/2)%2)*scale/2.0;
|
||||
spot[1] = sinf(location[0])*0.15 + cosf(location[2]/0.2)*0.10 + randFloat()*0.005;
|
||||
makeCubes2D(spot, scale/2.0, index, cubes_position, cubes_scale, cubes_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VoxelSystem::VoxelSystem(int num,
|
||||
glm::vec3 box) {
|
||||
|
||||
float location[] = {0,0,0};
|
||||
float scale = 10.0;
|
||||
int j = 0;
|
||||
int index = 0;
|
||||
if (num > 0)
|
||||
makeCubes2D(location, scale, &index, cubes_position, cubes_scale, cubes_color);
|
||||
std::cout << "Run " << j << " Made " << index << " cubes\n";
|
||||
cube_count = index;
|
||||
|
||||
}
|
||||
|
||||
void VoxelSystem::render() {
|
||||
glPushMatrix();
|
||||
int i = 0;
|
||||
while (i < cube_count) {
|
||||
glPushMatrix();
|
||||
glTranslatef(cubes_position[i*3], cubes_position[i*3+1], cubes_position[i*3+2]);
|
||||
glColor3fv(&cubes_color[i*3]);
|
||||
glutSolidCube(cubes_scale[i]);
|
||||
glPopMatrix();
|
||||
i++;
|
||||
}
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void VoxelSystem::simulate(float deltaTime) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
//
|
||||
// cube.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip on 12/31/12.
|
||||
// Copyright (c) 2012 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_cube_h
|
||||
#define interface_cube_h
|
||||
|
||||
#include "glm.hpp"
|
||||
#include "util.h"
|
||||
#include "world.h"
|
||||
#include <GLUT/glut.h>
|
||||
#include <iostream>
|
||||
|
||||
class VoxelSystem {
|
||||
public:
|
||||
VoxelSystem(int num,
|
||||
glm::vec3 box);
|
||||
void simulate(float deltaTime);
|
||||
void render();
|
||||
private:
|
||||
struct Voxel {
|
||||
glm::vec3 color;
|
||||
bool hasChildren;
|
||||
Voxel * children;
|
||||
} *voxels;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,228 +0,0 @@
|
|||
//
|
||||
// field.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/23/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#include "field.h"
|
||||
#include "glm.hpp"
|
||||
#define FIELD_SCALE 0.00050
|
||||
#define COLOR_DRIFT_RATE 0.001f // per-frame drift of particle color towards field element color
|
||||
#define COLOR_MIN 0.2f // minimum R/G/B value at 0,0,0 - also needs setting in cloud.cpp
|
||||
|
||||
#define USE_SCALAR 0
|
||||
|
||||
// A vector-valued field over an array of elements arranged as a 3D lattice
|
||||
|
||||
int field_value(float *value, float *pos)
|
||||
// sets the vector value (3 floats) to field value at location pos in space.
|
||||
// returns zero if the location is outside world bounds
|
||||
{
|
||||
int index = (int)(pos[0]/WORLD_SIZE*10.0) +
|
||||
(int)(pos[1]/WORLD_SIZE*10.0)*10 +
|
||||
(int)(pos[2]/WORLD_SIZE*10.0)*100;
|
||||
if ((index >= 0) && (index < FIELD_ELEMENTS))
|
||||
{
|
||||
value[0] = field[index].val.x;
|
||||
value[1] = field[index].val.y;
|
||||
value[2] = field[index].val.z;
|
||||
return 1;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
void field_init()
|
||||
// Initializes the field to some random values
|
||||
{
|
||||
int i;
|
||||
float fx, fy, fz;
|
||||
for (i = 0; i < FIELD_ELEMENTS; i++)
|
||||
{
|
||||
field[i].val.x = (randFloat() - 0.5)*FIELD_SCALE;
|
||||
field[i].val.y = (randFloat() - 0.5)*FIELD_SCALE;
|
||||
field[i].val.z = (randFloat() - 0.5)*FIELD_SCALE;
|
||||
field[i].scalar = 0;
|
||||
// Record center point for this field cell
|
||||
fx = (int)(i % 10);
|
||||
fy = (int)(i%100 / 10);
|
||||
fz = (int)(i / 100);
|
||||
field[i].center.x = fx + 0.5;
|
||||
field[i].center.y = fy + 0.5;
|
||||
field[i].center.z = fz + 0.5;
|
||||
|
||||
// and set up the RGB values for each field element.
|
||||
float color_mult = 1 - COLOR_MIN;
|
||||
fieldcolors[i].rgb = glm::vec3(((i%10)*(color_mult/10.0f)) + COLOR_MIN,
|
||||
((i%100)*(color_mult/100.0f)) + COLOR_MIN,
|
||||
(i*(color_mult/1000.0f)) + COLOR_MIN);
|
||||
}
|
||||
}
|
||||
|
||||
void field_add(float* add, float *pos)
|
||||
// At location loc, add vector add to the field values
|
||||
{
|
||||
int index = (int)(pos[0]/WORLD_SIZE*10.0) +
|
||||
(int)(pos[1]/WORLD_SIZE*10.0)*10 +
|
||||
(int)(pos[2]/WORLD_SIZE*10.0)*100;
|
||||
if ((index >= 0) && (index < FIELD_ELEMENTS))
|
||||
{
|
||||
field[index].val.x += add[0];
|
||||
field[index].val.y += add[1];
|
||||
field[index].val.z += add[2];
|
||||
}
|
||||
}
|
||||
|
||||
void field_interact(float dt, glm::vec3 * pos, glm::vec3 * vel, glm::vec3 * color, float coupling) {
|
||||
|
||||
int index = (int)(pos->x/WORLD_SIZE*10.0) +
|
||||
(int)(pos->y/WORLD_SIZE*10.0)*10 +
|
||||
(int)(pos->z/WORLD_SIZE*10.0)*100;
|
||||
if ((index >= 0) && (index < FIELD_ELEMENTS)) {
|
||||
//
|
||||
// Vector Coupling with particle velocity
|
||||
//
|
||||
*vel += field[index].val*dt; // Particle influenced by field
|
||||
|
||||
glm::vec3 temp = *vel*dt; // Field influenced by particle
|
||||
temp *= coupling;
|
||||
field[index].val += temp;
|
||||
//
|
||||
// Scalar coupling: Damp particle as function of local density
|
||||
//
|
||||
|
||||
if (USE_SCALAR) {
|
||||
//*vel *= (1.f + field[index].scalar*0.01*dt);
|
||||
const float SCALAR_PARTICLE_ADD = 1.0;
|
||||
field[index].scalar += SCALAR_PARTICLE_ADD*dt;
|
||||
}
|
||||
|
||||
|
||||
// add a fraction of the field color to the particle color
|
||||
//*color = (*color * (1 - COLOR_DRIFT_RATE)) + (fieldcolors[index].rgb * COLOR_DRIFT_RATE);
|
||||
}
|
||||
}
|
||||
|
||||
void field_avg_neighbors(int index, glm::vec3 * result) {
|
||||
// Given index to field element i, return neighbor field values
|
||||
glm::vec3 neighbors(0,0,0);
|
||||
|
||||
int x,y,z;
|
||||
x = (int)(index % 10);
|
||||
y = (int)(index%100 / 10);
|
||||
z = (int)(index / 100);
|
||||
|
||||
neighbors += field[(x+1)%10 + y*10 + z*100].val;
|
||||
neighbors += field[(x-1)%10 + y*10 + z*100].val;
|
||||
|
||||
neighbors += field[x + ((y+1)%10)*10 + z*100].val;
|
||||
neighbors += field[x + ((y-1)%10)*10 + z*100].val;
|
||||
|
||||
neighbors += field[x + y*10 + ((z+1)%10)*100].val;
|
||||
neighbors += field[x%10 + y*10 + ((z-1)%10)*100].val;
|
||||
|
||||
neighbors /= 6;
|
||||
result->x = neighbors.x;
|
||||
result->y = neighbors.y;
|
||||
result->z = neighbors.z;
|
||||
|
||||
}
|
||||
|
||||
void field_simulate(float dt) {
|
||||
glm::vec3 neighbors, add, diff;
|
||||
float size, distance;
|
||||
int i, j;
|
||||
for (i = 0; i < FIELD_ELEMENTS; i++)
|
||||
{
|
||||
if (0) { //(randFloat() > 0.01) {
|
||||
field_avg_neighbors(i, &neighbors);
|
||||
size = powf(field[i].val.x*field[i].val.x +
|
||||
field[i].val.y*field[i].val.y +
|
||||
field[i].val.z*field[i].val.z, 0.5);
|
||||
|
||||
neighbors *= 0.0001;
|
||||
field[i].val = glm::normalize(field[i].val);
|
||||
field[i].val *= size * 0.99;
|
||||
add = glm::normalize(neighbors);
|
||||
add *= size * 0.01;
|
||||
field[i].val += add;
|
||||
}
|
||||
else {
|
||||
const float CONSTANT_DAMPING = 0.5;
|
||||
const float CONSTANT_SCALAR_DAMPING = 2.5;
|
||||
field[i].val *= (1.f - CONSTANT_DAMPING*dt);
|
||||
field[i].scalar *= (1.f - CONSTANT_SCALAR_DAMPING*dt);
|
||||
}
|
||||
|
||||
if (USE_SCALAR) {
|
||||
//
|
||||
// Compute a field value from sum of all other field values (electrostatics, etc)
|
||||
//
|
||||
field[i].fld.x = field[i].fld.y = field[i].fld.z = 0;
|
||||
for (j = 0; j < FIELD_ELEMENTS; j++)
|
||||
{
|
||||
if (i != j) {
|
||||
// Compute vector field from scalar densities
|
||||
diff = field[j].center - field[i].center;
|
||||
distance = glm::length(diff);
|
||||
diff = glm::normalize(diff);
|
||||
field[i].fld += diff*field[j].scalar*(1/distance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void field_render()
|
||||
// Render the field lines
|
||||
{
|
||||
int i;
|
||||
float fx, fy, fz;
|
||||
float scale_view = 0.1;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glBegin(GL_LINES);
|
||||
for (i = 0; i < FIELD_ELEMENTS; i++)
|
||||
{
|
||||
fx = field[i].center.x;
|
||||
fy = field[i].center.y;
|
||||
fz = field[i].center.z;
|
||||
|
||||
glColor3f(0, 1, 0);
|
||||
glVertex3f(fx, fy, fz);
|
||||
glVertex3f(fx + field[i].val.x*scale_view,
|
||||
fy + field[i].val.y*scale_view,
|
||||
fz + field[i].val.z*scale_view);
|
||||
if (USE_SCALAR) {
|
||||
glColor3f(1, 0, 0);
|
||||
glVertex3f(fx, fy, fz);
|
||||
glVertex3f(fx, fy+field[i].scalar*0.01, fz);
|
||||
glColor3f(1, 1, 0);
|
||||
glVertex3f(fx, fy, fz);
|
||||
glVertex3f(fx + field[i].fld.x*0.0001,
|
||||
fy + field[i].fld.y*0.0001,
|
||||
fz + field[i].fld.z*0.0001);
|
||||
}
|
||||
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glColor3f(0, 1, 0);
|
||||
glPointSize(4.0);
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
glBegin(GL_POINTS);
|
||||
|
||||
for (i = 0; i < FIELD_ELEMENTS; i++)
|
||||
{
|
||||
fx = (int)(i % 10);
|
||||
fy = (int)(i%100 / 10);
|
||||
fz = (int)(i / 100);
|
||||
|
||||
glVertex3f(fx, fy, fz);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
//
|
||||
// field.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/23/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_field_h
|
||||
#define interface_field_h
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
#include <iostream>
|
||||
#include "world.h"
|
||||
#include "util.h"
|
||||
#include "glm.hpp"
|
||||
|
||||
// Field is a lattice of vectors uniformly distributed FIELD_ELEMENTS^(1/3) on side
|
||||
const int FIELD_ELEMENTS = 1000;
|
||||
|
||||
struct {
|
||||
glm::vec3 val;
|
||||
glm::vec3 center;
|
||||
glm::vec3 fld;
|
||||
float scalar;
|
||||
} field[FIELD_ELEMENTS];
|
||||
|
||||
// Pre-calculated RGB values for each field element
|
||||
struct {
|
||||
glm::vec3 rgb;
|
||||
} fieldcolors[FIELD_ELEMENTS];
|
||||
|
||||
void field_init();
|
||||
int field_value(float *ret, float *pos);
|
||||
void field_render();
|
||||
void field_add(float* add, float *loc);
|
||||
void field_interact(float dt, glm::vec3 * pos, glm::vec3 * vel, glm::vec3 * color, float coupling);
|
||||
void field_simulate(float dt);
|
||||
glm::vec3 hsv2rgb(glm::vec3 in);
|
||||
#endif
|
|
@ -1,192 +0,0 @@
|
|||
//
|
||||
// finger.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip on 1/21/13.
|
||||
// Copyright (c) 2013 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#include "finger.h"
|
||||
|
||||
const int NUM_BEADS = 75;
|
||||
const float RADIUS = 50; // Radius of beads around finger
|
||||
|
||||
const int NUM_PUCKS = 10;
|
||||
|
||||
Finger::Finger(int w, int h) {
|
||||
width = w;
|
||||
height = h;
|
||||
pos.x = pos.y = 0;
|
||||
vel.x = vel.y = 0;
|
||||
target.x = target.y = 0;
|
||||
m = 1;
|
||||
pressure = 0;
|
||||
start = true;
|
||||
// Create surface beads
|
||||
beads = new bead[NUM_BEADS];
|
||||
pucks = new puck[NUM_PUCKS];
|
||||
|
||||
float alpha = 0;
|
||||
for (int i = 0; i < NUM_BEADS; i++) {
|
||||
beads[i].target.x = cosf(alpha)*RADIUS + 2.0*(randFloat() - 0.5);
|
||||
beads[i].target.y = sinf(alpha)*RADIUS + 2.0*(randFloat() - 0.5);
|
||||
beads[i].pos.x = beads[i].pos.y = 0.0;
|
||||
beads[i].vel.x = beads[i].vel.y = 0.0;
|
||||
alpha += 2*PI/NUM_BEADS;
|
||||
beads[i].color[0] = randFloat()*0.05; beads[i].color[1] = randFloat()*0.05; beads[i].color[2] = 0.75 + randFloat()*0.25;
|
||||
beads[i].brightness = 0.0;
|
||||
}
|
||||
for (int i = 0; i < NUM_PUCKS; i++) {
|
||||
pucks[i].pos.x = randFloat()*width;
|
||||
pucks[i].pos.y = randFloat()*height;
|
||||
pucks[i].radius = 5.0 + randFloat()*30.0;
|
||||
pucks[i].vel.x = pucks[i].vel.y = 0.0;
|
||||
pucks[i].mass = pucks[i].radius*pucks[i].radius/25.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const float SHADOW_COLOR[4] = {0.0, 0.0, 0.0, 0.75};
|
||||
const float SHADOW_OFFSET = 2.5;
|
||||
|
||||
void Finger::render() {
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
|
||||
glPointSize(30.0f);
|
||||
glBegin(GL_POINTS);
|
||||
glColor4fv(SHADOW_COLOR);
|
||||
glVertex2f(pos.x + SHADOW_OFFSET, pos.y + SHADOW_OFFSET);
|
||||
glColor4f(0.0, 0.0, 0.7, 1.0);
|
||||
glVertex2f(pos.x, pos.y);
|
||||
glEnd();
|
||||
|
||||
// Render Pucks
|
||||
for (int i = 0; i < NUM_PUCKS; i++) {
|
||||
glColor4fv(SHADOW_COLOR);
|
||||
glPointSize(pucks[i].radius*2.f);
|
||||
glBegin(GL_POINTS);
|
||||
glVertex2f(pucks[i].pos.x + SHADOW_OFFSET, pucks[i].pos.y + SHADOW_OFFSET);
|
||||
glColor4f(1.0, 0.0, 0.0, 1.0);
|
||||
glVertex2f(pucks[i].pos.x, pucks[i].pos.y);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// Render beads
|
||||
glPointSize(5.0f);
|
||||
glLineWidth(3.0);
|
||||
|
||||
glBegin(GL_POINTS);
|
||||
for (int i = 0; i < NUM_BEADS; i++) {
|
||||
glColor4fv(SHADOW_COLOR);
|
||||
glVertex2f(beads[i].pos.x + SHADOW_OFFSET, beads[i].pos.y + SHADOW_OFFSET);
|
||||
glColor3f(beads[i].color[0]+beads[i].brightness, beads[i].color[1]+beads[i].brightness, beads[i].color[2]+beads[i].brightness);
|
||||
glVertex2f(beads[i].pos.x, beads[i].pos.y);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
}
|
||||
|
||||
void Finger::setTarget(int x, int y) {
|
||||
target.x = x;
|
||||
target.y = y;
|
||||
if (start) {
|
||||
// On startup, set finger to first target location
|
||||
pos.x = target.x;
|
||||
pos.y = target.y;
|
||||
vel.x = vel.y = 0.0;
|
||||
start = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Finger::simulate(float deltaTime) {
|
||||
// Using the new target position x and y as where the mouse intends the finger to be, move the finger
|
||||
if (!start) {
|
||||
|
||||
// Move the finger
|
||||
float distance = glm::distance(pos, target);
|
||||
float spring_length = 0;
|
||||
const float SPRING_FORCE = 1000.0;
|
||||
|
||||
if (distance > 0.1) {
|
||||
vel += glm::normalize(target - pos)*deltaTime*SPRING_FORCE*distance;
|
||||
}
|
||||
// Decay Velocity (Drag)
|
||||
|
||||
vel *= 0.8;
|
||||
//vel *= (1.f - CONSTANT_DAMPING*deltaTime);
|
||||
|
||||
// Update position
|
||||
pos += vel*deltaTime;
|
||||
|
||||
// Update the beads
|
||||
const float BEAD_SPRING_FORCE = 500.0;
|
||||
const float BEAD_NEIGHBOR_FORCE = 200.0;
|
||||
const float HARD_SPHERE_FORCE = 2500.0;
|
||||
const float PRESSURE_FACTOR = 0.00;
|
||||
float separation, contact;
|
||||
float newPressure = 0;
|
||||
int n1, n2;
|
||||
float d1, d2;
|
||||
|
||||
for (int i = 0; i < NUM_BEADS; i++) {
|
||||
distance = glm::distance(beads[i].pos, pos + beads[i].target * (1.f + pressure*PRESSURE_FACTOR));
|
||||
if (distance > 0.1) {
|
||||
beads[i].vel += glm::normalize((pos + (beads[i].target*(1.f + pressure*PRESSURE_FACTOR))) - beads[i].pos)*deltaTime*BEAD_SPRING_FORCE*distance;
|
||||
}
|
||||
// Add forces from 2 neighboring beads
|
||||
if ((i-1)>=0) n1 = i - 1;
|
||||
else n1 = NUM_PUCKS - 1;
|
||||
if ((i+1)<NUM_PUCKS) n2 = i + 1;
|
||||
else n2 = 0;
|
||||
d1 = glm::distance(beads[i].pos, beads[n1].pos);
|
||||
if (d1 > 0.01) beads[i].vel += glm::normalize(beads[n1].pos - beads[i].pos)*deltaTime*BEAD_NEIGHBOR_FORCE*distance;
|
||||
d2 = glm::distance(beads[i].pos, beads[n2].pos);
|
||||
if (d2 > 0.01) beads[i].vel += glm::normalize(beads[n2].pos - beads[i].pos)*deltaTime*BEAD_NEIGHBOR_FORCE*distance;
|
||||
|
||||
|
||||
// Look for hard collision with pucks
|
||||
for (int j = 0; j < NUM_PUCKS; j++) {
|
||||
|
||||
separation = glm::distance(beads[i].pos, pucks[j].pos);
|
||||
contact = 2.5 + pucks[j].radius;
|
||||
|
||||
// Hard Sphere Scattering
|
||||
|
||||
if (separation < contact) {
|
||||
beads[i].vel += glm::normalize(beads[i].pos - pucks[j].pos)*
|
||||
deltaTime*HARD_SPHERE_FORCE*(contact - separation);
|
||||
pucks[j].vel -= glm::normalize(beads[i].pos - pucks[j].pos)*
|
||||
deltaTime*HARD_SPHERE_FORCE*(contact - separation)/pucks[j].mass;
|
||||
if (beads[i].brightness < 0.5) beads[i].brightness = 0.5;
|
||||
beads[i].brightness *= 1.1;
|
||||
} else {
|
||||
beads[i].brightness *= 0.95;
|
||||
}
|
||||
beads[i].brightness = fminf(beads[i].brightness, 1.f);
|
||||
}
|
||||
|
||||
|
||||
// Decay velocity, move beads
|
||||
beads[i].vel *= 0.85;
|
||||
beads[i].pos += beads[i].vel*deltaTime;
|
||||
|
||||
// Measure pressure for next run
|
||||
newPressure += glm::distance(beads[i].pos, pos);
|
||||
}
|
||||
if (fabs(newPressure - NUM_BEADS*RADIUS) < 100.f) pressure = newPressure - (NUM_BEADS*RADIUS);
|
||||
|
||||
// Update the pucks for any pressure they have received
|
||||
for (int j = 0; j < NUM_PUCKS; j++) {
|
||||
pucks[j].vel *= 0.99;
|
||||
|
||||
if (pucks[j].radius < 25.0) pucks[j].pos += pucks[j].vel*deltaTime;
|
||||
|
||||
// wrap at edges
|
||||
if (pucks[j].pos.x > width) pucks[j].pos.x = 0.0;
|
||||
if (pucks[j].pos.x < 0) pucks[j].pos.x = width;
|
||||
if (pucks[j].pos.y > height) pucks[j].pos.y = 0.0;
|
||||
if (pucks[j].pos.y < 0) pucks[j].pos.y = height;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
//
|
||||
// finger.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip on 1/21/13.
|
||||
// Copyright (c) 2013 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __interface__finger__
|
||||
#define __interface__finger__
|
||||
|
||||
#include "glm.hpp"
|
||||
#include "util.h"
|
||||
#include "world.h"
|
||||
#include <GLUT/glut.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class Finger {
|
||||
public:
|
||||
Finger(int w, int h);
|
||||
void simulate(float deltaTime);
|
||||
void render();
|
||||
void setTarget(int x, int y);
|
||||
private:
|
||||
int width, height; // Screen size in pixels
|
||||
bool start;
|
||||
glm::vec2 pos, vel; // Position and velocity of finger
|
||||
float m; // Velocity of finger
|
||||
float pressure; // Internal pressure of skin vessel as function of measured volume
|
||||
glm::vec2 target; // Where the mouse is
|
||||
// little beads used to render the dynamic skin surface
|
||||
struct bead {
|
||||
glm::vec2 target, pos, vel;
|
||||
float color[3];
|
||||
float brightness;
|
||||
} *beads;
|
||||
struct puck {
|
||||
glm::vec2 pos, vel;
|
||||
float brightness;
|
||||
float radius;
|
||||
float mass;
|
||||
} *pucks;
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__finger__) */
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
//
|
||||
// hand.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 10/13/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#include "hand.h"
|
||||
|
||||
const float DEFAULT_X = 0.0;
|
||||
const float DEFAULT_Y = 0.0;
|
||||
const float DEFAULT_Z = -7.0;
|
||||
|
||||
Hand::Hand(float initradius, glm::vec3 initcolor)
|
||||
{
|
||||
color = initcolor;
|
||||
radius = initradius;
|
||||
reset();
|
||||
noise = 0;
|
||||
}
|
||||
|
||||
void Hand::render()
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
if (isColliding) glColor3f(1,0,0);
|
||||
else glColor3f(color.x, color.y, color.z);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(-0.05, -0.5, 0.0);
|
||||
glVertex3f(position.x, position.y, position.z);
|
||||
glVertex3f(0.05, -0.5, 0.0);
|
||||
glVertex3f(position.x, position.y, position.z);
|
||||
glEnd();
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
glutSolidSphere(radius, 15, 15);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void Hand::reset()
|
||||
{
|
||||
position.x = DEFAULT_X;
|
||||
position.y = DEFAULT_Y;
|
||||
position.z = DEFAULT_Z;
|
||||
velocity.x = velocity.y = velocity.z = 0;
|
||||
isColliding = false;
|
||||
}
|
||||
|
||||
void Hand::simulate(float deltaTime)
|
||||
{
|
||||
position += velocity*deltaTime;
|
||||
|
||||
velocity *= (1.f - 4.0*deltaTime);
|
||||
|
||||
if ((noise) && (randFloat() < 0.1))
|
||||
{
|
||||
velocity.x += (randFloat() - 0.5)*noise;
|
||||
velocity.y += (randFloat() - 0.5)*noise;
|
||||
velocity.z += (randFloat() - 0.5)*noise;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
//
|
||||
// hand.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 10/13/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_hand_h
|
||||
#define interface_hand_h
|
||||
|
||||
#include "glm.hpp"
|
||||
#include <iostream>
|
||||
#include "util.h"
|
||||
#include "field.h"
|
||||
#include "world.h"
|
||||
#include <GLUT/glut.h>
|
||||
|
||||
const float RADIUS_RANGE = 10.0;
|
||||
|
||||
class Hand {
|
||||
public:
|
||||
Hand(float initradius, glm::vec3 color);
|
||||
void simulate (float deltaTime);
|
||||
void render ();
|
||||
void reset ();
|
||||
void setNoise (float mag) { noise = mag; };
|
||||
void addVel (glm::vec3 add) { velocity += add; };
|
||||
glm::vec3 getPos() { return position; };
|
||||
void setPos(glm::vec3 newpos) { position = newpos; };
|
||||
float getRadius() { return radius; };
|
||||
void setRadius(float newradius) { radius = newradius; };
|
||||
void setColliding(bool newcollide) { isColliding = newcollide; };
|
||||
private:
|
||||
glm::vec3 position, velocity, color;
|
||||
float noise;
|
||||
float radius;
|
||||
bool isColliding;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
Read a set of analog input lines and echo their readings over the serial port with averaging
|
||||
*/
|
||||
|
||||
// ADC PIN MAPPINGS
|
||||
//
|
||||
// 15,16 = Head Pitch, Yaw gyro
|
||||
// 17,18,19 = Head Accelerometer
|
||||
|
||||
|
||||
#define NUM_CHANNELS 6
|
||||
#define MSECS_PER_SAMPLE 15
|
||||
|
||||
#define LED_PIN 12
|
||||
|
||||
int inputPins[NUM_CHANNELS] = {19,20,18,15,16,17};
|
||||
|
||||
int LED_on = 0;
|
||||
unsigned int total_count = 0;
|
||||
|
||||
unsigned int time;
|
||||
|
||||
int measured[NUM_CHANNELS];
|
||||
float accumulate[NUM_CHANNELS];
|
||||
|
||||
int sampleCount = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < NUM_CHANNELS; i++) {
|
||||
pinMode(inputPins[i], INPUT_ANALOG);
|
||||
measured[i] = analogRead(inputPins[i]);
|
||||
accumulate[i] = measured[i];
|
||||
}
|
||||
pinMode(BOARD_LED_PIN, OUTPUT);
|
||||
pinMode(LED_PIN,OUTPUT);
|
||||
time = millis();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
int i;
|
||||
sampleCount++;
|
||||
total_count++;
|
||||
if (total_count % 20172 == 0) {
|
||||
LED_on = !LED_on;
|
||||
if (LED_on) digitalWrite(LED_PIN, HIGH);
|
||||
else digitalWrite(LED_PIN, LOW);
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_CHANNELS; i++) {
|
||||
accumulate[i] += analogRead(inputPins[i]);
|
||||
}
|
||||
if ((millis() - time) >= MSECS_PER_SAMPLE) {
|
||||
time = millis();
|
||||
for (i = 0; i < NUM_CHANNELS; i++) {
|
||||
measured[i] = accumulate[i] / sampleCount;
|
||||
SerialUSB.print(measured[i]);
|
||||
SerialUSB.print(" ");
|
||||
accumulate[i] = 0;
|
||||
}
|
||||
SerialUSB.print(sampleCount);
|
||||
SerialUSB.print(" ");
|
||||
if (LED_on) SerialUSB.print("1");
|
||||
else SerialUSB.print("0");
|
||||
SerialUSB.println("");
|
||||
|
||||
sampleCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
297
Sources/head.cpp
297
Sources/head.cpp
|
@ -1,297 +0,0 @@
|
|||
//
|
||||
// head.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 9/11/12.
|
||||
// Copyright (c) 2012 Physical, Inc.. All rights reserved.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include "head.h"
|
||||
#include "util.h"
|
||||
#include "vector_angle.hpp"
|
||||
|
||||
float skinColor[] = {1.0, 0.84, 0.66};
|
||||
float browColor[] = {210.0/255.0, 105.0/255.0, 30.0/255.0};
|
||||
float mouthColor[] = {1, 0, 0};
|
||||
|
||||
float BrowRollAngle[5] = {0, 15, 30, -30, -15};
|
||||
float BrowPitchAngle[3] = {-70, -60, -50};
|
||||
float eyeColor[3] = {1,1,1};
|
||||
|
||||
float MouthWidthChoices[3] = {0.5, 0.77, 0.3};
|
||||
|
||||
float browWidth = 0.8;
|
||||
float browThickness = 0.16;
|
||||
|
||||
const float DECAY = 0.1;
|
||||
|
||||
Head::Head()
|
||||
{
|
||||
position.x = position.y = position.z = 0;
|
||||
PupilSize = 0.10;
|
||||
interPupilDistance = 0.6;
|
||||
interBrowDistance = 0.75;
|
||||
NominalPupilSize = 0.10;
|
||||
EyebrowPitch[0] = EyebrowPitch[1] = BrowPitchAngle[0];
|
||||
EyebrowRoll[0] = 30;
|
||||
EyebrowRoll[1] = -30;
|
||||
MouthPitch = 0;
|
||||
MouthYaw = 0;
|
||||
MouthWidth = 1.0;
|
||||
MouthHeight = 0.2;
|
||||
EyeballPitch[0] = EyeballPitch[1] = 0;
|
||||
EyeballScaleX = 1.2; EyeballScaleY = 1.5; EyeballScaleZ = 1.0;
|
||||
EyeballYaw[0] = EyeballYaw[1] = 0;
|
||||
PitchTarget = YawTarget = 0;
|
||||
NoiseEnvelope = 1.0;
|
||||
PupilConverge = 5.0;
|
||||
leanForward = 0.0;
|
||||
leanSideways = 0.0;
|
||||
setNoise(0);
|
||||
}
|
||||
|
||||
void Head::reset()
|
||||
{
|
||||
Pitch = Yaw = Roll = 0;
|
||||
leanForward = leanSideways = 0;
|
||||
}
|
||||
|
||||
void Head::UpdatePos(float frametime, int * adc_channels, float * avg_adc_channels, int head_mirror, glm::vec3 * gravity)
|
||||
// Using serial data, update avatar/render position and angles
|
||||
{
|
||||
float measured_pitch_rate = adc_channels[PITCH_RATE] - avg_adc_channels[PITCH_RATE];
|
||||
float measured_yaw_rate = adc_channels[YAW_RATE] - avg_adc_channels[YAW_RATE];
|
||||
float measured_lateral_accel = adc_channels[ACCEL_X] - avg_adc_channels[ACCEL_X];
|
||||
float measured_fwd_accel = avg_adc_channels[ACCEL_Z] - adc_channels[ACCEL_Z];
|
||||
float measured_roll_rate = adc_channels[ROLL_RATE] - avg_adc_channels[ROLL_RATE];
|
||||
|
||||
// Update avatar head position based on measured gyro rates
|
||||
const float HEAD_ROTATION_SCALE = 0.20;
|
||||
const float HEAD_ROLL_SCALE = 0.50;
|
||||
const float HEAD_LEAN_SCALE = 0.02;
|
||||
if (head_mirror) {
|
||||
addYaw(measured_yaw_rate * HEAD_ROTATION_SCALE * frametime);
|
||||
addPitch(measured_pitch_rate * -HEAD_ROTATION_SCALE * frametime);
|
||||
addRoll(measured_roll_rate * HEAD_ROLL_SCALE * frametime);
|
||||
addLean(measured_lateral_accel * frametime * HEAD_LEAN_SCALE, measured_fwd_accel*frametime * HEAD_LEAN_SCALE);
|
||||
} else {
|
||||
addYaw(measured_yaw_rate * -HEAD_ROTATION_SCALE * frametime);
|
||||
addPitch(measured_pitch_rate * -HEAD_ROTATION_SCALE * frametime);
|
||||
addRoll(measured_roll_rate * HEAD_ROLL_SCALE * frametime);
|
||||
addLean(measured_lateral_accel * frametime * -HEAD_LEAN_SCALE, measured_fwd_accel*frametime * HEAD_LEAN_SCALE);
|
||||
}
|
||||
|
||||
|
||||
// Try to measure absolute roll from sensors
|
||||
const float MIN_ROLL = 3.0;
|
||||
glm::vec3 v1(gravity->x, gravity->y, 0);
|
||||
glm::vec3 v2(adc_channels[ACCEL_X], adc_channels[ACCEL_Y], 0);
|
||||
float newRoll = acos(glm::dot(glm::normalize(v1), glm::normalize(v2))) ;
|
||||
if (newRoll != NAN) {
|
||||
newRoll *= 1000.0;
|
||||
if (newRoll > MIN_ROLL) {
|
||||
if (adc_channels[ACCEL_X] > gravity->x) newRoll *= -1.0;
|
||||
//SetRoll(newRoll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Head::addLean(float x, float z) {
|
||||
// Add Body lean as impulse
|
||||
leanSideways += x;
|
||||
leanForward += z;
|
||||
}
|
||||
|
||||
void Head::setLeanForward(float dist){
|
||||
leanForward = dist;
|
||||
}
|
||||
|
||||
void Head::setLeanSideways(float dist){
|
||||
leanSideways = dist;
|
||||
}
|
||||
|
||||
// Simulate the head over time
|
||||
void Head::simulate(float deltaTime)
|
||||
{
|
||||
if (!noise)
|
||||
{
|
||||
// Decay back toward center
|
||||
Pitch *= (1.f - DECAY*deltaTime);
|
||||
Yaw *= (1.f - DECAY*deltaTime);
|
||||
Roll *= (1.f - DECAY*deltaTime);
|
||||
}
|
||||
else {
|
||||
// Move toward new target
|
||||
Pitch += (PitchTarget - Pitch)*22*deltaTime; // (1.f - DECAY*deltaTime)*Pitch + ;
|
||||
Yaw += (YawTarget - Yaw)*22*deltaTime; // (1.f - DECAY*deltaTime);
|
||||
Roll *= (1.f - DECAY*deltaTime);
|
||||
}
|
||||
|
||||
leanForward *= (1.f - DECAY*30.f*deltaTime);
|
||||
leanSideways *= (1.f - DECAY*30.f*deltaTime);
|
||||
|
||||
if (noise)
|
||||
{
|
||||
Pitch += (randFloat() - 0.5)*0.05*NoiseEnvelope;
|
||||
Yaw += (randFloat() - 0.5)*0.1*NoiseEnvelope;
|
||||
PupilSize += (randFloat() - 0.5)*0.001*NoiseEnvelope;
|
||||
|
||||
if (randFloat() < 0.005) MouthWidth = MouthWidthChoices[rand()%3];
|
||||
|
||||
//if (randFloat() < 0.005) Pitch = (randFloat() - 0.5)*45;
|
||||
//if (randFloat() < 0.005) Yaw = (randFloat() - 0.5)*45;
|
||||
//if (randFloat() < 0.001) Roll = (randFloat() - 0.5)*45;
|
||||
//if (randFloat() < 0.003) PupilSize = ((randFloat() - 0.5)*0.25+1)*NominalPupilSize;
|
||||
if (randFloat() < 0.01) EyeballPitch[0] = EyeballPitch[1] = (randFloat() - 0.5)*20;
|
||||
if (randFloat() < 0.01) EyeballYaw[0] = EyeballYaw[1] = (randFloat()- 0.5)*10;
|
||||
|
||||
if ((randFloat() < 0.005) && (fabs(PitchTarget - Pitch) < 1.0) && (fabs(YawTarget - Yaw) < 1.0))
|
||||
{
|
||||
SetNewHeadTarget((randFloat()-0.5)*20.0, (randFloat()-0.5)*45.0);
|
||||
}
|
||||
|
||||
if (0)
|
||||
{
|
||||
|
||||
// Pick new target
|
||||
PitchTarget = (randFloat() - 0.5)*45;
|
||||
YawTarget = (randFloat() - 0.5)*22;
|
||||
}
|
||||
if (randFloat() < 0.01)
|
||||
{
|
||||
EyebrowPitch[0] = EyebrowPitch[1] = BrowPitchAngle[rand()%3];
|
||||
EyebrowRoll[0] = EyebrowRoll[1] = BrowRollAngle[rand()%5];
|
||||
EyebrowRoll[1]*=-1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Head::render()
|
||||
{
|
||||
int side = 0;
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glTranslatef(leanSideways, 0.f, leanForward);
|
||||
|
||||
glRotatef(Yaw/2.0, 0, 1, 0);
|
||||
glRotatef(Pitch/2.0, 1, 0, 0);
|
||||
glRotatef(Roll/2.0, 0, 0, 1);
|
||||
|
||||
|
||||
// Overall scale of head
|
||||
glScalef(1.5, 2.0, 2.0);
|
||||
glColor3fv(skinColor);
|
||||
|
||||
// Head
|
||||
glutSolidSphere(1, 30, 30);
|
||||
|
||||
// Ears
|
||||
glPushMatrix();
|
||||
glTranslatef(1, 0, 0);
|
||||
for(side = 0; side < 2; side++)
|
||||
{
|
||||
glPushMatrix();
|
||||
glScalef(0.5, 0.75, 1.0);
|
||||
glutSolidSphere(0.5, 30, 30);
|
||||
glPopMatrix();
|
||||
glTranslatef(-2, 0, 0);
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
// Eyebrows
|
||||
glPushMatrix();
|
||||
glTranslatef(-interBrowDistance/2.0,0.4,0.45);
|
||||
for(side = 0; side < 2; side++)
|
||||
{
|
||||
glColor3fv(browColor);
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 0.4, 0);
|
||||
glRotatef(EyebrowPitch[side]/2.0, 1, 0, 0);
|
||||
glRotatef(EyebrowRoll[side]/2.0, 0, 0, 1);
|
||||
glScalef(browWidth, browThickness, 1);
|
||||
glutSolidCube(0.5);
|
||||
glPopMatrix();
|
||||
glTranslatef(interBrowDistance, 0, 0);
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
// Mouth
|
||||
glPushMatrix();
|
||||
glTranslatef(0,-0.3,0.75);
|
||||
glColor3fv(mouthColor);
|
||||
glRotatef(MouthPitch, 1, 0, 0);
|
||||
glRotatef(MouthYaw, 0, 0, 1);
|
||||
glScalef(MouthWidth, MouthHeight, 1);
|
||||
glutSolidCube(0.5);
|
||||
glPopMatrix();
|
||||
|
||||
glTranslatef(0, 1.0, 0);
|
||||
|
||||
|
||||
glTranslatef(-interPupilDistance/2.0,-0.68,0.7);
|
||||
// Right Eye
|
||||
glRotatef(-10, 1, 0, 0);
|
||||
glColor3fv(eyeColor);
|
||||
glPushMatrix();
|
||||
{
|
||||
glTranslatef(interPupilDistance/10.0, 0, 0.05);
|
||||
glRotatef(20, 0, 0, 1);
|
||||
glScalef(EyeballScaleX, EyeballScaleY, EyeballScaleZ);
|
||||
glutSolidSphere(0.25, 30, 30);
|
||||
}
|
||||
glPopMatrix();
|
||||
// Right Pupil
|
||||
glPushMatrix();
|
||||
glRotatef(EyeballPitch[1], 1, 0, 0);
|
||||
glRotatef(EyeballYaw[1] + PupilConverge, 0, 1, 0);
|
||||
glTranslatef(0,0,.25);
|
||||
glColor3f(0,0,0);
|
||||
glutSolidSphere(PupilSize, 15, 15);
|
||||
glPopMatrix();
|
||||
// Left Eye
|
||||
glColor3fv(eyeColor);
|
||||
glTranslatef(interPupilDistance, 0, 0);
|
||||
glPushMatrix();
|
||||
{
|
||||
glTranslatef(-interPupilDistance/10.0, 0, .05);
|
||||
glRotatef(-20, 0, 0, 1);
|
||||
glScalef(EyeballScaleX, EyeballScaleY, EyeballScaleZ);
|
||||
glutSolidSphere(0.25, 30, 30);
|
||||
}
|
||||
glPopMatrix();
|
||||
// Left Pupil
|
||||
glPushMatrix();
|
||||
glRotatef(EyeballPitch[0], 1, 0, 0);
|
||||
glRotatef(EyeballYaw[0] - PupilConverge, 0, 1, 0);
|
||||
glTranslatef(0,0,.25);
|
||||
glColor3f(0,0,0);
|
||||
glutSolidSphere(PupilSize, 15, 15);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
// Transmit data to agents requesting it
|
||||
|
||||
int Head::getBroadcastData(char* data)
|
||||
{
|
||||
// Copy data for transmission to the buffer, return length of data
|
||||
sprintf(data, "H%f,%f,%f,%f,%f,%f", Pitch, Yaw, Roll, position.x, position.y, position.z);
|
||||
return strlen(data);
|
||||
}
|
||||
|
||||
void Head::recvBroadcastData(char * data, int size)
|
||||
{
|
||||
sscanf(data, "H%f,%f,%f,%f,%f,%f", &Pitch, &Yaw, &Roll, &position.x, &position.y, &position.z);
|
||||
}
|
||||
|
||||
void Head::SetNewHeadTarget(float pitch, float yaw)
|
||||
{
|
||||
PitchTarget = pitch;
|
||||
YawTarget = yaw;
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
//
|
||||
// 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>
|
||||
#include "SerialInterface.h"
|
||||
|
||||
class Head {
|
||||
float noise;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
float Roll;
|
||||
float PitchRate;
|
||||
float YawRate;
|
||||
float RollRate;
|
||||
float EyeballPitch[2];
|
||||
float EyeballYaw[2];
|
||||
float EyebrowPitch[2];
|
||||
float EyebrowRoll[2];
|
||||
float EyeballScaleX, EyeballScaleY, EyeballScaleZ;
|
||||
float interPupilDistance;
|
||||
float interBrowDistance;
|
||||
float NominalPupilSize;
|
||||
float PupilSize;
|
||||
float MouthPitch;
|
||||
float MouthYaw;
|
||||
float MouthWidth;
|
||||
float MouthHeight;
|
||||
float leanForward;
|
||||
float leanSideways;
|
||||
|
||||
float PitchTarget;
|
||||
float YawTarget;
|
||||
|
||||
float NoiseEnvelope;
|
||||
|
||||
float PupilConverge;
|
||||
|
||||
glm::vec3 position;
|
||||
|
||||
void readSensors();
|
||||
|
||||
public:
|
||||
Head(void);
|
||||
void reset();
|
||||
void UpdatePos(float frametime, int * adc_channels, float * avg_adc_channels,
|
||||
int head_mirror, glm::vec3 * gravity);
|
||||
void setNoise (float mag) { noise = mag; }
|
||||
void setPitch(float p) {Pitch = p; }
|
||||
void setYaw(float y) {Yaw = y; }
|
||||
void setRoll(float r) {Roll = r; };
|
||||
void setLeanForward(float dist);
|
||||
void setLeanSideways(float dist);
|
||||
void addPitch(float p) {Pitch -= p; }
|
||||
void addYaw(float y){Yaw -= y; }
|
||||
void addRoll(float r){Roll += r; }
|
||||
void addLean(float x, float z);
|
||||
float getPitch() {return Pitch;}
|
||||
float getRoll() {return Roll;}
|
||||
float getYaw() {return Yaw;}
|
||||
void render();
|
||||
void simulate(float);
|
||||
// Send and receive network data
|
||||
int getBroadcastData(char* data);
|
||||
void recvBroadcastData(char * data, int size);
|
||||
void SetNewHeadTarget(float, float);
|
||||
glm::vec3 getPos() { return position; };
|
||||
void setPos(glm::vec3 newpos) { position = newpos; };
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,104 +0,0 @@
|
|||
//
|
||||
// lattice.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip on 1/19/13.
|
||||
// Copyright (c) 2013 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#include "lattice.h"
|
||||
|
||||
Lattice::Lattice(int w, int h) {
|
||||
width = w;
|
||||
height = h;
|
||||
tilegap = 3;
|
||||
lastindex = -1;
|
||||
tiles = new Tile[width*height];
|
||||
for (int i = 0; i < (width*height); i++) {
|
||||
tiles[i].color[0] = tiles[i].color[1] = tiles[i].color[2] = 0.2 + randFloat()*0.3;
|
||||
tiles[i].x = (i % width);
|
||||
tiles[i].y = int(i/width);
|
||||
tiles[i].brightness = 1.0;
|
||||
tiles[i].type = 0;
|
||||
tiles[i].excited = tiles[i].inhibited = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void Lattice::render(int screenWidth, int screenHeight) {
|
||||
float tilewidth = screenWidth/width;
|
||||
float tileheight = screenHeight/height;
|
||||
float tilecolor[3];
|
||||
glBegin(GL_QUADS);
|
||||
for (int i = 0; i < (width*height); i++) {
|
||||
if (tiles[i].type == 0) {
|
||||
tilecolor[0] = 0.25; tilecolor[1] = 0.25; tilecolor[2] = 0.25;
|
||||
} else if (tiles[i].type == 1) {
|
||||
if (tiles[i].inhibited >= 0.1) {
|
||||
tilecolor[0] = 0.5; tilecolor[1] = 0.0; tilecolor[2] = 0.0;
|
||||
} else {
|
||||
tilecolor[0] = 0.2; tilecolor[1] = 0.0; tilecolor[2] = 0.5;
|
||||
}
|
||||
}
|
||||
glColor3f(tilecolor[0]*(1.f+tiles[i].excited), tilecolor[1]*(1.f+tiles[i].excited), tilecolor[2]*(1.f+tiles[i].excited));
|
||||
glVertex2f(tiles[i].x*tilewidth, tiles[i].y*tileheight);
|
||||
glVertex2f((tiles[i].x + 1)*tilewidth - tilegap, tiles[i].y*tileheight);
|
||||
glVertex2f((tiles[i].x + 1)*tilewidth - tilegap, (tiles[i].y + 1)*tileheight - tilegap);
|
||||
glVertex2f(tiles[i].x*tilewidth, (tiles[i].y + 1)*tileheight - tilegap);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void Lattice::mouseClick(float x, float y) {
|
||||
// Update lattice based on mouse location, where x and y are floats between 0 and 1 corresponding to screen location clicked
|
||||
// Change the clicked cell to a different type
|
||||
//printf("X = %3.1f Y = %3.1f\n", x, y);
|
||||
int index = int(x*(float)width) + int(y*(float)height)*width;
|
||||
if (index != lastindex) {
|
||||
tiles[index].type++;
|
||||
if (tiles[index].type == 2) tiles[index].type = 0;
|
||||
lastindex = index;
|
||||
}
|
||||
}
|
||||
|
||||
void Lattice::mouseOver(float x, float y) {
|
||||
// Update lattice based on mouse location, where x and y are floats between 0 and 1 corresponding to screen location clicked
|
||||
// Excite the hovered cell a bit toward firing
|
||||
//printf("X = %3.1f Y = %3.1f\n", x, y);
|
||||
int index = int(x*(float)width) + int(y*(float)height)*width;
|
||||
if (tiles[index].type > 0) tiles[index].excited += 0.05;
|
||||
//printf("excited = %3.1f, inhibited = %3.1f\n", tiles[index].excited, tiles[index].inhibited);
|
||||
}
|
||||
|
||||
void Lattice::simulate(float deltaTime) {
|
||||
int index;
|
||||
for (int i = 0; i < (width*height); i++) {
|
||||
if (tiles[i].type > 0) {
|
||||
if ((tiles[i].excited > 0.5) && (tiles[i].inhibited < 0.1)) {
|
||||
tiles[i].excited = 1.0;
|
||||
tiles[i].inhibited = 1.0;
|
||||
// Add Energy to neighbors
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (j == 0) index = i - width - 1;
|
||||
else if (j == 1) index = i - width;
|
||||
else if (j == 2) index = i - width + 1;
|
||||
else if (j == 3) index = i - 1;
|
||||
else if (j == 4) index = i + 1;
|
||||
else if (j == 5) index = i + width - 1;
|
||||
else if (j == 6) index = i + width;
|
||||
else index = i + width + 1;
|
||||
if ((index > 0) && (index < width*height)) {
|
||||
if (tiles[index].inhibited < 0.1) tiles[index].excited += 0.5;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tiles[i].excited *= 0.98;
|
||||
tiles[i].inhibited *= 0.98;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
//
|
||||
// lattice.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip on 1/19/13.
|
||||
// Copyright (c) 2013 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __interface__lattice__
|
||||
#define __interface__lattice__
|
||||
|
||||
#include "glm.hpp"
|
||||
#include "util.h"
|
||||
#include "world.h"
|
||||
#include <GLUT/glut.h>
|
||||
#include <iostream>
|
||||
|
||||
class Lattice {
|
||||
public:
|
||||
Lattice(int width, int height);
|
||||
void simulate(float deltaTime);
|
||||
void render(int screenWidth, int screenHeight);
|
||||
void mouseClick(float x, float y);
|
||||
void mouseOver(float x, float y);
|
||||
private:
|
||||
int lastindex;
|
||||
int width, height;
|
||||
int tilegap;
|
||||
struct Tile {
|
||||
float x,y;
|
||||
float color[3];
|
||||
float brightness;
|
||||
float excited;
|
||||
float inhibited;
|
||||
int type;
|
||||
} *tiles;
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__lattice__) */
|
6208
Sources/lodepng.cpp
6208
Sources/lodepng.cpp
File diff suppressed because it is too large
Load diff
1656
Sources/lodepng.h
1656
Sources/lodepng.h
File diff suppressed because it is too large
Load diff
1047
Sources/main.cpp
1047
Sources/main.cpp
File diff suppressed because it is too large
Load diff
|
@ -1,81 +0,0 @@
|
|||
//
|
||||
// marker_acquisition_view.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Kenneth Keiter on 12/12/12.
|
||||
// Copyright (c) 2012 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#include "marker_acquisition_view.h"
|
||||
#include <GLUT/glut.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
MarkerAcquisitionView::MarkerAcquisitionView(MarkerCapture* marker_capture_instance){
|
||||
capture = marker_capture_instance;
|
||||
}
|
||||
|
||||
void MarkerAcquisitionView::show(){
|
||||
visible = true;
|
||||
}
|
||||
|
||||
void MarkerAcquisitionView::hide(){
|
||||
visible = false;
|
||||
}
|
||||
|
||||
void MarkerAcquisitionView::handle_key(unsigned char k){
|
||||
if(visible){
|
||||
switch(k){
|
||||
case 'a': // acquire new color target.
|
||||
acquired_color = reticle_color;
|
||||
capture->acquire_color(acquired_color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MarkerAcquisitionView::render(IplImage* frame){
|
||||
if(visible){
|
||||
GLint m_viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, m_viewport);
|
||||
|
||||
// display the image in the center of the display.
|
||||
CvPoint origin = cvPoint((m_viewport[2] / 2)-(frame->width / 2), (m_viewport[3] / 2)-(frame->height / 2));
|
||||
capture->glDrawIplImage(frame, origin.x, origin.y, 1.0, -1.0);
|
||||
|
||||
// determine the average color within the reticle.
|
||||
reticle_color = mean_color(frame,
|
||||
frame->width / 2 - ACQ_VIEW_RETICLE_RADIUS,
|
||||
frame->height / 2 - ACQ_VIEW_RETICLE_RADIUS,
|
||||
ACQ_VIEW_RETICLE_RADIUS * 2, ACQ_VIEW_RETICLE_RADIUS * 2);
|
||||
|
||||
// draw a targeting reticle in the center of the image.
|
||||
int reticle_x = origin.x + frame->width / 2 - ACQ_VIEW_RETICLE_RADIUS;
|
||||
int reticle_y = origin.y + frame->height / 2 - ACQ_VIEW_RETICLE_RADIUS;
|
||||
draw_targeting_reticle(reticle_x, reticle_y,(GLfloat)ACQ_VIEW_RETICLE_RADIUS, reticle_color);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
PRIVATE
|
||||
**************************************************************/
|
||||
|
||||
void MarkerAcquisitionView::draw_targeting_reticle(GLfloat x, GLfloat y, GLfloat r, CvScalar color){
|
||||
static const double inc = M_PI / 12;
|
||||
static const double max = 2 * M_PI;
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glColor3f(color.val[2] * 0.01, color.val[1] * 0.01, color.val[0] * 0.01); // scale color values
|
||||
// printf("Reticle color R:%f G:%f B:%f\n", color.val[2], color.val[1], color.val[0]);
|
||||
glLineWidth(2.0);
|
||||
for(double d = 0; d < max; d += inc){
|
||||
glVertex2f(cos(d) * r + x, sin(d) * r + y);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
CvScalar MarkerAcquisitionView::mean_color(IplImage* img, int x, int y, int width, int height){
|
||||
CvRect _roi = cvGetImageROI(img);
|
||||
cvSetImageROI(img, cvRect(x, y, width, height));
|
||||
CvScalar color = cvAvg(img);
|
||||
cvSetImageROI(img, _roi); // replace it with the original, otherwise OpenCV won't deallocate properly.
|
||||
return color;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
//
|
||||
// marker_acquisition_view.h
|
||||
// interface
|
||||
//
|
||||
// Created by Kenneth Keiter on 12/12/12.
|
||||
// Copyright (c) 2012 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __interface__marker_acquisition_view__
|
||||
#define __interface__marker_acquisition_view__
|
||||
|
||||
#include <iostream>
|
||||
#include <vector.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <GLUT/glut.h>
|
||||
#include <CVBlob/blob.h>
|
||||
#include <CVBlob/BlobResult.h>
|
||||
#include "markers.h"
|
||||
|
||||
#define ACQ_VIEW_RETICLE_RADIUS 10
|
||||
|
||||
class MarkerAcquisitionView{
|
||||
public:
|
||||
MarkerCapture* capture;
|
||||
CvScalar reticle_color;
|
||||
CvScalar acquired_color;
|
||||
bool visible = false;
|
||||
|
||||
MarkerAcquisitionView(MarkerCapture* marker_capture_instance);
|
||||
|
||||
void show();
|
||||
void hide();
|
||||
void handle_key(unsigned char k);
|
||||
void render(IplImage* frame);
|
||||
|
||||
private:
|
||||
void draw_targeting_reticle(GLfloat x, GLfloat y, GLfloat r, CvScalar color);
|
||||
CvScalar mean_color(IplImage* img, int x, int y, int width, int height);
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__marker_acquisition_view__) */
|
|
@ -1,261 +0,0 @@
|
|||
//
|
||||
// markers.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Kenneth Keiter <ken@kenkeiter.com> on 12/11/12.
|
||||
// Copyright (c) 2012 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#include "markers.h"
|
||||
#include <vector.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <GLUT/glut.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <CVBlob/blob.h>
|
||||
#include <CVBlob/BlobResult.h>
|
||||
|
||||
|
||||
MarkerCapture::MarkerCapture(int source_index){
|
||||
capture_source_index = source_index;
|
||||
capture_ready = false;
|
||||
if (pthread_mutex_init(&frame_mutex, NULL) != 0){
|
||||
printf("Frame lock mutext init failed. Exiting.\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
MarkerCapture::~MarkerCapture(){
|
||||
pthread_mutex_destroy(&frame_mutex);
|
||||
}
|
||||
|
||||
/* Begin capture of camera data. Should be called exactly once. */
|
||||
int MarkerCapture::init_capture(){
|
||||
camera = cvCaptureFromCAM(capture_source_index);
|
||||
if(!camera){
|
||||
return -1;
|
||||
}else{
|
||||
time = clock();
|
||||
capture_ready = true;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Begin tracking targets of a given CvScalar, color. */
|
||||
void MarkerCapture::acquire_color(CvScalar color){
|
||||
target_color = color_to_range(color, CV_COLOR_TOLERANCE);
|
||||
color_acquired = true;
|
||||
}
|
||||
|
||||
/* Fetch a frame (if available) and process it, calling appropriate
|
||||
callbacks when data becomes available. */
|
||||
void MarkerCapture::tick(){
|
||||
IplImage *thresh_frame = NULL;
|
||||
CBlobResult blobs;
|
||||
|
||||
// Acquire the lock, update the current frame.
|
||||
pthread_mutex_lock(&frame_mutex);
|
||||
current_frame = cvCloneImage(cvQueryFrame(camera));
|
||||
if(color_acquired && current_frame){
|
||||
thresh_frame = apply_threshold(current_frame, target_color);
|
||||
}else{
|
||||
// create a suplicant.
|
||||
thresh_frame = cvCreateImage(cvGetSize(current_frame),IPL_DEPTH_8U,1);
|
||||
}
|
||||
pthread_mutex_unlock(&frame_mutex);
|
||||
// Lock released. Done messing with buffers.
|
||||
|
||||
if(frame_update_callback){
|
||||
(*frame_update_callback)(this, current_frame, thresh_frame);
|
||||
}
|
||||
if(color_acquired){
|
||||
blobs = detect_blobs(thresh_frame, CV_BLOB_SIZE_MIN);
|
||||
if(blobs.GetNumBlobs() >= 2){ // need 2 or more blobs for positional fix.
|
||||
MarkerPositionEstimate position;
|
||||
// fetch the two largest blobs, by area.
|
||||
CBlob blob0, blob1;
|
||||
blobs.GetNthBlob(CBlobGetArea(), 0, blob0);
|
||||
blobs.GetNthBlob(CBlobGetArea(), 1, blob1);
|
||||
// perform positional calculations
|
||||
position.distance = distance(blob0, blob1);
|
||||
position.angle = angle(blob0, blob1);
|
||||
position.blob0_center = blob_center(blob0);
|
||||
position.blob1_center = blob_center(blob1);
|
||||
// call the update handler.
|
||||
if(position_update_callback){
|
||||
(*position_update_callback)(this, position);
|
||||
}
|
||||
}
|
||||
blobs.ClearBlobs();
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&frame_mutex);
|
||||
cvReleaseImage(¤t_frame);
|
||||
cvReleaseImage(&thresh_frame);
|
||||
pthread_mutex_unlock(&frame_mutex);
|
||||
|
||||
int curr_time = clock();
|
||||
fps = CLOCKS_PER_SEC/(double)(curr_time - time);
|
||||
time = curr_time;
|
||||
}
|
||||
|
||||
/* Provide a callback to handle new frames. */
|
||||
void MarkerCapture::frame_updated(void (*callback)(MarkerCapture* inst, IplImage* image, IplImage* thresh_image)){
|
||||
frame_update_callback = callback;
|
||||
}
|
||||
|
||||
/* Provide a callback to handle marker position updates. */
|
||||
void MarkerCapture::position_updated(void (*callback)(MarkerCapture* inst, MarkerPositionEstimate position)){
|
||||
position_update_callback = callback;
|
||||
}
|
||||
|
||||
void MarkerCapture::end_capture(){
|
||||
|
||||
}
|
||||
|
||||
/* Convert an IplImage to an OpenGL texture */
|
||||
void MarkerCapture::ipl_to_texture(IplImage *img, GLuint *t){
|
||||
glGenTextures(1, t);
|
||||
glBindTexture(GL_TEXTURE_2D, *t);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
pthread_mutex_lock(&frame_mutex);
|
||||
char* buffer = IplImage_to_buffer(img);
|
||||
pthread_mutex_unlock(&frame_mutex);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img->width, img->height, 0, GL_BGR, GL_UNSIGNED_BYTE, buffer);
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
/* Given an IplImage, draw it using glDrawPixels. */
|
||||
void MarkerCapture::glDrawIplImage(IplImage *img, int x = 0, int y = 0, GLfloat xZoom = 1.0, GLfloat yZoom = 1.0){
|
||||
GLint format, type;
|
||||
switch(img->nChannels){
|
||||
case 1:
|
||||
format = GL_LUMINANCE;
|
||||
break;
|
||||
case 3:
|
||||
format = GL_BGR;
|
||||
break;
|
||||
case 4:
|
||||
format = GL_BGRA;
|
||||
default:
|
||||
format = GL_BGR;
|
||||
}
|
||||
switch(img->depth){
|
||||
case IPL_DEPTH_8U:
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case IPL_DEPTH_8S:
|
||||
type = GL_BYTE;
|
||||
break;
|
||||
case IPL_DEPTH_16U:
|
||||
type = GL_UNSIGNED_SHORT;
|
||||
break;
|
||||
case IPL_DEPTH_16S:
|
||||
type = GL_SHORT;
|
||||
break;
|
||||
case IPL_DEPTH_32S:
|
||||
type = GL_INT;
|
||||
break;
|
||||
case IPL_DEPTH_32F:
|
||||
type = GL_FLOAT;
|
||||
break;
|
||||
case IPL_DEPTH_64F:
|
||||
/* not supported by opengl */
|
||||
default:
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
glRasterPos2i(x, y);
|
||||
glPixelZoom(xZoom, yZoom);
|
||||
|
||||
// Acquire frame lock while we copy the buffer.
|
||||
char* buffer = IplImage_to_buffer(img);
|
||||
|
||||
glDrawPixels(img->width, img->height, format, type, buffer);
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
/*******
|
||||
PRIVATE
|
||||
*******/
|
||||
|
||||
MarkerColorRange MarkerCapture::color_to_range(CvScalar color, int tolerance){
|
||||
MarkerColorRange range;
|
||||
range.base = color;
|
||||
range.tolerance = tolerance;
|
||||
float r, g, b;
|
||||
// note that color min is clamped to 0 if v - tolerance <= 0;
|
||||
range.from = cvScalar(((b = color.val[0] - tolerance) >= 0) ? b : 0,
|
||||
((g = color.val[1] - tolerance) >= 0) ? g : 0,
|
||||
((r = color.val[2] - tolerance) >= 0) ? r : 0);
|
||||
|
||||
// note that color max are clamped to 0 if v - tolerance <= 0;
|
||||
range.to = cvScalar(((b = color.val[0] + tolerance) <= 255) ? b : 255,
|
||||
((g = color.val[1] + tolerance) <= 255) ? g : 255,
|
||||
((r = color.val[2] + tolerance) <= 255) ? r : 255);
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
/* Find the center of a given blob. */
|
||||
CvPoint MarkerCapture::blob_center(CBlob blob){
|
||||
CvPoint point;
|
||||
point.x = blob.GetBoundingBox().x + (blob.GetBoundingBox().width / 2);
|
||||
point.y = blob.GetBoundingBox().y + (blob.GetBoundingBox().height / 2);
|
||||
return point;
|
||||
}
|
||||
|
||||
/* Convert an IplImage to an allocated buffer, removing any byte alignment. */
|
||||
char* MarkerCapture::IplImage_to_buffer(IplImage *img){
|
||||
char* buffer = new char[img->width*img->height*img->nChannels];
|
||||
char * data = (char *)img->imageData;
|
||||
for(int i=0; i<img->height; i++){
|
||||
memcpy(&buffer[i*img->width*img->nChannels], &(data[i*img->widthStep]), img->width*img->nChannels);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* Given an IplImage, convert it to HSV, and select only colors within the proper range. */
|
||||
IplImage* MarkerCapture::apply_threshold(IplImage* img, MarkerColorRange color_range){
|
||||
// convert to HSV
|
||||
// IplImage* imgHSV = cvCreateImage(cvGetSize(img), 8, 3);
|
||||
// cvCvtColor(img, imgHSV, CV_BGR2HSV);
|
||||
|
||||
IplImage* imgThresh = cvCreateImage(cvGetSize(img), 8, 1);
|
||||
cvInRangeS(img, color_range.from, color_range.to, imgThresh); // match the color range.
|
||||
|
||||
return imgThresh;
|
||||
}
|
||||
|
||||
/* Detect blobs larger than min_size in a given IplImage. */
|
||||
CBlobResult MarkerCapture::detect_blobs(IplImage *img, int min_size = 10){
|
||||
// find white blobs in thresholded image
|
||||
CBlobResult blobs = CBlobResult(img, NULL, 0);
|
||||
// exclude ones smaller than min_size.
|
||||
blobs.Filter(blobs, B_EXCLUDE, CBlobGetArea(), B_LESS, min_size);
|
||||
return blobs;
|
||||
}
|
||||
|
||||
double MarkerCapture::distance(CBlob blob1, CBlob blob2){
|
||||
// calculate centers, return the distance between them.
|
||||
CvPoint blob1_p = blob_center(blob1);
|
||||
CvPoint blob2_p = blob_center(blob2);
|
||||
return sqrt(pow(abs(blob2_p.x - blob1_p.x), 2) + pow(abs(blob2_p.y - blob1_p.y), 2));
|
||||
}
|
||||
|
||||
/* Get the angle, in degrees, between two blobs */
|
||||
double MarkerCapture::angle(CBlob blob1, CBlob blob2){
|
||||
CvPoint blob1_p = blob_center(blob1);
|
||||
CvPoint blob2_p = blob_center(blob2);
|
||||
double delta_x = fabs(blob2_p.x - blob1_p.x);
|
||||
double delta_y = fabs(blob2_p.y - blob1_p.y);
|
||||
double abs_angle = atan2(delta_y, delta_x) * 180 / M_PI;
|
||||
if(blob1_p.x < blob2_p.x && blob1_p.y > blob2_p.y){ // blob1 is above and to the left of blob2
|
||||
return abs_angle * -1.0;
|
||||
}else{
|
||||
return abs_angle;
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
//
|
||||
// markers.h
|
||||
// interface
|
||||
//
|
||||
// Created by Kenneth Keiter on 12/11/12.
|
||||
// Copyright (c) 2012 Rosedale Lab. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __interface__markers__
|
||||
#define __interface__markers__
|
||||
|
||||
#include <iostream>
|
||||
#include <vector.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <GLUT/glut.h>
|
||||
#include <CVBlob/blob.h>
|
||||
#include <CVBlob/BlobResult.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define CAMERA_INDEX CV_CAP_ANY
|
||||
#define CV_BLOB_SIZE_MIN 40
|
||||
#define CV_COLOR_TOLERANCE 30
|
||||
|
||||
typedef struct MarkerPositionEstimate{
|
||||
double distance;
|
||||
double angle;
|
||||
CvPoint blob0_center;
|
||||
CvPoint blob1_center;
|
||||
} MarkerPositionEstimate;
|
||||
|
||||
typedef struct MarkerColorRange{
|
||||
CvScalar base; // Initial color
|
||||
CvScalar from; // Min color
|
||||
CvScalar to; // Max color
|
||||
unsigned int tolerance;
|
||||
} MarkerColorRange;
|
||||
|
||||
// Cute little lock/unlock macro.
|
||||
#define synchronized(lock) \
|
||||
for (pthread_mutex_t * i_ = &lock; i_; \
|
||||
i_ = NULL, pthread_mutex_unlock(i_)) \
|
||||
for (pthread_mutex_lock(i_); i_; i_ = NULL)
|
||||
|
||||
class MarkerCapture{
|
||||
public:
|
||||
double fps;
|
||||
bool color_acquired = false;
|
||||
MarkerColorRange target_color;
|
||||
pthread_mutex_t frame_mutex;
|
||||
|
||||
MarkerCapture(int source_index);
|
||||
~MarkerCapture();
|
||||
|
||||
int init_capture();
|
||||
void tick();
|
||||
void end_capture();
|
||||
|
||||
void acquire_color(CvScalar color);
|
||||
void frame_updated(void (*callback)(MarkerCapture* inst, IplImage* image, IplImage* thresh_image));
|
||||
void position_updated(void (*callback)(MarkerCapture* inst, MarkerPositionEstimate position));
|
||||
void glDrawIplImage(IplImage *img, int x, int, GLfloat xZoom, GLfloat yZoom);
|
||||
void ipl_to_texture(IplImage *img, GLuint *t);
|
||||
|
||||
private:
|
||||
CvCapture* camera;
|
||||
IplImage* current_frame;
|
||||
int capture_source_index;
|
||||
bool capture_ready = false;
|
||||
int time;
|
||||
|
||||
void (*position_update_callback)(MarkerCapture* inst, MarkerPositionEstimate position);
|
||||
void (*frame_update_callback)(MarkerCapture* inst, IplImage* image, IplImage* thresh_image);
|
||||
|
||||
MarkerColorRange color_to_range(CvScalar color, int tolerance);
|
||||
char* IplImage_to_buffer(IplImage *img);
|
||||
IplImage* apply_threshold(IplImage* img, MarkerColorRange color_range);
|
||||
void IplDeinterlace(IplImage* src);
|
||||
CvPoint blob_center(CBlob blob);
|
||||
CBlobResult detect_blobs(IplImage* img, int min_size);
|
||||
double distance(CBlob blob1, CBlob blob2);
|
||||
double angle(CBlob blob1, CBlob blob2);
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__markers__) */
|
|
@ -1,154 +0,0 @@
|
|||
//
|
||||
// network.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/27/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include "network.h"
|
||||
|
||||
|
||||
// Implementation of optional delay behavior using a ring buffer
|
||||
const int MAX_DELAY_PACKETS = 300;
|
||||
char delay_buffer[MAX_PACKET_SIZE*MAX_DELAY_PACKETS];
|
||||
timeval delay_time_received[MAX_DELAY_PACKETS];
|
||||
int delay_size_received[MAX_DELAY_PACKETS];
|
||||
int next_to_receive = 0;
|
||||
int next_to_send = 0;
|
||||
|
||||
sockaddr_in address, dest_address, spaceserver_address, from;
|
||||
socklen_t fromLength = sizeof( from );
|
||||
|
||||
int network_init()
|
||||
{
|
||||
// Create socket
|
||||
int handle = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
|
||||
|
||||
if ( handle <= 0 )
|
||||
{
|
||||
printf( "failed to create socket\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Bind socket to port
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
address.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
|
||||
if ( bind( handle, (const sockaddr*) &address, sizeof(sockaddr_in) ) < 0 )
|
||||
{
|
||||
printf( "failed to bind socket\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set socket as non-blocking
|
||||
int nonBlocking = 1;
|
||||
if ( fcntl( handle, F_SETFL, O_NONBLOCK, nonBlocking ) == -1 )
|
||||
{
|
||||
printf( "failed to set non-blocking socket\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Setup desination address
|
||||
|
||||
/*unsigned int ip_address;
|
||||
if (!inet_pton(AF_INET, DESTINATION_IP, &ip_address))
|
||||
{
|
||||
printf("failed to translate destination IP address\n");
|
||||
return false;
|
||||
}*/
|
||||
|
||||
dest_address.sin_family = AF_INET;
|
||||
dest_address.sin_addr.s_addr = inet_addr(DESTINATION_IP);
|
||||
dest_address.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
|
||||
spaceserver_address.sin_family = AF_INET;
|
||||
spaceserver_address.sin_addr.s_addr = inet_addr(SPACESERVER_IP);
|
||||
spaceserver_address.sin_port = htons( (unsigned short) SPACESERVER_PORT );
|
||||
|
||||
from.sin_family = AF_INET;
|
||||
//from.sin_addr.s_addr = htonl(ip_address);
|
||||
from.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
// Send a ping packet and mark the time sent
|
||||
timeval network_send_ping(int handle) {
|
||||
timeval check;
|
||||
char packet_data[] = "P";
|
||||
sendto(handle, (const char*)packet_data, 1,
|
||||
0, (sockaddr*)&dest_address, sizeof(sockaddr_in) );
|
||||
gettimeofday(&check, NULL);
|
||||
return check;
|
||||
}
|
||||
|
||||
int notify_spaceserver(int handle, float x, float y, float z) {
|
||||
char data[100];
|
||||
sprintf(data, "%f,%f,%f", x, y, z);
|
||||
//std::cout << "sending: " << data << "\n";
|
||||
int packet_size = strlen(data);
|
||||
int sent_bytes = sendto( handle, (const char*)data, packet_size,
|
||||
0, (sockaddr*)&spaceserver_address, sizeof(sockaddr_in) );
|
||||
if ( sent_bytes != packet_size )
|
||||
{
|
||||
printf( "failed to send to spaceserver: return value = %d\n", sent_bytes );
|
||||
return false;
|
||||
}
|
||||
return sent_bytes;
|
||||
}
|
||||
|
||||
|
||||
int network_send(int handle, char * packet_data, int packet_size)
|
||||
{
|
||||
int sent_bytes = 0;
|
||||
sent_bytes = sendto( handle, (const char*)packet_data, packet_size,
|
||||
0, (sockaddr*)&dest_address, sizeof(sockaddr_in) );
|
||||
|
||||
if ( sent_bytes != packet_size )
|
||||
{
|
||||
printf( "failed to send packet: return value = %d\n", sent_bytes );
|
||||
return false;
|
||||
}
|
||||
return sent_bytes;
|
||||
}
|
||||
|
||||
int network_receive(int handle, in_addr * from_addr, char * packet_data, int delay /*msecs*/)
|
||||
{
|
||||
int received_bytes = recvfrom(handle, (char*)packet_data, MAX_PACKET_SIZE,
|
||||
0, (sockaddr*)&dest_address, &fromLength );
|
||||
from_addr->s_addr = dest_address.sin_addr.s_addr;
|
||||
|
||||
if (!delay) {
|
||||
// No delay set, so just return packets immediately!
|
||||
return received_bytes;
|
||||
} else {
|
||||
timeval check;
|
||||
gettimeofday(&check, NULL);
|
||||
if (received_bytes > 0) {
|
||||
// First write received data into ring buffer
|
||||
delay_time_received[next_to_receive] = check;
|
||||
delay_size_received[next_to_receive] = received_bytes;
|
||||
memcpy(&delay_buffer[next_to_receive*MAX_PACKET_SIZE], packet_data, received_bytes);
|
||||
next_to_receive++;
|
||||
if (next_to_receive == MAX_DELAY_PACKETS) next_to_receive = 0;
|
||||
}
|
||||
// Then check if next to be sent is past due, send if so
|
||||
if ((next_to_receive != next_to_send) &&
|
||||
(diffclock(delay_time_received[next_to_send], check) > delay)) {
|
||||
int returned_bytes = delay_size_received[next_to_send];
|
||||
memcpy(packet_data,
|
||||
&delay_buffer[next_to_send*MAX_PACKET_SIZE],
|
||||
returned_bytes);
|
||||
next_to_send++;
|
||||
if (next_to_send == MAX_DELAY_PACKETS) next_to_send = 0;
|
||||
return returned_bytes;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
//
|
||||
// network.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/27/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_network_h
|
||||
#define interface_network_h
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include "util.h"
|
||||
|
||||
// Port to use for communicating UDP with other nearby agents
|
||||
const int MAX_PACKET_SIZE = 1500;
|
||||
const int UDP_PORT = 30001;
|
||||
const char DESTINATION_IP[] = "127.0.0.1";
|
||||
|
||||
// Address and port of spaceserver process to advertise other agents
|
||||
const char SPACESERVER_IP[] = "127.0.0.1";
|
||||
const int SPACESERVER_PORT = 40000;
|
||||
|
||||
// Randomly send a ping packet every N packets sent
|
||||
const int PING_PACKET_COUNT = 20;
|
||||
|
||||
int network_init();
|
||||
int network_send(int handle, char * packet_data, int packet_size);
|
||||
int network_receive(int handle, in_addr * from_addr, char * packet_data, int delay /*msecs*/);
|
||||
timeval network_send_ping(int handle);
|
||||
int notify_spaceserver(int handle, float x, float y, float z);
|
||||
|
||||
#endif
|
|
@ -1,244 +0,0 @@
|
|||
//
|
||||
// particle.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Seiji Emery on 9/4/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#include "particle.h"
|
||||
|
||||
#define NUM_ELEMENTS 4
|
||||
|
||||
glm::vec3 color0(1,0,0); // Motionless particle
|
||||
glm::vec3 color1(0,1,0); // Spring force
|
||||
glm::vec3 color2(0,0,1);
|
||||
glm::vec3 color3(0,1,1);
|
||||
|
||||
float radii[NUM_ELEMENTS] = {0.3, 0.5, 0.2, 0.4};
|
||||
|
||||
ParticleSystem::ParticleSystem(int num,
|
||||
glm::vec3 box,
|
||||
int wrap,
|
||||
float noiselevel,
|
||||
float setscale,
|
||||
float setgravity) {
|
||||
// Create and initialize particles
|
||||
int i, element;
|
||||
bounds = box;
|
||||
count = num;
|
||||
wrapBounds = false;
|
||||
noise = noiselevel;
|
||||
gravity = setgravity;
|
||||
scale = setscale;
|
||||
particles = new Particle[count];
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
particles[i].position.x = randFloat()*box.x;
|
||||
particles[i].position.y = randFloat()*box.y;
|
||||
particles[i].position.z = randFloat()*box.z;
|
||||
|
||||
// Constrain to a small box in center
|
||||
//particles[i].position.x = randFloat()+box.x/2.0;
|
||||
//particles[i].position.y = randFloat()+box.y/2.0;
|
||||
//particles[i].position.z = randFloat()+box.z/2.0;
|
||||
|
||||
particles[i].velocity.x = 0;
|
||||
particles[i].velocity.y = 0;
|
||||
particles[i].velocity.z = 0;
|
||||
|
||||
particles[i].parent = 0;
|
||||
particles[i].link *= 0;
|
||||
|
||||
element = 1; //rand()%NUM_ELEMENTS;
|
||||
particles[i].element = element;
|
||||
|
||||
if (element == 0) particles[i].color = color0;
|
||||
else if (element == 1) particles[i].color = color1;
|
||||
else if (element == 2) particles[i].color = color2;
|
||||
else if (element == 3) particles[i].color = color3;
|
||||
|
||||
particles[i].radius = 0.10; //radii[element]*scale;
|
||||
particles[i].isColliding = false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool ParticleSystem::updateHand(glm::vec3 pos, glm::vec3 vel, float radius) {
|
||||
handPos = pos;
|
||||
handVel = vel;
|
||||
handRadius = radius;
|
||||
return handIsColliding;
|
||||
}
|
||||
|
||||
void ParticleSystem::resetHand() {
|
||||
handActive = false;
|
||||
handIsColliding = false;
|
||||
handPos = glm::vec3(0,0,0);
|
||||
handVel = glm::vec3(0,0,0);
|
||||
handRadius = 0;
|
||||
}
|
||||
|
||||
void ParticleSystem::render() {
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
glPushMatrix();
|
||||
glTranslatef(particles[i].position.x, particles[i].position.y, particles[i].position.z);
|
||||
if (particles[i].numSprung == 0) glColor3f(1,1,1);
|
||||
else if (particles[i].numSprung == 1) glColor3f(0,1,0);
|
||||
else if (particles[i].numSprung == 2) glColor3f(1,1,0);
|
||||
else if (particles[i].numSprung >= 3) glColor3f(1,0,0);
|
||||
glutSolidSphere(particles[i].radius, 15, 15);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
void ParticleSystem::link(int child, int parent) {
|
||||
particles[child].parent = parent;
|
||||
particles[child].velocity *= 0.5;
|
||||
particles[parent].velocity += particles[child].velocity;
|
||||
particles[child].velocity *= 0.0;
|
||||
particles[child].color = glm::vec3(1,1,0);
|
||||
particles[child].link = particles[parent].position - particles[child].position;
|
||||
}
|
||||
|
||||
void ParticleSystem::simulate (float deltaTime) {
|
||||
int i, j;
|
||||
for (i = 0; i < count; ++i) {
|
||||
if (particles[i].element != 0) {
|
||||
|
||||
if (particles[i].parent == 0) {
|
||||
// Move particles
|
||||
particles[i].position += particles[i].velocity * deltaTime;
|
||||
|
||||
// Add gravity
|
||||
particles[i].velocity.y -= gravity*deltaTime;
|
||||
|
||||
// Drag: decay velocity
|
||||
const float CONSTANT_DAMPING = 0.1;
|
||||
particles[i].velocity *= (1.f - CONSTANT_DAMPING*deltaTime);
|
||||
|
||||
// Add velocity from field
|
||||
//Field::addTo(particles[i].velocity);
|
||||
//particles[i].velocity += Field::valueAt(particles[i].position);
|
||||
|
||||
// Add noise
|
||||
const float RAND_VEL = 0.05;
|
||||
if (noise) {
|
||||
if (1) {
|
||||
particles[i].velocity += glm::vec3((randFloat() - 0.5)*RAND_VEL,
|
||||
(randFloat() - 0.5)*RAND_VEL,
|
||||
(randFloat() - 0.5)*RAND_VEL);
|
||||
}
|
||||
if (randFloat() < noise*deltaTime) {
|
||||
particles[i].velocity += glm::vec3((randFloat() - 0.5)*RAND_VEL*100,
|
||||
(randFloat() - 0.5)*RAND_VEL*100,
|
||||
(randFloat() - 0.5)*RAND_VEL*100);
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
particles[i].position = particles[particles[i].parent].position + particles[i].link;
|
||||
}
|
||||
|
||||
|
||||
// Check for collision with manipulator hand
|
||||
particles[i].isColliding = (glm::vec3(particles[i].position - handPos).length() <
|
||||
(radius + handRadius));
|
||||
|
||||
// Check for collision with other balls
|
||||
float separation;
|
||||
const float HARD_SPHERE_FORCE = 100.0;
|
||||
const float SPRING_FORCE = 10.0;
|
||||
const float SPRING_DAMPING = 0.5;
|
||||
float spring_length = 0.5; //2*radii[1];
|
||||
float spring_range = spring_length * 1.2;
|
||||
float contact;
|
||||
|
||||
particles[i].isColliding = false;
|
||||
particles[i].numSprung = 0;
|
||||
|
||||
for (j = 0; j < count; j++) {
|
||||
if ((j != i) &&
|
||||
(!particles[i].parent)) {
|
||||
separation = glm::distance(particles[i].position, particles[j].position);
|
||||
contact = particles[i].radius + particles[j].radius;
|
||||
|
||||
// Hard Sphere Scattering
|
||||
|
||||
if (separation < contact) {
|
||||
particles[i].velocity += glm::normalize(particles[i].position - particles[j].position)*deltaTime*HARD_SPHERE_FORCE*(contact - separation);
|
||||
particles[i].isColliding = true;
|
||||
}
|
||||
|
||||
// Spring Action
|
||||
if ((particles[i].element == 1) && (separation < spring_range)) {
|
||||
particles[i].velocity += glm::normalize(particles[i].position - particles[j].position)*deltaTime*SPRING_FORCE*(spring_length - separation);
|
||||
particles[i].velocity *= (1.f - SPRING_DAMPING*deltaTime);
|
||||
particles[i].numSprung++;
|
||||
}
|
||||
|
||||
// Link!
|
||||
if ((particles[i].parent == 0) &&
|
||||
(particles[j].parent != i) &&
|
||||
(separation > 0.9*(particles[j].radius + particles[i].radius)) &&
|
||||
(separation < 1.0*(particles[j].radius + particles[i].radius)) ) {
|
||||
// Link i to j!!
|
||||
//link(i, j);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!particles[i].parent) {
|
||||
if (wrapBounds) {
|
||||
// wrap around bounds
|
||||
if (particles[i].position.x > bounds.x)
|
||||
particles[i].position.x -= bounds.x;
|
||||
else if (particles[i].position.x < 0.0f)
|
||||
particles[i].position.x += bounds.x;
|
||||
|
||||
if (particles[i].position.y > bounds.y)
|
||||
particles[i].position.y -= bounds.y;
|
||||
else if (particles[i].position.y < 0.0f)
|
||||
particles[i].position.y += bounds.y;
|
||||
|
||||
if (particles[i].position.z > bounds.z)
|
||||
particles[i].position.z -= bounds.z;
|
||||
else if (particles[i].position.z < 0.0f)
|
||||
particles[i].position.z += bounds.z;
|
||||
} else {
|
||||
// Bounce at bounds
|
||||
if (particles[i].position.x > bounds.x
|
||||
|| particles[i].position.x < 0.f) {
|
||||
if (particles[i].position.x > bounds.x) particles[i].position.x = bounds.x;
|
||||
else particles[i].position.x = 0.f;
|
||||
particles[i].velocity.x *= -1;
|
||||
}
|
||||
if (particles[i].position.y > bounds.y
|
||||
|| particles[i].position.y < 0.f) {
|
||||
if (particles[i].position.y > bounds.y) particles[i].position.y = bounds.y;
|
||||
else particles[i].position.y = 0.f;
|
||||
particles[i].velocity.y *= -1;
|
||||
}
|
||||
if (particles[i].position.z > bounds.z
|
||||
|| particles[i].position.z < 0.f) {
|
||||
if (particles[i].position.z > bounds.z) particles[i].position.z = bounds.z;
|
||||
else particles[i].position.z = 0.f;
|
||||
particles[i].velocity.z *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
//
|
||||
// particle.h
|
||||
// interface
|
||||
//
|
||||
// Created by Seiji Emery on 9/4/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_particle_h
|
||||
#define interface_particle_h
|
||||
|
||||
#include "glm.hpp"
|
||||
#include "util.h"
|
||||
#include "world.h"
|
||||
#include <GLUT/glut.h>
|
||||
|
||||
class ParticleSystem {
|
||||
public:
|
||||
ParticleSystem(int num,
|
||||
glm::vec3 box,
|
||||
int wrap,
|
||||
float noiselevel,
|
||||
float setscale,
|
||||
float setgravity);
|
||||
|
||||
void simulate(float deltaTime);
|
||||
void render();
|
||||
bool updateHand(glm::vec3 pos, glm::vec3 vel, float radius);
|
||||
|
||||
private:
|
||||
struct Particle {
|
||||
glm::vec3 position, velocity, color, link;
|
||||
int element;
|
||||
int parent;
|
||||
float radius;
|
||||
bool isColliding;
|
||||
int numSprung;
|
||||
} *particles;
|
||||
unsigned int count;
|
||||
|
||||
glm::vec3 bounds;
|
||||
|
||||
float radius;
|
||||
bool wrapBounds;
|
||||
float noise;
|
||||
float gravity;
|
||||
float scale;
|
||||
glm::vec3 color;
|
||||
|
||||
void link(int child, int parent);
|
||||
|
||||
// Manipulator from outside
|
||||
void resetHand();
|
||||
bool handActive;
|
||||
bool handIsColliding;
|
||||
glm::vec3 handPos;
|
||||
glm::vec3 handVel;
|
||||
float handRadius;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,78 +0,0 @@
|
|||
//
|
||||
// texture.cpp
|
||||
// interface
|
||||
//
|
||||
// Added by Yoz on 11/5/12.
|
||||
//
|
||||
// Code lifted from http://en.wikibooks.org/wiki/OpenGL_Programming/Intermediate/Textures
|
||||
|
||||
#include "texture.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
#include "lodepng.h"
|
||||
#include <vector>
|
||||
#include <cstdio>
|
||||
|
||||
#define TEXTURE_LOAD_ERROR 0
|
||||
|
||||
/**
|
||||
* Read a given filename as a PNG texture, and set
|
||||
it as the current default OpenGL texture.
|
||||
* @param[in] filename Relative path to PNG file
|
||||
* @return Zero for success.
|
||||
*/
|
||||
|
||||
int load_png_as_texture(char* filename)
|
||||
{
|
||||
std::vector<unsigned char> image;
|
||||
// width and height will be read from the file at the start
|
||||
// and loaded into these vars
|
||||
unsigned int width = 1, height = 1;
|
||||
unsigned error = lodepng::decode(image, width, height, filename);
|
||||
if (error) {
|
||||
std::cout << "Error loading texture" << std::endl;
|
||||
return (int) error;
|
||||
}
|
||||
|
||||
// Make some OpenGL properties better for 2D and enable alpha channel.
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
|
||||
if(glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
std::cout << "Error initing GL" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Texture size must be power of two for the primitive OpenGL version this is written for. Find next power of two.
|
||||
size_t u2 = 1; while(u2 < width) u2 *= 2;
|
||||
size_t v2 = 1; while(v2 < height) v2 *= 2;
|
||||
// Ratio for power of two version compared to actual version, to render the non power of two image with proper size.
|
||||
// double u3 = (double)width / u2;
|
||||
// double v3 = (double)height / v2;
|
||||
|
||||
// Make power of two version of the image.
|
||||
std::vector<unsigned char> image2(u2 * v2 * 4);
|
||||
for(size_t y = 0; y < height; y++)
|
||||
for(size_t x = 0; x < width; x++)
|
||||
for(size_t c = 0; c < 4; c++)
|
||||
{
|
||||
image2[4 * u2 * y + 4 * x + c] = image[4 * width * y + 4 * x + c];
|
||||
}
|
||||
|
||||
// Enable the texture for OpenGL.
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); //GL_NEAREST = no smoothing
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, 4, u2, v2, 0, GL_RGBA, GL_UNSIGNED_BYTE, &image2[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// texture.h
|
||||
// interface
|
||||
//
|
||||
// Created by Yoz Work on 11/5/12.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __interface__texture__
|
||||
#define __interface__texture__
|
||||
|
||||
#include <iostream>
|
||||
#ifdef __APPLE__
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
int load_png_as_texture(char* filename);
|
||||
|
||||
#endif /* defined(__interface__texture__) */
|
143
Sources/util.cpp
143
Sources/util.cpp
|
@ -1,143 +0,0 @@
|
|||
//
|
||||
// util.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/24/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
#include <iostream>
|
||||
#include "world.h"
|
||||
#include "glm.hpp"
|
||||
|
||||
float randFloat () {
|
||||
return (rand()%10000)/10000.f;
|
||||
}
|
||||
|
||||
|
||||
void render_vector(glm::vec3 * vec)
|
||||
{
|
||||
// Show edge of world
|
||||
glDisable(GL_LIGHTING);
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glLineWidth(1.0);
|
||||
glBegin(GL_LINES);
|
||||
// Draw axes
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f(-1,0,0);
|
||||
glVertex3f(1,0,0);
|
||||
glColor3f(0,1,0);
|
||||
glVertex3f(0,-1,0);
|
||||
glVertex3f(0, 1, 0);
|
||||
glColor3f(0,0,1);
|
||||
glVertex3f(0,0,-1);
|
||||
glVertex3f(0, 0, 1);
|
||||
// Draw vector
|
||||
glColor3f(1,1,1);
|
||||
glVertex3f(0,0,0);
|
||||
glVertex3f(vec->x, vec->y, vec->z);
|
||||
// Draw marker dots for magnitude
|
||||
glEnd();
|
||||
float particle_attenuation_quadratic[] = { 0.0f, 0.0f, 2.0f }; // larger Z = smaller particles
|
||||
glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, particle_attenuation_quadratic );
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
glPointSize(10.0);
|
||||
glBegin(GL_POINTS);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f(vec->x,0,0);
|
||||
glColor3f(0,1,0);
|
||||
glVertex3f(0,vec->y,0);
|
||||
glColor3f(0,0,1);
|
||||
glVertex3f(0,0,vec->z);
|
||||
glEnd();
|
||||
|
||||
}
|
||||
|
||||
void render_world_box()
|
||||
{
|
||||
// Show edge of world
|
||||
glDisable(GL_LIGHTING);
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glLineWidth(1.0);
|
||||
glBegin(GL_LINES);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f(0,0,0);
|
||||
glVertex3f(WORLD_SIZE,0,0);
|
||||
glColor3f(0,1,0);
|
||||
glVertex3f(0,0,0);
|
||||
glVertex3f(0, WORLD_SIZE, 0);
|
||||
glColor3f(0,0,1);
|
||||
glVertex3f(0,0,0);
|
||||
glVertex3f(0, 0, WORLD_SIZE);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void outstring(char * string, int length) {
|
||||
char out[length];
|
||||
memcpy(out, string, length);
|
||||
std::cout << out << "\n";
|
||||
}
|
||||
|
||||
double diffclock(timeval clock1,timeval clock2)
|
||||
{
|
||||
double diffms = (clock2.tv_sec - clock1.tv_sec) * 1000.0;
|
||||
diffms += (clock2.tv_usec - clock1.tv_usec) / 1000.0; // us to ms
|
||||
|
||||
return diffms;
|
||||
}
|
||||
|
||||
void drawtext(int x, int y, float scale, float rotate, float thick, int mono, char *string,
|
||||
float r=1.0, float g=1.0, float b=1.0)
|
||||
{
|
||||
//
|
||||
// Draws text on screen as stroked so it can be resized
|
||||
//
|
||||
int len, i;
|
||||
glPushMatrix();
|
||||
glTranslatef(x, y, 0);
|
||||
glColor3f(r,g,b);
|
||||
glRotated(180+rotate,0,0,1);
|
||||
glRotated(180,0,1,0);
|
||||
glLineWidth(thick);
|
||||
glScalef(scale, scale, 1.0);
|
||||
len = (int) strlen(string);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (!mono) glutStrokeCharacter(GLUT_STROKE_ROMAN, int(string[i]));
|
||||
else glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, int(string[i]));
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec,
|
||||
float r=1.0, float g=1.0, float b=1.0)
|
||||
{
|
||||
//
|
||||
// Draws text on screen as stroked so it can be resized
|
||||
//
|
||||
char vectext[20];
|
||||
sprintf(vectext,"%3.1f,%3.1f,%3.1f", vec.x, vec.y, vec.z);
|
||||
int len, i;
|
||||
glPushMatrix();
|
||||
glTranslatef(x, y, 0);
|
||||
glColor3f(r,g,b);
|
||||
glRotated(180+rotate,0,0,1);
|
||||
glRotated(180,0,1,0);
|
||||
glLineWidth(thick);
|
||||
glScalef(scale, scale, 1.0);
|
||||
len = (int) strlen(vectext);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (!mono) glutStrokeCharacter(GLUT_STROKE_ROMAN, int(vectext[i]));
|
||||
else glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, int(vectext[i]));
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
//
|
||||
// util.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/24/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interface_util_h
|
||||
#define interface_util_h
|
||||
|
||||
#include "glm.hpp"
|
||||
|
||||
void outstring(char * string, int length);
|
||||
float randFloat();
|
||||
void render_world_box();
|
||||
void render_vector(glm::vec3 * vec);
|
||||
void drawtext(int x, int y, float scale, float rotate, float thick, int mono, char *string,
|
||||
float r=1.0, float g=1.0, float b=1.0);
|
||||
void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec,
|
||||
float r=1.0, float g=1.0, float b=1.0);
|
||||
double diffclock(timeval clock1,timeval clock2);
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
//
|
||||
// world.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/23/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
// Simulation happens in positive cube with edge of size WORLD_SIZE
|
||||
|
||||
#ifndef interface_world_h
|
||||
#define interface_world_h
|
||||
|
||||
const float WORLD_SIZE = 10.0;
|
||||
#define PI 3.14159265
|
||||
|
||||
#endif
|
|
@ -7,25 +7,25 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
5325C25016AF4DBE0051A40B /* agent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C22916AF4DBE0051A40B /* agent.cpp */; };
|
||||
5325C25116AF4DBE0051A40B /* audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C22B16AF4DBE0051A40B /* audio.cpp */; };
|
||||
5325C25216AF4DBE0051A40B /* cloud.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C22D16AF4DBE0051A40B /* cloud.cpp */; };
|
||||
5325C25316AF4DBE0051A40B /* cube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C22F16AF4DBE0051A40B /* cube.cpp */; };
|
||||
5325C25416AF4DBE0051A40B /* field.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C23116AF4DBE0051A40B /* field.cpp */; };
|
||||
5325C25516AF4DBE0051A40B /* finger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C23316AF4DBE0051A40B /* finger.cpp */; };
|
||||
5325C25616AF4DBE0051A40B /* hand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C23516AF4DBE0051A40B /* hand.cpp */; };
|
||||
5325C25716AF4DBE0051A40B /* head.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C23A16AF4DBE0051A40B /* head.cpp */; };
|
||||
5325C25816AF4DBE0051A40B /* lattice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C23C16AF4DBE0051A40B /* lattice.cpp */; };
|
||||
5325C25916AF4DBE0051A40B /* lodepng.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C23E16AF4DBE0051A40B /* lodepng.cpp */; };
|
||||
5325C25A16AF4DBE0051A40B /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C24016AF4DBE0051A40B /* main.cpp */; };
|
||||
5325C25B16AF4DBE0051A40B /* marker_acquisition_view.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C24116AF4DBE0051A40B /* marker_acquisition_view.cpp */; };
|
||||
5325C25C16AF4DBE0051A40B /* markers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C24316AF4DBE0051A40B /* markers.cpp */; };
|
||||
5325C25D16AF4DBE0051A40B /* network.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C24516AF4DBE0051A40B /* network.cpp */; };
|
||||
5325C25E16AF4DBE0051A40B /* particle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C24716AF4DBE0051A40B /* particle.cpp */; };
|
||||
5325C25F16AF4DBE0051A40B /* SerialInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C24916AF4DBE0051A40B /* SerialInterface.cpp */; };
|
||||
5325C26016AF4DBE0051A40B /* texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C24B16AF4DBE0051A40B /* texture.cpp */; };
|
||||
5325C26116AF4DBE0051A40B /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5325C24D16AF4DBE0051A40B /* util.cpp */; };
|
||||
532C7AF216AF298D00B1A969 /* CVBlob.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 532C792A16AF298900B1A969 /* CVBlob.framework */; };
|
||||
532C7B0616AF298D00B1A969 /* agent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7ACB16AF298D00B1A969 /* agent.cpp */; };
|
||||
532C7B0716AF298D00B1A969 /* audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7ACD16AF298D00B1A969 /* audio.cpp */; };
|
||||
532C7B0816AF298D00B1A969 /* cloud.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7ACF16AF298D00B1A969 /* cloud.cpp */; };
|
||||
532C7B0916AF298D00B1A969 /* cube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AD116AF298D00B1A969 /* cube.cpp */; };
|
||||
532C7B0A16AF298D00B1A969 /* field.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AD316AF298D00B1A969 /* field.cpp */; };
|
||||
532C7B0B16AF298D00B1A969 /* finger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AD516AF298D00B1A969 /* finger.cpp */; };
|
||||
532C7B0C16AF298D00B1A969 /* hand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AD716AF298D00B1A969 /* hand.cpp */; };
|
||||
532C7B0D16AF298D00B1A969 /* head.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7ADC16AF298D00B1A969 /* head.cpp */; };
|
||||
532C7B0E16AF298D00B1A969 /* lattice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7ADE16AF298D00B1A969 /* lattice.cpp */; };
|
||||
532C7B0F16AF298D00B1A969 /* lodepng.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AE016AF298D00B1A969 /* lodepng.cpp */; };
|
||||
532C7B1016AF298D00B1A969 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AE216AF298D00B1A969 /* main.cpp */; };
|
||||
532C7B1116AF298D00B1A969 /* marker_acquisition_view.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AE316AF298D00B1A969 /* marker_acquisition_view.cpp */; };
|
||||
532C7B1216AF298D00B1A969 /* markers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AE516AF298D00B1A969 /* markers.cpp */; };
|
||||
532C7B1316AF298D00B1A969 /* network.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AE716AF298D00B1A969 /* network.cpp */; };
|
||||
532C7B1416AF298D00B1A969 /* particle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AE916AF298D00B1A969 /* particle.cpp */; };
|
||||
532C7B1516AF298D00B1A969 /* SerialInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AEB16AF298D00B1A969 /* SerialInterface.cpp */; };
|
||||
532C7B1616AF298D00B1A969 /* texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AED16AF298D00B1A969 /* texture.cpp */; };
|
||||
532C7B1716AF298D00B1A969 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532C7AEF16AF298D00B1A969 /* util.cpp */; };
|
||||
532C7CCC16AF301E00B1A969 /* grayson-particle.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = 532C7AC316AF298D00B1A969 /* grayson-particle.png */; };
|
||||
532C7CCD16AF301E00B1A969 /* int-texture256-v2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = 532C7AC416AF298D00B1A969 /* int-texture256-v2.png */; };
|
||||
532C7CCE16AF301E00B1A969 /* int-texture256-v4.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = 532C7AC516AF298D00B1A969 /* int-texture256-v4.png */; };
|
||||
|
@ -79,6 +79,43 @@
|
|||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
5325C22916AF4DBE0051A40B /* agent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = agent.cpp; sourceTree = "<group>"; };
|
||||
5325C22A16AF4DBE0051A40B /* agent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = agent.h; sourceTree = "<group>"; };
|
||||
5325C22B16AF4DBE0051A40B /* audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = audio.cpp; sourceTree = "<group>"; };
|
||||
5325C22C16AF4DBE0051A40B /* audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio.h; sourceTree = "<group>"; };
|
||||
5325C22D16AF4DBE0051A40B /* cloud.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cloud.cpp; sourceTree = "<group>"; };
|
||||
5325C22E16AF4DBE0051A40B /* cloud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cloud.h; sourceTree = "<group>"; };
|
||||
5325C22F16AF4DBE0051A40B /* cube.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cube.cpp; sourceTree = "<group>"; };
|
||||
5325C23016AF4DBE0051A40B /* cube.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cube.h; sourceTree = "<group>"; };
|
||||
5325C23116AF4DBE0051A40B /* field.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = field.cpp; sourceTree = "<group>"; };
|
||||
5325C23216AF4DBE0051A40B /* field.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = field.h; sourceTree = "<group>"; };
|
||||
5325C23316AF4DBE0051A40B /* finger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = finger.cpp; sourceTree = "<group>"; };
|
||||
5325C23416AF4DBE0051A40B /* finger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = finger.h; sourceTree = "<group>"; };
|
||||
5325C23516AF4DBE0051A40B /* hand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hand.cpp; sourceTree = "<group>"; };
|
||||
5325C23616AF4DBE0051A40B /* hand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hand.h; sourceTree = "<group>"; };
|
||||
5325C23916AF4DBE0051A40B /* head_hand.pde */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = head_hand.pde; sourceTree = "<group>"; };
|
||||
5325C23A16AF4DBE0051A40B /* head.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = head.cpp; sourceTree = "<group>"; };
|
||||
5325C23B16AF4DBE0051A40B /* head.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = head.h; sourceTree = "<group>"; };
|
||||
5325C23C16AF4DBE0051A40B /* lattice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lattice.cpp; sourceTree = "<group>"; };
|
||||
5325C23D16AF4DBE0051A40B /* lattice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lattice.h; sourceTree = "<group>"; };
|
||||
5325C23E16AF4DBE0051A40B /* lodepng.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lodepng.cpp; sourceTree = "<group>"; };
|
||||
5325C23F16AF4DBE0051A40B /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lodepng.h; sourceTree = "<group>"; };
|
||||
5325C24016AF4DBE0051A40B /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
5325C24116AF4DBE0051A40B /* marker_acquisition_view.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = marker_acquisition_view.cpp; sourceTree = "<group>"; };
|
||||
5325C24216AF4DBE0051A40B /* marker_acquisition_view.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = marker_acquisition_view.h; sourceTree = "<group>"; };
|
||||
5325C24316AF4DBE0051A40B /* markers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = markers.cpp; sourceTree = "<group>"; };
|
||||
5325C24416AF4DBE0051A40B /* markers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = markers.h; sourceTree = "<group>"; };
|
||||
5325C24516AF4DBE0051A40B /* network.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = network.cpp; sourceTree = "<group>"; };
|
||||
5325C24616AF4DBE0051A40B /* network.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = network.h; sourceTree = "<group>"; };
|
||||
5325C24716AF4DBE0051A40B /* particle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = particle.cpp; sourceTree = "<group>"; };
|
||||
5325C24816AF4DBE0051A40B /* particle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = particle.h; sourceTree = "<group>"; };
|
||||
5325C24916AF4DBE0051A40B /* SerialInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerialInterface.cpp; sourceTree = "<group>"; };
|
||||
5325C24A16AF4DBE0051A40B /* SerialInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerialInterface.h; sourceTree = "<group>"; };
|
||||
5325C24B16AF4DBE0051A40B /* texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = texture.cpp; sourceTree = "<group>"; };
|
||||
5325C24C16AF4DBE0051A40B /* texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = texture.h; sourceTree = "<group>"; };
|
||||
5325C24D16AF4DBE0051A40B /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
|
||||
5325C24E16AF4DBE0051A40B /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
|
||||
5325C24F16AF4DBE0051A40B /* world.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = world.h; sourceTree = "<group>"; };
|
||||
532C792A16AF298900B1A969 /* CVBlob.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CVBlob.framework; path = Frameworks/CVBlob.framework; sourceTree = "<group>"; };
|
||||
532C7AC316AF298D00B1A969 /* grayson-particle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "grayson-particle.png"; sourceTree = "<group>"; };
|
||||
532C7AC416AF298D00B1A969 /* int-texture256-v2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "int-texture256-v2.png"; sourceTree = "<group>"; };
|
||||
|
@ -87,43 +124,6 @@
|
|||
532C7AC716AF298D00B1A969 /* philip-image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "philip-image.png"; sourceTree = "<group>"; };
|
||||
532C7AC816AF298D00B1A969 /* pngtest8rgba.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pngtest8rgba.png; sourceTree = "<group>"; };
|
||||
532C7AC916AF298D00B1A969 /* sphere.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sphere.png; sourceTree = "<group>"; };
|
||||
532C7ACB16AF298D00B1A969 /* agent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = agent.cpp; sourceTree = "<group>"; };
|
||||
532C7ACC16AF298D00B1A969 /* agent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = agent.h; sourceTree = "<group>"; };
|
||||
532C7ACD16AF298D00B1A969 /* audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = audio.cpp; sourceTree = "<group>"; };
|
||||
532C7ACE16AF298D00B1A969 /* audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio.h; sourceTree = "<group>"; };
|
||||
532C7ACF16AF298D00B1A969 /* cloud.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cloud.cpp; sourceTree = "<group>"; };
|
||||
532C7AD016AF298D00B1A969 /* cloud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cloud.h; sourceTree = "<group>"; };
|
||||
532C7AD116AF298D00B1A969 /* cube.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cube.cpp; sourceTree = "<group>"; };
|
||||
532C7AD216AF298D00B1A969 /* cube.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cube.h; sourceTree = "<group>"; };
|
||||
532C7AD316AF298D00B1A969 /* field.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = field.cpp; sourceTree = "<group>"; };
|
||||
532C7AD416AF298D00B1A969 /* field.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = field.h; sourceTree = "<group>"; };
|
||||
532C7AD516AF298D00B1A969 /* finger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = finger.cpp; sourceTree = "<group>"; };
|
||||
532C7AD616AF298D00B1A969 /* finger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = finger.h; sourceTree = "<group>"; };
|
||||
532C7AD716AF298D00B1A969 /* hand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hand.cpp; sourceTree = "<group>"; };
|
||||
532C7AD816AF298D00B1A969 /* hand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hand.h; sourceTree = "<group>"; };
|
||||
532C7ADB16AF298D00B1A969 /* head_hand.pde */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = head_hand.pde; sourceTree = "<group>"; };
|
||||
532C7ADC16AF298D00B1A969 /* head.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = head.cpp; sourceTree = "<group>"; };
|
||||
532C7ADD16AF298D00B1A969 /* head.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = head.h; sourceTree = "<group>"; };
|
||||
532C7ADE16AF298D00B1A969 /* lattice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lattice.cpp; sourceTree = "<group>"; };
|
||||
532C7ADF16AF298D00B1A969 /* lattice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lattice.h; sourceTree = "<group>"; };
|
||||
532C7AE016AF298D00B1A969 /* lodepng.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lodepng.cpp; sourceTree = "<group>"; };
|
||||
532C7AE116AF298D00B1A969 /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lodepng.h; sourceTree = "<group>"; };
|
||||
532C7AE216AF298D00B1A969 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
532C7AE316AF298D00B1A969 /* marker_acquisition_view.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = marker_acquisition_view.cpp; sourceTree = "<group>"; };
|
||||
532C7AE416AF298D00B1A969 /* marker_acquisition_view.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = marker_acquisition_view.h; sourceTree = "<group>"; };
|
||||
532C7AE516AF298D00B1A969 /* markers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = markers.cpp; sourceTree = "<group>"; };
|
||||
532C7AE616AF298D00B1A969 /* markers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = markers.h; sourceTree = "<group>"; };
|
||||
532C7AE716AF298D00B1A969 /* network.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = network.cpp; sourceTree = "<group>"; };
|
||||
532C7AE816AF298D00B1A969 /* network.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = network.h; sourceTree = "<group>"; };
|
||||
532C7AE916AF298D00B1A969 /* particle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = particle.cpp; sourceTree = "<group>"; };
|
||||
532C7AEA16AF298D00B1A969 /* particle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = particle.h; sourceTree = "<group>"; };
|
||||
532C7AEB16AF298D00B1A969 /* SerialInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerialInterface.cpp; sourceTree = "<group>"; };
|
||||
532C7AEC16AF298D00B1A969 /* SerialInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerialInterface.h; sourceTree = "<group>"; };
|
||||
532C7AED16AF298D00B1A969 /* texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = texture.cpp; sourceTree = "<group>"; };
|
||||
532C7AEE16AF298D00B1A969 /* texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = texture.h; sourceTree = "<group>"; };
|
||||
532C7AEF16AF298D00B1A969 /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
|
||||
532C7AF016AF298D00B1A969 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
|
||||
532C7AF116AF298D00B1A969 /* world.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = world.h; sourceTree = "<group>"; };
|
||||
532C7E9616AF3B1500B1A969 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
532C7E9816AF3B1500B1A969 /* _detail.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = _detail.hpp; sourceTree = "<group>"; };
|
||||
532C7E9916AF3B1500B1A969 /* _fixes.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = _fixes.hpp; sourceTree = "<group>"; };
|
||||
|
@ -552,7 +552,7 @@
|
|||
532C7E9416AF3B1500B1A969 /* Libraries */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
532C7AC116AF298D00B1A969 /* Resources */,
|
||||
532C7ACA16AF298D00B1A969 /* Sources */,
|
||||
5325C22816AF4DBE0051A40B /* Source */,
|
||||
);
|
||||
name = test_c_plus;
|
||||
sourceTree = "<group>";
|
||||
|
@ -579,6 +579,66 @@
|
|||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5325C22816AF4DBE0051A40B /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5325C22916AF4DBE0051A40B /* agent.cpp */,
|
||||
5325C22A16AF4DBE0051A40B /* agent.h */,
|
||||
5325C22B16AF4DBE0051A40B /* audio.cpp */,
|
||||
5325C22C16AF4DBE0051A40B /* audio.h */,
|
||||
5325C22D16AF4DBE0051A40B /* cloud.cpp */,
|
||||
5325C22E16AF4DBE0051A40B /* cloud.h */,
|
||||
5325C22F16AF4DBE0051A40B /* cube.cpp */,
|
||||
5325C23016AF4DBE0051A40B /* cube.h */,
|
||||
5325C23116AF4DBE0051A40B /* field.cpp */,
|
||||
5325C23216AF4DBE0051A40B /* field.h */,
|
||||
5325C23316AF4DBE0051A40B /* finger.cpp */,
|
||||
5325C23416AF4DBE0051A40B /* finger.h */,
|
||||
5325C23516AF4DBE0051A40B /* hand.cpp */,
|
||||
5325C23616AF4DBE0051A40B /* hand.h */,
|
||||
5325C23716AF4DBE0051A40B /* hardware */,
|
||||
5325C23A16AF4DBE0051A40B /* head.cpp */,
|
||||
5325C23B16AF4DBE0051A40B /* head.h */,
|
||||
5325C23C16AF4DBE0051A40B /* lattice.cpp */,
|
||||
5325C23D16AF4DBE0051A40B /* lattice.h */,
|
||||
5325C23E16AF4DBE0051A40B /* lodepng.cpp */,
|
||||
5325C23F16AF4DBE0051A40B /* lodepng.h */,
|
||||
5325C24016AF4DBE0051A40B /* main.cpp */,
|
||||
5325C24116AF4DBE0051A40B /* marker_acquisition_view.cpp */,
|
||||
5325C24216AF4DBE0051A40B /* marker_acquisition_view.h */,
|
||||
5325C24316AF4DBE0051A40B /* markers.cpp */,
|
||||
5325C24416AF4DBE0051A40B /* markers.h */,
|
||||
5325C24516AF4DBE0051A40B /* network.cpp */,
|
||||
5325C24616AF4DBE0051A40B /* network.h */,
|
||||
5325C24716AF4DBE0051A40B /* particle.cpp */,
|
||||
5325C24816AF4DBE0051A40B /* particle.h */,
|
||||
5325C24916AF4DBE0051A40B /* SerialInterface.cpp */,
|
||||
5325C24A16AF4DBE0051A40B /* SerialInterface.h */,
|
||||
5325C24B16AF4DBE0051A40B /* texture.cpp */,
|
||||
5325C24C16AF4DBE0051A40B /* texture.h */,
|
||||
5325C24D16AF4DBE0051A40B /* util.cpp */,
|
||||
5325C24E16AF4DBE0051A40B /* util.h */,
|
||||
5325C24F16AF4DBE0051A40B /* world.h */,
|
||||
);
|
||||
path = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5325C23716AF4DBE0051A40B /* hardware */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5325C23816AF4DBE0051A40B /* head_hand */,
|
||||
);
|
||||
path = hardware;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5325C23816AF4DBE0051A40B /* head_hand */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5325C23916AF4DBE0051A40B /* head_hand.pde */,
|
||||
);
|
||||
path = head_hand;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
532C7AC116AF298D00B1A969 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -601,66 +661,6 @@
|
|||
path = images;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
532C7ACA16AF298D00B1A969 /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
532C7ACB16AF298D00B1A969 /* agent.cpp */,
|
||||
532C7ACC16AF298D00B1A969 /* agent.h */,
|
||||
532C7ACD16AF298D00B1A969 /* audio.cpp */,
|
||||
532C7ACE16AF298D00B1A969 /* audio.h */,
|
||||
532C7ACF16AF298D00B1A969 /* cloud.cpp */,
|
||||
532C7AD016AF298D00B1A969 /* cloud.h */,
|
||||
532C7AD116AF298D00B1A969 /* cube.cpp */,
|
||||
532C7AD216AF298D00B1A969 /* cube.h */,
|
||||
532C7AD316AF298D00B1A969 /* field.cpp */,
|
||||
532C7AD416AF298D00B1A969 /* field.h */,
|
||||
532C7AD516AF298D00B1A969 /* finger.cpp */,
|
||||
532C7AD616AF298D00B1A969 /* finger.h */,
|
||||
532C7AD716AF298D00B1A969 /* hand.cpp */,
|
||||
532C7AD816AF298D00B1A969 /* hand.h */,
|
||||
532C7AD916AF298D00B1A969 /* hardware */,
|
||||
532C7ADC16AF298D00B1A969 /* head.cpp */,
|
||||
532C7ADD16AF298D00B1A969 /* head.h */,
|
||||
532C7ADE16AF298D00B1A969 /* lattice.cpp */,
|
||||
532C7ADF16AF298D00B1A969 /* lattice.h */,
|
||||
532C7AE016AF298D00B1A969 /* lodepng.cpp */,
|
||||
532C7AE116AF298D00B1A969 /* lodepng.h */,
|
||||
532C7AE216AF298D00B1A969 /* main.cpp */,
|
||||
532C7AE316AF298D00B1A969 /* marker_acquisition_view.cpp */,
|
||||
532C7AE416AF298D00B1A969 /* marker_acquisition_view.h */,
|
||||
532C7AE516AF298D00B1A969 /* markers.cpp */,
|
||||
532C7AE616AF298D00B1A969 /* markers.h */,
|
||||
532C7AE716AF298D00B1A969 /* network.cpp */,
|
||||
532C7AE816AF298D00B1A969 /* network.h */,
|
||||
532C7AE916AF298D00B1A969 /* particle.cpp */,
|
||||
532C7AEA16AF298D00B1A969 /* particle.h */,
|
||||
532C7AEB16AF298D00B1A969 /* SerialInterface.cpp */,
|
||||
532C7AEC16AF298D00B1A969 /* SerialInterface.h */,
|
||||
532C7AED16AF298D00B1A969 /* texture.cpp */,
|
||||
532C7AEE16AF298D00B1A969 /* texture.h */,
|
||||
532C7AEF16AF298D00B1A969 /* util.cpp */,
|
||||
532C7AF016AF298D00B1A969 /* util.h */,
|
||||
532C7AF116AF298D00B1A969 /* world.h */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
532C7AD916AF298D00B1A969 /* hardware */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
532C7ADA16AF298D00B1A969 /* head_hand */,
|
||||
);
|
||||
path = hardware;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
532C7ADA16AF298D00B1A969 /* head_hand */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
532C7ADB16AF298D00B1A969 /* head_hand.pde */,
|
||||
);
|
||||
path = head_hand;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
532C7E9416AF3B1500B1A969 /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1330,24 +1330,24 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
532C7B0616AF298D00B1A969 /* agent.cpp in Sources */,
|
||||
532C7B0716AF298D00B1A969 /* audio.cpp in Sources */,
|
||||
532C7B0816AF298D00B1A969 /* cloud.cpp in Sources */,
|
||||
532C7B0916AF298D00B1A969 /* cube.cpp in Sources */,
|
||||
532C7B0A16AF298D00B1A969 /* field.cpp in Sources */,
|
||||
532C7B0B16AF298D00B1A969 /* finger.cpp in Sources */,
|
||||
532C7B0C16AF298D00B1A969 /* hand.cpp in Sources */,
|
||||
532C7B0D16AF298D00B1A969 /* head.cpp in Sources */,
|
||||
532C7B0E16AF298D00B1A969 /* lattice.cpp in Sources */,
|
||||
532C7B0F16AF298D00B1A969 /* lodepng.cpp in Sources */,
|
||||
532C7B1016AF298D00B1A969 /* main.cpp in Sources */,
|
||||
532C7B1116AF298D00B1A969 /* marker_acquisition_view.cpp in Sources */,
|
||||
532C7B1216AF298D00B1A969 /* markers.cpp in Sources */,
|
||||
532C7B1316AF298D00B1A969 /* network.cpp in Sources */,
|
||||
532C7B1416AF298D00B1A969 /* particle.cpp in Sources */,
|
||||
532C7B1516AF298D00B1A969 /* SerialInterface.cpp in Sources */,
|
||||
532C7B1616AF298D00B1A969 /* texture.cpp in Sources */,
|
||||
532C7B1716AF298D00B1A969 /* util.cpp in Sources */,
|
||||
5325C25016AF4DBE0051A40B /* agent.cpp in Sources */,
|
||||
5325C25116AF4DBE0051A40B /* audio.cpp in Sources */,
|
||||
5325C25216AF4DBE0051A40B /* cloud.cpp in Sources */,
|
||||
5325C25316AF4DBE0051A40B /* cube.cpp in Sources */,
|
||||
5325C25416AF4DBE0051A40B /* field.cpp in Sources */,
|
||||
5325C25516AF4DBE0051A40B /* finger.cpp in Sources */,
|
||||
5325C25616AF4DBE0051A40B /* hand.cpp in Sources */,
|
||||
5325C25716AF4DBE0051A40B /* head.cpp in Sources */,
|
||||
5325C25816AF4DBE0051A40B /* lattice.cpp in Sources */,
|
||||
5325C25916AF4DBE0051A40B /* lodepng.cpp in Sources */,
|
||||
5325C25A16AF4DBE0051A40B /* main.cpp in Sources */,
|
||||
5325C25B16AF4DBE0051A40B /* marker_acquisition_view.cpp in Sources */,
|
||||
5325C25C16AF4DBE0051A40B /* markers.cpp in Sources */,
|
||||
5325C25D16AF4DBE0051A40B /* network.cpp in Sources */,
|
||||
5325C25E16AF4DBE0051A40B /* particle.cpp in Sources */,
|
||||
5325C25F16AF4DBE0051A40B /* SerialInterface.cpp in Sources */,
|
||||
5325C26016AF4DBE0051A40B /* texture.cpp in Sources */,
|
||||
5325C26116AF4DBE0051A40B /* util.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue