mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
attempt to make sure the ray that picks against polyvox entities is long enough
This commit is contained in:
parent
386b3301f4
commit
1109444c3d
2 changed files with 11 additions and 4 deletions
2
cmake/externals/tbb/CMakeLists.txt
vendored
2
cmake/externals/tbb/CMakeLists.txt
vendored
|
@ -57,8 +57,6 @@ ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
|
||||||
|
|
||||||
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||||
|
|
||||||
message("HERE in tbb")
|
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(_TBB_LIB_DIR "${SOURCE_DIR}/lib")
|
set(_TBB_LIB_DIR "${SOURCE_DIR}/lib")
|
||||||
set(_LIB_PREFIX "lib")
|
set(_LIB_PREFIX "lib")
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "EntityTreeRenderer.h"
|
#include "EntityTreeRenderer.h"
|
||||||
#include "RenderablePolyVoxEntityItem.h"
|
#include "RenderablePolyVoxEntityItem.h"
|
||||||
|
|
||||||
|
|
||||||
EntityItemPointer RenderablePolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItemPointer RenderablePolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
return EntityItemPointer(new RenderablePolyVoxEntityItem(entityID, properties));
|
return EntityItemPointer(new RenderablePolyVoxEntityItem(entityID, properties));
|
||||||
}
|
}
|
||||||
|
@ -255,8 +256,13 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o
|
||||||
PolyVox::Vector3DFloat start(originInVoxel[0], originInVoxel[1], originInVoxel[2]);
|
PolyVox::Vector3DFloat start(originInVoxel[0], originInVoxel[1], originInVoxel[2]);
|
||||||
PolyVox::Vector3DFloat pvDirection(directionInVoxel[0], directionInVoxel[1], directionInVoxel[2]);
|
PolyVox::Vector3DFloat pvDirection(directionInVoxel[0], directionInVoxel[1], directionInVoxel[2]);
|
||||||
pvDirection.normalise();
|
pvDirection.normalise();
|
||||||
// pvDirection *= 1000.0f; // Casts ray of length 1000
|
|
||||||
pvDirection *= 64.0f; // Casts ray of length 1000
|
// the PolyVox ray intersection code requires a near and far point.
|
||||||
|
glm::vec3 scale = _dimensions / _voxelVolumeSize; // meters / voxel-units
|
||||||
|
float distanceToEntity = glm::distance(origin, _position);
|
||||||
|
float largestDimension = glm::max(_dimensions[0], _dimensions[1], _dimensions[2]);
|
||||||
|
// set ray cast length to long enough to cover all of the voxel space
|
||||||
|
pvDirection *= (distanceToEntity + largestDimension) / glm::min(scale[0], scale[1], scale[2]);
|
||||||
|
|
||||||
PolyVox::RaycastResult raycastResult;
|
PolyVox::RaycastResult raycastResult;
|
||||||
RaycastFunctor callback;
|
RaycastFunctor callback;
|
||||||
|
@ -275,6 +281,8 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// compress the data in _volData and save the results. The compressed form is used during
|
||||||
|
// saves to disk and for transmission over the wire
|
||||||
void RenderablePolyVoxEntityItem::compressVolumeData() {
|
void RenderablePolyVoxEntityItem::compressVolumeData() {
|
||||||
int rawSize = _volData->getDepth() * _volData->getHeight() * _volData->getWidth();
|
int rawSize = _volData->getDepth() * _volData->getHeight() * _volData->getWidth();
|
||||||
QByteArray uncompressedData = QByteArray(rawSize, '\0');
|
QByteArray uncompressedData = QByteArray(rawSize, '\0');
|
||||||
|
@ -303,6 +311,7 @@ void RenderablePolyVoxEntityItem::compressVolumeData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// take compressed data and decompreess it into _volData.
|
||||||
void RenderablePolyVoxEntityItem::decompressVolumeData() {
|
void RenderablePolyVoxEntityItem::decompressVolumeData() {
|
||||||
int rawSize = _volData->getDepth() * _volData->getHeight() * _volData->getWidth();
|
int rawSize = _volData->getDepth() * _volData->getHeight() * _volData->getWidth();
|
||||||
QByteArray uncompressedData = QByteArray(rawSize, '\0');
|
QByteArray uncompressedData = QByteArray(rawSize, '\0');
|
||||||
|
|
Loading…
Reference in a new issue