Friday night end of the day, last compilation.... almost

This commit is contained in:
samcake 2018-05-18 17:41:28 -07:00
parent aa18aaa7b1
commit 36a08fdd84
5 changed files with 40 additions and 28 deletions

View file

@ -1126,8 +1126,11 @@ void MyAvatar::setEnableDebugDrawIKChains(bool isEnabled) {
_enableDebugDrawIKChains = isEnabled; _enableDebugDrawIKChains = isEnabled;
} }
bool MyAvatar::getEnableMeshVisible() const {
return Avatar::getEnableMeshVisible();
}
void MyAvatar::setEnableMeshVisible(bool isEnabled) { void MyAvatar::setEnableMeshVisible(bool isEnabled) {
_skeletonModel->setVisibleInScene(isEnabled, qApp->getMain3DScene(), render::ItemKey::TAG_BITS_0 | render::ItemKey::TAG_BITS_1, true);
Avatar::setEnableMeshVisible(isEnabled); Avatar::setEnableMeshVisible(isEnabled);
} }

View file

@ -1159,7 +1159,7 @@ public slots:
* @function MyAvatar.getEnableMeshVisible * @function MyAvatar.getEnableMeshVisible
* @returns {boolean} <code>true</code> if your avatar's mesh is visible, otherwise <code>false</code>. * @returns {boolean} <code>true</code> if your avatar's mesh is visible, otherwise <code>false</code>.
*/ */
bool getEnableMeshVisible() const override { return _skeletonModel->isVisible(); } bool getEnableMeshVisible() const override;
/**jsdoc /**jsdoc
* Set whether or not your avatar mesh is visible. * Set whether or not your avatar mesh is visible.

View file

@ -55,7 +55,9 @@ namespace render {
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(ItemKey::TAG_BITS_0 | ItemKey::TAG_BITS_1).withMetaCullGroup();
auto avatarPtr = static_pointer_cast<Avatar>(avatar); auto avatarPtr = static_pointer_cast<Avatar>(avatar);
auto model = avatarPtr->getSkeletonModel(); auto model = avatarPtr->getSkeletonModel();
if (model && !model->isVisible()) { //if (model && !model->isVisible()) {
if (!avatarPtr->getEnableMeshVisible() && model) {
keyBuilder.withInvisible(); keyBuilder.withInvisible();
} }
return keyBuilder.build(); return keyBuilder.build();
@ -767,16 +769,14 @@ void Avatar::render(RenderArgs* renderArgs) {
void Avatar::setEnableMeshVisible(bool isEnabled) { void Avatar::setEnableMeshVisible(bool isEnabled) {
render::Transaction transaction; if (_isMeshEnableVisible != isEnabled) {
if (render::Item::isValidID(_renderItemID)) { _isMeshEnableVisible = isEnabled;
transaction.updateItem<render::Payload<AvatarData>>(_renderItemID, [](render::Payload<AvatarData>& p) { _needMeshVisibleSwitch = true;
});
} }
qApp->getMain3DScene()->enqueueTransaction(transaction);
} }
bool Avatar::getEnableMeshVisible() const { bool Avatar::getEnableMeshVisible() const {
return true; return _isMeshEnableVisible;
} }
void Avatar::fixupModelsInScene(const render::ScenePointer& scene) { void Avatar::fixupModelsInScene(const render::ScenePointer& scene) {
@ -801,6 +801,12 @@ void Avatar::fixupModelsInScene(const render::ScenePointer& scene) {
} }
} }
if (_needMeshVisibleSwitch) {
// _skeletonModel->setVisibleInScene(_isMeshEnableVisible, scene, render::ItemKey::TAG_BITS_0 | render::ItemKey::TAG_BITS_1, true);
updateRenderItem(transaction);
_needMeshVisibleSwitch = false;
}
if (_mustFadeIn && canTryFade) { if (_mustFadeIn && canTryFade) {
// Do it now to be sure all the sub items are ready and the fade is sent to them too // Do it now to be sure all the sub items are ready and the fade is sent to them too
fade(transaction, render::Transition::USER_ENTER_DOMAIN); fade(transaction, render::Transition::USER_ENTER_DOMAIN);

View file

@ -536,6 +536,9 @@ protected:
std::mutex _materialsLock; std::mutex _materialsLock;
void processMaterials(); void processMaterials();
bool _isMeshEnableVisible{ true };
bool _needMeshVisibleSwitch{ true };
}; };
#endif // hifi_Avatar_h #endif // hifi_Avatar_h

View file

@ -368,9 +368,9 @@ void CullShapeBounds::run(const RenderContextPointer& renderContext, const Input
RenderArgs* args = renderContext->args; RenderArgs* args = renderContext->args;
const auto& inShapes = inputs.get0(); const auto& inShapes = inputs.get0();
const auto& cullFilter = inputs.get1(); const auto& cullFilter = inputs.get1();
const auto& boundsFilter = inputs.get2(); const auto& boundsFilter = inputs.get2();
const auto& antiFrustum = inputs.get3(); const auto& antiFrustum = inputs.get3();
auto& outShapes = outputs.edit0(); auto& outShapes = outputs.edit0();
auto& outBounds = outputs.edit1(); auto& outBounds = outputs.edit1();
@ -380,7 +380,7 @@ void CullShapeBounds::run(const RenderContextPointer& renderContext, const Input
if (!cullFilter.selectsNothing() || !boundsFilter.selectsNothing()) { if (!cullFilter.selectsNothing() || !boundsFilter.selectsNothing()) {
auto& details = args->_details.edit(_detailType); auto& details = args->_details.edit(_detailType);
Test test(_cullFunctor, args, details, antiFrustum); Test test(_cullFunctor, args, details, antiFrustum);
auto scene = args->_scene; auto scene = args->_scene;
for (auto& inItems : inShapes) { for (auto& inItems : inShapes) {
auto key = inItems.first; auto key = inItems.first;
@ -395,26 +395,26 @@ void CullShapeBounds::run(const RenderContextPointer& renderContext, const Input
if (antiFrustum == nullptr) { if (antiFrustum == nullptr) {
for (auto& item : inItems.second) { for (auto& item : inItems.second) {
if (test.solidAngleTest(item.bound) && test.frustumTest(item.bound)) { if (test.solidAngleTest(item.bound) && test.frustumTest(item.bound)) {
const auto shapeKey = scene->getItem(item.id).getKey(); const auto shapeKey = scene->getItem(item.id).getKey();
if (cullFilter.test(shapeKey)) { if (cullFilter.test(shapeKey)) {
outItems->second.emplace_back(item); outItems->second.emplace_back(item);
} }
if (boundsFilter.test(shapeKey)) { if (boundsFilter.test(shapeKey)) {
outBounds += item.bound; outBounds += item.bound;
} }
} }
} }
} else { } else {
for (auto& item : inItems.second) { for (auto& item : inItems.second) {
if (test.solidAngleTest(item.bound) && test.frustumTest(item.bound) && test.antiFrustumTest(item.bound)) { if (test.solidAngleTest(item.bound) && test.frustumTest(item.bound) && test.antiFrustumTest(item.bound)) {
const auto shapeKey = scene->getItem(item.id).getKey(); const auto shapeKey = scene->getItem(item.id).getKey();
if (cullFilter.test(shapeKey)) { if (cullFilter.test(shapeKey)) {
outItems->second.emplace_back(item); outItems->second.emplace_back(item);
} }
if (boundsFilter.test(shapeKey)) { if (boundsFilter.test(shapeKey)) {
outBounds += item.bound; outBounds += item.bound;
} }
} }
} }
} }
details._rendered += (int)outItems->second.size(); details._rendered += (int)outItems->second.size();