Merge pull request #267 from PhilipRosedale/master

Stars meridians removed and count reduced, some log cleanup
This commit is contained in:
ZappoMan 2013-05-09 22:25:56 -07:00
commit f0b4dde388
6 changed files with 27 additions and 20 deletions

View file

@ -14,9 +14,9 @@ from random import random,randint
from math import sqrt, hypot, atan2, pi, fmod, degrees from math import sqrt, hypot, atan2, pi, fmod, degrees
from sys import argv,stderr from sys import argv,stderr
hemisphere_only, equator, meridians= False, 0, 1000 hemisphere_only, equator, meridians=False, 0, 1000
n_random = 100000 n_random = 50000
if len(argv) > 1: if len(argv) > 1:
n_random = int(argv[1]) n_random = int(argv[1])
@ -35,9 +35,9 @@ def meridian(azimuth,n,(r0,g0,b0),(r1,g1,b1)):
print "%f %f #%02x%02x%02x" % (azimuth,altitude,r,g,b) print "%f %f #%02x%02x%02x" % (azimuth,altitude,r,g,b)
print "%f %f #%02x%02x%02x" % (azimuth,-altitude,r,g,b) print "%f %f #%02x%02x%02x" % (azimuth,-altitude,r,g,b)
if meridians: #if meridians:
meridian( 0,meridians,(255,255,255), (180, 60,255)) # N->S #meridian( 0,meridians,(255,255,255), (180, 60,255)) # N->S
meridian(90,meridians,( 80,255, 80), (255,240, 40)) # E->W #meridian(90,meridians,( 80,255, 80), (255,240, 40)) # E->W
if equator: if equator:
azis = 360.0/equator azis = 360.0/equator

View file

