POV-Ray / povray

The Persistence of Vision Raytracer (POV-Ray)
https://www.povray.org/
GNU Affero General Public License v3.0
1.37k stars 282 forks source link

Fixing density_map by defined id parsing. #346

Closed wfpokorny closed 5 years ago

wfpokorny commented 6 years ago

Including some testing sdl which should all run cleanly, but which doesn't without this fix in the last media block case.

#version 3.8;
global_settings { assumed_gamma 1 }

//---- color_maps work as expected...
// media {
//   emission 0.75
//   scattering {1, 0.5}
//   density {
//     spherical
//     color_map {
//       [0.0 rgb <0,0,0.5>]
//       [0.5 rgb <0.8, 0.8, 0.4>]
//       [1.0 rgb <1,1,1>]
//     }
//   }
// }
//
// #declare ColorMap00 =
//     color_map {
//       [0.0 rgb <0,0,0.5>]
//       [0.5 rgb <0.8, 0.8, 0.4>]
//       [1.0 rgb <1,1,1>]
//     }
//
// media {
//   emission 0.75
//   scattering {1, 0.5}
//   density {
//     spherical
//     color_map { ColorMap00 }
//   }
// }

//---- density_maps do NOT work as expected without fix.
//
// media {
//   emission 0.75
//   scattering {1, 0.5}
//   density {
//     spherical
//     density_map {
//       [0.0 rgb <0,0,0.5>]
//       [0.5 rgb <0.8, 0.8, 0.4>]
//       [1.0 rgb <1,1,1>]
//     }
//   }
// }

   #declare DensityMap00 =
       density_map {
         [0.0 rgb <0,0,0.5>]
         [0.5 rgb <0.8, 0.8, 0.4>]
         [1.0 rgb <1,1,1>]
       }

   media {
     emission 0.75
     scattering {1, 0.5}
     density {
       spherical
       density_map { DensityMap00 }
     }
   }
wfpokorny commented 5 years ago

Branch at closing still exists and is occasionally re-based to master.