POV-Ray : Newsgroups : povray.text.tutorials : Calling a C function from povray? : Re: Calling a C function from povray? Server Time
18 May 2024 11:25:19 EDT (-0400)
  Re: Calling a C function from povray?  
From: Jerry Anning
Date: 30 Dec 1998 15:11:52
Message: <368A88FE.1129061A@dhol.com>
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.

Jerry Anning
cle### [at] dholcom


Post a reply to this message

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