Skip to content

Commit

Permalink
added some test/improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Cbeed committed Aug 28, 2014
1 parent 25cf45a commit 38bb735
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion boxtest.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ define light ambient amb 0.05 0.1 0.05
define light diffuse sun 0 50 -44 1.0 1.0 1.0

# camera
define camera eye 60.0 0 0 0
define camera eye 60.0 10 0 0
# camera xform
transform eye rotate -45 0 1 0
transform eye translate 100 0 100
Expand Down
9 changes: 5 additions & 4 deletions framework/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
#define GLM_FORCE_RADIANS
#include "glm/detail/type_vec.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include <iostream>

Camera::Camera():
name("unnamed"),
fovX(100),
transformation(glm::mat4x4()),
transformation_inv(glm::mat4x4())
transformation(glm::mat4()),
transformation_inv(glm::mat4())
{}

Camera::Camera(std::string const& name, const int fovX):
name(name),
fovX(fovX),
transformation(glm::mat4x4()),
transformation_inv(glm::mat4x4())
transformation(glm::mat4()),
transformation_inv(glm::mat4())
{}

void Camera::translate(glm::vec3 const& transl) {
Expand Down
3 changes: 2 additions & 1 deletion framework/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ void Renderer::render() {
}
p.color /=scene_.antialiase;
} else {
Ray ray(glm::vec3(scene_.camera.GetTransformation_inv() * glm::vec4(0,0,0,1)));
//Ray ray(glm::vec3(scene_.camera.GetTransformation() * glm::vec4(0,0,0,1)));
Ray ray;
ray.direction.x = -scene_.resX/2.0f+x;
ray.direction.y = -scene_.resY/2.0f+y;
ray.direction.z = d;
Expand Down

0 comments on commit 38bb735

Please sign in to comment.