Skip to content

Commit f532bbd

Browse files
committed
MaterialXView: Add --directLight command line parameter
1 parent e20fa7b commit f532bbd

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

source/MaterialXView/Main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const std::string options =
3232
" --envSampleCount [INTEGER] Specify the environment sample count (defaults to 16)\n"
3333
" --envLightIntensity [FLOAT] Specify the environment light intensity (defaults to 1)\n"
3434
" --lightRotation [FLOAT] Specify the rotation in degrees of the lighting environment about the Y axis (defaults to 0)\n"
35+
" --directLight [BOOLEAN] Specify whether direct lighting is enabled (defaults to true)\n"
3536
" --shadowMap [BOOLEAN] Specify whether shadow mapping is enabled (defaults to true)\n"
3637
" --path [FILEPATH] Specify an additional data search path location (e.g. '/projects/MaterialX'). This absolute path will be queried when locating data libraries, XInclude references, and referenced images.\n"
3738
" --library [FILEPATH] Specify an additional data library folder (e.g. 'vendorlib', 'studiolib'). This relative path will be appended to each location in the data search path when loading data libraries.\n"
@@ -94,6 +95,7 @@ int main(int argc, char* const argv[])
9495
int envSampleCount = mx::DEFAULT_ENV_SAMPLE_COUNT;
9596
float envLightIntensity = 1.0f;
9697
float lightRotation = 0.0f;
98+
bool directLight = true;
9799
bool shadowMap = true;
98100
DocumentModifiers modifiers;
99101
int screenWidth = 1280;
@@ -177,6 +179,10 @@ int main(int argc, char* const argv[])
177179
{
178180
parseToken(nextToken, "float", lightRotation);
179181
}
182+
else if (token == "--directLight")
183+
{
184+
parseToken(nextToken, "boolean", directLight);
185+
}
180186
else if (token == "--shadowMap")
181187
{
182188
parseToken(nextToken, "boolean", shadowMap);
@@ -315,6 +321,7 @@ int main(int argc, char* const argv[])
315321
viewer->setEnvSampleCount(envSampleCount);
316322
viewer->setEnvLightIntensity(envLightIntensity);
317323
viewer->setLightRotation(lightRotation);
324+
viewer->setDirectLightEnable(directLight);
318325
viewer->setShadowMapEnable(shadowMap);
319326
viewer->setDrawEnvironment(drawEnvironment);
320327
viewer->setDocumentModifiers(modifiers);

source/MaterialXView/Viewer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ class Viewer : public ng::Screen
126126
_genContext.getOptions().hwShadowMap = enable;
127127
}
128128

129+
// Enable or disable direct lighting.
130+
void setDirectLightEnable(bool enable)
131+
{
132+
_lightHandler->setDirectLighting(enable);
133+
}
134+
129135
// Enable or disable drawing environment as the background.
130136
void setDrawEnvironment(bool enable)
131137
{

0 commit comments

Comments
 (0)