-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed formatting and replaced macros with constexpr
- Loading branch information
Showing
4 changed files
with
127 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
#include "Vec3f.h" | ||
|
||
class Light { | ||
private: | ||
float diffuse; | ||
float specular; | ||
float ambient; | ||
private: | ||
float diffuse; | ||
float specular; | ||
float ambient; | ||
|
||
Vec3f position; | ||
Vec3f color; | ||
public: | ||
Light(Vec3f position, Vec3f color) : position(position), color(color) {} | ||
Vec3f get_position() const { return position; } | ||
Vec3f get_color() const { return color; } | ||
Vec3f position; | ||
Vec3f color; | ||
|
||
void set_light(float amb, float diff, float spec) { | ||
diffuse = diff; | ||
specular = spec; | ||
ambient = amb; | ||
} | ||
public: | ||
Light(Vec3f position, Vec3f color) : position(position), color(color) {} | ||
Vec3f get_position() const { return position; } | ||
Vec3f get_color() const { return color; } | ||
|
||
float get_diffuse() const { return diffuse; } | ||
float get_specular() const { return specular; } | ||
float get_ambient() const { return ambient; } | ||
void set_light(float amb, float diff, float spec) { | ||
ambient = amb; | ||
diffuse = diff; | ||
specular = spec; | ||
} | ||
|
||
float get_diffuse() const { return diffuse; } | ||
float get_specular() const { return specular; } | ||
float get_ambient() const { return ambient; } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
#ifndef __VEC3F_H__ | ||
#define __VEC3F_H__ | ||
class Vec3f { | ||
public: | ||
Vec3f(float x_, float y_, float z_); | ||
Vec3f(const Vec3f& a); | ||
Vec3f(); | ||
Vec3f operator+(const Vec3f& a) const; | ||
Vec3f operator-(const Vec3f& a) const; | ||
Vec3f operator/(const float& a) const; | ||
Vec3f operator^(const Vec3f& a) const; // cross product | ||
Vec3f operator&(const Vec3f& a) const; // element wise multiplication | ||
friend Vec3f operator*(const float& a, const Vec3f& b); | ||
|
||
public: | ||
Vec3f(float x_, float y_, float z_); | ||
Vec3f(const Vec3f &a); | ||
Vec3f(); | ||
Vec3f operator+(const Vec3f &a) const; | ||
Vec3f operator-(const Vec3f &a) const; | ||
Vec3f operator/(const float &a) const; | ||
Vec3f operator^(const Vec3f &a) const; //cross product | ||
Vec3f operator&(const Vec3f &a) const; //element wise multiplication | ||
friend Vec3f operator*(const float &a, const Vec3f &b); | ||
float length() const; | ||
Vec3f normalize() const; | ||
Vec3f scale(float factor) const; | ||
Vec3f cap(float max) const; | ||
|
||
float length() const; | ||
Vec3f normalize() const; | ||
Vec3f scale(float factor) const; | ||
Vec3f cap(float max) const; | ||
|
||
void display(); | ||
float x_() const; | ||
float y_() const; | ||
float z_() const; | ||
|
||
private: | ||
float x; | ||
float y; | ||
float z; | ||
void display(); | ||
float x_() const; | ||
float y_() const; | ||
float z_() const; | ||
|
||
private: | ||
float x; | ||
float y; | ||
float z; | ||
}; | ||
#endif |
Oops, something went wrong.