mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Add nudgeVoxel shading in grid. Fix erase bug.
This commit is contained in:
parent
b0803c1267
commit
f41533fee6
3 changed files with 15 additions and 4 deletions
|
@ -1672,7 +1672,6 @@ void Application::update(float deltaTime) {
|
|||
_mouseVoxel.z += faceVector.z * _mouseVoxel.s;
|
||||
}
|
||||
}
|
||||
_nudgeVoxel.s = _mouseVoxel.s;
|
||||
} else {
|
||||
_mouseVoxel.s = 0.0f;
|
||||
}
|
||||
|
@ -2322,7 +2321,11 @@ void Application::displaySide(Camera& whichCamera) {
|
|||
_mouseVoxel.z + _mouseVoxel.s*0.5f);
|
||||
glLineWidth(4.0f);
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelNudgeMode)) {
|
||||
glutWireCube(_nudgeVoxel.s);
|
||||
if (_nudgeVoxel.s) {
|
||||
glutWireCube(_nudgeVoxel.s);
|
||||
} else {
|
||||
glutWireCube(_mouseVoxel.s);
|
||||
}
|
||||
} else {
|
||||
glutWireCube(_mouseVoxel.s);
|
||||
}
|
||||
|
|
|
@ -438,6 +438,15 @@ 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
|
||||
glVertex3f(voxelX, 0.0f, voxelZ);//first vertex
|
||||
glVertex3f(voxelX + voxelS, 0.0f, voxelZ);//second vertex
|
||||
glVertex3f(voxelX + voxelS, 0.0f, voxelZ + voxelS);//third vertex
|
||||
glVertex3f(voxelX, 0.0f, voxelZ + voxelS);//fourth vertex
|
||||
glEnd();//end drawing of polygon
|
||||
}
|
||||
|
||||
void renderNudgeGuide(const float& voxelX, const float& voxelY, const float& voxelZ, const float& voxelS) {
|
||||
|
|
|
@ -1907,7 +1907,6 @@ bool VoxelTree::nudgeCheck(VoxelNode* node, void* extraData) {
|
|||
|
||||
// find necessary leaf size
|
||||
float newLeafSize = findNewLeafSize(args->nudgeVec, unNudgedDetails.s);
|
||||
args->ancestorSize = unNudgedDetails.s;
|
||||
|
||||
// check to see if this unNudged node can be nudged
|
||||
if (unNudgedDetails.s <= newLeafSize) {
|
||||
|
@ -1957,7 +1956,7 @@ void VoxelTree::nudgeLeaf(VoxelNode* node, void* extraData) {
|
|||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue