diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html
index cb680dd83a..a2358b40d5 100644
--- a/examples/html/entityProperties.html
+++ b/examples/html/entityProperties.html
@@ -618,7 +618,8 @@
elVoxelVolumeSizeZ.value = properties.voxelVolumeSize.z.toFixed(2);
elVoxelSurfaceStyle.value = properties.voxelSurfaceStyle;
elXTextureURL.value = properties.xTextureURL;
-
+ elYTextureURL.value = properties.yTextureURL;
+ elZTextureURL.value = properties.zTextureURL;
}
if (selected) {
diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp
index 81e4654840..5e18f8db55 100644
--- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp
@@ -45,7 +45,10 @@ EntityItemPointer RenderablePolyVoxEntityItem::factory(const EntityItemID& entit
RenderablePolyVoxEntityItem::RenderablePolyVoxEntityItem(const EntityItemID& entityItemID,
const EntityItemProperties& properties) :
- PolyVoxEntityItem(entityItemID, properties) {
+ PolyVoxEntityItem(entityItemID, properties),
+ _xTexture(nullptr),
+ _yTexture(nullptr),
+ _zTexture(nullptr) {
model::Mesh* mesh = new model::Mesh();
model::MeshPointer meshPtr(mesh);
@@ -410,7 +413,7 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
auto mesh = _modelGeometry.getMesh();
Q_ASSERT(args->_batch);
gpu::Batch& batch = *args->_batch;
- DependencyManager::get()->bindSimpleProgram(batch);
+ DependencyManager::get()->bindSimpleProgram(batch, true);
batch.setModelTransform(transform);
batch.setInputFormat(mesh->getVertexFormat());
batch.setInputBuffer(gpu::Stream::POSITION, mesh->getVertexBuffer());
@@ -421,6 +424,20 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
batch.setIndexBuffer(gpu::UINT32, mesh->getIndexBuffer()._buffer, 0);
batch.drawIndexed(gpu::TRIANGLES, mesh->getNumIndices(), 0);
+ if (!_xTextureURL.isEmpty() && !_xTexture) {
+ _xTexture = DependencyManager::get()->getTexture(_xTextureURL);
+ }
+ if (!_yTextureURL.isEmpty() && !_yTexture) {
+ _yTexture = DependencyManager::get()->getTexture(_yTextureURL);
+ }
+ if (!_zTextureURL.isEmpty() && !_zTexture) {
+ _zTexture = DependencyManager::get()->getTexture(_zTextureURL);
+ }
+
+ if (_xTexture) {
+ batch.setResourceTexture(0, _xTexture->getGPUTexture());
+ }
+
RenderableDebugableEntityItem::render(this, args);
}
@@ -708,3 +725,15 @@ void RenderablePolyVoxEntityItem::computeShapeInfo(ShapeInfo& info) {
info.setParams(type, collisionModelDimensions, QString(b64));
info.setConvexHulls(_points);
}
+
+void RenderablePolyVoxEntityItem::setXTextureURL(QString xTextureURL) {
+ PolyVoxEntityItem::setXTextureURL(xTextureURL);
+}
+
+void RenderablePolyVoxEntityItem::setYTextureURL(QString yTextureURL) {
+ PolyVoxEntityItem::setYTextureURL(yTextureURL);
+}
+
+void RenderablePolyVoxEntityItem::setZTextureURL(QString zTextureURL) {
+ PolyVoxEntityItem::setZTextureURL(zTextureURL);
+}
diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h
index 1097ad21be..d3fac2a7a9 100644
--- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h
+++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h
@@ -13,6 +13,7 @@
#define hifi_RenderablePolyVoxEntityItem_h
#include
+#include
#include "PolyVoxEntityItem.h"
#include "RenderableDebugableEntityItem.h"
@@ -72,6 +73,10 @@ public:
SIMPLE_RENDERABLE();
+ virtual void setXTextureURL(QString xTextureURL);
+ virtual void setYTextureURL(QString yTextureURL);
+ virtual void setZTextureURL(QString zTextureURL);
+
protected:
virtual void updateVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle);
@@ -90,6 +95,10 @@ private:
QVector> _points; // XXX
+ NetworkTexturePointer _xTexture;
+ NetworkTexturePointer _yTexture;
+ NetworkTexturePointer _zTexture;
+
int _onCount = 0; // how many non-zero voxels are in _volData
};