Skip to content

Commit

Permalink
Windows compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
morganbengtsson committed Aug 28, 2018
1 parent 4f4ee9e commit e0b3216
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/mos/gfx/light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Light::Light(const glm::vec3 &position,
const float angle,
const glm::vec3 &color,
const float strength,
const float near,
const float far)
const float near_plane,
const float far_plane)
: color(color), angle_(angle),
camera(position, center, glm::perspective(angle, 1.0f, near, far),
camera(position, center, glm::perspective(angle, 1.0f, near_plane, far_plane),
glm::vec3(0.0f, 0.0001f, 1.0f)), strength(strength), near_(near), far_(far) {}

void Light::position(const glm::vec3 &position) {
Expand Down Expand Up @@ -46,14 +46,14 @@ glm::vec3 Light::direction() const {
return camera.direction();
}

void Light::near_far(const float near, const float far) {
near_ = near;
far_ = far;
void Light::near_far(const float near_plane, const float far_plane) {
near_ = near_plane;
far_ = far_plane;
camera.projection = glm::perspective(angle_, 1.0f, near_, far_);

}
Light::Light(const std::string &directory, const std::string &path, const float near, const float far,
const glm::mat4 &parent_transform) : near_(near), far_(far) {
Light::Light(const std::string &directory, const std::string &path, const float near_plane, const float far_plane,
const glm::mat4 &parent_transform) : near_(near_plane), far_(far_plane) {
using json = nlohmann::json;
if (!path.empty()) {
filesystem::path fpath = path;
Expand All @@ -74,7 +74,7 @@ Light::Light(const std::string &directory, const std::string &path, const float
angle_ = data_value["size"];
auto blend = value["blend"];

camera = mos::gfx::Camera(position, center, glm::perspective(angle_, 1.0f, near, far),
camera = mos::gfx::Camera(position, center, glm::perspective(angle_, 1.0f, near_plane, far_plane),
glm::vec3(0.0f, 0.0001f, 1.0f));

} else {
Expand Down
3 changes: 2 additions & 1 deletion src/mos/gfx/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Model::Model(Assets &assets, const nlohmann::json &json, const glm::mat4 &parent
auto parsed = json;
if (parsed.is_string()) {
std::cout << "Loading: " << parsed << std::endl;
parsed = nlohmann::json::parse(mos::text(assets.directory() + std::string(parsed)));
std::string path = parsed;
parsed = nlohmann::json::parse(mos::text(assets.directory() + path));
}
auto name = parsed.value("name", "");
auto mesh_path = std::string("");
Expand Down

0 comments on commit e0b3216

Please sign in to comment.