-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScene.h
More file actions
98 lines (82 loc) · 2.16 KB
/
Scene.h
File metadata and controls
98 lines (82 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*Bijan Hamidi & Ruth Obidah
* bhamidi@csu.fullerton.edu, ruthobidah@csu.fullerton.edu
* CS 599 Independent Study
* December 2017
*
* $Id: Scene.h 2764 2017-12-05 05:35:16Z mshafae $
*
*/
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include "Camera.h"
#include "Image.h"
#include "Material.h"
#include "Group.h"
#include "ViewPlane.h"
#ifndef _SCENE_H_
#define _SCENE_H_
using namespace std;
class Scene{
public:
Scene( string inputFilename = "", string outputFilename = "", string depthFilename = "" );
~Scene( );
// Accessors
Camera& camera( );
Pixel& backgroundColor( );
int numberOfMaterials( );
void setCurrentMaterial( int i );
Material* currentMaterial( );
Group* group( );
string& inputSceneFile( );
string& outputFile( );
string& depthFile( );
void setInputSceneFile( string file );
void setOutputFile( string file );
void setDepthFile( string file );
bool hasInputSceneFilePath( );
bool hasOutputFilePath( );
bool hasDepthFilePath( );
bool parse( Camera &myCam, glm::vec3 &myColor, Material &myMaterial, Group &myGroup, ViewPlane & myViewPlane);
// I/O
void write( std::ostream &out ) const;
private:
string myInputSceneFile;
string myOutputFile;
string myDepthFile;
Camera myCamera;
Pixel myBackgroundColor;
int myNumberOfMaterials;
Material **materials;
Material *myCurrentMaterial;
Group *myGroup;
ifstream inputFileStream;
// For parsing
char currentLine[255];
char currentToken[255];
int lineNumber;
int tokenCount;
int length;
int i;
int j;
void nextToken( );
void parseCamera( Camera &myCam);
void parsePerspectiveCamera( );
void nextOnLine( );
bool areMoreTokens( );
void advance( );
void checkToken( const char *str, const char *stage );
void parseBackground( glm::vec3 &myColor);
float parseFloat( );
double parseDouble( );
int parseInt( );
// Finish these...
void parseMaterials( Material &myMaterial);
void parseMaterialsNew( );
void parseGroup( Group &myGroup);
void parseViewPlane( ViewPlane &myViewPlane);
//void parseLights( );
};
std::ostream& operator <<( std::ostream &out, const Scene &s );
#endif