Render circle in 3D space for lookatIndicator. Still not normal to the screen.

This commit is contained in:
Mark Peng 2013-07-18 14:34:51 -07:00
parent 6006b8e96b
commit 7ee0d8da2e
4 changed files with 11 additions and 7 deletions

View file

@ -1907,9 +1907,12 @@ void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& which
glColor3f(1.0f, 0.0f, 0.0f); glColor3f(1.0f, 0.0f, 0.0f);
// renderCircle(haloOrigin, 0.1f, glm::vec3(0.0f, 1.0f, 0.0f), 30); // renderCircle(haloOrigin, 0.1f, glm::vec3(0.0f, 1.0f, 0.0f), 30);
// glm::vec3 normal; loadViewFrustum(_myCamera, _viewFrustum);
// _viewFrustum.computeNormalToNearClipPlane(normal); glm::vec3 normal;
renderCircle(indicatorOrigin, 0.1f, _viewFrustum.getDirection(), 30); _viewFrustum.computeNormalToOffset(normal);
// Plane::Plane p(_viewFrustum.getOffsetPosition(), _viewFrustum.getOffsetUp(), _viewFrustum.getOffsetRight());
renderCircle(indicatorOrigin, 0.1f, normal, 30);
} }
void Application::update(float deltaTime) { void Application::update(float deltaTime) {

View file

@ -42,6 +42,7 @@
#include "ViewFrustum.h" #include "ViewFrustum.h"
#include "VoxelSystem.h" #include "VoxelSystem.h"
#include "Webcam.h" #include "Webcam.h"
#include "Plane.h"
class QAction; class QAction;

View file

@ -364,9 +364,9 @@ bool ViewFrustum::matches(const ViewFrustum& compareTo, bool debug) const {
return result; return result;
} }
void ViewFrustum::computeNormalToNearClipPlane(glm::vec3& normal) const { void ViewFrustum::computeNormalToOffset(glm::vec3& normal) const {
Plane nearClipPlane(_nearTopLeft, _nearTopRight, _nearBottomLeft); Plane offsetPlane(_offsetPosition, _offsetRight, _offsetUp);
normal = nearClipPlane.getNormal(); normal = offsetPlane.getNormal();
} }
void ViewFrustum::computePickRay(float x, float y, glm::vec3& origin, glm::vec3& direction) const { void ViewFrustum::computePickRay(float x, float y, glm::vec3& origin, glm::vec3& direction) const {

View file

@ -83,7 +83,7 @@ public:
bool matches(const ViewFrustum& compareTo, bool debug = false) const; bool matches(const ViewFrustum& compareTo, bool debug = false) const;
bool matches(const ViewFrustum* compareTo, bool debug = false) const { return matches(*compareTo, debug); }; bool matches(const ViewFrustum* compareTo, bool debug = false) const { return matches(*compareTo, debug); };
void computeNormalToNearClipPlane(glm::vec3& normal) const; void computeNormalToOffset(glm::vec3& normal) const;
void computePickRay(float x, float y, glm::vec3& origin, glm::vec3& direction) const; void computePickRay(float x, float y, glm::vec3& origin, glm::vec3& direction) const;