Skip to content

Commit f162f53

Browse files
wfpokornyc-lipka
authored andcommitted
Adding df3, density_file query range support to max_extent. (#80)
* Adding df3, density_file query range support to max_extent. Enables users to determine the x,y,z ranges, returned as a vector, for density_file based pigments matching a similar function for image maps. * Adding normal, density support to max_extent range feature. Adding normal and density support to the existing pigment support for image and density_file range determination with max_extent. Also re-worked the conditionals as requested.
1 parent 79f6c9b commit f162f53

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

source/parser/parser_expressions.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,7 @@ void Parser::Parse_Num_Factor (EXPRESS& Express,int *Terms)
12121212
case MAX_EXTENT_TOKEN:
12131213
GET (LEFT_PAREN_TOKEN);
12141214
EXPECT
1215+
12151216
CASE (OBJECT_ID_TOKEN)
12161217
Object = reinterpret_cast<ObjectPtr>(Token.Data);
12171218
if ( Object )
@@ -1220,18 +1221,25 @@ void Parser::Parse_Num_Factor (EXPRESS& Express,int *Terms)
12201221
END_CASE
12211222

12221223
// JN2007: Image map dimensions:
1223-
CASE (PIGMENT_ID_TOKEN)
1224+
CASE3 (DENSITY_ID_TOKEN,PIGMENT_ID_TOKEN,TNORMAL_ID_TOKEN)
12241225
Pigment = reinterpret_cast<PIGMENT *>(Token.Data);
1225-
if(Pigment->Type != BITMAP_PATTERN)
1226-
{
1227-
Error("The parameter to max_extent must be an image map pigment identifier");
1228-
}
1229-
else
1226+
if(Pigment->Type == BITMAP_PATTERN)
12301227
{
12311228
Vect[X] = dynamic_cast<ImagePattern*>(Pigment->pattern.get())->pImage->iwidth;
12321229
Vect[Y] = dynamic_cast<ImagePattern*>(Pigment->pattern.get())->pImage->iheight;
12331230
Vect[Z] = 0;
12341231
}
1232+
else if(Pigment->Type == DENSITY_FILE_PATTERN)
1233+
{
1234+
Vect[X] = dynamic_cast<DensityFilePattern*>(Pigment->pattern.get())->densityFile->Data->Sx;
1235+
Vect[Y] = dynamic_cast<DensityFilePattern*>(Pigment->pattern.get())->densityFile->Data->Sy;
1236+
Vect[Z] = dynamic_cast<DensityFilePattern*>(Pigment->pattern.get())->densityFile->Data->Sz;
1237+
}
1238+
else
1239+
{
1240+
Error("\rThe parameter to max_extent must be a bump_map, image map\r"
1241+
"or density_file form of a normal, pigment or density identifier.");
1242+
}
12351243
EXIT
12361244
END_CASE
12371245

0 commit comments

Comments
 (0)