mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 20:54:25 +02:00
Remove magic numbers, fix spacing, and other code clean up in nudge code.
This commit is contained in:
parent
f41533fee6
commit
3b464094d9
5 changed files with 10 additions and 14 deletions
|
@ -1299,7 +1299,7 @@ void Application::nudgeVoxels() {
|
|||
VoxelNode* nodeToNudge = _voxels.getVoxelAt(_nudgeVoxel.x, _nudgeVoxel.y, _nudgeVoxel.z, _nudgeVoxel.s);
|
||||
|
||||
if (nodeToNudge) {
|
||||
_voxels.getVoxelTree()->nudgeSubTree(nodeToNudge, nudgeVec, _voxelEditSender);
|
||||
_voxels.getTree()->nudgeSubTree(nodeToNudge, nudgeVec, _voxelEditSender);
|
||||
_finishedNudge = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -414,7 +414,7 @@ void renderMouseVoxelGrid(const float& mouseVoxelX, const float& mouseVoxelY, co
|
|||
glEnd();
|
||||
}
|
||||
|
||||
void renderNudgeGrid(const float& voxelX, const float& voxelY, const float& voxelZ, const float& voxelS, const float& voxelPrecision) {
|
||||
void renderNudgeGrid(float voxelX, float voxelY, float voxelZ, float voxelS, float voxelPrecision) {
|
||||
glm::vec3 origin = glm::vec3(voxelX, voxelY, voxelZ);
|
||||
|
||||
glLineWidth(1.0);
|
||||
|
@ -438,7 +438,7 @@ void renderNudgeGrid(const float& voxelX, const float& voxelY, const float& voxe
|
|||
glVertex3f(origin.x + xz * voxelPrecision, 0, origin.z - (GRID_DIMENSIONS - 1) * voxelS);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
|
||||
glColor3f(1.0f,1.0f,1.0f);
|
||||
|
||||
glBegin(GL_POLYGON);//begin drawing of square
|
||||
|
@ -449,7 +449,7 @@ void renderNudgeGrid(const float& voxelX, const float& voxelY, const float& voxe
|
|||
glEnd();//end drawing of polygon
|
||||
}
|
||||
|
||||
void renderNudgeGuide(const float& voxelX, const float& voxelY, const float& voxelZ, const float& voxelS) {
|
||||
void renderNudgeGuide(float voxelX, float voxelY, float voxelZ, float voxelS) {
|
||||
glm::vec3 origin = glm::vec3(voxelX, voxelY, voxelZ);
|
||||
|
||||
glLineWidth(3.0);
|
||||
|
|
|
@ -61,9 +61,9 @@ void renderGroundPlaneGrid(float size, float impact);
|
|||
|
||||
void renderMouseVoxelGrid(const float& mouseVoxelX, const float& mouseVoxelY, const float& mouseVoxelZ, const float& mouseVoxelS);
|
||||
|
||||
void renderNudgeGrid(const float& voxelX, const float& voxelY, const float& voxelZ, const float& voxelS, const float& voxelPrecision);
|
||||
void renderNudgeGrid(float voxelX, float voxelY, float voxelZ, float voxelS, float voxelPrecision);
|
||||
|
||||
void renderNudgeGuide(const float& voxelX, const float& voxelY, const float& voxelZ, const float& voxelS);
|
||||
void renderNudgeGuide(float voxelX, float voxelY, float voxelZ, float voxelS);
|
||||
|
||||
void renderCollisionOverlay(int width, int height, float magnitude);
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ public:
|
|||
float getVoxelsCreatedPerSecondAverage();
|
||||
float getVoxelsColoredPerSecondAverage();
|
||||
float getVoxelsBytesReadPerSecondAverage();
|
||||
VoxelTree* getVoxelTree() {return _tree;}
|
||||
|
||||
void killLocalVoxels();
|
||||
|
||||
|
|
|
@ -1864,8 +1864,6 @@ public:
|
|||
float ancestorSize;
|
||||
glm::vec3 nudgeVec;
|
||||
VoxelEditPacketSender* voxelEditSenderPtr;
|
||||
|
||||
int colorIndex;
|
||||
};
|
||||
|
||||
float findNewLeafSize(const glm::vec3& nudgeAmount, float leafSize) {
|
||||
|
@ -1949,14 +1947,14 @@ void VoxelTree::nudgeLeaf(VoxelNode* node, void* extraData) {
|
|||
voxelDetails.y = unNudgedDetails.y;
|
||||
voxelDetails.z = unNudgedDetails.z;
|
||||
voxelDetails.s = unNudgedDetails.s;
|
||||
voxelDetails.red = node->getColor()[0];
|
||||
voxelDetails.green = node->getColor()[1];
|
||||
voxelDetails.blue = node->getColor()[2];
|
||||
voxelDetails.red = node->getColor()[RED_INDEX];
|
||||
voxelDetails.green = node->getColor()[GREEN_INDEX];
|
||||
voxelDetails.blue = node->getColor()[BLUE_INDEX];
|
||||
glm::vec3 nudge = args->nudgeVec;
|
||||
|
||||
// delete the old node
|
||||
// if the nudge replaces the node in an area outside of the ancestor node
|
||||
if ((fabs(nudge.x) >= args->ancestorSize || fabs(nudge.y) >= args->ancestorSize || fabs(nudge.z) >= args->ancestorSize)) {
|
||||
if (fabs(nudge.x) >= args->ancestorSize || fabs(nudge.y) >= args->ancestorSize || fabs(nudge.z) >= args->ancestorSize) {
|
||||
args->voxelEditSenderPtr->sendVoxelEditMessage(PACKET_TYPE_ERASE_VOXEL, voxelDetails);
|
||||
}
|
||||
|
||||
|
@ -1986,7 +1984,6 @@ void VoxelTree::nudgeSubTree(VoxelNode* nodeToNudge, const glm::vec3& nudgeAmoun
|
|||
args.ancestorSize = ancestorDetails.s;
|
||||
args.nudgeVec = nudgeAmount;
|
||||
args.voxelEditSenderPtr = &voxelEditSender;
|
||||
args.colorIndex = 0;
|
||||
|
||||
recurseNodeWithOperation(nodeToNudge, nudgeCheck, &args);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue