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

This commit is contained in:
Leonardo Murillo 2013-03-25 16:24:25 -06:00
commit 957dde317f
10 changed files with 488 additions and 16 deletions

View file

@ -50,6 +50,7 @@ AgentList agentList(DOMAIN_LISTEN_PORT);
unsigned char * addAgentToBroadcastPacket(unsigned char *currentPosition, Agent *agentToAdd) {
*currentPosition++ = agentToAdd->getType();
currentPosition += packAgentId(currentPosition, agentToAdd->getAgentId());
currentPosition += packSocket(currentPosition, agentToAdd->getPublicSocket());
currentPosition += packSocket(currentPosition, agentToAdd->getLocalSocket());
@ -83,7 +84,14 @@ int main(int argc, const char * argv[])
agentType = packetData[0];
unpackSocket(&packetData[1], (sockaddr *)&agentLocalAddress);
agentList.addOrUpdateAgent((sockaddr *)&agentPublicAddress, (sockaddr *)&agentLocalAddress, agentType);
if (agentList.addOrUpdateAgent((sockaddr *)&agentPublicAddress,
(sockaddr *)&agentLocalAddress,
agentType,
agentList.getLastAgentId())) {
agentList.increaseAgentId();
}
currentBufferPos = broadcastPacket + 1;
startPointer = currentBufferPos;

View file

@ -8,6 +8,8 @@
#include <cstring>
#include <cmath>
#include <iostream> // to load voxels from file
#include <fstream> // to load voxels from file
#include <SharedUtil.h>
#include <OctalCode.h>
#include <AgentList.h>
@ -46,6 +48,167 @@ VoxelSystem::~VoxelSystem() {
delete tree;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Method: VoxelSystem::loadVoxelsFile()
// Description: Loads HiFidelity encoded Voxels from a binary file. The current file
// format is a stream of single voxels with NO color data. Currently
// colors are set randomly
// Complaints: Brad :)
// To Do: Need to add color data to the file.
void VoxelSystem::loadVoxelsFile(char* fileName) {
std::ifstream file(fileName, std::ios::in|std::ios::binary);
char octets;
unsigned int lengthInBytes;
int totalBytesRead = 0;
if(file.is_open())
{
while (!file.eof()) {
file.get(octets);
totalBytesRead++;
lengthInBytes = (octets*3/8)+1;
unsigned char * voxelData = new unsigned char[lengthInBytes+1+3];
voxelData[0]=octets;
char byte;
for (size_t i = 0; i < lengthInBytes; i++) {
file.get(byte);
totalBytesRead++;
voxelData[i+1] = byte;
}
// random color data
voxelData[lengthInBytes+1] = randomColorValue(65);
voxelData[lengthInBytes+2] = randomColorValue(65);
voxelData[lengthInBytes+3] = randomColorValue(65);
tree->readCodeColorBufferToTree(voxelData);
delete voxelData;
}
file.close();
}
// reset the verticesEndPointer so we're writing to the beginning of the array
verticesEndPointer = verticesArray;
// call recursive function to populate in memory arrays
// it will return the number of voxels added
voxelsRendered = treeToArrays(tree->rootNode);
// set the boolean if there are any voxels to be rendered so we re-fill the VBOs
voxelsToRender = (voxelsRendered > 0);
}
//////////////////////////////////////////////////////////////////////////////////////////
// Method: VoxelSystem::createSphere()
// Description: Creates a sphere of voxels in the local system at a given location/radius
// To Do: Move this function someplace better? I put it here because we need a
// mechanism to tell the system to redraw it's arrays after voxels are done
// being added. This is a concept mostly only understood by VoxelSystem.
// Complaints: Brad :)
void VoxelSystem::createSphere(float r,float xc, float yc, float zc, float s, bool solid)
{
// About the color of the sphere... we're going to make this sphere be a gradient
// between two RGB colors. We will do the gradient along the phi spectrum
unsigned char r1 = randomColorValue(165);
unsigned char g1 = randomColorValue(165);
unsigned char b1 = randomColorValue(165);
unsigned char r2 = randomColorValue(65);
unsigned char g2 = randomColorValue(65);
unsigned char b2 = randomColorValue(65);
// we don't want them to match!!
if (r1==r2 && g1==g2 && b1==b2)
{
r2=r1/2;
g2=g1/2;
b2=b1/2;
}
/**
std::cout << "creatSphere COLORS ";
std::cout << " r1=" << (int)r1;
std::cout << " g1=" << (int)g1;
std::cout << " b1=" << (int)b1;
std::cout << " r2=" << (int)r2;
std::cout << " g2=" << (int)g2;
std::cout << " b2=" << (int)b2;
std::cout << std::endl;
**/
// Psuedocode for creating a sphere:
//
// for (theta from 0 to 2pi):
// for (phi from 0 to pi):
// x = xc+r*cos(theta)*sin(phi)
// y = yc+r*sin(theta)*sin(phi)
// z = zc+r*cos(phi)
int t=0; // total points
// We want to make sure that as we "sweep" through our angles
// we use a delta angle that's small enough to not skip any voxels
// we can calculate theta from our desired arc length
//
// lenArc = ndeg/360deg * 2pi*R
// lenArc = theta/2pi * 2pi*R
// lenArc = theta*R
// theta = lenArc/R
// theta = g/r
float angleDelta = (s/r);
// assume solid for now
float ri = 0.0;
if (!solid)
{
ri=r; // just the outer surface
}
// If you also iterate form the interior of the sphere to the radius, makeing
// larger and larger sphere's you'd end up with a solid sphere. And lots of voxels!
for (; ri <= r; ri+=s)
{
for (float theta=0.0; theta <= 2*M_PI; theta += angleDelta)
{
for (float phi=0.0; phi <= M_PI; phi += angleDelta)
{
t++; // total voxels
float x = xc+r*cos(theta)*sin(phi);
float y = yc+r*sin(theta)*sin(phi);
float z = zc+r*cos(phi);
/*
std::cout << " r=" << r;
std::cout << " theta=" << theta;
std::cout << " phi=" << phi;
std::cout << " x=" << x;
std::cout << " y=" << y;
std::cout << " z=" << z;
std::cout << " t=" << t;
std::cout << std::endl;
*/
// gradient color data
float gradient = (phi/M_PI);
unsigned char red = r1+((r2-r1)*gradient);
unsigned char green = g1+((g2-g1)*gradient);
unsigned char blue = b1+((b2-b1)*gradient);
unsigned char* voxelData = pointToVoxel(x,y,z,s,red,green,blue);
tree->readCodeColorBufferToTree(voxelData);
delete voxelData;
}
}
}
// reset the verticesEndPointer so we're writing to the beginning of the array
verticesEndPointer = verticesArray;
// call recursive function to populate in memory arrays
// it will return the number of voxels added
voxelsRendered = treeToArrays(tree->rootNode);
// set the boolean if there are any voxels to be rendered so we re-fill the VBOs
voxelsToRender = (voxelsRendered > 0);
}
void VoxelSystem::parseData(void *data, int size) {
// output the bits received from the voxel server
unsigned char *voxelData = (unsigned char *) data + 1;
@ -68,7 +231,7 @@ void VoxelSystem::parseData(void *data, int size) {
int VoxelSystem::treeToArrays(VoxelNode *currentNode) {
int voxelsAdded = 0;
for (int i = 0; i < 8; i++) {
// check if there is a child here
if (currentNode->children[i] != NULL) {
@ -95,7 +258,7 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode) {
delete [] startVertex;
}
return voxelsAdded;
}
@ -191,3 +354,4 @@ void VoxelSystem::simulate(float deltaTime) {
}

View file

@ -33,6 +33,8 @@ public:
void render();
void setVoxelsRendered(int v) {voxelsRendered = v;};
int getVoxelsRendered() {return voxelsRendered;};
void loadVoxelsFile(char* fileName);
void createSphere(float r,float xc, float yc, float zc, float s, bool solid);
private:
int voxelsRendered;
VoxelTree *tree;

View file

@ -53,6 +53,7 @@
#include "Oscilloscope.h"
#include "UDPSocket.h"
#include "SerialInterface.h"
#include <SharedUtil.h>
using namespace std;
@ -228,9 +229,9 @@ void Timer(int extra)
//
// Send a message to the domainserver telling it we are ALIVE
//
//
unsigned char output[7];
output[0] = 'I';
output[0] = 'I';
packSocket(output + 1, localAddress, htons(AGENT_SOCKET_LISTEN_PORT));
agentList.getAgentSocket().send(DOMAIN_IP, DOMAINSERVER_PORT, output, 7);
@ -324,7 +325,6 @@ void initDisplay(void)
void init(void)
{
voxels.init();
myHead.setRenderYaw(start_yaw);
head_mouse_x = WIDTH/2;
@ -692,6 +692,45 @@ void display(void)
framecount++;
}
void testPointToVoxel()
{
float y=0;
float z=0;
float s=0.1;
for (float x=0; x<=1; x+= 0.05)
{
std::cout << " x=" << x << " ";
unsigned char red = 200; //randomColorValue(65);
unsigned char green = 200; //randomColorValue(65);
unsigned char blue = 200; //randomColorValue(65);
unsigned char* voxelCode = pointToVoxel(x, y, z, s,red,green,blue);
printVoxelCode(voxelCode);
delete voxelCode;
std::cout << std::endl;
}
}
void addRandomSphere()
{
float r = randFloatInRange(0.05,0.1);
float xc = randFloatInRange(r,(1-r));
float yc = randFloatInRange(r,(1-r));
float zc = randFloatInRange(r,(1-r));
float s = 0.001; // size of voxels to make up surface of sphere
bool solid = false;
printf("random sphere\n");
printf("radius=%f\n",r);
printf("xc=%f\n",xc);
printf("yc=%f\n",yc);
printf("zc=%f\n",zc);
voxels.createSphere(r,xc,yc,zc,s,solid);
}
const float KEYBOARD_YAW_RATE = 0.8;
const float KEYBOARD_STRAFE_RATE = 0.03;
const float KEYBOARD_FLY_RATE = 0.08;
@ -766,6 +805,13 @@ void key(unsigned char k, int x, int y)
{
myHead.SetNewHeadTarget((randFloat()-0.5)*20.0, (randFloat()-0.5)*20.0);
}
// press the . key to get a new random sphere of voxels added
if (k == '.')
{
addRandomSphere();
//testPointToVoxel();
}
}
//
@ -969,6 +1015,14 @@ int main(int argc, char** argv)
printf( "Initialized Display.\n" );
init();
// Check to see if the user passed in a command line option for loading a local
// Voxel File. If so, load it now.
char* voxelsFilename = getCmdOption(argv, argv + argc, "-i");
if (voxelsFilename)
{
voxels.loadVoxelsFile(voxelsFilename);
}
// create thread for receipt of data via UDP
pthread_create(&networkReceiveThread, NULL, networkReceive, NULL);

View file

@ -19,7 +19,7 @@
Agent::Agent() {}
Agent::Agent(sockaddr *agentPublicSocket, sockaddr *agentLocalSocket, char agentType) {
Agent::Agent(sockaddr *agentPublicSocket, sockaddr *agentLocalSocket, char agentType, uint16_t thisAgentId) {
publicSocket = new sockaddr;
memcpy(publicSocket, agentPublicSocket, sizeof(sockaddr));
@ -27,6 +27,7 @@ Agent::Agent(sockaddr *agentPublicSocket, sockaddr *agentLocalSocket, char agent
memcpy(localSocket, agentLocalSocket, sizeof(sockaddr));
type = agentType;
agentId = thisAgentId;
firstRecvTimeUsecs = usecTimestampNow();
lastRecvTimeUsecs = usecTimestampNow();
@ -42,6 +43,8 @@ Agent::Agent(const Agent &otherAgent) {
localSocket = new sockaddr;
memcpy(localSocket, otherAgent.localSocket, sizeof(sockaddr));
agentId = otherAgent.agentId;
if (otherAgent.activeSocket == otherAgent.publicSocket) {
activeSocket = publicSocket;
} else if (otherAgent.activeSocket == otherAgent.localSocket) {
@ -80,6 +83,14 @@ void Agent::setType(char newType) {
type = newType;
}
uint16_t Agent::getAgentId() {
return agentId;
}
void Agent::setAgentId(uint16_t thisAgentId) {
agentId = thisAgentId;
}
double Agent::getFirstRecvTimeUsecs() {
return firstRecvTimeUsecs;
}
@ -144,6 +155,7 @@ void Agent::swap(Agent &first, Agent &second) {
swap(first.activeSocket, second.activeSocket);
swap(first.type, second.type);
swap(first.linkedData, second.linkedData);
swap(first.agentId, second.agentId);
}
bool Agent::matches(sockaddr *otherPublicSocket, sockaddr *otherLocalSocket, char otherAgentType) {

View file

@ -21,7 +21,7 @@
class Agent {
public:
Agent();
Agent(sockaddr *agentPublicSocket, sockaddr *agentLocalSocket, char agentType);
Agent(sockaddr *agentPublicSocket, sockaddr *agentLocalSocket, char agentType, uint16_t thisAgentId);
Agent(const Agent &otherAgent);
~Agent();
Agent& operator=(Agent otherAgent);
@ -30,6 +30,8 @@ class Agent {
bool matches(sockaddr *otherPublicSocket, sockaddr *otherLocalSocket, char otherAgentType);
char getType();
void setType(char newType);
uint16_t getAgentId();
void setAgentId(uint16_t thisAgentId);
double getFirstRecvTimeUsecs();
void setFirstRecvTimeUsecs(double newTimeUsecs);
double getLastRecvTimeUsecs();
@ -49,6 +51,7 @@ class Agent {
void swap(Agent &first, Agent &second);
sockaddr *publicSocket, *localSocket, *activeSocket;
char type;
uint16_t agentId;
double firstRecvTimeUsecs;
double lastRecvTimeUsecs;
AgentData *linkedData;

View file

@ -24,11 +24,14 @@ pthread_mutex_t vectorChangeMutex = PTHREAD_MUTEX_INITIALIZER;
AgentList::AgentList() : agentSocket(AGENT_SOCKET_LISTEN_PORT) {
linkedDataCreateCallback = NULL;
audioMixerSocketUpdate = NULL;
lastAgentId = 0;
}
AgentList::AgentList(int socketListenPort) : agentSocket(socketListenPort) {
linkedDataCreateCallback = NULL;
audioMixerSocketUpdate = NULL;
lastAgentId = 0;
}
AgentList::~AgentList() {
@ -105,10 +108,19 @@ int AgentList::indexOfMatchingAgent(sockaddr *senderAddress) {
return -1;
}
uint16_t AgentList::getLastAgentId() {
return lastAgentId;
}
void AgentList::increaseAgentId() {
++lastAgentId;
}
int AgentList::updateList(unsigned char *packetData, size_t dataBytes) {
int readAgents = 0;
char agentType;
uint16_t agentId;
// assumes only IPv4 addresses
sockaddr_in agentPublicSocket;
@ -121,19 +133,20 @@ int AgentList::updateList(unsigned char *packetData, size_t dataBytes) {
while((readPtr - startPtr) < dataBytes) {
agentType = *readPtr++;
readPtr += unpackAgentId(readPtr, (uint16_t *)&agentId);
readPtr += unpackSocket(readPtr, (sockaddr *)&agentPublicSocket);
readPtr += unpackSocket(readPtr, (sockaddr *)&agentLocalSocket);
addOrUpdateAgent((sockaddr *)&agentPublicSocket, (sockaddr *)&agentLocalSocket, agentType);
addOrUpdateAgent((sockaddr *)&agentPublicSocket, (sockaddr *)&agentLocalSocket, agentType, agentId);
}
return readAgents;
}
bool AgentList::addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket, char agentType) {
bool AgentList::addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket, char agentType, uint16_t agentId) {
std::vector<Agent>::iterator agent;
for(agent = agents.begin(); agent != agents.end(); agent++) {
for (agent = agents.begin(); agent != agents.end(); agent++) {
if (agent->matches(publicSocket, localSocket, agentType)) {
// we already have this agent, stop checking
break;
@ -142,7 +155,8 @@ bool AgentList::addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket,
if (agent == agents.end()) {
// we didn't have this agent, so add them
Agent newAgent = Agent(publicSocket, localSocket, agentType);
Agent newAgent = Agent(publicSocket, localSocket, agentType, agentId);
if (socketMatch(publicSocket, localSocket)) {
// likely debugging scenario with DS + agent on local network
@ -261,4 +275,14 @@ void AgentList::startSilentAgentRemovalThread() {
void AgentList::stopSilentAgentRemovalThread() {
stopAgentRemovalThread = true;
pthread_join(removeSilentAgentsThread, NULL);
}
int unpackAgentId(unsigned char *packedData, uint16_t *agentId) {
memcpy(packedData, agentId, sizeof(uint16_t));
return sizeof(uint16_t);
}
int packAgentId(unsigned char *packStore, uint16_t agentId) {
memcpy(&agentId, packStore, sizeof(uint16_t));
return sizeof(uint16_t);
}

View file

@ -34,10 +34,12 @@ class AgentList {
std::vector<Agent>& getAgents();
UDPSocket& getAgentSocket();
int updateList(unsigned char *packetData, size_t dataBytes);
int indexOfMatchingAgent(sockaddr *senderAddress);
bool addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket, char agentType);
uint16_t getLastAgentId();
void increaseAgentId();
bool addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket, char agentType, uint16_t agentId);
void processAgentData(sockaddr *senderAddress, void *packetData, size_t dataBytes);
void updateAgentWithData(sockaddr *senderAddress, void *packetData, size_t dataBytes);
void broadcastToAgents(char *broadcastData, size_t dataBytes);
@ -49,8 +51,11 @@ class AgentList {
UDPSocket agentSocket;
std::vector<Agent> agents;
pthread_t removeSilentAgentsThread;
uint16_t lastAgentId;
void handlePingReply(sockaddr *agentAddress);
};
int unpackAgentId(unsigned char *packedData, uint16_t *agentId);
int packAgentId(unsigned char *packStore, uint16_t agentId);
#endif /* defined(__hifi__AgentList__) */

View file

@ -28,6 +28,10 @@ float randFloat () {
return (rand() % 10000)/10000.f;
}
float randFloatInRange (float min,float max) {
return min + ((rand() % 10000)/10000.f * (max-min));
}
unsigned char randomColorValue(int miniumum) {
return miniumum + (rand() % (255 - miniumum));
}
@ -73,4 +77,193 @@ void switchToResourcesIfRequired() {
chdir(path);
#endif
}
}
//////////////////////////////////////////////////////////////////////////////////////////
// Function: getCmdOption()
// Description: Handy little function to tell you if a command line flag and option was
// included while launching the application, and to get the option value
// immediately following the flag. For example if you ran:
// ./app -i filename.txt
// then you're using the "-i" flag to set the input file name.
// Usage: char * inputFilename = getCmdOption(argv, argv + argc, "-i");
// Complaints: Brad :)
char* getCmdOption(char ** begin, char ** end, const std::string & option)
{
char ** itr = std::find(begin, end, option);
if (itr != end && ++itr != end)
{
return *itr;
}
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Function: getCmdOption()
// Description: Handy little function to tell you if a command line option flag was
// included while launching the application. Returns bool true/false
// Usage: bool wantDump = cmdOptionExists(argv, argv+argc, "-d");
// Complaints: Brad :)
bool cmdOptionExists(char** begin, char** end, const std::string& option)
{
return std::find(begin, end, option) != end;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Function: pointToVoxel()
// Description: Given a universal point with location x,y,z this will return the voxel
// voxel code corresponding to the closest voxel which encloses a cube with
// lower corners at x,y,z, having side of length S.
// The input values x,y,z range 0.0 <= v < 1.0
// TO DO: This code is not very DRY. It should be cleaned up to be DRYer.
// IMPORTANT: The voxel is returned to you a buffer which you MUST delete when you are
// done with it.
// Usage:
// unsigned char* voxelData = pointToVoxel(x,y,z,s,red,green,blue);
// tree->readCodeColorBufferToTree(voxelData);
// delete voxelData;
//
// Complaints: Brad :)
unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r, unsigned char g, unsigned char b ) {
float xTest, yTest, zTest, sTest;
xTest = yTest = zTest = sTest = 0.5;
// First determine the voxelSize that will properly encode a
// voxel of size S.
int voxelSizeInBits = 0;
while (sTest > s) {
sTest /= 2.0;
voxelSizeInBits+=3;
}
unsigned int voxelSizeInBytes = (voxelSizeInBits/8)+1;
unsigned int voxelSizeInOctets = (voxelSizeInBits/3);
unsigned int voxelBufferSize = voxelSizeInBytes+1+3; // 1 for size, 3 for color
// allocate our resulting buffer
unsigned char* voxelOut = new unsigned char[voxelBufferSize];
// first byte of buffer is always our size in octets
voxelOut[0]=voxelSizeInOctets;
sTest = 0.5; // reset sTest so we can do this again.
unsigned char byte = 0; // we will be adding coding bits here
int bitInByteNDX = 0; // keep track of where we are in byte as we go
int byteNDX = 1; // keep track of where we are in buffer of bytes as we go
int octetsDone = 0;
// Now we actually fill out the voxel code
while (octetsDone < voxelSizeInOctets) {
if (x > xTest) {
//<write 1 bit>
byte = (byte << 1) | true;
xTest += sTest/2.0;
}
else {
//<write 0 bit;>
byte = (byte << 1) | false;
xTest -= sTest/2.0;
}
bitInByteNDX++;
// If we've reached the last bit of the byte, then we want to copy this byte
// into our buffer. And get ready to start on a new byte
if (bitInByteNDX > 7)
{
voxelOut[byteNDX]=byte;
byteNDX++;
bitInByteNDX=0;
byte=0;
}
if (y > yTest) {
//<write 1 bit>
byte = (byte << 1) | true;
yTest += sTest/2.0;
}
else {
//<write 0 bit;>
byte = (byte << 1) | false;
yTest -= sTest/2.0;
}
bitInByteNDX++;
// If we've reached the last bit of the byte, then we want to copy this byte
// into our buffer. And get ready to start on a new byte
if (bitInByteNDX > 7)
{
voxelOut[byteNDX]=byte;
byteNDX++;
bitInByteNDX=0;
byte=0;
}
if (z > zTest) {
//<write 1 bit>
byte = (byte << 1) | true;
zTest += sTest/2.0;
}
else {
//<write 0 bit;>
byte = (byte << 1) | false;
zTest -= sTest/2.0;
}
bitInByteNDX++;
// If we've reached the last bit of the byte, then we want to copy this byte
// into our buffer. And get ready to start on a new byte
if (bitInByteNDX > 7)
{
voxelOut[byteNDX]=byte;
byteNDX++;
bitInByteNDX=0;
byte=0;
}
octetsDone++;
sTest /= 2.0;
}
// If we've got here, and we didn't fill the last byte, we need to zero pad this
// byte before we copy it into our buffer.
if (bitInByteNDX > 0 && bitInByteNDX < 7)
{
// Pad the last byte
while (bitInByteNDX <= 7)
{
byte = (byte << 1) | false;
bitInByteNDX++;
}
// Copy it into our output buffer
voxelOut[byteNDX]=byte;
byteNDX++;
}
// copy color data
voxelOut[byteNDX]=r;
voxelOut[byteNDX+1]=g;
voxelOut[byteNDX+2]=b;
return voxelOut;
}
void printVoxelCode(unsigned char* voxelCode)
{
unsigned char octets = voxelCode[0];
unsigned int voxelSizeInBits = octets*3;
unsigned int voxelSizeInBytes = (voxelSizeInBits/8)+1;
unsigned int voxelSizeInOctets = (voxelSizeInBits/3);
unsigned int voxelBufferSize = voxelSizeInBytes+1+3; // 1 for size, 3 for color
printf("octets=%d\n",octets);
printf("voxelSizeInBits=%d\n",voxelSizeInBits);
printf("voxelSizeInBytes=%d\n",voxelSizeInBytes);
printf("voxelSizeInOctets=%d\n",voxelSizeInOctets);
printf("voxelBufferSize=%d\n",voxelBufferSize);
for(int i=0;i<voxelBufferSize;i++)
{
printf("i=%d ",i);
outputBits(voxelCode[i]);
}
}

View file

@ -22,13 +22,20 @@ double usecTimestamp(timeval *time);
double usecTimestampNow();
float randFloat();
float randFloatInRange (float min,float max);
unsigned char randomColorValue(int minimum);
bool randomBoolean();
void outputBits(unsigned char byte);
void printVoxelCode(unsigned char* voxelCode);
int numberOfOnes(unsigned char byte);
bool oneAtBit(unsigned char byte, int bitIndex);
void switchToResourcesIfRequired();
char* getCmdOption(char ** begin, char ** end, const std::string& option);
bool cmdOptionExists(char** begin, char** end, const std::string& option);
unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r, unsigned char g, unsigned char b );
#endif /* defined(__hifi__SharedUtil__) */