Some more memory leaks and codes formatting

This commit is contained in:
atlante45 2013-09-03 17:16:06 -07:00
parent 06119990e8
commit b03482ead5
23 changed files with 145 additions and 91 deletions

View file

@ -40,19 +40,19 @@ public:
void addReceivedAudioToBuffer(unsigned char* receivedData, int receivedBytes); void addReceivedAudioToBuffer(unsigned char* receivedData, int receivedBytes);
float getLastInputLoudness() const { return _lastInputLoudness; }; float getLastInputLoudness() const { return _lastInputLoudness; }
void setLastAcceleration(glm::vec3 lastAcceleration) { _lastAcceleration = lastAcceleration; }; void setLastAcceleration(glm::vec3 lastAcceleration) { _lastAcceleration = lastAcceleration; }
void setLastVelocity(glm::vec3 lastVelocity) { _lastVelocity = lastVelocity; }; void setLastVelocity(glm::vec3 lastVelocity) { _lastVelocity = lastVelocity; }
void setJitterBufferSamples(int samples) { _jitterBufferSamples = samples; }; void setJitterBufferSamples(int samples) { _jitterBufferSamples = samples; }
int getJitterBufferSamples() { return _jitterBufferSamples; }; int getJitterBufferSamples() { return _jitterBufferSamples; }
void lowPassFilter(int16_t* inputBuffer); void lowPassFilter(int16_t* inputBuffer);
void startCollisionSound(float magnitude, float frequency, float noise, float duration); void startCollisionSound(float magnitude, float frequency, float noise, float duration);
float getCollisionSoundMagnitude() { return _collisionSoundMagnitude; }; float getCollisionSoundMagnitude() { return _collisionSoundMagnitude; }
void ping(); void ping();
@ -61,8 +61,8 @@ public:
// The results of the analysis are written to the log. // The results of the analysis are written to the log.
bool eventuallyAnalyzePing(); bool eventuallyAnalyzePing();
void setListenMode(AudioRingBuffer::ListenMode mode) { _listenMode = mode; }; void setListenMode(AudioRingBuffer::ListenMode mode) { _listenMode = mode; }
void setListenRadius(float radius) { _listenRadius = radius; }; void setListenRadius(float radius) { _listenRadius = radius; }
void addListenSource(int sourceID); void addListenSource(int sourceID);
void removeListenSource(int sourceID); void removeListenSource(int sourceID);
void clearListenSources(); void clearListenSources();

View file

