mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 00:59:56 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
8e27a69e92
17 changed files with 137 additions and 86 deletions
|
@ -135,7 +135,11 @@ int main(int argc, const char * argv[])
|
|||
!agent->matches((sockaddr *)&agentPublicAddress, (sockaddr *)&agentLocalAddress, agentType)) {
|
||||
if (memchr(SOLO_AGENT_TYPES_STRING, agent->getType(), 1) == NULL) {
|
||||
// this is an agent of which there can be multiple, just add them to the packet
|
||||
currentBufferPos = addAgentToBroadcastPacket(currentBufferPos, &(*agent));
|
||||
// don't send avatar agents to other avatars, that will come from avatar mixer
|
||||
if (agentType != AGENT_TYPE_AVATAR || agent->getType() != AGENT_TYPE_AVATAR) {
|
||||
currentBufferPos = addAgentToBroadcastPacket(currentBufferPos, &(*agent));
|
||||
}
|
||||
|
||||
} else {
|
||||
// solo agent, we need to only send newest
|
||||
if (newestSoloAgents[agent->getType()] == NULL ||
|
||||
|
|
|
@ -114,7 +114,7 @@ float VoxelSystem::getVoxelsBytesReadPerSecondAverage() {
|
|||
}
|
||||
|
||||
|
||||
void VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
|
||||
unsigned char command = *sourceBuffer;
|
||||
unsigned char *voxelData = sourceBuffer + 1;
|
||||
|
@ -154,6 +154,7 @@ void VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
}
|
||||
|
||||
setupNewVoxelsForDrawing();
|
||||
return numBytes;
|
||||
}
|
||||
|
||||
void VoxelSystem::setupNewVoxelsForDrawing() {
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
VoxelSystem();
|
||||
~VoxelSystem();
|
||||
|
||||
void parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
int parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
VoxelSystem* clone() const;
|
||||
|
||||
void init();
|
||||
|
|
|
@ -1456,8 +1456,7 @@ void *networkReceive(void *args)
|
|||
case PACKET_HEADER_BULK_AVATAR_DATA:
|
||||
AgentList::getInstance()->processBulkAgentData(&senderAddress,
|
||||
incomingPacket,
|
||||
bytesReceived,
|
||||
BYTES_PER_AVATAR);
|
||||
bytesReceived);
|
||||
break;
|
||||
default:
|
||||
AgentList::getInstance()->processAgentData(&senderAddress, incomingPacket, bytesReceived);
|
||||
|
|
|
@ -95,10 +95,13 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
}
|
||||
|
||||
// called on the other agents - assigns it to my views of the others
|
||||
void AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
|
||||
// increment to push past the packet header
|
||||
sourceBuffer++;
|
||||
|
||||
unsigned char* startPosition = sourceBuffer;
|
||||
|
||||
memcpy(&_bodyPosition, sourceBuffer, sizeof(float) * 3);
|
||||
sourceBuffer += sizeof(float) * 3;
|
||||
|
||||
|
@ -126,6 +129,8 @@ void AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
sourceBuffer += sizeof(_cameraNearClip);
|
||||
memcpy(&_cameraFarClip, sourceBuffer, sizeof(_cameraFarClip));
|
||||
sourceBuffer += sizeof(_cameraFarClip);
|
||||
|
||||
return sourceBuffer - startPosition;
|
||||
}
|
||||
|
||||
glm::vec3 AvatarData::getBodyPosition() {
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
|
||||
#include <AgentData.h>
|
||||
|
||||
const int BYTES_PER_AVATAR = 94;
|
||||
|
||||
class AvatarData : public AgentData {
|
||||
public:
|
||||
AvatarData();
|
||||
|
@ -27,7 +25,7 @@ public:
|
|||
void setHandPosition(glm::vec3 handPosition);
|
||||
|
||||
int getBroadcastData(unsigned char* destinationBuffer);
|
||||
void parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
int parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
|
||||
float getBodyYaw();
|
||||
void setBodyYaw(float bodyYaw);
|
||||
|
|
|
@ -23,11 +23,19 @@
|
|||
using shared_lib::printLog;
|
||||
|
||||
Agent::Agent(sockaddr *agentPublicSocket, sockaddr *agentLocalSocket, char agentType, uint16_t thisAgentId) {
|
||||
publicSocket = new sockaddr;
|
||||
memcpy(publicSocket, agentPublicSocket, sizeof(sockaddr));
|
||||
if (agentPublicSocket != NULL) {
|
||||
publicSocket = new sockaddr;
|
||||
memcpy(publicSocket, agentPublicSocket, sizeof(sockaddr));
|
||||
} else {
|
||||
publicSocket = NULL;
|
||||
}
|
||||
|
||||
localSocket = new sockaddr;
|
||||
memcpy(localSocket, agentLocalSocket, sizeof(sockaddr));
|
||||
if (agentLocalSocket != NULL) {
|
||||
localSocket = new sockaddr;
|
||||
memcpy(localSocket, agentLocalSocket, sizeof(sockaddr));
|
||||
} else {
|
||||
localSocket = NULL;
|
||||
}
|
||||
|
||||
type = agentType;
|
||||
agentId = thisAgentId;
|
||||
|
@ -44,11 +52,19 @@ Agent::Agent(sockaddr *agentPublicSocket, sockaddr *agentLocalSocket, char agent
|
|||
}
|
||||
|
||||
Agent::Agent(const Agent &otherAgent) {
|
||||
publicSocket = new sockaddr;
|
||||
memcpy(publicSocket, otherAgent.publicSocket, sizeof(sockaddr));
|
||||
if (otherAgent.publicSocket != NULL) {
|
||||
publicSocket = new sockaddr;
|
||||
memcpy(publicSocket, otherAgent.publicSocket, sizeof(sockaddr));
|
||||
} else {
|
||||
publicSocket = NULL;
|
||||
}
|
||||
|
||||
localSocket = new sockaddr;
|
||||
memcpy(localSocket, otherAgent.localSocket, sizeof(sockaddr));
|
||||
if (otherAgent.localSocket != NULL) {
|
||||
localSocket = new sockaddr;
|
||||
memcpy(localSocket, otherAgent.localSocket, sizeof(sockaddr));
|
||||
} else {
|
||||
localSocket = NULL;
|
||||
}
|
||||
|
||||
agentId = otherAgent.agentId;
|
||||
|
||||
|
@ -248,23 +264,27 @@ void Agent::printLog(Agent const& agent) {
|
|||
|
||||
sockaddr_in *agentPublicSocket = (sockaddr_in *) agent.publicSocket;
|
||||
sockaddr_in *agentLocalSocket = (sockaddr_in *) agent.localSocket;
|
||||
|
||||
const char* publicAddressString = (agentPublicSocket == NULL)
|
||||
? "Unknown"
|
||||
: inet_ntoa(agentPublicSocket->sin_addr);
|
||||
unsigned short publicAddressPort = (agentPublicSocket == NULL)
|
||||
? 0
|
||||
: ntohs(agentPublicSocket->sin_port);
|
||||
|
||||
const char* localAddressString = (agentLocalSocket == NULL)
|
||||
? "Unknown"
|
||||
: inet_ntoa(agentLocalSocket->sin_addr);
|
||||
unsigned short localAddressPort = (agentLocalSocket == NULL)
|
||||
? 0
|
||||
: ntohs(agentPublicSocket->sin_port);
|
||||
|
||||
::printLog("ID: %d T: %s (%c) PA: %s:%d LA: %s:%d\n",
|
||||
agent.agentId,
|
||||
agent.getTypeName(),
|
||||
agent.type,
|
||||
inet_ntoa(agentPublicSocket->sin_addr),
|
||||
ntohs(agentPublicSocket->sin_port),
|
||||
inet_ntoa(agentLocalSocket->sin_addr),
|
||||
ntohs(agentLocalSocket->sin_port));
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Agent* agent) {
|
||||
sockaddr_in *agentPublicSocket = (sockaddr_in *)agent->publicSocket;
|
||||
sockaddr_in *agentLocalSocket = (sockaddr_in *)agent->localSocket;
|
||||
|
||||
os << "T: " << agent->getTypeName() << " (" << agent->type << ") PA: " << inet_ntoa(agentPublicSocket->sin_addr) <<
|
||||
":" << ntohs(agentPublicSocket->sin_port) << " LA: " << inet_ntoa(agentLocalSocket->sin_addr) <<
|
||||
":" << ntohs(agentLocalSocket->sin_port);
|
||||
return os;
|
||||
publicAddressString,
|
||||
publicAddressPort,
|
||||
localAddressString,
|
||||
localAddressPort);
|
||||
}
|
|
@ -63,7 +63,6 @@ public:
|
|||
float getAveragePacketsPerSecond();
|
||||
|
||||
static void printLog(Agent const&);
|
||||
friend std::ostream& operator<<(std::ostream& os, const Agent* agent);
|
||||
private:
|
||||
void swap(Agent &first, Agent &second);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class AgentData {
|
||||
public:
|
||||
virtual ~AgentData() = 0;
|
||||
virtual void parseData(unsigned char* sourceBuffer, int numBytes) = 0;
|
||||
virtual int parseData(unsigned char* sourceBuffer, int numBytes) = 0;
|
||||
virtual AgentData* clone() const = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ void AgentList::processAgentData(sockaddr *senderAddress, unsigned char *packetD
|
|||
}
|
||||
}
|
||||
|
||||
void AgentList::processBulkAgentData(sockaddr *senderAddress, unsigned char *packetData, int numTotalBytes, int numBytesPerAgent) {
|
||||
void AgentList::processBulkAgentData(sockaddr *senderAddress, unsigned char *packetData, int numTotalBytes) {
|
||||
// find the avatar mixer in our agent list and update the lastRecvTime from it
|
||||
int bulkSendAgentIndex = indexOfMatchingAgent(senderAddress);
|
||||
|
||||
|
@ -118,7 +118,7 @@ void AgentList::processBulkAgentData(sockaddr *senderAddress, unsigned char *pac
|
|||
|
||||
unsigned char *startPosition = packetData;
|
||||
unsigned char *currentPosition = startPosition + 1;
|
||||
unsigned char packetHolder[numBytesPerAgent + 1];
|
||||
unsigned char packetHolder[numTotalBytes];
|
||||
|
||||
packetHolder[0] = PACKET_HEADER_HEAD_DATA;
|
||||
|
||||
|
@ -126,39 +126,49 @@ void AgentList::processBulkAgentData(sockaddr *senderAddress, unsigned char *pac
|
|||
|
||||
while ((currentPosition - startPosition) < numTotalBytes) {
|
||||
currentPosition += unpackAgentId(currentPosition, &agentID);
|
||||
memcpy(packetHolder + 1, currentPosition, numBytesPerAgent);
|
||||
memcpy(packetHolder + 1, currentPosition, numTotalBytes - (currentPosition - startPosition));
|
||||
|
||||
int matchingAgentIndex = indexOfMatchingAgent(agentID);
|
||||
|
||||
if (matchingAgentIndex >= 0) {
|
||||
if (matchingAgentIndex < 0) {
|
||||
// we're missing this agent, we need to add it to the list
|
||||
addOrUpdateAgent(NULL, NULL, AGENT_TYPE_AVATAR, agentID);
|
||||
|
||||
updateAgentWithData(&agents[matchingAgentIndex], packetHolder, numBytesPerAgent + 1);
|
||||
// theoretically if we can lock the vector we could assume this is size - 1
|
||||
matchingAgentIndex = indexOfMatchingAgent(agentID);
|
||||
}
|
||||
|
||||
currentPosition += numBytesPerAgent;
|
||||
currentPosition += updateAgentWithData(&agents[matchingAgentIndex],
|
||||
packetHolder,
|
||||
numTotalBytes - (currentPosition - startPosition));
|
||||
}
|
||||
}
|
||||
|
||||
void AgentList::updateAgentWithData(sockaddr *senderAddress, unsigned char *packetData, size_t dataBytes) {
|
||||
int AgentList::updateAgentWithData(sockaddr *senderAddress, unsigned char *packetData, size_t dataBytes) {
|
||||
// find the agent by the sockaddr
|
||||
int agentIndex = indexOfMatchingAgent(senderAddress);
|
||||
|
||||
if (agentIndex != -1) {
|
||||
updateAgentWithData(&agents[agentIndex], packetData, dataBytes);
|
||||
return updateAgentWithData(&agents[agentIndex], packetData, dataBytes);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AgentList::updateAgentWithData(Agent *agent, unsigned char *packetData, int dataBytes) {
|
||||
int AgentList::updateAgentWithData(Agent *agent, unsigned char *packetData, int dataBytes) {
|
||||
agent->setLastRecvTimeUsecs(usecTimestampNow());
|
||||
agent->recordBytesReceived(dataBytes);
|
||||
|
||||
if (agent->getActiveSocket() != NULL) {
|
||||
agent->recordBytesReceived(dataBytes);
|
||||
}
|
||||
|
||||
if (agent->getLinkedData() == NULL) {
|
||||
if (linkedDataCreateCallback != NULL) {
|
||||
linkedDataCreateCallback(agent);
|
||||
}
|
||||
}
|
||||
|
||||
agent->getLinkedData()->parseData(packetData, dataBytes);
|
||||
|
||||
return agent->getLinkedData()->parseData(packetData, dataBytes);
|
||||
}
|
||||
|
||||
int AgentList::indexOfMatchingAgent(sockaddr *senderAddress) {
|
||||
|
@ -173,7 +183,7 @@ int AgentList::indexOfMatchingAgent(sockaddr *senderAddress) {
|
|||
|
||||
int AgentList::indexOfMatchingAgent(uint16_t agentID) {
|
||||
for(std::vector<Agent>::iterator agent = agents.begin(); agent != agents.end(); agent++) {
|
||||
if (agent->getActiveSocket() != NULL && agent->getAgentId() == agentID) {
|
||||
if (agent->getAgentId() == agentID) {
|
||||
return agent - agents.begin();
|
||||
}
|
||||
}
|
||||
|
@ -219,11 +229,15 @@ int AgentList::updateList(unsigned char *packetData, size_t dataBytes) {
|
|||
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++) {
|
||||
if (agent->matches(publicSocket, localSocket, agentType)) {
|
||||
// we already have this agent, stop checking
|
||||
break;
|
||||
if (publicSocket != NULL) {
|
||||
for (agent = agents.begin(); agent != agents.end(); agent++) {
|
||||
if (agent->matches(publicSocket, localSocket, agentType)) {
|
||||
// we already have this agent, stop checking
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
agent = agents.end();
|
||||
}
|
||||
|
||||
if (agent == agents.end()) {
|
||||
|
@ -316,7 +330,8 @@ void *pingUnknownAgents(void *args) {
|
|||
for(std::vector<Agent>::iterator agent = agentList->getAgents().begin();
|
||||
agent != agentList->getAgents().end();
|
||||
agent++) {
|
||||
if (agent->getActiveSocket() == NULL) {
|
||||
if (agent->getActiveSocket() == NULL
|
||||
&& (agent->getPublicSocket() != NULL && agent->getLocalSocket() != NULL)) {
|
||||
// ping both of the sockets for the agent so we can figure out
|
||||
// which socket we can use
|
||||
agentList->getAgentSocket().send(agent->getPublicSocket(), &PACKET_HEADER_PING, 1);
|
||||
|
|
|
@ -50,10 +50,10 @@ public:
|
|||
bool addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket, char agentType, uint16_t agentId);
|
||||
|
||||
void processAgentData(sockaddr *senderAddress, unsigned char *packetData, size_t dataBytes);
|
||||
void processBulkAgentData(sockaddr *senderAddress, unsigned char *packetData, int numTotalBytes, int numBytesPerAgent);
|
||||
void processBulkAgentData(sockaddr *senderAddress, unsigned char *packetData, int numTotalBytes);
|
||||
|
||||
void updateAgentWithData(sockaddr *senderAddress, unsigned char *packetData, size_t dataBytes);
|
||||
void updateAgentWithData(Agent *agent, unsigned char *packetData, int dataBytes);
|
||||
int updateAgentWithData(sockaddr *senderAddress, unsigned char *packetData, size_t dataBytes);
|
||||
int updateAgentWithData(Agent *agent, unsigned char *packetData, int dataBytes);
|
||||
|
||||
void broadcastToAgents(unsigned char *broadcastData, size_t dataBytes, const char* agentTypes, int numAgentTypes);
|
||||
char getOwnerType();
|
||||
|
|
|
@ -105,7 +105,7 @@ void AudioRingBuffer::setBearing(float newBearing) {
|
|||
bearing = newBearing;
|
||||
}
|
||||
|
||||
void AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
if (numBytes > (bufferLengthSamples * sizeof(int16_t))) {
|
||||
|
||||
unsigned char *dataPtr = sourceBuffer + 1;
|
||||
|
@ -140,7 +140,9 @@ void AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
|
||||
if (endOfLastWrite >= buffer + ringBufferLengthSamples) {
|
||||
endOfLastWrite = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
return numBytes;
|
||||
}
|
||||
|
||||
short AudioRingBuffer::diffLastWriteNextOutput()
|
||||
|
|
|
@ -18,7 +18,7 @@ class AudioRingBuffer : public AgentData {
|
|||
~AudioRingBuffer();
|
||||
AudioRingBuffer(const AudioRingBuffer &otherRingBuffer);
|
||||
|
||||
void parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
int parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
AudioRingBuffer* clone() const;
|
||||
|
||||
int16_t* getNextOutput();
|
||||
|
|
|
@ -28,20 +28,24 @@ using shared_lib::printLog;
|
|||
sockaddr_in destSockaddr, senderAddress;
|
||||
|
||||
bool socketMatch(sockaddr *first, sockaddr *second) {
|
||||
// utility function that indicates if two sockets are equivalent
|
||||
|
||||
// currently only compares two IPv4 addresses
|
||||
// expandable to IPv6 by adding else if for AF_INET6
|
||||
|
||||
if (first->sa_family != second->sa_family) {
|
||||
// not the same family, can't be equal
|
||||
return false;
|
||||
} else if (first->sa_family == AF_INET) {
|
||||
sockaddr_in *firstIn = (sockaddr_in *) first;
|
||||
sockaddr_in *secondIn = (sockaddr_in *) second;
|
||||
if (first != NULL && second != NULL) {
|
||||
// utility function that indicates if two sockets are equivalent
|
||||
|
||||
return firstIn->sin_addr.s_addr == secondIn->sin_addr.s_addr
|
||||
// currently only compares two IPv4 addresses
|
||||
// expandable to IPv6 by adding else if for AF_INET6
|
||||
|
||||
if (first->sa_family != second->sa_family) {
|
||||
// not the same family, can't be equal
|
||||
return false;
|
||||
} else if (first->sa_family == AF_INET) {
|
||||
sockaddr_in *firstIn = (sockaddr_in *) first;
|
||||
sockaddr_in *secondIn = (sockaddr_in *) second;
|
||||
|
||||
return firstIn->sin_addr.s_addr == secondIn->sin_addr.s_addr
|
||||
&& firstIn->sin_port == secondIn->sin_port;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -192,16 +192,16 @@ int ViewFrustum::sphereInFrustum(const glm::vec3& center, float radius) const {
|
|||
|
||||
int ViewFrustum::boxInFrustum(const AABox& box) const {
|
||||
|
||||
printf("ViewFrustum::boxInFrustum() box.corner=%f,%f,%f x=%f\n",
|
||||
box.getCorner().x,box.getCorner().y,box.getCorner().z,box.getSize().x);
|
||||
//printf("ViewFrustum::boxInFrustum() box.corner=%f,%f,%f x=%f\n",
|
||||
// box.getCorner().x,box.getCorner().y,box.getCorner().z,box.getSize().x);
|
||||
int result = INSIDE;
|
||||
for(int i=0; i < 6; i++) {
|
||||
|
||||
printf("plane[%d] -- point(%f,%f,%f) normal(%f,%f,%f) d=%f \n",i,
|
||||
_planes[i].getPoint().x, _planes[i].getPoint().y, _planes[i].getPoint().z,
|
||||
_planes[i].getNormal().x, _planes[i].getNormal().y, _planes[i].getNormal().z,
|
||||
_planes[i].getDCoefficient()
|
||||
);
|
||||
//printf("plane[%d] -- point(%f,%f,%f) normal(%f,%f,%f) d=%f \n",i,
|
||||
// _planes[i].getPoint().x, _planes[i].getPoint().y, _planes[i].getPoint().z,
|
||||
// _planes[i].getNormal().x, _planes[i].getNormal().y, _planes[i].getNormal().z,
|
||||
// _planes[i].getDCoefficient()
|
||||
//);
|
||||
|
||||
glm::vec3 normal = _planes[i].getNormal();
|
||||
glm::vec3 boxVertexP = box.getVertexP(normal);
|
||||
|
@ -210,13 +210,11 @@ int ViewFrustum::boxInFrustum(const AABox& box) const {
|
|||
glm::vec3 boxVertexN = box.getVertexN(normal);
|
||||
float planeToBoxVertexNDistance = _planes[i].distance(boxVertexN);
|
||||
|
||||
|
||||
|
||||
printf("plane[%d] normal=(%f,%f,%f) bVertexP=(%f,%f,%f) planeToBoxVertexPDistance=%f boxVertexN=(%f,%f,%f) planeToBoxVertexNDistance=%f\n",i,
|
||||
normal.x,normal.y,normal.z,
|
||||
boxVertexP.x,boxVertexP.y,boxVertexP.z,planeToBoxVertexPDistance,
|
||||
boxVertexN.x,boxVertexN.y,boxVertexN.z,planeToBoxVertexNDistance
|
||||
);
|
||||
//printf("plane[%d] normal=(%f,%f,%f) bVertexP=(%f,%f,%f) planeToBoxVertexPDistance=%f boxVertexN=(%f,%f,%f) planeToBoxVertexNDistance=%f\n",i,
|
||||
// normal.x,normal.y,normal.z,
|
||||
// boxVertexP.x,boxVertexP.y,boxVertexP.z,planeToBoxVertexPDistance,
|
||||
// boxVertexN.x,boxVertexN.y,boxVertexN.z,planeToBoxVertexNDistance
|
||||
// );
|
||||
|
||||
if (planeToBoxVertexPDistance < 0) {
|
||||
return OUTSIDE;
|
||||
|
|
|
@ -58,6 +58,12 @@ void VoxelNode::getAABox(AABox& box) const {
|
|||
void VoxelNode::addChildAtIndex(int childIndex) {
|
||||
children[childIndex] = new VoxelNode();
|
||||
|
||||
// XXXBHG - When the node is constructed, it should be cleanly set up as
|
||||
// true colored, but for some reason, not so much. I've added a a basecamp
|
||||
// to-do to research this. But for now we'll use belt and suspenders and set
|
||||
// it to not-false-colored here!
|
||||
children[childIndex]->setFalseColored(false);
|
||||
|
||||
// give this child its octal code
|
||||
children[childIndex]->octalCode = childOctalCode(octalCode, childIndex);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ VoxelTree randomTree;
|
|||
|
||||
bool wantColorRandomizer = false;
|
||||
bool debugViewFrustum = false;
|
||||
bool viewFrustumCulling = false; // for now
|
||||
bool viewFrustumCulling = true; // for now
|
||||
|
||||
void addSphere(VoxelTree * tree,bool random, bool wantColorRandomizer) {
|
||||
float r = random ? randFloatInRange(0.05,0.1) : 0.25;
|
||||
|
@ -276,8 +276,8 @@ int main(int argc, const char * argv[])
|
|||
::debugViewFrustum = cmdOptionExists(argc, argv, DEBUG_VIEW_FRUSTUM);
|
||||
printf("debugViewFrustum=%s\n", (::debugViewFrustum ? "yes" : "no"));
|
||||
|
||||
const char* VIEW_FRUSTUM_CULLING = "--ViewFrustumCulling";
|
||||
::viewFrustumCulling = cmdOptionExists(argc, argv, VIEW_FRUSTUM_CULLING);
|
||||
const char* NO_VIEW_FRUSTUM_CULLING = "--NoViewFrustumCulling";
|
||||
::viewFrustumCulling = !cmdOptionExists(argc, argv, NO_VIEW_FRUSTUM_CULLING);
|
||||
printf("viewFrustumCulling=%s\n", (::viewFrustumCulling ? "yes" : "no"));
|
||||
|
||||
const char* WANT_COLOR_RANDOMIZER = "--WantColorRandomizer";
|
||||
|
|
Loading…
Reference in a new issue