This commit is contained in:
HifiExperiments 2023-11-19 15:17:18 -08:00
parent 3336efb6ee
commit 6af7b9f772
2 changed files with 6 additions and 3 deletions

View file

@ -248,6 +248,7 @@ ItemID EntityRenderer::computeMirrorViewOperator(ViewFrustum& viewFrustum, const
glm::vec3 outPropertiesPosition = inPropertiesPosition; glm::vec3 outPropertiesPosition = inPropertiesPosition;
glm::quat outPropertiesRotation = inPropertiesRotation; glm::quat outPropertiesRotation = inPropertiesRotation;
glm::mat4 outToWorld = inToWorld; glm::mat4 outToWorld = inToWorld;
bool foundPortalExit = false;
if (mirrorMode == MirrorMode::PORTAL && !portalExitID.isNull()) { if (mirrorMode == MirrorMode::PORTAL && !portalExitID.isNull()) {
auto renderer = DependencyManager::get<EntityTreeRenderer>(); auto renderer = DependencyManager::get<EntityTreeRenderer>();
if (renderer) { if (renderer) {
@ -258,6 +259,7 @@ ItemID EntityRenderer::computeMirrorViewOperator(ViewFrustum& viewFrustum, const
}); });
outToWorld = glm::translate(outPropertiesPosition) * glm::mat4_cast(outPropertiesRotation); outToWorld = glm::translate(outPropertiesPosition) * glm::mat4_cast(outPropertiesRotation);
foundPortalExit = true;
} }
} }
} }
@ -314,7 +316,7 @@ ItemID EntityRenderer::computeMirrorViewOperator(ViewFrustum& viewFrustum, const
viewFrustum.setProjection(projection, true); viewFrustum.setProjection(projection, true);
return (mirrorMode == MirrorMode::PORTAL && !portalExitID.isNull()) ? DependencyManager::get<EntityTreeRenderer>()->renderableIdForEntityId(portalExitID) : Item::INVALID_ITEM_ID; return foundPortalExit ? DependencyManager::get<EntityTreeRenderer>()->renderableIdForEntityId(portalExitID) : Item::INVALID_ITEM_ID;
} }
void EntityRenderer::render(RenderArgs* args) { void EntityRenderer::render(RenderArgs* args) {

View file

@ -59,15 +59,16 @@ void main() {
<@if HIFI_USE_MIRROR@> <@if HIFI_USE_MIRROR@>
color.rgb = texelFetch(mirrorMap, ivec2(gl_FragCoord.xy), 0).rgb; color.rgb = texelFetch(mirrorMap, ivec2(gl_FragCoord.xy), 0).rgb;
color.a = 1.0;
<@endif@> <@endif@>
<@if HIFI_USE_UNLIT@> <@if HIFI_USE_UNLIT@>
<@if HIFI_USE_TRANSLUCENT or HIFI_USE_FORWARD@> <@if HIFI_USE_TRANSLUCENT or HIFI_USE_FORWARD@>
_fragColor0 = vec4(color.rgb * isUnlitEnabled(), 1.0); _fragColor0 = vec4(color.rgb * isUnlitEnabled(), color.a);
<@else@> <@else@>
packDeferredFragmentUnlit( packDeferredFragmentUnlit(
normalize(_normalWS), normalize(_normalWS),
1.0, color.a,
color.rgb); color.rgb);
<@endif@> <@endif@>
<@else@> <@else@>