From 9df819085e1f06711520268e16e8405e4f58742f Mon Sep 17 00:00:00 2001 From: Jacob Pine Date: Tue, 4 Apr 2023 17:49:30 -0400 Subject: [PATCH] added simple scenes --- Controller.cpp | 2 +- scenegraphmodels/box.txt | 9 +++++++++ scenegraphmodels/sphere.txt | 31 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 scenegraphmodels/sphere.txt diff --git a/Controller.cpp b/Controller.cpp index cf3cb87..ed2e7d6 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -20,7 +20,7 @@ using namespace std; Controller::Controller(istream& scenegraphFile, Model& m,View& v): model(m), view(v) { initScenegraph(scenegraphFile); - globalCamera = new StationaryCamera(glm::vec3(0.0, 0.0, 100.0)); + globalCamera = new StationaryCamera(glm::vec3(0.0, 0.0, 20.0)); globalCamera->LookAt(glm::vec3(0.0,0.0,0.0)); cameras.push_back(globalCamera); diff --git a/scenegraphmodels/box.txt b/scenegraphmodels/box.txt index ac3028b..a3ba412 100644 --- a/scenegraphmodels/box.txt +++ b/scenegraphmodels/box.txt @@ -10,9 +10,18 @@ specular 1 0 0 shininess 0 end-material +light globalLight +ambient 0.3 0.3 0.3 +diffuse 0.4 0.4 0.4 +specular 0.6 0.6 0.6 +position 2 2 2 +end-light + + #the root group node-1-0 root scale node-2-0 scale 10 10 10 +assign-light node-2-0 globalLight leaf node-3-0 one-box instanceof box #comment here? assign-material node-3-0 mat-node-3-0 diff --git a/scenegraphmodels/sphere.txt b/scenegraphmodels/sphere.txt new file mode 100644 index 0000000..5682843 --- /dev/null +++ b/scenegraphmodels/sphere.txt @@ -0,0 +1,31 @@ +#all the instances +instance sphere models/sphere.obj + +#material +material mat-node-3-0 +emission 0 0 0 +ambient 1 0 0 +diffuse 1 0 0 +specular 1 0 0 +shininess 0 +end-material + +light globalLight +ambient 0.3 0.3 0.3 +diffuse 0.4 0.4 0.4 +specular 0.6 0.6 0.6 +position 2 2 2 +end-light + + +#the root +group node-1-0 root +scale node-2-0 scale 5 5 5 +assign-light node-2-0 globalLight +leaf node-3-0 one-sphere instanceof sphere #comment here? + +assign-material node-3-0 mat-node-3-0 +add-child node-3-0 node-2-0 +add-child node-2-0 node-1-0 +assign-root node-1-0 +