renamed VoxelProjectedShadow class

This commit is contained in:
ZappoMan 2013-06-18 12:01:01 -07:00
parent 9a22db28a3
commit 8b18ee6844
8 changed files with 30 additions and 30 deletions

View file

@ -1202,7 +1202,7 @@ bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraDat
AABox voxelBox = node->getAABox();
voxelBox.scale(TREE_SCALE);
VoxelProjectedShadow* voxelShadow = new VoxelProjectedShadow(args->viewFrustum->getProjectedShadow(voxelBox));
VoxelProjectedPolygon* voxelShadow = new VoxelProjectedPolygon(args->viewFrustum->getProjectedShadow(voxelBox));
// If we're not all in view, then ignore it, and just return. But keep searching...
if (!voxelShadow->getAllInView()) {
@ -1239,7 +1239,7 @@ bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraDat
AABox voxelBox = node->getAABox();
voxelBox.scale(TREE_SCALE);
VoxelProjectedShadow* voxelShadow = new VoxelProjectedShadow(args->viewFrustum->getProjectedShadow(voxelBox));
VoxelProjectedPolygon* voxelShadow = new VoxelProjectedPolygon(args->viewFrustum->getProjectedShadow(voxelBox));
// If we're not all in view, then ignore it, and just return. But keep searching...
if (!voxelShadow->getAllInView()) {

View file

@ -96,12 +96,12 @@ BoundingBox CoverageMap::getChildBoundingBox(int childIndex) {
void CoverageMap::growPolygonArray() {
VoxelProjectedShadow** newPolygons = new VoxelProjectedShadow*[_polygonArraySize + DEFAULT_GROW_SIZE];
VoxelProjectedPolygon** newPolygons = new VoxelProjectedPolygon*[_polygonArraySize + DEFAULT_GROW_SIZE];
float* newDistances = new float[_polygonArraySize + DEFAULT_GROW_SIZE];
if (_polygons) {
memcpy(newPolygons, _polygons, sizeof(VoxelProjectedShadow*) * _polygonCount);
memcpy(newPolygons, _polygons, sizeof(VoxelProjectedPolygon*) * _polygonCount);
delete[] _polygons;
memcpy(newDistances, _polygonDistances, sizeof(float) * _polygonCount);
delete[] _polygonDistances;
@ -117,7 +117,7 @@ int CoverageMap::_totalPolygons = 0;
// just handles storage in the array, doesn't test for occlusion or
// determining if this is the correct map to store in!
void CoverageMap::storeInArray(VoxelProjectedShadow* polygon) {
void CoverageMap::storeInArray(VoxelProjectedPolygon* polygon) {
_totalPolygons++;
@ -142,11 +142,11 @@ void CoverageMap::storeInArray(VoxelProjectedShadow* polygon) {
// possible results = STORED/NOT_STORED, OCCLUDED, DOESNT_FIT
CoverageMap::StorageResult CoverageMap::checkMap(VoxelProjectedShadow* polygon, bool storeIt) {
CoverageMap::StorageResult CoverageMap::checkMap(VoxelProjectedPolygon* polygon, bool storeIt) {
if (_isRoot || _myBoundingBox.contains(polygon->getBoundingBox())) {
// check to make sure this polygon isn't occluded by something at this level
for (int i = 0; i < _polygonCount; i++) {
VoxelProjectedShadow* polygonAtThisLevel = _polygons[i];
VoxelProjectedPolygon* polygonAtThisLevel = _polygons[i];
// Check to make sure that the polygon in question is "behind" the polygon in the list
// otherwise, we don't need to test it's occlusion (although, it means we've potentially
// added an item previously that may be occluded??? Is that possible? Maybe not, because two

View file

@ -1,5 +1,5 @@
//
// CoverageMap.h - 2D CoverageMap Quad tree for storage of VoxelProjectedShadows
// CoverageMap.h - 2D CoverageMap Quad tree for storage of VoxelProjectedPolygons
// hifi
//
// Added by Brad Hefta-Gaub on 06/11/13.
@ -9,7 +9,7 @@
#define _COVERAGE_MAP_
#include <glm/glm.hpp>
#include "VoxelProjectedShadow.h"
#include "VoxelProjectedPolygon.h"
class CoverageMap {
@ -23,7 +23,7 @@ public:
~CoverageMap();
typedef enum {STORED, OCCLUDED, DOESNT_FIT, NOT_STORED} StorageResult;
StorageResult checkMap(VoxelProjectedShadow* polygon, bool storeIt = true);
StorageResult checkMap(VoxelProjectedPolygon* polygon, bool storeIt = true);
BoundingBox getChildBoundingBox(int childIndex);
@ -32,14 +32,14 @@ public:
private:
void init();
void growPolygonArray();
void storeInArray(VoxelProjectedShadow* polygon);
void storeInArray(VoxelProjectedPolygon* polygon);
bool _isRoot; // is this map the root, if so, it never returns DOESNT_FIT
BoundingBox _myBoundingBox;
bool _managePolygons; // will the coverage map delete the polygons on destruct
int _polygonCount; // how many polygons at this level
int _polygonArraySize; // how much room is there to store polygons at this level
VoxelProjectedShadow** _polygons;
VoxelProjectedPolygon** _polygons;
float* _polygonDistances;
CoverageMap* _childMaps[NUMBER_OF_CHILDREN];

View file

@ -503,7 +503,7 @@ const int hullVertexLookup[MAX_POSSIBLE_COMBINATIONS][MAX_SHADOW_VERTEX_COUNT+1]
{6, TOP_RIGHT_NEAR, TOP_RIGHT_FAR, BOTTOM_RIGHT_FAR, BOTTOM_LEFT_FAR, BOTTOM_LEFT_NEAR, TOP_LEFT_NEAR}, // back, top, left
};
VoxelProjectedShadow ViewFrustum::getProjectedShadow(const AABox& box) const {
VoxelProjectedPolygon ViewFrustum::getProjectedShadow(const AABox& box) const {
glm::vec3 bottomNearRight = box.getCorner();
glm::vec3 topFarLeft = box.getCorner() + box.getSize();
int lookUp = ((_position.x < bottomNearRight.x) ) // 1 = right | compute 6-bit
@ -515,7 +515,7 @@ VoxelProjectedShadow ViewFrustum::getProjectedShadow(const AABox& box) const {
int vertexCount = hullVertexLookup[lookUp][0]; //look up number of vertices
VoxelProjectedShadow shadow(vertexCount);
VoxelProjectedPolygon shadow(vertexCount);
bool pointInView = true;
bool allPointsInView = false; // assume the best, but wait till we know we have a vertex

View file

@ -15,7 +15,7 @@
#include <glm/gtc/quaternion.hpp>
#include "Plane.h"
#include "AABox.h"
#include "VoxelProjectedShadow.h"
#include "VoxelProjectedPolygon.h"
const float DEFAULT_KEYHOLE_RADIUS = 2.0f;
@ -89,7 +89,7 @@ public:
void printDebugDetails() const;
glm::vec2 projectPoint(glm::vec3 point, bool& pointInView) const;
VoxelProjectedShadow getProjectedShadow(const AABox& box) const;
VoxelProjectedPolygon getProjectedShadow(const AABox& box) const;
private:

View file

@ -1,11 +1,11 @@
//
// VoxelProjectedShadow.cpp - The projected shadow (on the 2D view plane) for a voxel
// VoxelProjectedPolygon.cpp - The projected shadow (on the 2D view plane) for a voxel
// hifi
//
// Added by Brad Hefta-Gaub on 06/11/13.
//
#include "VoxelProjectedShadow.h"
#include "VoxelProjectedPolygon.h"
#include "GeometryUtil.h"
#include "Log.h"
@ -29,7 +29,7 @@ void BoundingBox::printDebugDetails(const char* label) const {
}
void VoxelProjectedShadow::setVertex(int vertex, const glm::vec2& point) {
void VoxelProjectedPolygon::setVertex(int vertex, const glm::vec2& point) {
_vertices[vertex] = point;
// keep track of our bounding box
@ -48,7 +48,7 @@ void VoxelProjectedShadow::setVertex(int vertex, const glm::vec2& point) {
};
bool VoxelProjectedShadow::occludes(const VoxelProjectedShadow& occludee) const {
bool VoxelProjectedPolygon::occludes(const VoxelProjectedPolygon& occludee) const {
// if we are completely out of view, then we definitely don't occlude!
// if the occludee is completely out of view, then we also don't occlude it
@ -80,7 +80,7 @@ bool VoxelProjectedShadow::occludes(const VoxelProjectedShadow& occludee) const
return true;
}
bool VoxelProjectedShadow::pointInside(const glm::vec2& point) const {
bool VoxelProjectedPolygon::pointInside(const glm::vec2& point) const {
// first check the bounding boxes, the point mush be fully within the boounding box of this shadow
if ((point.x > getMaxX()) ||
(point.y > getMaxY()) ||
@ -113,8 +113,8 @@ bool VoxelProjectedShadow::pointInside(const glm::vec2& point) const {
return ((intersections & 1) == 1);
}
void VoxelProjectedShadow::printDebugDetails() const {
printf("VoxelProjectedShadow...");
void VoxelProjectedPolygon::printDebugDetails() const {
printf("VoxelProjectedPolygon...");
printf(" minX=%f maxX=%f minY=%f maxY=%f\n", getMinX(), getMaxX(), getMinY(), getMaxY());
printf(" vertex count=%d distance=%f\n", getVertexCount(), getDistance());
for (int i = 0; i < getVertexCount(); i++) {

View file

@ -1,5 +1,5 @@
//
// VoxelProjectedShadow.h - The projected shadow (on the 2D view plane) for a voxel
// VoxelProjectedPolygon.h - The projected shadow (on the 2D view plane) for a voxel
// hifi
//
// Added by Brad Hefta-Gaub on 06/11/13.
@ -24,16 +24,16 @@ public:
void printDebugDetails(const char* label=NULL) const;
};
class VoxelProjectedShadow {
class VoxelProjectedPolygon {
public:
VoxelProjectedShadow(int vertexCount = 0) :
VoxelProjectedPolygon(int vertexCount = 0) :
_vertexCount(vertexCount),
_maxX(-FLT_MAX), _maxY(-FLT_MAX), _minX(FLT_MAX), _minY(FLT_MAX),
_distance(0)
{ };
~VoxelProjectedShadow() { };
~VoxelProjectedPolygon() { };
const ShadowVertices& getVerices() const { return _vertices; };
const glm::vec2& getVertex(int i) const { return _vertices[i]; };
void setVertex(int vertex, const glm::vec2& point);
@ -48,7 +48,7 @@ public:
bool getAllInView() const { return _allInView; };
void setAllInView(bool allInView) { _allInView = allInView; };
bool occludes(const VoxelProjectedShadow& occludee) const;
bool occludes(const VoxelProjectedPolygon& occludee) const;
bool pointInside(const glm::vec2& point) const;
float getMaxX() const { return _maxX; }

View file

@ -1125,7 +1125,7 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp
//node->printDebugDetails("upper section, params.wantOcclusionCulling... node=");
AABox voxelBox = node->getAABox();
voxelBox.scale(TREE_SCALE);
VoxelProjectedShadow* voxelShadow = new VoxelProjectedShadow(params.viewFrustum->getProjectedShadow(voxelBox));
VoxelProjectedPolygon* voxelShadow = new VoxelProjectedPolygon(params.viewFrustum->getProjectedShadow(voxelBox));
// In order to check occlusion culling, the shadow has to be "all in view" otherwise, we will ignore occlusion
// culling and proceed as normal
@ -1241,7 +1241,7 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp
AABox voxelBox = childNode->getAABox();
voxelBox.scale(TREE_SCALE);
VoxelProjectedShadow* voxelShadow = new VoxelProjectedShadow(params.viewFrustum->getProjectedShadow(voxelBox));
VoxelProjectedPolygon* voxelShadow = new VoxelProjectedPolygon(params.viewFrustum->getProjectedShadow(voxelBox));
// In order to check occlusion culling, the shadow has to be "all in view" otherwise, we will ignore occlusion
// culling and proceed as normal