Add Materials to the shapes in the scene
This commit is contained in:
parent
b480e2c869
commit
2c23fb819e
4 changed files with 33 additions and 38 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "basics.h"
|
||||
#include "light.h"
|
||||
#include "material.h"
|
||||
#include "object_sphere.h"
|
||||
#include "scene.h"
|
||||
#include "writer_png.h"
|
||||
|
@ -22,10 +23,20 @@ main(int argc,
|
|||
{
|
||||
Scene scene = Scene();
|
||||
|
||||
Material *m1 = new Material();
|
||||
m1->set_color(Color(1, 0, 0, 1));
|
||||
Material *m2 = new Material();
|
||||
m2->set_color(Color(0, 1, 0, 1));
|
||||
Material *m3 = new Material();
|
||||
m3->set_color(Color(0, 0, 1, 1));
|
||||
|
||||
// Make some spheres.
|
||||
Sphere *s1 = new Sphere(Vector3(233, 290, 0), 100.0);
|
||||
Sphere *s2 = new Sphere(Vector3(407, 290, 0), 100.0);
|
||||
Sphere *s3 = new Sphere(Vector3(320, 140, 0), 100.0);
|
||||
s1->set_material(m1);
|
||||
s2->set_material(m2);
|
||||
s3->set_material(m3);
|
||||
scene.add_shape(s1);
|
||||
scene.add_shape(s2);
|
||||
scene.add_shape(s3);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue