Skip to content

Commit

Permalink
added examples 4_Example_Materials and 5_Example_Shadows for standalo…
Browse files Browse the repository at this point in the history
…ne workflow
  • Loading branch information
moebiussurfing committed Nov 18, 2023
1 parent 08e7b91 commit 699404a
Show file tree
Hide file tree
Showing 12 changed files with 587 additions and 296 deletions.
24 changes: 15 additions & 9 deletions 4_Example_Materials/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void ofApp::setup() {
for (size_t i = 0; i < OFAPP_NUM_ITEMS; i++) {
std::unique_ptr<SurfingMaterial> m;
m = std::make_unique<SurfingMaterial>();
string s = ofToString(i);
string s = "MATERIAL_" + ofToString(i);
m->setup(s);
materials.push_back(std::move(m));
}
Expand Down Expand Up @@ -62,19 +62,24 @@ void ofApp::draw() {
//--------------------------------------------------------------
void ofApp::buildHelp() {

string s = "";
s += "KEYS\n\n";
s += "DEBUG LIGHTS\n";
s += "L : " + string(bEnableLights ? "ON" : "OFF") + "\n\n";
bool b1 = pointLights[0]->getIsEnabled();
bool b2 = pointLights[1]->getIsEnabled();
bool b3 = pointLights[2]->getIsEnabled();
bool b4 = pointLights[3]->getIsEnabled();
bool b5 = pointLights[4]->getIsEnabled();

string s = "";
s += "KEYS\n\n";
s += "HELP\n";
s += "H : " + string(bHelp ? "ON" : "OFF") + "\n\n";
s += "DEBUG LIGHTS\n";
s += "L : " + string(bEnableLights ? "ON" : "OFF") + "\n\n";
s += "ENABLE LIGHT\n";
s += "1 : " + string(b1 ? "ON" : "OFF") + "\n";
s += "2 : " + string(b2 ? "ON" : "OFF") + "\n";
s += "3 : " + string(b3 ? "ON" : "OFF") + "\n";
s += "4 : " + string(b4 ? "ON" : "OFF");
s += "4 : " + string(b4 ? "ON" : "OFF") + "\n";
s += "5 : " + string(b5 ? "ON" : "OFF");

sHelp = s;
}
Expand All @@ -87,11 +92,11 @@ void ofApp::drawGui() {
// draw gui panels

for (size_t i = 0; i < materials.size(); i++) {
materials[i]->gui.draw();
materials[i]->drawGui();
}

for (size_t i = 0; i < objects.size(); i++) {
objects[i]->gui.draw();
objects[i]->drawGui();
}

#ifdef SURFING__USE__LIGHTS
Expand Down Expand Up @@ -212,8 +217,9 @@ void ofApp::keyPressed(int key) {
lindex = 2;
} else if (key == '4') {
lindex = 3;
}else if (key == '5') {
lindex = 4;
}
//..
if (lindex > -1 && lindex < (int)pointLights.size()) {
if (pointLights[lindex]->getIsEnabled()) {
pointLights[lindex]->disable();
Expand Down
3 changes: 1 addition & 2 deletions 4_Example_Materials/src/ofApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "ofMain.h"

#include "SurfingMaterial.h"
#include "ofxSurfingPBR.h"

#include "SurfingMeshSphereDisplaced.h"

Expand Down Expand Up @@ -31,7 +30,7 @@ class ofApp : public ofBaseApp {
vector<std::unique_ptr<SurfingMeshSphereDisplaced>> objects;

#ifdef SURFING__USE__LIGHTS
const int OFAPP_NUM_LIGHTS = 4;
const int OFAPP_NUM_LIGHTS = 5;
bool bEnableLights = true;
vector<shared_ptr<ofLight>> pointLights;
float colorHue = 0.0f;
Expand Down
Binary file added 5_Example_Shadows/Capture.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions 5_Example_Shadows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
![](Capture.PNG)
Empty file.
22 changes: 22 additions & 0 deletions 5_Example_Shadows/bin/data/Sphere
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"Sphere": {
"Coat": {
"Clear_Coat": "0",
"Clear_Coat_Roughness": "0.0001",
"Clear_Coat_Strength": "0.0001"
},
"Colors": {
"Ambient_Color": "0.849315, 0.801791, 0.0264705, 1",
"Diffuse_Color": "0.849315, 0.801791, 0.0264705, 1",
"Emissive_Color": "0.849315, 0.801791, 0.0264705, 1",
"Specular_Color": "0.849315, 0.801791, 0.0264705, 1"
},
"Settings": {
"Metallic": "0",
"Reflectance": "0",
"Roughness": "0",
"Shininess": "0"
},
"UI_HELPERS": "0"
}
}
Loading

0 comments on commit 699404a

Please sign in to comment.