POV-Ray : Newsgroups : povray.general : INC questions Server Time
9 Aug 2024 09:07:28 EDT (-0400)
  INC questions (Message 1 to 4 of 4)  
From: Tom Melly
Subject: INC questions
Date: 23 Aug 2000 07:15:19
Message: <39a3b247$1@news.povray.org>
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).

2. Would I post such a macro to scene-files or utilities?


Post a reply to this message

From: Christoph Hormann
Subject: Re: INC questions
Date: 23 Aug 2000 10:43:59
Message: <39A3E358.D37B8ADB@schunter.etc.tu-bs.de>
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 don't see any way without modifying the scene file, but the modification is
quite simple:

#declare No_Sample = true;
#include "incfile.pov"

And the incfile.pov with

#if (No_Sample)

   [sample code]

#end

> 2. Would I post such a macro to scene-files or utilities?

scene-files IMO, because utilities is for seperate programs (no pov-code)

Christoph

--
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Chris Huff
Subject: Re: INC questions
Date: 23 Aug 2000 11:21:25
Message: <chrishuff-3FDE64.10224923082000@news.povray.org>
In article <39a3b247$1@news.povray.org>, "Tom Melly" 
<tom### [at] tomandlucouk> 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).

Well...maybe only produce the scene file if none of the variables are 
set. This won't work for macros, though.
Maybe call an Init() macro after including the file to set up variables 
and turn the example scene off.
Or maybe have a variable telling the include which sample to use...if 
not declared, no sample would be used.
Anyway, in my opinion, it is a much better idea to have separate 
examples. It won't be any harder to do, and it will be easier on the 
user and anyone trying to understand either the examples or the utility. 
And it allows multiple samples.


> 2. Would I post such a macro to scene-files or utilities?

Scene-files. The povray.binaries.utilities group is for stuff not 
written in POV-Script, and the povray.*.scene-files groups are really 
for any POV-Script files or code snippets.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Dick Balaska
Subject: Re: INC questions
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.