POV-Ray : Newsgroups : povray.programming : Passing custom key presses to a POV scene? : Re: Passing custom key presses to a POV scene? Server Time
6 May 2024 02:09:54 EDT (-0400)
  Re: Passing custom key presses to a POV scene?  
From: stbenge
Date: 15 Oct 2009 19:14:24
Message: <4ad7acd0@news.povray.org>
Christian Froeschlin wrote:
> stbenge wrote:
> 
>> I started developing a simple real-time game with POV yesterday. 
> 
> Umm ... what's your definition of real-time here? ;)

Anywhere between 70-12 FPS for a 100x100 to 200x200 render on a quad 
core. This doesn't involve using the +rtr command line option. Instead, 
I'm having to use +kff1215752192, which should be enough time for 
solving the maze.

>> receiving errors possibly related to my text file not being fully 
>> written before POV can read the vector :(
> 
> How do you start the render and wait for it to finish?

I don't :/ My program simply writes to an .inc file every time an arrow 
key is pressed. I might be able to optimize this by writing only once if 
a key is still being pressed.

> Maybe you could try calling fflush() after writing the data.

I will look into that. Currently, I do this:

myfile.open(file_temp);
myfile << "#declare dir=";
myfile << vEcToR << ";\n";
myfile.close();

ifstream ifs(file_temp,ios::in|ios::binary);
ofstream ofs(file,ios::out | ios::binary);
ofs << ifs.rdbuf();

I haven't had a problem with this new setup yet, but I feel like I'm 
just getting lucky again.

>> Is there another way to pass custom key presses to a POV scene 
> 
> Sure, you can pass a define via command line:
> 
>   pvengine +whatever ... maze.pov Declare=Arrow=2
> 
> Then the scene would have a variable "Arrow" defined with value 2.

How do I do this? With a system() command? If so, how do I find out 
where 'pvengine' is?

Sam


Post a reply to this message

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