mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Clean up and trying to get ready for merge
This commit is contained in:
parent
873cabe284
commit
2e9076c71e
9 changed files with 13 additions and 127 deletions
|
@ -1483,7 +1483,7 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
|||
_skeletonModelChangeCount++;
|
||||
int skeletonModelChangeCount = _skeletonModelChangeCount;
|
||||
Avatar::setSkeletonModelURL(skeletonModelURL);
|
||||
_skeletonModel->setViewMask(render::ItemKey::TAG_BITS_NONE);
|
||||
_skeletonModel->setViewMask(Model::NoView);
|
||||
_skeletonModel->setGroupCulled(true);
|
||||
_skeletonModel->setVisibleInScene(true, qApp->getMain3DScene());
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ const glm::vec3 HAND_TO_PALM_OFFSET(0.0f, 0.12f, 0.08f);
|
|||
|
||||
namespace render {
|
||||
template <> const ItemKey payloadGetKey(const AvatarSharedPointer& avatar) {
|
||||
ItemKey::Builder keyBuilder = ItemKey::Builder::opaqueShape().withTypeMeta().withTagBits(ItemKey::TAG_BITS_0 | ItemKey::TAG_BITS_1).withMetaCullGroup();
|
||||
ItemKey::Builder keyBuilder = ItemKey::Builder::opaqueShape().withTypeMeta().withTagBits(Model::AllViews).withMetaCullGroup();
|
||||
auto avatarPtr = static_pointer_cast<Avatar>(avatar);
|
||||
auto model = avatarPtr->getSkeletonModel();
|
||||
if (!avatarPtr->getEnableMeshVisible()) {
|
||||
|
|
|
@ -74,7 +74,6 @@ public:
|
|||
virtual void instantiableAvatar() = 0;
|
||||
|
||||
typedef render::Payload<AvatarData> Payload;
|
||||
// typedef std::shared_ptr<render::Item::PayloadInterface> PayloadPointer;
|
||||
|
||||
void init();
|
||||
void updateAvatarEntities();
|
||||
|
|
|
@ -1387,20 +1387,19 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
entity->stopModelOverrideIfNoParent();
|
||||
|
||||
// Default behavior for model is to not be visible in main view if cauterized (aka parented to the avatar's neck joint)
|
||||
uint32_t viewTaskBits = _cauterized ?
|
||||
render::ItemKey::TAG_BITS_1 : // draw in every view except the main one (view zero)
|
||||
render::ItemKey::TAG_BITS_ALL; // draw in all views
|
||||
auto viewMask = _cauterized ?
|
||||
Model::SecondaryView : // draw in every view except the main one (view zero)
|
||||
Model::AllViews; // draw in all views
|
||||
|
||||
if (model->isVisible() != _visible) {
|
||||
// FIXME: this seems like it could be optimized if we tracked our last known visible state in
|
||||
// the renderable item. As it stands now the model checks it's visible/invisible state
|
||||
// so most of the time we don't do anything in this function.
|
||||
// model->setVisibleInScene(_visible, scene, viewTaskBits, false);
|
||||
model->setVisibleInScene(_visible, scene);
|
||||
}
|
||||
|
||||
if (model->getViewMask() != viewTaskBits) {
|
||||
model->setViewMask(viewTaskBits, scene);
|
||||
if (model->getViewMask() != viewMask) {
|
||||
model->setViewMask(viewMask, scene);
|
||||
}
|
||||
|
||||
// TODO? early exit here when not visible?
|
||||
|
|
|
@ -215,12 +215,8 @@ void CauterizedModel::updateRenderItems() {
|
|||
modelTransform.setRotation(self->getRotation());
|
||||
|
||||
bool isWireframe = self->isWireframe();
|
||||
bool isVisible = self->isVisible();
|
||||
bool canCastShadow = self->canCastShadow();
|
||||
bool isLayeredInFront = self->isLayeredInFront();
|
||||
bool isLayeredInHUD = self->isLayeredInHUD();
|
||||
auto renderItemKeyGlobalFlags = self->getRenderItemKeyGlobalFlags();
|
||||
bool enableCauterization = self->getEnableCauterization();
|
||||
bool isGroupCulled = self->isGroupCulled();
|
||||
|
||||
render::Transaction transaction;
|
||||
for (int i = 0; i < (int)self->_modelMeshRenderItemIDs.size(); i++) {
|
||||
|
@ -235,7 +231,7 @@ void CauterizedModel::updateRenderItems() {
|
|||
bool useDualQuaternionSkinning = self->getUseDualQuaternionSkinning();
|
||||
|
||||
transaction.updateItem<CauterizedMeshPartPayload>(itemID, [modelTransform, meshState, useDualQuaternionSkinning, cauterizedMeshState, invalidatePayloadShapeKey,
|
||||
isWireframe, isVisible, isLayeredInFront, isLayeredInHUD, canCastShadow, enableCauterization, isGroupCulled](CauterizedMeshPartPayload& data) {
|
||||
isWireframe, renderItemKeyGlobalFlags, enableCauterization](CauterizedMeshPartPayload& data) {
|
||||
if (useDualQuaternionSkinning) {
|
||||
data.updateClusterBuffer(meshState.clusterDualQuaternions,
|
||||
cauterizedMeshState.clusterDualQuaternions);
|
||||
|
@ -277,8 +273,7 @@ void CauterizedModel::updateRenderItems() {
|
|||
data.updateTransformForCauterizedMesh(renderTransform);
|
||||
|
||||
data.setEnableCauterization(enableCauterization);
|
||||
data.updateKey(isVisible, isLayeredInFront || isLayeredInHUD, canCastShadow, render::ItemKey::TAG_BITS_ALL, isGroupCulled);
|
||||
// data.setLayer(isLayeredInFront, isLayeredInHUD);
|
||||
data.updateKey(renderItemKeyGlobalFlags);
|
||||
data.setShapeKey(invalidatePayloadShapeKey, isWireframe, useDualQuaternionSkinning);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -79,39 +79,6 @@ void MeshPartPayload::removeMaterial(graphics::MaterialPointer material) {
|
|||
_drawMaterials.remove(material);
|
||||
}
|
||||
|
||||
void MeshPartPayload::updateKey(bool isVisible, uint8_t layer, bool canCastShadow, uint8_t tagBits, bool isGroupCulled) {
|
||||
ItemKey::Builder builder;
|
||||
builder.withTypeShape();
|
||||
|
||||
if (!isVisible) {
|
||||
builder.withInvisible();
|
||||
}
|
||||
|
||||
builder.withTagBits(tagBits);
|
||||
|
||||
// if (layer) {
|
||||
// builder.withLayered();
|
||||
builder.withLayer((ItemKey::Layer) layer);
|
||||
// }
|
||||
|
||||
if (canCastShadow) {
|
||||
builder.withShadowCaster();
|
||||
}
|
||||
|
||||
if (isGroupCulled) {
|
||||
builder.withSubMetaCulled();
|
||||
}
|
||||
|
||||
if (topMaterialExists()) {
|
||||
auto matKey = _drawMaterials.top().material->getKey();
|
||||
if (matKey.isTranslucent()) {
|
||||
builder.withTransparent();
|
||||
}
|
||||
}
|
||||
|
||||
_itemKey = builder.build();
|
||||
}
|
||||
|
||||
void MeshPartPayload::updateKey(const render::ItemKey& key) {
|
||||
ItemKey::Builder builder(key);
|
||||
builder.withTypeShape();
|
||||
|
@ -215,13 +182,6 @@ template <> const Item::Bound payloadGetBound(const ModelMeshPartPayload::Pointe
|
|||
}
|
||||
return Item::Bound();
|
||||
}
|
||||
/*
|
||||
template <> int payloadGetLayer(const ModelMeshPartPayload::Pointer& payload) {
|
||||
if (payload) {
|
||||
return payload->getLayer();
|
||||
}
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
template <> const ShapeKey shapeGetShapeKey(const ModelMeshPartPayload::Pointer& payload) {
|
||||
if (payload) {
|
||||
|
@ -348,42 +308,6 @@ void ModelMeshPartPayload::updateTransformForSkinnedMesh(const Transform& render
|
|||
}
|
||||
|
||||
// Note that this method is called for models but not for shapes
|
||||
void ModelMeshPartPayload::updateKey(bool isVisible, uint8_t layer, bool canCastShadow, uint8_t tagBits, bool isGroupCulled) {
|
||||
ItemKey::Builder builder;
|
||||
builder.withTypeShape();
|
||||
|
||||
if (!isVisible) {
|
||||
builder.withInvisible();
|
||||
}
|
||||
|
||||
builder.withTagBits(tagBits);
|
||||
|
||||
// if (isLayered) {
|
||||
builder.withLayer((ItemKey::Layer) layer);
|
||||
// }
|
||||
|
||||
if (canCastShadow) {
|
||||
builder.withShadowCaster();
|
||||
}
|
||||
|
||||
if (isGroupCulled) {
|
||||
builder.withSubMetaCulled();
|
||||
}
|
||||
|
||||
if (_isBlendShaped || _isSkinned) {
|
||||
builder.withDeformed();
|
||||
}
|
||||
|
||||
if (topMaterialExists()) {
|
||||
auto matKey = _drawMaterials.top().material->getKey();
|
||||
if (matKey.isTranslucent()) {
|
||||
builder.withTransparent();
|
||||
}
|
||||
}
|
||||
|
||||
_itemKey = builder.build();
|
||||
}
|
||||
|
||||
void ModelMeshPartPayload::updateKey(const render::ItemKey& key) {
|
||||
ItemKey::Builder builder(key);
|
||||
builder.withTypeShape();
|
||||
|
@ -402,22 +326,6 @@ void ModelMeshPartPayload::updateKey(const render::ItemKey& key) {
|
|||
_itemKey = builder.build();
|
||||
}
|
||||
|
||||
/*
|
||||
void ModelMeshPartPayload::setLayer(bool isLayeredInFront, bool isLayeredInHUD) {
|
||||
if (isLayeredInFront) {
|
||||
_layer = Item::LAYER_3D_FRONT;
|
||||
} else if (isLayeredInHUD) {
|
||||
_layer = Item::LAYER_3D_HUD;
|
||||
} else {
|
||||
_layer = Item::LAYER_3D;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
int ModelMeshPartPayload::getLayer() const {
|
||||
return _layer;
|
||||
}*/
|
||||
|
||||
void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe, bool useDualQuaternionSkinning) {
|
||||
if (invalidateShapeKey) {
|
||||
_shapeKey = ShapeKey::Builder::invalid();
|
||||
|
|
|
@ -32,7 +32,6 @@ public:
|
|||
typedef render::Payload<MeshPartPayload> Payload;
|
||||
typedef Payload::DataPointer Pointer;
|
||||
|
||||
virtual void updateKey(bool isVisible, uint8_t layer, bool canCastShadow, uint8_t tagBits, bool isGroupCulled = false);
|
||||
virtual void updateKey(const render::ItemKey& key);
|
||||
|
||||
virtual void updateMeshPart(const std::shared_ptr<const graphics::Mesh>& drawMesh, int partIndex);
|
||||
|
@ -96,7 +95,6 @@ public:
|
|||
|
||||
void notifyLocationChanged() override;
|
||||
|
||||
void updateKey(bool isVisible, uint8_t layer, bool canCastShadow, uint8_t tagBits, bool isGroupCulled = false) override;
|
||||
void updateKey(const render::ItemKey& key) override;
|
||||
|
||||
// matrix palette skinning
|
||||
|
@ -107,11 +105,9 @@ public:
|
|||
void updateTransformForSkinnedMesh(const Transform& renderTransform, const Transform& boundTransform);
|
||||
|
||||
// Render Item interface
|
||||
// int getLayer() const;
|
||||
render::ShapeKey getShapeKey() const override; // shape interface
|
||||
void render(RenderArgs* args) override;
|
||||
|
||||
// void setLayer(bool isLayeredInFront, bool isLayeredInHUD);
|
||||
void setShapeKey(bool invalidateShapeKey, bool isWireframe, bool useDualQuaternionSkinning);
|
||||
|
||||
// ModelMeshPartPayload functions to perform render
|
||||
|
@ -141,13 +137,11 @@ private:
|
|||
|
||||
gpu::BufferPointer _blendedVertexBuffer;
|
||||
render::ShapeKey _shapeKey { render::ShapeKey::Builder::invalid() };
|
||||
// int _layer { render::Item::LAYER_3D };
|
||||
};
|
||||
|
||||
namespace render {
|
||||
template <> const ItemKey payloadGetKey(const ModelMeshPartPayload::Pointer& payload);
|
||||
template <> const Item::Bound payloadGetBound(const ModelMeshPartPayload::Pointer& payload);
|
||||
// template <> int payloadGetLayer(const ModelMeshPartPayload::Pointer& payload);
|
||||
template <> const ShapeKey shapeGetShapeKey(const ModelMeshPartPayload::Pointer& payload);
|
||||
template <> void payloadRender(const ModelMeshPartPayload::Pointer& payload, RenderArgs* args);
|
||||
}
|
||||
|
|
|
@ -29,12 +29,6 @@ const float Item::Status::Value::CYAN = 180.0f;
|
|||
const float Item::Status::Value::BLUE = 240.0f;
|
||||
const float Item::Status::Value::MAGENTA = 300.0f;
|
||||
|
||||
/*const int Item::LAYER_2D = 0;
|
||||
const int Item::LAYER_3D = 1;
|
||||
const int Item::LAYER_3D_FRONT = 2;
|
||||
const int Item::LAYER_3D_HUD = 3;
|
||||
*/
|
||||
|
||||
const uint8_t ItemKey::TAG_BITS_ALL { 0xFF };
|
||||
const uint8_t ItemKey::TAG_BITS_NONE { 0x00 };
|
||||
const uint8_t ItemKey::TAG_BITS_0 { 0x01 };
|
||||
|
|
|
@ -288,8 +288,6 @@ public:
|
|||
static Builder light() { return Builder().withTypeLight(); }
|
||||
static Builder meta() { return Builder().withTypeMeta(); }
|
||||
static Builder background() { return Builder().withViewSpace().withLayer(ItemKey::LAYER_BACKGROUND); }
|
||||
// static Builder opaqueShapeLayered() { return Builder().withTypeShape().withOpaque().withWorldSpace().withLayered(); }
|
||||
// static Builder transparentShapeLayered() { return Builder().withTypeShape().withTransparent().withWorldSpace().withLayered(); }
|
||||
static Builder nothing() { return Builder().withNothing(); }
|
||||
};
|
||||
|
||||
|
@ -412,7 +410,6 @@ public:
|
|||
public:
|
||||
virtual const ItemKey getKey() const = 0;
|
||||
virtual const Bound getBound() const = 0;
|
||||
// virtual int getLayer() const = 0;
|
||||
virtual void render(RenderArgs* args) = 0;
|
||||
|
||||
virtual const ShapeKey getShapeKey() const = 0;
|
||||
|
@ -460,10 +457,10 @@ public:
|
|||
// Get the layer where the item belongs, simply reflecting the key.
|
||||
int getLayer() const { return _key.getLayer(); }
|
||||
|
||||
static const uint8_t LAYER_2D{ ItemKey::LAYER_1 };
|
||||
static const uint8_t LAYER_3D{ ItemKey::LAYER_DEFAULT };
|
||||
static const uint8_t LAYER_3D_FRONT{ ItemKey::LAYER_2 };
|
||||
static const uint8_t LAYER_3D_HUD{ ItemKey::LAYER_3 };
|
||||
static const uint8_t LAYER_3D_FRONT{ ItemKey::LAYER_1 };
|
||||
static const uint8_t LAYER_3D_HUD{ ItemKey::LAYER_2 };
|
||||
static const uint8_t LAYER_2D{ ItemKey::LAYER_3 };
|
||||
|
||||
// Render call for the item
|
||||
void render(RenderArgs* args) const { _payload->render(args); }
|
||||
|
|
Loading…
Reference in a new issue