Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] several build errors on Linux #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Ambient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

Ambient::Ambient()
: Light() {

}
Ambient::Ambient(const float intensity, const RGBColor& color)
: Light(intensity, color){

}

Ambient::~Ambient(){

}

const float Ambient::get_distance(const Point3D& point) const{
Expand All @@ -31,4 +31,3 @@ const Vector3D Ambient::get_direction(const Point3D& surface_point) const {
const RGBColor Ambient::get_color(const ShadeRec& sr) const {
return m_intensity * m_color;
}

6 changes: 3 additions & 3 deletions src/Ambient.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* and open the template in the editor.
*/

/*
/*
* File: Ambient.h
* Author: maru
*
Expand All @@ -19,12 +19,12 @@ class Ambient : public Light {
public:
Ambient();
Ambient(const float intensity, const RGBColor& color);

virtual ~Ambient();
virtual const float get_distance(const Point3D& point) const;
virtual const Vector3D get_direction(const Point3D& surface_point) const override;
const RGBColor get_color(const ShadeRec& sr) const override;

};


Expand Down
4 changes: 2 additions & 2 deletions src/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# include "Camera.h"

Camera::Camera(){

}

Camera::Camera(const Point3D& eye, const Point3D& lookat, const float distance)
Expand All @@ -22,5 +22,5 @@ Camera::Camera(const Point3D& eye, const Point3D& lookat, const float distance)
}

Camera::~Camera(){

}
7 changes: 4 additions & 3 deletions src/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* and open the template in the editor.
*/

/*
/*
* File: Camera.h
* Author: maru
*
Expand All @@ -17,18 +17,19 @@
#include "Point3D.h"
#include "Vector3D.h"
#include "World.h"

class Camera{
protected:
Point3D m_eye;
Point3D m_lookat;
Vector3D m_up, m_u, m_v, m_w;
float m_distance_view_plane;

public:
Camera();
Camera(const Point3D& eye, const Point3D& lookat, const float distance);
~Camera();

virtual Vector3D calculate_ray_dir(const Point2D& p) = 0;
virtual void render_scene(World *world) = 0;
private:
Expand Down
4 changes: 2 additions & 2 deletions src/Chalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

Chalk::Chalk()
: Phong(){

}

Chalk::Chalk(const RGBColor& c, const float kd, const float ks, const float sp_e, const float lci)
: Phong(c, ks, ks, sp_e, lci){

}
}
2 changes: 1 addition & 1 deletion src/Chalk.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* and open the template in the editor.
*/

/*
/*
* File: Chalk.h
* Author: maru
*
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* and open the template in the editor.
*/

/*
/*
* File: Constants.h
* Author: maru
*
Expand Down
6 changes: 3 additions & 3 deletions src/Flat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

Flat::Flat()
: Material(){

}

Flat::Flat(const RGBColor& c)
: Material(c){

}

const RGBColor Flat::shade(const ShadeRec& sr) const {
return color;
}
}
4 changes: 2 additions & 2 deletions src/Flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* and open the template in the editor.
*/

/*
/*
* File: Flat.h
* Author: maru
*
Expand All @@ -20,7 +20,7 @@ class Flat : public Material {
Flat();
Flat(const RGBColor& c);
~Flat();

const virtual RGBColor shade(const ShadeRec& sr) const override;

};
Expand Down
4 changes: 2 additions & 2 deletions src/GeometryObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ GeometryObject::GeometryObject(){
}

GeometryObject::~GeometryObject(){
}

}
4 changes: 2 additions & 2 deletions src/GeometryObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* and open the template in the editor.
*/

/*
/*
* File: GeometryObject.h
* Author: maru
*
Expand All @@ -22,7 +22,7 @@ class GeometryObject {
public:
GeometryObject();
~GeometryObject();

virtual bool hit (const Ray &ray, double& tmin, ShadeRec& sr) = 0;
public:
//TODO delete
Expand Down
9 changes: 5 additions & 4 deletions src/Light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
* and open the template in the editor.
*/

# include "Light.h"
#include "ShadeRec.h"
#include "Light.h"
#include "Ambient.h"

Light::Light(){

}

Light::Light(const float intensity, const RGBColor& color)
: m_intensity(intensity), m_color(color) {
}

Light::~Light(){
}

}
6 changes: 4 additions & 2 deletions src/Light.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* and open the template in the editor.
*/

/*
/*
* File: Light.h
* Author: maru
*
Expand All @@ -18,11 +18,13 @@
#include "Vector3D.h"
#include "RGBColor.h"

class ShadeRec;

class Light {
public:
Light();
Light(const float intensity, const RGBColor& color);

virtual ~Light();
virtual const float get_distance(const Point3D& point) const = 0;
virtual const Vector3D get_direction(const Point3D& surface_point) const = 0;
Expand Down
9 changes: 5 additions & 4 deletions src/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
* and open the template in the editor.
*/

# include "Material.h"
#include "Material.h"
#include "ShadeRec.h"

Material::Material(){

}

Material::Material(const RGBColor& c)
: color(c) {

}

Material::~Material(){

}
7 changes: 5 additions & 2 deletions src/Material.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* and open the template in the editor.
*/

/*
/*
* File: Material.h
* Author: maru
*
Expand All @@ -13,13 +13,16 @@

#ifndef MATERIAL_H
#define MATERIAL_H
#include "RGBColor.h"

class ShadeRec;

class Material {
public:
Material();
Material(const RGBColor& c);
~Material();

const virtual RGBColor shade(const ShadeRec& sr) const = 0;

public:
Expand Down
38 changes: 19 additions & 19 deletions src/Matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ----------------------------------------------------------------------- default constructor
// a default matrix is an identity matrix

Matrix::Matrix(void) {
Matrix::Matrix(void) {
for (int x = 0; x < 4; x++)
for (int y = 0; y < 4; y++) {
if (x == y)
Expand All @@ -25,27 +25,27 @@ Matrix::Matrix(void) {
// ----------------------------------------------------------------------- copy constructor

Matrix::Matrix (const Matrix& mat) {
for (int x = 0; x < 4; x++)
for (int y = 0; y < 4; y++)
m[x][y] = mat.m[x][y];
for (int x = 0; x < 4; x++)
for (int y = 0; y < 4; y++)
m[x][y] = mat.m[x][y];
}


// ----------------------------------------------------------------------- destructor

Matrix::~Matrix (void) {}
Matrix::~Matrix (void) {}


// ----------------------------------------------------------------------- assignment operator

Matrix&
Matrix&
Matrix::operator= (const Matrix& rhs) {
if (this == &rhs)
return (*this);

for (int x = 0; x < 4; x++)
for (int y = 0; y < 4; y++)
m[x][y] = rhs.m[x][y];
for (int x = 0; x < 4; x++)
for (int y = 0; y < 4; y++)
m[x][y] = rhs.m[x][y];

return (*this);
}
Expand All @@ -54,32 +54,32 @@ Matrix::operator= (const Matrix& rhs) {
// ----------------------------------------------------------------------- operator*
// multiplication of two matrices

Matrix
Matrix
Matrix::operator* (const Matrix& mat) const {
Matrix product;

for (int y = 0; y < 4; y++)
for (int x = 0; x < 4; x++) {
double sum = 0.0;

for (int j = 0; j < 4; j++)
sum += m[x][j] * mat.m[j][y];
product.m[x][y] = sum;

product.m[x][y] = sum;
}

return (product);
}


// ----------------------------------------------------------------------- operator/
// division by a double

Matrix
Matrix
Matrix::operator/ (const double d) {
for (int x = 0; x < 4; x++)
for (int y = 0; y < 4; y++)
m[x][y] = m[x][y] / d;
for (int x = 0; x < 4; x++)
for (int y = 0; y < 4; y++)
m[x][y] = m[x][y] / d;

return (*this);
}
Expand All @@ -89,7 +89,7 @@ Matrix::operator/ (const double d) {
// ----------------------------------------------------------------------- set_identity
// set matrix to the identity matrix

void
void
Matrix::set_identity(void) {
for (int x = 0; x < 4; x++)
for (int y = 0; y < 4; y++) {
Expand Down
Loading