POV-Ray : Newsgroups : povray.general : INC questions : Re: INC questions Server Time
9 Aug 2024 03:24:32 EDT (-0400)
  Re: INC questions  
From: Dick Balaska
Date: 24 Aug 2000 05:00:55
Message: <39A4E415.7A68C080@buckosoft.com>
Tom Melly wrote:
> 
> Two questions regarding .inc files:
> 
> 1. Is there any way to make an include file automatically detect whether it
> was called or not? In my case I have an include file/macro that will
> generate a bolt of lightning. I would like the file to generate an sample
> scene if run directly, but not when called (without the user having to
> set/change a variable).

I always do at the top of a file:

#ifndef (True)
  #declare True=1;                        // So whoever is parsed first will declare
True and generate a camera.
  #declare False=0;
  #declare TestThisObject=1;              // flag to generate a test object at the
bottom.
  #declare my_other_constants...;         // usually turn on dummy textures or what
not.
  #include "other_objects.inc"            // whatever other objects i am testing with.
  camera { location here look_at there }  // generate a test camera
#end

#declare ThisObject=
union {
...
}

// And then at the bottom of the file i put:
#ifdef (TestThisObject)
object {ThisObject}
#end

dik


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.