Skip to content

Default ambient for 3.8 and above #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/core/material/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ void Transform_Textures(TEXTURE *Textures, const TRANSFORM *Trans)
* 6/27/98 MBP Added initializers for reflection blur
* 8/27/98 MBP Added initializers for angle-based reflectivity
*
* NOTES
* since 3.8, the default ambient might be overriden to 0.0 when the first statement
* is a #version with value 3.8 or greater or when such version is set explicitly in command line or ini file
*
******************************************************************************/

FINISH *Create_Finish()
Expand Down
6 changes: 6 additions & 0 deletions source/parser/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ void Parser::Run()
Default_Texture->Pigment = Create_Pigment();
Default_Texture->Tnormal = NULL;
Default_Texture->Finish = Create_Finish();
// [JG] the version has been *explictly* set in the ini or command line,
// override the default ambient (rgb 0.1) (in Create_Finish) for 0.0
if ((sceneData->languageVersionSet)&&(sceneData->languageVersion >= 380))
{
Default_Texture->Finish->Ambient.Clear();
}

Not_In_Default = true;
Ok_To_Declare = true;
Expand Down
7 changes: 6 additions & 1 deletion source/parser/parser_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2430,7 +2430,12 @@ void Parser::Parse_Directive(int After_Hash)
if (Include_File_Index == 0)
Error("As of POV-Ray 3.7, the '#version' directive must be the first non-comment "
"statement in the scene file. If your scene will adapt to whatever version "
"is un use dynamically, start your scene with '#version version'.");
"is in use dynamically, start your scene with '#version version'.");
}
else if ((!sceneData->languageVersionSet)&&(sceneData->languageVersion >= 380))
{// [JG] first item, not languageVersionLate : override the default ambient (rgb 0.1) (in Create_Finish) for 0.0
// Do not bother to create a copy, it has not been used yet
Default_Texture->Finish->Ambient.Clear();
}

// NB: This must be set _after_ parsing the value, in order for the `#version version`
Expand Down