mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 03:41:39 +02:00
remove naked gl from Avatar::calculateDisplayNameTransform()
This commit is contained in:
parent
7795eaace6
commit
d5a6e87a02
2 changed files with 7 additions and 12 deletions
|
@ -523,7 +523,7 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition, boo
|
||||||
|
|
||||||
auto cameraMode = Application::getInstance()->getCamera()->getMode();
|
auto cameraMode = Application::getInstance()->getCamera()->getMode();
|
||||||
if (!isMyAvatar() || cameraMode != CAMERA_MODE_FIRST_PERSON) {
|
if (!isMyAvatar() || cameraMode != CAMERA_MODE_FIRST_PERSON) {
|
||||||
renderDisplayName(batch, *renderArgs->_viewFrustum);
|
renderDisplayName(batch, *renderArgs->_viewFrustum, renderArgs->_viewport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ glm::vec3 Avatar::getDisplayNamePosition() const {
|
||||||
return namePosition;
|
return namePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
Transform Avatar::calculateDisplayNameTransform(const ViewFrustum& frustum, float fontSize) const {
|
Transform Avatar::calculateDisplayNameTransform(const ViewFrustum& frustum, float fontSize, const glm::ivec4& viewport) const {
|
||||||
Transform result;
|
Transform result;
|
||||||
// We assume textPosition is whithin the frustum
|
// We assume textPosition is whithin the frustum
|
||||||
glm::vec3 textPosition = getDisplayNamePosition();
|
glm::vec3 textPosition = getDisplayNamePosition();
|
||||||
|
@ -693,12 +693,7 @@ Transform Avatar::calculateDisplayNameTransform(const ViewFrustum& frustum, floa
|
||||||
glm::vec4 p0 = viewProj * glm::vec4(testPoint0, 1.0);
|
glm::vec4 p0 = viewProj * glm::vec4(testPoint0, 1.0);
|
||||||
glm::vec4 p1 = viewProj * glm::vec4(testPoint1, 1.0);
|
glm::vec4 p1 = viewProj * glm::vec4(testPoint1, 1.0);
|
||||||
|
|
||||||
// TODO REMOVE vvv
|
float windowSizeY = viewport.w;
|
||||||
GLint viewportMatrix[4];
|
|
||||||
glGetIntegerv(GL_VIEWPORT, viewportMatrix);
|
|
||||||
glm::dmat4 modelViewMatrix;
|
|
||||||
float windowSizeY = viewportMatrix[3] - viewportMatrix[1];
|
|
||||||
// TODO REMOVE ^^^
|
|
||||||
|
|
||||||
const float DESIRED_HIGHT_ON_SCREEN = 20; // In pixels (this is double on retinas)
|
const float DESIRED_HIGHT_ON_SCREEN = 20; // In pixels (this is double on retinas)
|
||||||
|
|
||||||
|
@ -731,7 +726,7 @@ Transform Avatar::calculateDisplayNameTransform(const ViewFrustum& frustum, floa
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::renderDisplayName(gpu::Batch& batch, const ViewFrustum& frustum) const {
|
void Avatar::renderDisplayName(gpu::Batch& batch, const ViewFrustum& frustum, const glm::ivec4& viewport) const {
|
||||||
bool shouldShowReceiveStats = DependencyManager::get<AvatarManager>()->shouldShowReceiveStats() && !isMyAvatar();
|
bool shouldShowReceiveStats = DependencyManager::get<AvatarManager>()->shouldShowReceiveStats() && !isMyAvatar();
|
||||||
|
|
||||||
// If we have nothing to draw, or it's tottaly transparent, return
|
// If we have nothing to draw, or it's tottaly transparent, return
|
||||||
|
@ -773,7 +768,7 @@ void Avatar::renderDisplayName(gpu::Batch& batch, const ViewFrustum& frustum) co
|
||||||
(_displayNameAlpha / DISPLAYNAME_ALPHA) * DISPLAYNAME_BACKGROUND_ALPHA);
|
(_displayNameAlpha / DISPLAYNAME_ALPHA) * DISPLAYNAME_BACKGROUND_ALPHA);
|
||||||
|
|
||||||
// Compute display name transform
|
// Compute display name transform
|
||||||
auto textTransform = calculateDisplayNameTransform(frustum, renderer->getFontSize());
|
auto textTransform = calculateDisplayNameTransform(frustum, renderer->getFontSize(), viewport);
|
||||||
batch.setModelTransform(textTransform);
|
batch.setModelTransform(textTransform);
|
||||||
|
|
||||||
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, false, true, true, true);
|
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, false, true, true, true);
|
||||||
|
|
|
@ -234,8 +234,8 @@ protected:
|
||||||
float getPelvisFloatingHeight() const;
|
float getPelvisFloatingHeight() const;
|
||||||
glm::vec3 getDisplayNamePosition() const;
|
glm::vec3 getDisplayNamePosition() const;
|
||||||
|
|
||||||
Transform calculateDisplayNameTransform(const ViewFrustum& frustum, float fontSize) const;
|
Transform calculateDisplayNameTransform(const ViewFrustum& frustum, float fontSize, const glm::ivec4& viewport) const;
|
||||||
void renderDisplayName(gpu::Batch& batch, const ViewFrustum& frustum) const;
|
void renderDisplayName(gpu::Batch& batch, const ViewFrustum& frustum, const glm::ivec4& viewport) const;
|
||||||
virtual void renderBody(RenderArgs* renderArgs, ViewFrustum* renderFrustum, bool postLighting, float glowLevel = 0.0f);
|
virtual void renderBody(RenderArgs* renderArgs, ViewFrustum* renderFrustum, bool postLighting, float glowLevel = 0.0f);
|
||||||
virtual bool shouldRenderHead(const RenderArgs* renderArgs) const;
|
virtual bool shouldRenderHead(const RenderArgs* renderArgs) const;
|
||||||
virtual void fixupModelsInScene();
|
virtual void fixupModelsInScene();
|
||||||
|
|
Loading…
Reference in a new issue