mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 03:24:13 +02:00
Fixed compilation warnings on Mac
This commit is contained in:
parent
5f1d45d4de
commit
e85bb6fd08
6 changed files with 34 additions and 31 deletions
|
@ -32,8 +32,6 @@
|
|||
#include "RenderableModelEntityItem.h"
|
||||
#include "RenderableEntityItem.h"
|
||||
|
||||
//#define USE_FADE_EFFECT
|
||||
|
||||
static CollisionRenderMeshCache collisionMeshCache;
|
||||
|
||||
|
||||
|
@ -246,7 +244,7 @@ bool RenderableModelEntityItem::addToScene(const EntityItemPointer& self, const
|
|||
|
||||
// note: we don't mind if the model fails to add, we'll retry (in render()) until it succeeds
|
||||
_model->addToScene(scene, transaction, statusGetters);
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef MODEL_ENTITY_USE_FADE_EFFECT
|
||||
if (!_hasTransitioned) {
|
||||
transaction.addTransitionToItem(_myMetaItem, render::Transition::ELEMENT_ENTER_DOMAIN);
|
||||
_hasTransitioned = true;
|
||||
|
@ -486,7 +484,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
makeEntityItemStatusGetters(getThisPointer(), statusGetters);
|
||||
_model->addToScene(scene, transaction, statusGetters);
|
||||
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef MODEL_ENTITY_USE_FADE_EFFECT
|
||||
if (!_hasTransitioned) {
|
||||
transaction.addTransitionToItem(_myMetaItem, render::Transition::ELEMENT_ENTER_DOMAIN);
|
||||
_hasTransitioned = true;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
class Model;
|
||||
class EntityTreeRenderer;
|
||||
|
||||
//#define MODEL_ENTITY_USE_FADE_EFFECT
|
||||
|
||||
class RenderableModelEntityItem : public ModelEntityItem, RenderableEntityInterface {
|
||||
public:
|
||||
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||
|
@ -134,8 +136,9 @@ private:
|
|||
QVariantMap _originalTextures;
|
||||
bool _originalTexturesRead = false;
|
||||
bool _dimensionsInitialized = true;
|
||||
#ifdef MODEL_ENTITY_USE_FADE_EFFECT
|
||||
bool _hasTransitioned{ false };
|
||||
|
||||
#endif
|
||||
AnimationPropertyGroup _renderAnimationProperties;
|
||||
|
||||
render::ItemID _myMetaItem{ render::Item::INVALID_ITEM_ID };
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
|
||||
//#define USE_FADE_EFFECT
|
||||
#ifdef USE_FADE_EFFECT
|
||||
//#define POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
# include <FadeEffect.h>
|
||||
#endif
|
||||
|
||||
|
@ -43,7 +43,7 @@ render::ShapePipelinePointer PolyLinePayload::shapePipelineFactory(const render:
|
|||
auto VS = gpu::Shader::createVertex(std::string(paintStroke_vert));
|
||||
auto PS = gpu::Shader::createPixel(std::string(paintStroke_frag));
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(VS, PS);
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
auto fadeVS = gpu::Shader::createVertex(std::string(paintStroke_fade_vert));
|
||||
auto fadePS = gpu::Shader::createPixel(std::string(paintStroke_fade_frag));
|
||||
gpu::ShaderPointer fadeProgram = gpu::Shader::createProgram(fadeVS, fadePS);
|
||||
|
@ -52,7 +52,7 @@ render::ShapePipelinePointer PolyLinePayload::shapePipelineFactory(const render:
|
|||
slotBindings.insert(gpu::Shader::Binding(std::string("originalTexture"), PAINTSTROKE_TEXTURE_SLOT));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("polyLineBuffer"), PAINTSTROKE_UNIFORM_SLOT));
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeMaskMap"), PAINTSTROKE_TEXTURE_SLOT + 1));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeParametersBuffer"), PAINTSTROKE_UNIFORM_SLOT+1));
|
||||
gpu::Shader::makeProgram(*fadeProgram, slotBindings);
|
||||
|
@ -64,19 +64,19 @@ render::ShapePipelinePointer PolyLinePayload::shapePipelineFactory(const render:
|
|||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||
_pipeline = gpu::Pipeline::create(program, state);
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
_fadePipeline = gpu::Pipeline::create(fadeProgram, state);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
if (key.isFaded()) {
|
||||
auto fadeEffect = DependencyManager::get<FadeEffect>();
|
||||
return std::make_shared<render::ShapePipeline>(_fadePipeline, nullptr, fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter());
|
||||
} else {
|
||||
#endif
|
||||
return std::make_shared<render::ShapePipeline>(_pipeline, nullptr, nullptr, nullptr);
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ bool RenderablePolyLineEntityItem::addToScene(const EntityItemPointer& self,
|
|||
renderPayload->addStatusGetters(statusGetters);
|
||||
|
||||
transaction.resetItem(_myItem, renderPayload);
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
transaction.addTransitionToItem(_myItem, render::Transition::ELEMENT_ENTER_DOMAIN);
|
||||
#endif
|
||||
updateMesh();
|
||||
|
@ -257,7 +257,7 @@ bool RenderablePolyLineEntityItem::addToScene(const EntityItemPointer& self,
|
|||
}
|
||||
|
||||
void RenderablePolyLineEntityItem::render(RenderArgs* args) {
|
||||
#ifndef USE_FADE_EFFECT
|
||||
#ifndef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
checkFading();
|
||||
#endif
|
||||
if (_empty) {
|
||||
|
@ -295,7 +295,7 @@ void RenderablePolyLineEntityItem::render(RenderArgs* args) {
|
|||
batch.setInputFormat(_format);
|
||||
batch.setInputBuffer(0, _verticesBuffer, 0, _format->getChannels().at(0)._stride);
|
||||
|
||||
#ifndef USE_FADE_EFFECT
|
||||
#ifndef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
if (_isFading) {
|
||||
batch._glColor4f(1.0f, 1.0f, 1.0f, Interpolate::calculateFadeRatio(_fadeStartTime));
|
||||
}
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
#include <model-networking/SimpleMeshProxy.h>
|
||||
#include "ModelScriptingInterface.h"
|
||||
|
||||
//#define USE_FADE_EFFECT
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYVOX_ENTITY_USE_FADE_EFFECT
|
||||
# include <FadeEffect.h>
|
||||
#endif
|
||||
|
||||
|
@ -812,7 +811,7 @@ bool RenderablePolyVoxEntityItem::addToScene(const EntityItemPointer& self,
|
|||
renderPayload->addStatusGetters(statusGetters);
|
||||
|
||||
transaction.resetItem(_myItem, renderPayload);
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYVOX_ENTITY_USE_FADE_EFFECT
|
||||
if (_mesh && _mesh->getIndexBuffer()._buffer) {
|
||||
transaction.addTransitionToItem(_myItem, render::Transition::ELEMENT_ENTER_DOMAIN);
|
||||
_hasTransitioned = true;
|
||||
|
@ -844,7 +843,7 @@ render::ShapePipelinePointer PolyVoxPayload::shapePipelineFactory(const render::
|
|||
slotBindings.insert(gpu::Shader::Binding(std::string("xMap"), 0));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("yMap"), 1));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("zMap"), 2));
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYVOX_ENTITY_USE_FADE_EFFECT
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeMaskMap"), 3));
|
||||
#endif
|
||||
|
||||
|
@ -869,7 +868,7 @@ render::ShapePipelinePointer PolyVoxPayload::shapePipelineFactory(const render::
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYVOX_ENTITY_USE_FADE_EFFECT
|
||||
if (key.isFaded()) {
|
||||
const auto& fadeEffect = DependencyManager::get<FadeEffect>();
|
||||
if (key.isWireframe()) {
|
||||
|
@ -886,7 +885,7 @@ render::ShapePipelinePointer PolyVoxPayload::shapePipelineFactory(const render::
|
|||
else {
|
||||
return std::make_shared<render::ShapePipeline>(_pipelines[0], nullptr, nullptr, nullptr);
|
||||
}
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYVOX_ENTITY_USE_FADE_EFFECT
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1404,7 +1403,7 @@ void RenderablePolyVoxEntityItem::setMesh(model::MeshPointer mesh) {
|
|||
bonkNeighbors();
|
||||
}
|
||||
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef POLYVOX_ENTITY_USE_FADE_EFFECT
|
||||
if (!_hasTransitioned) {
|
||||
render::Transaction transaction;
|
||||
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "RenderableEntityItem.h"
|
||||
|
||||
//#define POLYVOX_ENTITY_USE_FADE_EFFECT
|
||||
|
||||
class PolyVoxPayload {
|
||||
public:
|
||||
|
||||
|
@ -177,8 +179,9 @@ private:
|
|||
gpu::Stream::FormatPointer _vertexFormat;
|
||||
bool _meshDirty { true }; // does collision-shape need to be recomputed?
|
||||
bool _meshReady { false };
|
||||
#ifdef POLYVOX_ENTITY_USE_FADE_EFFECT
|
||||
bool _hasTransitioned{ false };
|
||||
|
||||
#endif
|
||||
NetworkTexturePointer _xTexture;
|
||||
NetworkTexturePointer _yTexture;
|
||||
NetworkTexturePointer _zTexture;
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include <render-utils/simple_vert.h>
|
||||
#include <render-utils/simple_frag.h>
|
||||
|
||||
//#define USE_FADE_EFFECT
|
||||
#ifdef USE_FADE_EFFECT
|
||||
//#define SHAPE_ENTITY_USE_FADE_EFFECT
|
||||
#ifdef SHAPE_ENTITY_USE_FADE_EFFECT
|
||||
# include <FadeEffect.h>
|
||||
#endif
|
||||
|
||||
|
@ -78,7 +78,7 @@ void RenderableShapeEntityItem::setUserData(const QString& value) {
|
|||
}
|
||||
|
||||
bool RenderableShapeEntityItem::isTransparent() {
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef SHAPE_ENTITY_USE_FADE_EFFECT
|
||||
return getLocalRenderAlpha() < 1.0f;
|
||||
#else
|
||||
if (_procedural && _procedural->isFading()) {
|
||||
|
@ -107,7 +107,7 @@ namespace render {
|
|||
|
||||
template <> const ShapeKey shapeGetShapeKey(const ShapePayload::Pointer& payload) {
|
||||
auto shapeKey = ShapeKey::Builder();
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef SHAPE_ENTITY_USE_FADE_EFFECT
|
||||
shapeKey.withCustom(GeometryCache::CUSTOM_PIPELINE_NUMBER);
|
||||
#endif
|
||||
auto entity = payload->_entity;
|
||||
|
@ -129,7 +129,7 @@ bool RenderableShapeEntityItem::addToScene(const EntityItemPointer& self, const
|
|||
renderPayload->addStatusGetters(statusGetters);
|
||||
|
||||
transaction.resetItem(_myItem, renderPayload);
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef SHAPE_ENTITY_USE_FADE_EFFECT
|
||||
transaction.addTransitionToItem(_myItem, render::Transition::ELEMENT_ENTER_DOMAIN);
|
||||
#endif
|
||||
return true;
|
||||
|
@ -139,7 +139,7 @@ void RenderableShapeEntityItem::render(RenderArgs* args) {
|
|||
PerformanceTimer perfTimer("RenderableShapeEntityItem::render");
|
||||
//Q_ASSERT(getType() == EntityTypes::Shape);
|
||||
Q_ASSERT(args->_batch);
|
||||
#ifndef USE_FADE_EFFECT
|
||||
#ifndef SHAPE_ENTITY_USE_FADE_EFFECT
|
||||
checkFading();
|
||||
#endif
|
||||
|
||||
|
@ -169,7 +169,7 @@ void RenderableShapeEntityItem::render(RenderArgs* args) {
|
|||
if (_procedural->ready()) {
|
||||
_procedural->prepare(batch, getPosition(), getDimensions(), getOrientation());
|
||||
auto outColor = _procedural->getColor(color);
|
||||
#ifndef USE_FADE_EFFECT
|
||||
#ifndef SHAPE_ENTITY_USE_FADE_EFFECT
|
||||
outColor.a *= _procedural->isFading() ? Interpolate::calculateFadeRatio(_procedural->getFadeStartTime()) : 1.0f;
|
||||
#endif
|
||||
batch._glColor4f(outColor.r, outColor.g, outColor.b, outColor.a);
|
||||
|
@ -181,7 +181,7 @@ void RenderableShapeEntityItem::render(RenderArgs* args) {
|
|||
} else {
|
||||
// FIXME, support instanced multi-shape rendering using multidraw indirect
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
#ifdef USE_FADE_EFFECT
|
||||
#ifdef SHAPE_ENTITY_USE_FADE_EFFECT
|
||||
auto shapeKey = render::ShapeKey(args->_itemShapeKey);
|
||||
|
||||
assert(args->_shapePipeline != nullptr);
|
||||
|
|
Loading…
Reference in a new issue