mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 06:16:24 +02:00
Added support for NO_FALSE_COLOR define.
- changed VoxelNode to have implementation option for NO_FALSE_COLOR Need some help from Stephen and/or Leo on how to make cmake support building the voxels library in NO_FALSE_COLOR mode for the server but keep false color support in the client
This commit is contained in:
parent
3dc818d31e
commit
e93ece0f52
2 changed files with 19 additions and 2 deletions
|
@ -19,7 +19,9 @@
|
||||||
VoxelNode::VoxelNode() {
|
VoxelNode::VoxelNode() {
|
||||||
octalCode = NULL;
|
octalCode = NULL;
|
||||||
|
|
||||||
|
#ifdef HAS_FALSE_COLOR
|
||||||
_falseColored = false; // assume true color
|
_falseColored = false; // assume true color
|
||||||
|
#endif
|
||||||
|
|
||||||
// default pointers to child nodes to NULL
|
// default pointers to child nodes to NULL
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
|
@ -83,6 +85,9 @@ void VoxelNode::setColorFromAverageOfChildren() {
|
||||||
setColor(newColor);
|
setColor(newColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: !NO_FALSE_COLOR implementations of setFalseColor(), setFalseColored(), and setColor() here.
|
||||||
|
// the actual NO_FALSE_COLOR version are inline in the VoxelNode.h
|
||||||
|
#ifndef NO_FALSE_COLOR // !NO_FALSE_COLOR means, does have false color
|
||||||
void VoxelNode::setFalseColor(colorPart red, colorPart green, colorPart blue) {
|
void VoxelNode::setFalseColor(colorPart red, colorPart green, colorPart blue) {
|
||||||
_falseColored=true;
|
_falseColored=true;
|
||||||
_currentColor[0] = red;
|
_currentColor[0] = red;
|
||||||
|
@ -91,7 +96,7 @@ void VoxelNode::setFalseColor(colorPart red, colorPart green, colorPart blue) {
|
||||||
_currentColor[3] = 1; // XXXBHG - False colors are always considered set
|
_currentColor[3] = 1; // XXXBHG - False colors are always considered set
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelNode::setFalseColored(bool isFalseColored) {
|
void VoxelNode::setFalseColored(bool isFalseColored) {
|
||||||
// if we were false colored, and are no longer false colored, then swap back
|
// if we were false colored, and are no longer false colored, then swap back
|
||||||
if (_falseColored && !isFalseColored) {
|
if (_falseColored && !isFalseColored) {
|
||||||
memcpy(&_currentColor,&_trueColor,sizeof(nodeColor));
|
memcpy(&_currentColor,&_trueColor,sizeof(nodeColor));
|
||||||
|
@ -107,6 +112,7 @@ void VoxelNode::setColor(const nodeColor& color) {
|
||||||
memcpy(&_currentColor,&color,sizeof(nodeColor));
|
memcpy(&_currentColor,&color,sizeof(nodeColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// will detect if children are leaves AND the same color
|
// will detect if children are leaves AND the same color
|
||||||
// and in that case will delete the children and make this node
|
// and in that case will delete the children and make this node
|
||||||
|
|
|
@ -17,8 +17,10 @@ typedef unsigned char nodeColor[4];
|
||||||
class VoxelNode {
|
class VoxelNode {
|
||||||
private:
|
private:
|
||||||
nodeColor _trueColor;
|
nodeColor _trueColor;
|
||||||
|
#ifndef NO_FALSE_COLOR // !NO_FALSE_COLOR means, does have false color
|
||||||
nodeColor _currentColor;
|
nodeColor _currentColor;
|
||||||
bool _falseColored;
|
bool _falseColored;
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
VoxelNode();
|
VoxelNode();
|
||||||
~VoxelNode();
|
~VoxelNode();
|
||||||
|
@ -32,13 +34,22 @@ public:
|
||||||
VoxelNode *children[8];
|
VoxelNode *children[8];
|
||||||
|
|
||||||
bool isColored() const { return (_trueColor[3]==1); };
|
bool isColored() const { return (_trueColor[3]==1); };
|
||||||
|
|
||||||
|
#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
|
||||||
|
void setFalseColor(colorPart red, colorPart green, colorPart blue) { /* no op */ };
|
||||||
|
void setFalseColored(bool isFalseColored) { /* no op */ };
|
||||||
|
bool getFalseColored() { return false; };
|
||||||
|
void setColor(const nodeColor& color) { memcpy(_trueColor,color,sizeof(nodeColor)); };
|
||||||
|
const nodeColor& getTrueColor() const { return _trueColor; };
|
||||||
|
const nodeColor& getColor() const { return _trueColor; };
|
||||||
|
#endif
|
||||||
|
|
||||||
void getAABox(AABox& box) const;
|
void getAABox(AABox& box) const;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue