mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:47:11 +02:00
added visulization for voxel add/kill
This commit is contained in:
parent
73510ec975
commit
88e2e3dd3f
6 changed files with 138 additions and 1 deletions
|
@ -3069,6 +3069,19 @@ void Application::displaySide(Camera& whichCamera) {
|
||||||
|
|
||||||
// brad's frustum for debugging
|
// brad's frustum for debugging
|
||||||
if (_frustumOn->isChecked()) renderViewFrustum(_viewFrustum);
|
if (_frustumOn->isChecked()) renderViewFrustum(_viewFrustum);
|
||||||
|
|
||||||
|
// render voxel fades if they exist
|
||||||
|
if (_voxelFades.size() > 0) {
|
||||||
|
for(std::vector<VoxelFade>::iterator fade = _voxelFades.begin(); fade != _voxelFades.end();) {
|
||||||
|
fade->render();
|
||||||
|
if(fade->isDone()) {
|
||||||
|
fade = _voxelFades.erase(fade);
|
||||||
|
} else {
|
||||||
|
++fade;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::displayOverlay() {
|
void Application::displayOverlay() {
|
||||||
|
@ -3839,6 +3852,15 @@ void Application::nodeKilled(Node* node) {
|
||||||
|
|
||||||
printf("voxel server going away...... v[%f, %f, %f, %f]\n",
|
printf("voxel server going away...... v[%f, %f, %f, %f]\n",
|
||||||
jurisditionDetails.x, jurisditionDetails.y, jurisditionDetails.z, jurisditionDetails.s);
|
jurisditionDetails.x, jurisditionDetails.y, jurisditionDetails.z, jurisditionDetails.s);
|
||||||
|
|
||||||
|
// Add the jurisditionDetails object to the list of "fade outs"
|
||||||
|
const float NODE_KILLED_RED = 1.0f;
|
||||||
|
const float NODE_KILLED_GREEN = 0.0f;
|
||||||
|
const float NODE_KILLED_BLUE = 0.0f;
|
||||||
|
|
||||||
|
VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE);
|
||||||
|
fade.voxelDetails = jurisditionDetails;
|
||||||
|
_voxelFades.push_back(fade);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3860,6 +3882,15 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng
|
||||||
if (_voxelServerJurisdictions.find(nodeID) == _voxelServerJurisdictions.end()) {
|
if (_voxelServerJurisdictions.find(nodeID) == _voxelServerJurisdictions.end()) {
|
||||||
printf("stats from new voxel server... v[%f, %f, %f, %f]\n",
|
printf("stats from new voxel server... v[%f, %f, %f, %f]\n",
|
||||||
jurisditionDetails.x, jurisditionDetails.y, jurisditionDetails.z, jurisditionDetails.s);
|
jurisditionDetails.x, jurisditionDetails.y, jurisditionDetails.z, jurisditionDetails.s);
|
||||||
|
|
||||||
|
// Add the jurisditionDetails object to the list of "fade outs"
|
||||||
|
const float NODE_ADDED_RED = 0.0f;
|
||||||
|
const float NODE_ADDED_GREEN = 1.0f;
|
||||||
|
const float NODE_ADDED_BLUE = 0.0f;
|
||||||
|
|
||||||
|
VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE);
|
||||||
|
fade.voxelDetails = jurisditionDetails;
|
||||||
|
_voxelFades.push_back(fade);
|
||||||
}
|
}
|
||||||
// store jurisdiction details for later use
|
// store jurisdiction details for later use
|
||||||
_voxelServerJurisdictions[nodeID] = jurisditionDetails;
|
_voxelServerJurisdictions[nodeID] = jurisditionDetails;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "Swatch.h"
|
#include "Swatch.h"
|
||||||
#include "ToolsPalette.h"
|
#include "ToolsPalette.h"
|
||||||
#include "ViewFrustum.h"
|
#include "ViewFrustum.h"
|
||||||
|
#include "VoxelFade.h"
|
||||||
#include "VoxelSystem.h"
|
#include "VoxelSystem.h"
|
||||||
#include "Webcam.h"
|
#include "Webcam.h"
|
||||||
#include "PieMenu.h"
|
#include "PieMenu.h"
|
||||||
|
@ -452,6 +453,8 @@ private:
|
||||||
int parseVoxelStats(unsigned char* messageData, ssize_t messageLength, sockaddr senderAddress);
|
int parseVoxelStats(unsigned char* messageData, ssize_t messageLength, sockaddr senderAddress);
|
||||||
|
|
||||||
std::map<uint16_t,VoxelPositionSize> _voxelServerJurisdictions;
|
std::map<uint16_t,VoxelPositionSize> _voxelServerJurisdictions;
|
||||||
|
|
||||||
|
std::vector<VoxelFade> _voxelFades;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__Application__) */
|
#endif /* defined(__interface__Application__) */
|
||||||
|
|
59
interface/src/VoxelFade.cpp
Normal file
59
interface/src/VoxelFade.cpp
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
//
|
||||||
|
// VoxelFade.cpp
|
||||||
|
// interface
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 8/6/13.
|
||||||
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <gl.h> // Header File For The OpenGL32 Library
|
||||||
|
#include <GLUT/GLUT.h>
|
||||||
|
|
||||||
|
#include <VoxelConstants.h>
|
||||||
|
|
||||||
|
#include "VoxelFade.h"
|
||||||
|
|
||||||
|
const float VoxelFade::FADE_OUT_START = 0.5f;
|
||||||
|
const float VoxelFade::FADE_OUT_END = 0.0f;
|
||||||
|
const float VoxelFade::FADE_OUT_STEP = -0.005f;
|
||||||
|
const float VoxelFade::FADE_IN_START = 0.0f;
|
||||||
|
const float VoxelFade::FADE_IN_END = 0.5f;
|
||||||
|
const float VoxelFade::FADE_IN_STEP = 0.005f;
|
||||||
|
const float VoxelFade::DEFAULT_RED = 0.5f;
|
||||||
|
const float VoxelFade::DEFAULT_GREEN = 0.5f;
|
||||||
|
const float VoxelFade::DEFAULT_BLUE = 0.5f;
|
||||||
|
|
||||||
|
VoxelFade::VoxelFade(FadeDirection direction, float red, float green, float blue) :
|
||||||
|
direction(direction),
|
||||||
|
red(red),
|
||||||
|
green(green),
|
||||||
|
blue(blue)
|
||||||
|
{
|
||||||
|
opacity = (direction == FADE_OUT) ? FADE_OUT_START : FADE_IN_START;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VoxelFade::render() {
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glPushMatrix();
|
||||||
|
glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE);
|
||||||
|
glColor4f(red, green, blue, opacity);
|
||||||
|
glTranslatef(voxelDetails.x + voxelDetails.s * 0.5f,
|
||||||
|
voxelDetails.y + voxelDetails.s * 0.5f,
|
||||||
|
voxelDetails.z + voxelDetails.s * 0.5f);
|
||||||
|
glLineWidth(1.0f);
|
||||||
|
glutSolidCube(voxelDetails.s);
|
||||||
|
glLineWidth(1.0f);
|
||||||
|
glPopMatrix();
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
|
||||||
|
opacity += (direction == FADE_OUT) ? FADE_OUT_STEP : FADE_IN_STEP;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VoxelFade::isDone() const {
|
||||||
|
if (direction == FADE_OUT) {
|
||||||
|
return opacity <= FADE_OUT_END;
|
||||||
|
} else {
|
||||||
|
return opacity >= FADE_IN_END;
|
||||||
|
}
|
||||||
|
return true; // unexpected case, assume we're done
|
||||||
|
}
|
43
interface/src/VoxelFade.h
Normal file
43
interface/src/VoxelFade.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// VoxelFade.h
|
||||||
|
// interface
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 8/6/13.
|
||||||
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __interface__VoxelFade__
|
||||||
|
#define __interface__VoxelFade__
|
||||||
|
|
||||||
|
#include <OctalCode.h> // for VoxelPositionSize
|
||||||
|
|
||||||
|
class VoxelFade {
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum FadeDirection { FADE_OUT, FADE_IN};
|
||||||
|
static const float FADE_OUT_START;
|
||||||
|
static const float FADE_OUT_END;
|
||||||
|
static const float FADE_OUT_STEP;
|
||||||
|
static const float FADE_IN_START;
|
||||||
|
static const float FADE_IN_END;
|
||||||
|
static const float FADE_IN_STEP;
|
||||||
|
static const float DEFAULT_RED;
|
||||||
|
static const float DEFAULT_GREEN;
|
||||||
|
static const float DEFAULT_BLUE;
|
||||||
|
|
||||||
|
VoxelPositionSize voxelDetails;
|
||||||
|
FadeDirection direction;
|
||||||
|
float opacity;
|
||||||
|
|
||||||
|
float red;
|
||||||
|
float green;
|
||||||
|
float blue;
|
||||||
|
|
||||||
|
VoxelFade(FadeDirection direction = FADE_OUT, float red = DEFAULT_RED,
|
||||||
|
float green = DEFAULT_GREEN, float blue = DEFAULT_BLUE);
|
||||||
|
|
||||||
|
void render();
|
||||||
|
bool isDone() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __interface__VoxelFade__
|
|
@ -37,7 +37,7 @@ float * firstVertexForCode(unsigned char * octalCode);
|
||||||
void copyFirstVertexForCode(unsigned char * octalCode, float* output);
|
void copyFirstVertexForCode(unsigned char * octalCode, float* output);
|
||||||
|
|
||||||
struct VoxelPositionSize {
|
struct VoxelPositionSize {
|
||||||
float x,y,z,s;
|
float x, y, z, s;
|
||||||
};
|
};
|
||||||
void voxelDetailsForCode(unsigned char * octalCode, VoxelPositionSize& voxelPositionSize);
|
void voxelDetailsForCode(unsigned char * octalCode, VoxelPositionSize& voxelPositionSize);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <OctalCode.h>
|
#include <OctalCode.h>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
// this is where the coordinate system is represented
|
// this is where the coordinate system is represented
|
||||||
const glm::vec3 IDENTITY_RIGHT = glm::vec3( 1.0f, 0.0f, 0.0f);
|
const glm::vec3 IDENTITY_RIGHT = glm::vec3( 1.0f, 0.0f, 0.0f);
|
||||||
|
|
Loading…
Reference in a new issue