Skip to content

Commit 6781386

Browse files
authored
Bugfix ofxAssimpAdvancedExample HDR (#8349)
* fix for hdr image and toggle for enabling cube map. * toggle for drawing cube map.
1 parent c44ac59 commit 6781386

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed
-5.12 MB
Binary file not shown.
1.12 MB
Binary file not shown.

examples/3d/ofxAssimpAdvancedExample/src/ofApp.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ void ofApp::setup(){
1414
glm::vec3(-maxWizardPos,-maxWizardPos,-maxWizardPos),
1515
glm::vec3(maxWizardPos,maxWizardPos,maxWizardPos) ) );
1616
gui.add(wizardHandOffset.set("WizardHandOffset", glm::vec3(10.0, 12, 38), glm::vec3(-200), glm::vec3(200)));
17+
gui.add(mBEnableCubeMap.set("EnableCubeMap", true));
1718
gui.add(cubeMapExposure.set("CubeMapExposure", 0.25, 0.0, 1.0));
19+
gui.add(mBDrawCubeMap.set("DrawCubeMap", false ));
1820

1921
ofx::assimp::ImportSettings tsettings;
2022
tsettings.filePath = "ofLogoHollow.fbx";
@@ -109,9 +111,9 @@ void ofApp::setup(){
109111
cam.setPosition( 0, 400, 1000 );
110112
cam.lookAt( glm::vec3(0,150,0) );
111113

112-
// try commenting this out to see the effect that cube maps have on lighting
114+
// cube maps still have an effect on the final output even if an image is not loaded.
113115
// https://polyhaven.com/a/kloppenheim_06_puresky
114-
cubeMap.load( "kloppenheim_06_puresky_1k.exr", 512 );
116+
cubeMap.load( "kloppenheim_06_puresky_1k.hdr", 512 );
115117
}
116118

117119
//--------------------------------------------------------------
@@ -150,7 +152,10 @@ void ofApp::update(){
150152
}
151153

152154
light.getShadow().setStrength(mShadowStrength);
153-
cubeMap.setExposure(cubeMapExposure);
155+
cubeMap.setEnabled(mBEnableCubeMap);
156+
if( mBEnableCubeMap ) {
157+
cubeMap.setExposure(cubeMapExposure);
158+
}
154159

155160
float spacing = 50.0f;
156161
float hw = (((float)foxes.size()-1.f) * spacing) / 2.f;
@@ -192,6 +197,9 @@ void ofApp::draw(){
192197

193198

194199
cam.begin();
200+
if(mBDrawCubeMap) {
201+
cubeMap.draw();
202+
}
195203
renderScene();
196204
if(mBDebug) {
197205
light.draw();

examples/3d/ofxAssimpAdvancedExample/src/ofApp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class ofApp : public ofBaseApp{
4444
ofCubeMap cubeMap;
4545
ofParameter<float> cubeMapExposure;
4646
ofParameter<bool> mBDebug;
47+
ofParameter<bool> mBEnableCubeMap, mBDrawCubeMap;
4748

4849
ofParameterGroup mShadowParams;
4950
ofParameter<float> mShadowStrength;

0 commit comments

Comments
 (0)