@ -1945,6 +1945,10 @@ void audioMixerUpdate(in_addr_t newMixerAddress, in_port_t newMixerPort) {
#endif #endif
int main(int argc, const char * argv[]) { int main(int argc, const char * argv[]) {
gettimeofday(&applicationStartupTime, NULL);
printLog("Interface Startup:\n");
voxels.setViewFrustum(&::viewFrustum); voxels.setViewFrustum(&::viewFrustum);
shared_lib::printLog = & ::printLog; shared_lib::printLog = & ::printLog;
@ -1962,7 +1966,6 @@ int main(int argc, const char * argv[]) {
AgentList::getInstance()->getAgentSocket().setBlocking(false); AgentList::getInstance()->getAgentSocket().setBlocking(false);
} }
gettimeofday(&applicationStartupTime, NULL);
const char* domainIP = getCmdOption(argc, argv, "--domain"); const char* domainIP = getCmdOption(argc, argv, "--domain");
if (domainIP) { if (domainIP) {
strcpy(DOMAIN_IP,domainIP); strcpy(DOMAIN_IP,domainIP);
@ -1999,13 +2002,17 @@ int main(int argc, const char * argv[]) {
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(WIDTH, HEIGHT); glutInitWindowSize(WIDTH, HEIGHT);
glutCreateWindow("Interface"); glutCreateWindow("Interface");
printLog( "Created Display Window.\n" );
#ifdef _WIN32 #ifdef _WIN32
glewInit(); glewInit();
printLog( "Glew Init complete.\n" );
#endif #endif
// we need to create a QApplication instance in order to use Qt's font rendering // we need to create a QApplication instance in order to use Qt's font rendering
app = new QApplication(argc, const_cast<char**>(argv)); app = new QApplication(argc, const_cast<char**>(argv));
printLog( "Created QT Application.\n" );
// Before we render anything, let's set up our viewFrustumOffsetCamera with a sufficiently large // Before we render anything, let's set up our viewFrustumOffsetCamera with a sufficiently large
// field of view and near and far clip to make it interesting. // field of view and near and far clip to make it interesting.
@ -2013,11 +2020,9 @@ int main(int argc, const char * argv[]) {
viewFrustumOffsetCamera.setNearClip(0.1); viewFrustumOffsetCamera.setNearClip(0.1);
viewFrustumOffsetCamera.setFarClip(500.0*TREE_SCALE); viewFrustumOffsetCamera.setFarClip(500.0*TREE_SCALE);
printLog( "Created Display Window.\n" );
initMenu(); initMenu();
initDisplay(); initDisplay();
printLog( "Initialized Display.\n" );
glutDisplayFunc(display); glutDisplayFunc(display);
glutReshapeFunc(reshape); glutReshapeFunc(reshape);
@ -2029,6 +2034,8 @@ int main(int argc, const char * argv[]) {
glutPassiveMotionFunc(mouseoverFunc); glutPassiveMotionFunc(mouseoverFunc);
glutMouseFunc(mouseFunc); glutMouseFunc(mouseFunc);
glutIdleFunc(idle); glutIdleFunc(idle);
printLog( "Initialized Display.\n" );
init(); init();
printLog( "Init() complete.\n" ); printLog( "Init() complete.\n" );

View file

@ -50,7 +50,7 @@ namespace starfield {
return false; return false;
} }
printLog("Stars.cpp: read %u vertices, using %lu\n", _valRecordsRead, _ptrVertices->size()); printLog("Loaded %u stars.\n", _valRecordsRead);
return true; return true;
} }

View file

@ -254,15 +254,13 @@ void Agent::printLog(Agent const& agent) {
char publicAddressBuffer[16] = {'\0'}; char publicAddressBuffer[16] = {'\0'};
unsigned short publicAddressPort = loadBufferWithSocketInfo(publicAddressBuffer, agent.publicSocket); unsigned short publicAddressPort = loadBufferWithSocketInfo(publicAddressBuffer, agent.publicSocket);
char localAddressBuffer[16] = {'\0'}; //char localAddressBuffer[16] = {'\0'};
unsigned short localAddressPort = loadBufferWithSocketInfo(localAddressBuffer, agent.localSocket); //unsigned short localAddressPort = loadBufferWithSocketInfo(localAddressBuffer, agent.localSocket);
::printLog("ID: %d T: %s (%c) PA: %s:%d LA: %s:%d\n", ::printLog("# %d %s (%c) @ %s:%d\n",
agent.agentId, agent.agentId,
agent.getTypeName(), agent.getTypeName(),
agent.type, agent.type,
publicAddressBuffer, publicAddressBuffer,
publicAddressPort, publicAddressPort);
localAddressBuffer,
localAddressPort);
} }

View file

@ -284,7 +284,7 @@ void AgentList::addAgentToList(Agent* newAgent) {
++_numAgents; ++_numAgents;
printLog("Added agent - "); printLog("Added ");
Agent::printLog(*newAgent); Agent::printLog(*newAgent);
} }
@ -377,7 +377,7 @@ void *removeSilentAgents(void *args) {
if ((checkTimeUSecs - agent->getLastHeardMicrostamp()) > AGENT_SILENCE_THRESHOLD_USECS if ((checkTimeUSecs - agent->getLastHeardMicrostamp()) > AGENT_SILENCE_THRESHOLD_USECS
&& agent->getType() != AGENT_TYPE_VOXEL) { && agent->getType() != AGENT_TYPE_VOXEL) {
printLog("Killing agent - "); printLog("Killed ");
Agent::printLog(*agent); Agent::printLog(*agent);
agent->setAlive(false); agent->setAlive(false);
@ -416,12 +416,12 @@ void *checkInWithDomainServer(void *args) {
sockaddr_in tempAddress; sockaddr_in tempAddress;
memcpy(&tempAddress.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length); memcpy(&tempAddress.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length);
strcpy(DOMAIN_IP, inet_ntoa(tempAddress.sin_addr)); strcpy(DOMAIN_IP, inet_ntoa(tempAddress.sin_addr));
printLog("Domain server: %s - %s\n", DOMAIN_HOSTNAME, DOMAIN_IP); printLog("Domain Server: %s \n", DOMAIN_HOSTNAME);
} else { } else {
printLog("Failed lookup domainserver\n"); printLog("Failed lookup domainserver\n");
} }
} else printLog("Using static domainserver IP: %s\n", DOMAIN_IP); } else printLog("Domain Server IP: %s\n", DOMAIN_IP);
AgentList* parentAgentList = (AgentList*) args; AgentList* parentAgentList = (AgentList*) args;

View file

@ -96,6 +96,7 @@ void UrlReader::getinfo(char const*& url,
if (time > s.st_mtime) { if (time > s.st_mtime) {
// file on server is newer -> update cache file // file on server is newer -> update cache file
_ptrCacheFile = fopen(_strCacheFile, "wb"); _ptrCacheFile = fopen(_strCacheFile, "wb");
printf("From URL: ");
if (_ptrCacheFile != 0l) { if (_ptrCacheFile != 0l) {
_valCacheMode = cache_write; _valCacheMode = cache_write;
} }
@ -108,6 +109,7 @@ void UrlReader::getinfo(char const*& url,
} }
} }
_ptrCacheFile = fopen(_strCacheFile, "rb"); _ptrCacheFile = fopen(_strCacheFile, "rb");
printf("From file: ");
if (_ptrCacheFile != 0l) { if (_ptrCacheFile != 0l) {
_valCacheMode = cache_read; _valCacheMode = cache_read;
} }