Skip to content
Permalink
Browse files

After lecture 10: fix scene creation code.

Now both scenes are available and render as expected.
  • Loading branch information...
anrieff committed May 15, 2018
1 parent 209693a commit 30cbd787d01721c1fffd57e5f5a105dec4ce89b1
Showing with 18 additions and 18 deletions.
  1. +4 −2 src/constants.h
  2. +0 −6 src/main.cpp
  3. +11 −10 src/scene.cpp
  4. +3 −0 src/scene.h
@@ -24,8 +24,10 @@
#pragma once

#define VFB_MAX_SIZE 1920
#define RESX 903
#define RESY 602
//#define RESX 903
//#define RESY 602
#define RESX 800
#define RESY 600
#define PI 3.141592653589793238
#define INF 1e99

@@ -39,12 +39,6 @@ using namespace std;

Color vfb[VFB_MAX_SIZE][VFB_MAX_SIZE];

Color ambientLightColor = Color(1, 1, 1) * 0.0;
bool antialiasing = true;
int numDOFsamples = 20;
int sphereIndex;
int cubeIndex;

bool visible(const Vector& a, const Vector& b)
{
Ray ray;
@@ -30,6 +30,7 @@
#include "camera.h"
#include "geometry.h"
#include "mesh.h"
#include "main.h"
#include "scene.h"
#include "lights.h"
#include "shading.h"
@@ -39,10 +40,15 @@ using namespace std;
Camera camera;
vector<Node> nodes;
CubemapEnvironment env;
Color ambientLightColor;
bool antialiasing;
int numDOFsamples;


void setupScene_Forest()
void setupScene_Forest()
{
ambientLightColor = Color(1, 1, 0.9) * 0.5;
antialiasing = true;

Node plane;

Transform lightT;
@@ -126,6 +132,7 @@ CubemapEnvironment env;

void setupScene_DOF()
{
numDOFsamples = 20;
Light* defaultLight = new PointLight(Color(1, 1, 0.9), 100000, Vector(200, 200, -200));
lights.push_back(defaultLight);

@@ -136,14 +143,8 @@ void setupScene_DOF()
camera.roll = toRadians(2.3);
camera.fov = 38;
camera.aspectRatio = 1.5;
/*
dof on
focalPlaneDist 25.29
fNumber 2.0 # This is also not quite correct, the actual aperture was f/2.0
numSamples 100
*/
camera.focalPlaneDist = 29.29;
camera.fNumber = 2; // f/2
camera.focalPlaneDist = 25.29;
camera.fNumber = 1.4; // f/2

Mesh* leaf = new Mesh;
leaf->loadFromOBJ("data/geom/leaf.obj");
@@ -32,6 +32,9 @@
extern Camera camera;
extern std::vector<Node> nodes;
extern CubemapEnvironment env;
extern Color ambientLightColor;
extern bool antialiasing;
extern int numDOFsamples;

void setupScene_Forest();
void setupScene_DOF();

0 comments on commit 30cbd78

Please sign in to comment.
You can’t perform that action at this time.