POV-Ray : Newsgroups : povray.text.tutorials : Calling a C function from povray? : Re: Calling a C function from povray? (addendum) Server Time
18 May 2024 12:50:30 EDT (-0400)
  Re: Calling a C function from povray? (addendum)  
From: Jerry Anning
Date: 30 Dec 1998 15:43:18
Message: <368A905F.A4509E70@dhol.com>
Jerry Anning wrote:
> 
> Stefan Riedel wrote:
> >
> > How is it possible to call a C? function (one which takes a time and a
> > day and gives back
> > a direction vector - the sun's position for an animation of shadows over
> > a year)
> 
> If you only need to call the function once per frame, and know the
> calling parameters before you start to render the frame, you can write
> the function as a standalone program that takes a command line and saves
> a text file containing the desired vector.  Then, in your .ini file, add
> a line like this:
> 
> PreFrameCommand=C:\Stuff\Sun.exe -t 0800 -d 03041999 -p 800315e472238n
> 
> --- or whatever parameters your program takes.  Then use the file
> reading ability of 3.1 to read in the vector in the pov code for the
> frame.  Or get the macro SunPos (by ingo) at
> http://twysted.net/macroscope, tinker it a bit to output your desired
> format, and do the calculations with it strictly in your POV code.

I overlooked another method, perhaps the most like what you want.  Get
either Dan Connelly's #system patch or the SuperPatch, which contains
it.  If you are on a nonWindows system, you'll have to get the former
and compile it in.  This gives you the #system command.  You use it like
the #debug command, except that it sends the string you give it to the
shell from inside your scene file and executes it via the system
command.  So you would say this in your .pov file:

#system "C:\Stuff\Sun.exe -t 0800 -d 03041999 -p 800315e472238n"

Jerry Anning
cle### [at] dholcom


Post a reply to this message

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