@ -38,13 +38,31 @@ static sockaddr getZeroAddress() {
return addr; return addr;
} }
Environment::Environment()
: _initialized(false) {
}
Environment::~Environment() {
if (_initialized) {
delete _skyFromAtmosphereProgram;
delete _skyFromSpaceProgram;
}
}
void Environment::init() { void Environment::init() {
if (_initialized) {
qDebug("[ERROR] Environment is already initialized.\n");
return;
}
switchToResourcesParentIfRequired(); switchToResourcesParentIfRequired();
_skyFromAtmosphereProgram = createSkyProgram("Atmosphere", _skyFromAtmosphereUniformLocations); _skyFromAtmosphereProgram = createSkyProgram("Atmosphere", _skyFromAtmosphereUniformLocations);
_skyFromSpaceProgram = createSkyProgram("Space", _skyFromSpaceUniformLocations); _skyFromSpaceProgram = createSkyProgram("Space", _skyFromSpaceUniformLocations);
// start off with a default-constructed environment data // start off with a default-constructed environment data
_data[getZeroAddress()][0]; _data[getZeroAddress()][0];
_initialized = true;
} }
void Environment::resetToDefault() { void Environment::resetToDefault() {

View file

@ -22,6 +22,8 @@ class ProgramObject;
class Environment { class Environment {
public: public:
Environment();
~Environment();
void init(); void init();
void resetToDefault(); void resetToDefault();
@ -40,6 +42,7 @@ private:
void renderAtmosphere(Camera& camera, const EnvironmentData& data); void renderAtmosphere(Camera& camera, const EnvironmentData& data);
bool _initialized;
ProgramObject* _skyFromAtmosphereProgram; ProgramObject* _skyFromAtmosphereProgram;
ProgramObject* _skyFromSpaceProgram; ProgramObject* _skyFromSpaceProgram;

View file

@ -413,6 +413,13 @@ Menu::Menu() :
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DestructiveAddVoxel); addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DestructiveAddVoxel);
} }
Menu::~Menu() {
qDebug("[DEBUG] Menu destructor.\n]");
bandwidthDetailsClosed();
voxelStatsDetailsClosed();
delete _voxelModeActionsGroup;
}
void Menu::loadSettings(QSettings* settings) { void Menu::loadSettings(QSettings* settings) {
if (!settings) { if (!settings) {
settings = Application::getInstance()->getSettings(); settings = Application::getInstance()->getSettings();
@ -855,8 +862,10 @@ void Menu::bandwidthDetails() {
} }
void Menu::bandwidthDetailsClosed() { void Menu::bandwidthDetailsClosed() {
delete _bandwidthDialog; if (_bandwidthDialog) {
_bandwidthDialog = NULL; delete _bandwidthDialog;
_bandwidthDialog = NULL;
}
} }
void Menu::voxelStatsDetails() { void Menu::voxelStatsDetails() {
@ -870,8 +879,10 @@ void Menu::voxelStatsDetails() {
} }
void Menu::voxelStatsDetailsClosed() { void Menu::voxelStatsDetailsClosed() {
delete _voxelStatsDialog; if (_voxelStatsDialog) {
_voxelStatsDialog = NULL; delete _voxelStatsDialog;
_voxelStatsDialog = NULL;
}
} }
void Menu::cycleFrustumRenderMode() { void Menu::cycleFrustumRenderMode() {

View file

@ -79,6 +79,7 @@ private:
static Menu* _instance; static Menu* _instance;
Menu(); Menu();
~Menu();
typedef void(*settingsAction)(QSettings*, QAction*); typedef void(*settingsAction)(QSettings*, QAction*);
static void loadAction(QSettings* set, QAction* action); static void loadAction(QSettings* set, QAction* action);

View file

@ -29,6 +29,12 @@ Transmitter::Transmitter() :
} }
Transmitter::~Transmitter() {
if (_lastReceivedPacket) {
delete _lastReceivedPacket;
}
}
void Transmitter::checkForLostTransmitter() { void Transmitter::checkForLostTransmitter() {
// If we are in motion, check for loss of transmitter packets // If we are in motion, check for loss of transmitter packets
if (glm::length(_estimatedRotation) > 0.f) { if (glm::length(_estimatedRotation) > 0.f) {

View file

@ -25,6 +25,7 @@ class Transmitter
{ {
public: public:
Transmitter(); Transmitter();
~Transmitter();
void render(); void render();
void checkForLostTransmitter(); void checkForLostTransmitter();
void resetLevels(); void resetLevels();

View file

@ -70,6 +70,10 @@ namespace starfield {
_renderer(0l) { _renderer(0l) {
} }
~Controller() {
delete _renderer;
}
#if !STARFIELD_MULTITHREADING #if !STARFIELD_MULTITHREADING
#define lock #define lock
#define _(x) #define _(x)

View file

@ -78,11 +78,11 @@ public:
// Hand State // Hand State
void setHandState(char s) { _handState = s; }; void setHandState(char s) { _handState = s; }
char getHandState() const {return _handState; }; char getHandState() const {return _handState; }
// getters for camera details // getters for camera details
const glm::vec3& getCameraPosition() const { return _cameraPosition; }; const glm::vec3& getCameraPosition() const { return _cameraPosition; }
const glm::quat& getCameraOrientation() const { return _cameraOrientation; } const glm::quat& getCameraOrientation() const { return _cameraOrientation; }
float getCameraFov() const { return _cameraFov; } float getCameraFov() const { return _cameraFov; }
float getCameraAspectRatio() const { return _cameraAspectRatio; } float getCameraAspectRatio() const { return _cameraAspectRatio; }

View file

@ -32,12 +32,12 @@ public:
NetworkPacket(sockaddr& address, unsigned char* packetData, ssize_t packetLength); NetworkPacket(sockaddr& address, unsigned char* packetData, ssize_t packetLength);
sockaddr& getAddress() { return _address; }; sockaddr& getAddress() { return _address; }
ssize_t getLength() const { return _packetLength; }; ssize_t getLength() const { return _packetLength; }
unsigned char* getData() { return &_packetData[0]; }; unsigned char* getData() { return &_packetData[0]; }
const sockaddr& getAddress() const { return _address; }; const sockaddr& getAddress() const { return _address; }
const unsigned char* getData() const { return &_packetData[0]; }; const unsigned char* getData() const { return &_packetData[0]; }
private: private:
void copyContents(const sockaddr& address, const unsigned char* packetData, ssize_t packetLength); void copyContents(const sockaddr& address, const unsigned char* packetData, ssize_t packetLength);

View file

@ -58,15 +58,15 @@ public:
NodeData* getLinkedData() const { return _linkedData; } NodeData* getLinkedData() const { return _linkedData; }
void setLinkedData(NodeData* linkedData) { _linkedData = linkedData; } void setLinkedData(NodeData* linkedData) { _linkedData = linkedData; }
bool isAlive() const { return _isAlive; }; bool isAlive() const { return _isAlive; }
void setAlive(bool isAlive) { _isAlive = isAlive; }; void setAlive(bool isAlive) { _isAlive = isAlive; }
void recordBytesReceived(int bytesReceived); void recordBytesReceived(int bytesReceived);
float getAverageKilobitsPerSecond(); float getAverageKilobitsPerSecond();
float getAveragePacketsPerSecond(); float getAveragePacketsPerSecond();
int getPingMs() const { return _pingMs; }; int getPingMs() const { return _pingMs; }
void setPingMs(int pingMs) { _pingMs = pingMs; }; void setPingMs(int pingMs) { _pingMs = pingMs; }
void lock() { pthread_mutex_lock(&_mutex); } void lock() { pthread_mutex_lock(&_mutex); }
void unlock() { pthread_mutex_unlock(&_mutex); } void unlock() { pthread_mutex_unlock(&_mutex); }

View file

@ -156,9 +156,9 @@ private:
class NodeListIterator : public std::iterator<std::input_iterator_tag, Node> { class NodeListIterator : public std::iterator<std::input_iterator_tag, Node> {
public: public:
NodeListIterator(const NodeList* nodeList, int nodeIndex); NodeListIterator(const NodeList* nodeList, int nodeIndex);
~NodeListIterator() {}; ~NodeListIterator() {}
int getNodeIndex() { return _nodeIndex; }; int getNodeIndex() { return _nodeIndex; }
NodeListIterator& operator=(const NodeListIterator& otherValue); NodeListIterator& operator=(const NodeListIterator& otherValue);

View file

@ -35,9 +35,9 @@ private:
public: public:
std::string group; std::string group;
PerfStatHistory(): count(0), totalTime(0.0) {}; PerfStatHistory(): count(0), totalTime(0.0) {}
PerfStatHistory(std::string myGroup, double initialTime, long int initialCount) : PerfStatHistory(std::string myGroup, double initialTime, long int initialCount) :
count(initialCount), totalTime(initialTime), group(myGroup) {}; count(initialCount), totalTime(initialTime), group(myGroup) {}
void recordTime(double thisTime) { void recordTime(double thisTime) {
totalTime+=thisTime; totalTime+=thisTime;
@ -94,7 +94,7 @@ public:
_start(usecTimestampNow()), _start(usecTimestampNow()),
_message(message), _message(message),
_renderWarningsOn(renderWarnings), _renderWarningsOn(renderWarnings),
_alwaysDisplay(alwaysDisplay) { }; _alwaysDisplay(alwaysDisplay) { }
~PerformanceWarning(); ~PerformanceWarning();
}; };

View file

@ -18,7 +18,7 @@ public:
PointerStack() : PointerStack() :
_elements(NULL), _elements(NULL),
_elementsInUse(0), _elementsInUse(0),
_sizeOfElementsArray(0) {}; _sizeOfElementsArray(0) {}
~PointerStack(); ~PointerStack();
@ -28,7 +28,7 @@ public:
} }
_elements[_elementsInUse] = element; _elements[_elementsInUse] = element;
_elementsInUse++; _elementsInUse++;
}; }
void* pop() { void* pop() {
if (_elementsInUse) { if (_elementsInUse) {
@ -39,14 +39,14 @@ public:
return element; return element;
} }
return NULL; return NULL;
}; }
void* top() const { return (_elementsInUse) ? _elements[_elementsInUse - 1] : NULL; } void* top() const { return (_elementsInUse) ? _elements[_elementsInUse - 1] : NULL; }
bool isEmpty() const { return (_elementsInUse == 0); }; bool isEmpty() const { return (_elementsInUse == 0); }
bool empty() const { return (_elementsInUse == 0); }; bool empty() const { return (_elementsInUse == 0); }
int count() const { return _elementsInUse; }; int count() const { return _elementsInUse; }
int size() const { return _elementsInUse; }; int size() const { return _elementsInUse; }
private: private:
void growAndPush(void* element); void growAndPush(void* element);

View file

@ -106,7 +106,7 @@ int removeFromSortedArrays(void* value, void** valueArray, float* keyArray, int*
// Helper Class for debugging // Helper Class for debugging
class debug { class debug {
public: public:
static const char* valueOf(bool checkValue) { return checkValue ? "yes" : "no"; }; static const char* valueOf(bool checkValue) { return checkValue ? "yes" : "no"; }
}; };
#endif /* defined(__hifi__SharedUtil__) */ #endif /* defined(__hifi__SharedUtil__) */

View file

@ -16,7 +16,7 @@ class StDev {
void addValue(float v); void addValue(float v);
float getAverage(); float getAverage();
float getStDev(); float getStDev();
int getSamples() {return sampleCount;}; int getSamples() {return sampleCount;}
private: private:
float * data; float * data;
int sampleCount; int sampleCount;

View file

@ -108,6 +108,10 @@ TagList::TagList(std::stringstream &ss) :
} }
} }
TagList::~TagList() {
_data.clear();
}
TagCompound::TagCompound(std::stringstream &ss) : TagCompound::TagCompound(std::stringstream &ss) :
Tag(TAG_Compound, ss), Tag(TAG_Compound, ss),
_size(0), _size(0),
@ -145,6 +149,10 @@ TagCompound::TagCompound(std::stringstream &ss) :
} }
} }
TagCompound::~TagCompound() {
_data.clear();
}
TagIntArray::TagIntArray(std::stringstream &ss) : Tag(TAG_Int_Array, ss) { TagIntArray::TagIntArray(std::stringstream &ss) : Tag(TAG_Int_Array, ss) {
_size = ss.get() << 24 | ss.get() << 16 | ss.get() << 8 | ss.get(); _size = ss.get() << 24 | ss.get() << 16 | ss.get() << 8 | ss.get();

View file

@ -124,6 +124,7 @@ private:
class TagList : public Tag { class TagList : public Tag {
public: public:
TagList(std::stringstream &ss); TagList(std::stringstream &ss);
~TagList();
int getTagId() const {return _tagId;} int getTagId() const {return _tagId;}
int getSize () const {return _size; } int getSize () const {return _size; }
@ -138,6 +139,7 @@ private:
class TagCompound : public Tag { class TagCompound : public Tag {
public: public:
TagCompound(std::stringstream &ss); TagCompound(std::stringstream &ss);
~TagCompound();
int getSize () const {return _size; } int getSize () const {return _size; }
std::list<Tag*> getData () const {return _data; } std::list<Tag*> getData () const {return _data; }

View file

@ -34,8 +34,8 @@ public:
VoxelNode(unsigned char * octalCode); // regular constructor VoxelNode(unsigned char * octalCode); // regular constructor
~VoxelNode(); ~VoxelNode();
unsigned char* getOctalCode() const { return _octalCode; }; unsigned char* getOctalCode() const { return _octalCode; }
VoxelNode* getChildAtIndex(int childIndex) const { return _children[childIndex]; }; VoxelNode* getChildAtIndex(int childIndex) const { return _children[childIndex]; }
void deleteChildAtIndex(int childIndex); void deleteChildAtIndex(int childIndex);
VoxelNode* removeChildAtIndex(int childIndex); VoxelNode* removeChildAtIndex(int childIndex);
VoxelNode* addChildAtIndex(int childIndex); VoxelNode* addChildAtIndex(int childIndex);
@ -45,15 +45,15 @@ public:
void setRandomColor(int minimumBrightness); void setRandomColor(int minimumBrightness);
bool collapseIdenticalLeaves(); bool collapseIdenticalLeaves();
const AABox& getAABox() const { return _box; }; const AABox& getAABox() const { return _box; }
const glm::vec3& getCenter() const { return _box.getCenter(); }; const glm::vec3& getCenter() const { return _box.getCenter(); }
const glm::vec3& getCorner() const { return _box.getCorner(); }; const glm::vec3& getCorner() const { return _box.getCorner(); }
float getScale() const { return _box.getSize().x; /* voxelScale = (1 / powf(2, *node->getOctalCode())); */ }; float getScale() const { return _box.getSize().x; } // voxelScale = (1 / powf(2, *node->getOctalCode())); }
int getLevel() const { return *_octalCode + 1; /* one based or zero based? this doesn't correctly handle 2 byte case */ }; int getLevel() const { return *_octalCode + 1; } // one based or zero based? this doesn't correctly handle 2 byte case
float getEnclosingRadius() const; float getEnclosingRadius() const;
bool isColored() const { return (_trueColor[3]==1); }; bool isColored() const { return (_trueColor[3]==1); }
bool isInView(const ViewFrustum& viewFrustum) const; bool isInView(const ViewFrustum& viewFrustum) const;
ViewFrustum::location inFrustum(const ViewFrustum& viewFrustum) const; ViewFrustum::location inFrustum(const ViewFrustum& viewFrustum) const;
float distanceToCamera(const ViewFrustum& viewFrustum) const; float distanceToCamera(const ViewFrustum& viewFrustum) const;
@ -68,18 +68,18 @@ public:
bool isLeaf() const { return _childCount == 0; } bool isLeaf() const { return _childCount == 0; }
int getChildCount() const { return _childCount; } int getChildCount() const { return _childCount; }
void printDebugDetails(const char* label) const; void printDebugDetails(const char* label) const;
bool isDirty() const { return _isDirty; }; bool isDirty() const { return _isDirty; }
void clearDirtyBit() { _isDirty = false; }; void clearDirtyBit() { _isDirty = false; }
bool hasChangedSince(uint64_t time) const { return (_lastChanged > time); }; bool hasChangedSince(uint64_t time) const { return (_lastChanged > time); }
void markWithChangedTime() { _lastChanged = usecTimestampNow(); }; void markWithChangedTime() { _lastChanged = usecTimestampNow(); }
uint64_t getLastChanged() const { return _lastChanged; }; uint64_t getLastChanged() const { return _lastChanged; }
void handleSubtreeChanged(VoxelTree* myTree); void handleSubtreeChanged(VoxelTree* myTree);
glBufferIndex getBufferIndex() const { return _glBufferIndex; }; glBufferIndex getBufferIndex() const { return _glBufferIndex; }
bool isKnownBufferIndex() const { return (_glBufferIndex != GLBUFFER_INDEX_UNKNOWN); }; bool isKnownBufferIndex() const { return (_glBufferIndex != GLBUFFER_INDEX_UNKNOWN); }
void setBufferIndex(glBufferIndex index) { _glBufferIndex = index; }; void setBufferIndex(glBufferIndex index) { _glBufferIndex = index; }
VoxelSystem* getVoxelSystem() const { return _voxelSystem; }; VoxelSystem* getVoxelSystem() const { return _voxelSystem; }
void setVoxelSystem(VoxelSystem* voxelSystem) { _voxelSystem = voxelSystem; }; void setVoxelSystem(VoxelSystem* voxelSystem) { _voxelSystem = voxelSystem; }
// Used by VoxelSystem for rendering in/out of view and LOD // Used by VoxelSystem for rendering in/out of view and LOD
@ -89,10 +89,10 @@ public:
#ifndef NO_FALSE_COLOR // !NO_FALSE_COLOR means, does have false color #ifndef NO_FALSE_COLOR // !NO_FALSE_COLOR means, does have false color
void setFalseColor(colorPart red, colorPart green, colorPart blue); void setFalseColor(colorPart red, colorPart green, colorPart blue);
void setFalseColored(bool isFalseColored); void setFalseColored(bool isFalseColored);
bool getFalseColored() { return _falseColored; }; bool getFalseColored() { return _falseColored; }
void setColor(const nodeColor& color); void setColor(const nodeColor& color);
const nodeColor& getTrueColor() const { return _trueColor; }; const nodeColor& getTrueColor() const { return _trueColor; }
const nodeColor& getColor() const { return _currentColor; }; const nodeColor& getColor() const { return _currentColor; }
#else #else
void setFalseColor(colorPart red, colorPart green, colorPart blue) { /* no op */ }; void setFalseColor(colorPart red, colorPart green, colorPart blue) { /* no op */ };
void setFalseColored(bool isFalseColored) { /* no op */ }; void setFalseColored(bool isFalseColored) { /* no op */ };
@ -103,18 +103,18 @@ public:
const nodeColor& getColor() const { return _trueColor; }; const nodeColor& getColor() const { return _trueColor; };
#endif #endif
void setDensity(float density) { _density = density; }; void setDensity(float density) { _density = density; }
float getDensity() const { return _density; }; float getDensity() const { return _density; }
void setSourceID(uint16_t sourceID) { _sourceID = sourceID; }; void setSourceID(uint16_t sourceID) { _sourceID = sourceID; }
uint16_t getSourceID() const { return _sourceID; }; uint16_t getSourceID() const { return _sourceID; }
static void addDeleteHook(VoxelNodeDeleteHook* hook); static void addDeleteHook(VoxelNodeDeleteHook* hook);
static void removeDeleteHook(VoxelNodeDeleteHook* hook); static void removeDeleteHook(VoxelNodeDeleteHook* hook);
void recalculateSubTreeNodeCount(); void recalculateSubTreeNodeCount();
unsigned long getSubTreeNodeCount() const { return _subtreeNodeCount; }; unsigned long getSubTreeNodeCount() const { return _subtreeNodeCount; }
unsigned long getSubTreeInternalNodeCount() const { return _subtreeNodeCount - _subtreeLeafNodeCount; }; unsigned long getSubTreeInternalNodeCount() const { return _subtreeNodeCount - _subtreeLeafNodeCount; }
unsigned long getSubTreeLeafNodeCount() const { return _subtreeLeafNodeCount; }; unsigned long getSubTreeLeafNodeCount() const { return _subtreeLeafNodeCount; }
private: private:
void calculateAABox(); void calculateAABox();

View file

@ -27,8 +27,8 @@ public:
bool contains(VoxelNode* node); // is this node in the bag? bool contains(VoxelNode* node); // is this node in the bag?
void remove(VoxelNode* node); // remove a specific item from the bag void remove(VoxelNode* node); // remove a specific item from the bag
bool isEmpty() const { return (_elementsInUse == 0); }; bool isEmpty() const { return (_elementsInUse == 0); }
int count() const { return _elementsInUse; }; int count() const { return _elementsInUse; }
void deleteAll(); void deleteAll();

View file

@ -19,19 +19,19 @@ class BoundingBox {
public: public:
enum { BOTTOM_LEFT, BOTTOM_RIGHT, TOP_RIGHT, TOP_LEFT, VERTEX_COUNT }; enum { BOTTOM_LEFT, BOTTOM_RIGHT, TOP_RIGHT, TOP_LEFT, VERTEX_COUNT };
BoundingBox(glm::vec2 corner, glm::vec2 size) : corner(corner), size(size), _set(true) {}; BoundingBox(glm::vec2 corner, glm::vec2 size) : corner(corner), size(size), _set(true) {}
BoundingBox() : _set(false) {}; BoundingBox() : _set(false) {}
glm::vec2 corner; glm::vec2 corner;
glm::vec2 size; glm::vec2 size;
bool contains(const BoundingBox& box) const; bool contains(const BoundingBox& box) const;
bool contains(const glm::vec2& point) const; bool contains(const glm::vec2& point) const;
bool pointInside(const glm::vec2& point) const { return contains(point); }; bool pointInside(const glm::vec2& point) const { return contains(point); }
void explandToInclude(const BoundingBox& box); void explandToInclude(const BoundingBox& box);
float area() const { return size.x * size.y; }; float area() const { return size.x * size.y; }
int getVertexCount() const { return VERTEX_COUNT; }; int getVertexCount() const { return VERTEX_COUNT; }
glm::vec2 getVertex(int vertexNumber) const; glm::vec2 getVertex(int vertexNumber) const;
BoundingBox topHalf() const; BoundingBox topHalf() const;
@ -66,23 +66,23 @@ public:
_vertexCount(vertexCount), _vertexCount(vertexCount),
_maxX(-FLT_MAX), _maxY(-FLT_MAX), _minX(FLT_MAX), _minY(FLT_MAX), _maxX(-FLT_MAX), _maxY(-FLT_MAX), _minX(FLT_MAX), _minY(FLT_MAX),
_distance(0) _distance(0)
{ }; { }
~VoxelProjectedPolygon() { }; ~VoxelProjectedPolygon() { }
const ProjectedVertices& getVertices() const { return _vertices; }; const ProjectedVertices& getVertices() const { return _vertices; }
const glm::vec2& getVertex(int i) const { return _vertices[i]; }; const glm::vec2& getVertex(int i) const { return _vertices[i]; }
void setVertex(int vertex, const glm::vec2& point); void setVertex(int vertex, const glm::vec2& point);
int getVertexCount() const { return _vertexCount; }; int getVertexCount() const { return _vertexCount; }
void setVertexCount(int vertexCount) { _vertexCount = vertexCount; }; void setVertexCount(int vertexCount) { _vertexCount = vertexCount; }
float getDistance() const { return _distance; } float getDistance() const { return _distance; }
void setDistance(float distance) { _distance = distance; } void setDistance(float distance) { _distance = distance; }
bool getAnyInView() const { return _anyInView; }; bool getAnyInView() const { return _anyInView; }
void setAnyInView(bool anyInView) { _anyInView = anyInView; }; void setAnyInView(bool anyInView) { _anyInView = anyInView; }
bool getAllInView() const { return _allInView; }; bool getAllInView() const { return _allInView; }
void setAllInView(bool allInView) { _allInView = allInView; }; void setAllInView(bool allInView) { _allInView = allInView; }
void setProjectionType(unsigned char type) { _projectionType = type; }; void setProjectionType(unsigned char type) { _projectionType = type; }
unsigned char getProjectionType() const { return _projectionType; }; unsigned char getProjectionType() const { return _projectionType; }
bool pointInside(const glm::vec2& point, bool* matchesVertex = NULL) const; bool pointInside(const glm::vec2& point, bool* matchesVertex = NULL) const;

View file

@ -120,7 +120,7 @@ public:
/// Returns details about items tracked by VoxelSceneStats /// Returns details about items tracked by VoxelSceneStats
/// \param Item item The item from the stats you're interested in. /// \param Item item The item from the stats you're interested in.
ItemInfo& getItemInfo(Item item) { return _ITEMS[item]; }; ItemInfo& getItemInfo(Item item) { return _ITEMS[item]; }
/// Returns a UI formatted value of an item tracked by VoxelSceneStats /// Returns a UI formatted value of an item tracked by VoxelSceneStats
/// \param Item item The item from the stats you're interested in. /// \param Item item The item from the stats you're interested in.

View file

@ -158,10 +158,10 @@ public:
int encodeTreeBitstream(VoxelNode* node, unsigned char* outputBuffer, int availableBytes, VoxelNodeBag& bag, int encodeTreeBitstream(VoxelNode* node, unsigned char* outputBuffer, int availableBytes, VoxelNodeBag& bag,
EncodeBitstreamParams& params) ; EncodeBitstreamParams& params) ;
bool isDirty() const { return _isDirty; }; bool isDirty() const { return _isDirty; }
void clearDirtyBit() { _isDirty = false; }; void clearDirtyBit() { _isDirty = false; }
void setDirtyBit() { _isDirty = true; }; void setDirtyBit() { _isDirty = true; }
unsigned long int getNodesChangedFromBitstream() const { return _nodesChangedFromBitstream; }; unsigned long int getNodesChangedFromBitstream() const { return _nodesChangedFromBitstream; }
bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
VoxelNode*& node, float& distance, BoxFace& face); VoxelNode*& node, float& distance, BoxFace& face);