mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:21:16 +02:00
Fix rendering of look-at vectors
This commit is contained in:
parent
0df9ebeda3
commit
925fd71262
1 changed files with 14 additions and 12 deletions
|
@ -9,9 +9,11 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
#include <gpu/GPUConfig.h>
|
||||||
|
#include <gpu/Batch.h>
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <GlowEffect.h>
|
#include <DeferredLightingEffect.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -293,10 +295,8 @@ void Head::relaxLean(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Head::render(RenderArgs* renderArgs, float alpha, ViewFrustum* renderFrustum, bool postLighting) {
|
void Head::render(RenderArgs* renderArgs, float alpha, ViewFrustum* renderFrustum, bool postLighting) {
|
||||||
if (postLighting) {
|
if (_renderLookatVectors) {
|
||||||
if (_renderLookatVectors) {
|
|
||||||
renderLookatVectors(renderArgs, _leftEyePosition, _rightEyePosition, getCorrectedLookAtPosition());
|
renderLookatVectors(renderArgs, _leftEyePosition, _rightEyePosition, getCorrectedLookAtPosition());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,17 +380,19 @@ void Head::addLeanDeltas(float sideways, float forward) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Head::renderLookatVectors(RenderArgs* renderArgs, glm::vec3 leftEyePosition, glm::vec3 rightEyePosition, glm::vec3 lookatPosition) {
|
void Head::renderLookatVectors(RenderArgs* renderArgs, glm::vec3 leftEyePosition, glm::vec3 rightEyePosition, glm::vec3 lookatPosition) {
|
||||||
|
auto& batch = *renderArgs->_batch;
|
||||||
|
auto transform = Transform{};
|
||||||
|
batch.setModelTransform(transform);
|
||||||
|
batch._glLineWidth(2.0f);
|
||||||
|
|
||||||
|
auto deferredLighting = DependencyManager::get<DeferredLightingEffect>();
|
||||||
|
deferredLighting->bindSimpleProgram(batch);
|
||||||
|
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
DependencyManager::get<GlowEffect>()->begin(renderArgs);
|
|
||||||
|
|
||||||
glLineWidth(2.0);
|
|
||||||
|
|
||||||
glm::vec4 startColor(0.2f, 0.2f, 0.2f, 1.0f);
|
glm::vec4 startColor(0.2f, 0.2f, 0.2f, 1.0f);
|
||||||
glm::vec4 endColor(1.0f, 1.0f, 1.0f, 0.0f);
|
glm::vec4 endColor(1.0f, 1.0f, 1.0f, 0.0f);
|
||||||
geometryCache->renderLine(leftEyePosition, lookatPosition, startColor, endColor, _leftEyeLookAtID);
|
geometryCache->renderLine(batch, leftEyePosition, lookatPosition, startColor, endColor, _leftEyeLookAtID);
|
||||||
geometryCache->renderLine(rightEyePosition, lookatPosition, startColor, endColor, _rightEyeLookAtID);
|
geometryCache->renderLine(batch, rightEyePosition, lookatPosition, startColor, endColor, _rightEyeLookAtID);
|
||||||
|
|
||||||
DependencyManager::get<GlowEffect>()->end(renderArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue