mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
send X texture to renderer
This commit is contained in:
parent
8d6e7bace0
commit
8d2aacb46d
3 changed files with 42 additions and 3 deletions
|
@ -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) {
|
||||
|
|
|
@ -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<DeferredLightingEffect>()->bindSimpleProgram(batch);
|
||||
DependencyManager::get<DeferredLightingEffect>()->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<TextureCache>()->getTexture(_xTextureURL);
|
||||
}
|
||||
if (!_yTextureURL.isEmpty() && !_yTexture) {
|
||||
_yTexture = DependencyManager::get<TextureCache>()->getTexture(_yTextureURL);
|
||||
}
|
||||
if (!_zTextureURL.isEmpty() && !_zTexture) {
|
||||
_zTexture = DependencyManager::get<TextureCache>()->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);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#define hifi_RenderablePolyVoxEntityItem_h
|
||||
|
||||
#include <PolyVoxCore/SimpleVolume.h>
|
||||
#include <TextureCache.h>
|
||||
|
||||
#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<QVector<glm::vec3>> _points; // XXX
|
||||
|
||||
NetworkTexturePointer _xTexture;
|
||||
NetworkTexturePointer _yTexture;
|
||||
NetworkTexturePointer _zTexture;
|
||||
|
||||
int _onCount = 0; // how many non-zero voxels are in _volData
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue