POV-Ray : Newsgroups : povray.programming : Extending the #read directive Server Time
22 May 2024 03:46:06 EDT (-0400)
  Extending the #read directive (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: ABX
Subject: Re: Extending the #read directive
Date: 8 May 2003 08:51:58
Message: <sgkkbvofqo5unb9prdmua72dq716tp4lr4@4ax.com>
On Thu, 08 May 2003 14:40:17 +0200, Christoph Hormann <chr### [at] gmxde>
wrote:
> You should better
> tell what you are trying to achieve and not what you think is the best way
> to achieve it.

If I can somehow predict intentions I think that image format which read bytes
as gray values into one row image would be similiar solution which preserves 0
value. This could be readed via eval_pigment.

ABX


Post a reply to this message

From: Hugo Asm
Subject: Re: Extending the #read directive
Date: 8 May 2003 09:43:21
Message: <3eba5ef9$1@news.povray.org>
> If I can somehow predict intentions

No, but thanks for trying. My case deals with all software that outputs a
text file, with some information that could be used in a POV-Ray scene file.
There has been a few occasions where I could easily have written a
"converter" in SDL, if just POV-Ray could read those files. Most recent
example is the following:

1) Other software outputs a mesh2 for POV-Ray.

2) Animation in POV-Ray requires interpolation between sets of mesh2 data
(keyframes in a character animation). I wrote a macro to interpolate the
data.

3) However, I need to manually convert the mesh2 data, into a set of
array's, because otherwise a macro can't read them.

If I could search the mesh2 file, for the right place to begin loading all
the vertex vectors, normal vectors, etc.. this would run automatic. So far I
have to use the copy-and-paste methods, and with a lot of mesh2 input, this
is not very clever. The alternative is to modify POV-Ray, or modify the
other software, to output files that follow the rules of the #read
directive.

But I think the most user-friendly thing to do, is to modify POV-Ray. Most
software cannot output for POV-Ray, even if they can output some text files.
I could write an .obj converter in SDL since this file-format is text based.
I remember a case where someone mentioned a particle-system that runs
independant of POV-Ray, but it's output is text-based and could be converted
in SDL. The user had to manually edit the files.

Convinced?  :o)

Hugo


Post a reply to this message

From: ABX
Subject: Re: Extending the #read directive
Date: 8 May 2003 09:59:39
Message: <fdokbv0jghii35elgtngn37d0lbcnav78e@4ax.com>
On Thu, 8 May 2003 15:43:24 +0200, "Hugo Asm" <hua### [at] post3teledk> wrote:
> Convinced?  :o)

I have no idea what version of Windows are you using but look into 'for' command
in dos box (call 'for /?' for parameters). In some Windowses you can perform
loop over lines of text file and probably add quotation marks and commad for
each line to make acceptable file without opening text editor. I used similiar
method when worked on Insert menus for all include files from standard
distribution.

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Extending the #read directive
Date: 8 May 2003 10:01:46
Message: <3EBA634A.12D567E6@gmx.de>
Hugo Asm wrote:
> 
> [...]
> 
> Convinced?  :o)
> 

No.  You say you need to convert mesh data into a form that POV-Ray can
read as arrays and the only solution should be to modify POV-Ray?

If your mesh2 file is always in the same basic form (i.e. line breaks at
the same positions etc.) a short sed script should be sufficient to
convert it into a set of arrays.

In most cases the compressed mesh (pcm) toolkit:

http://www.geocities.com/SiliconValley/Lakes/1434/pcm.html

should also work for this purpose (although it does not support all mesh2
features IIRC).

Both solutions are very fast and the former is quite easily to adapt to
any special requirements in addition - in one word they are very user
friendly.  Reading a mesh2 file through individual strings with an SDL
program on the other hand would be extremely slow.  

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Hugo Asm
Subject: Re: Extending the #read directive
Date: 8 May 2003 10:16:04
Message: <3eba66a4@news.povray.org>
> I have no idea what version of Windows are you using but look
> into 'for' command in dos box

Thanks, I have lots of Windows in the house, it should be enough. I was
hoping for a more elegant solution though. What happens if I write \0 in a
string? There is probably some conversion to prevent it from ending
prematurely. Perhaps the same conversion could be added in the reading
process and the string would be fine?

Regards,
Hugo


Post a reply to this message

From: Warp
Subject: Re: Extending the #read directive
Date: 8 May 2003 13:52:47
Message: <3eba996e@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
> '\0' indicates the end of a string so this would mess up the whole thing.

  This shouldn't be a problem in C++. C++ strings do not have any special
character which marks the end of the string (ie. strings can have any
characters).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: ABX
Subject: Re: Extending the #read directive
Date: 8 May 2003 13:57:29
Message: <je6lbv4fls5qtothmhb34v8vutoa11mjn7@4ax.com>
On 8 May 2003 13:52:47 -0400, Warp <war### [at] tagpovrayorg> wrote:
> Christoph Hormann <chr### [at] gmxde> wrote:
> > '\0' indicates the end of a string so this would mess up the whole thing.
>
> This shouldn't be a problem in C++. C++ strings do not have any special
> character which marks the end of the string (ie. strings can have any
> characters).

IIRC Hugo meant _small_ change in POV-Ray sources ;-)

ABX


Post a reply to this message

From: Hugo Asm
Subject: Re: Extending the #read directive
Date: 8 May 2003 17:08:48
Message: <3ebac760@news.povray.org>
> IIRC Hugo meant _small_ change in POV-Ray sources ;-)

I do have a few questions to this:

Would a text file ever contain a null character (ascii value zero)
considering it's only text? A text file uses 0-9, A-Z, a-z, a few !"#&
signs, an invisible line break, and EOF.. There seems to be no need for a
null character.

On the other hand, if we are actually talking about 2 characters  '\0'  then
why not convert them to an ascii value that is never used in a text file?
Just as long as the C string can hold it. Then convert it back to \0 when
the user wants to read the string.


Regards,
Hugo


Post a reply to this message

From: Christopher James Huff
Subject: Re: Extending the #read directive
Date: 9 May 2003 11:16:28
Message: <cjameshuff-409C31.11163009052003@netplex.aussie.org>
In article <3ebac760@news.povray.org>, "Hugo Asm" <hua### [at] post3teledk> 
wrote:

> Would a text file ever contain a null character (ascii value zero)
> considering it's only text? A text file uses 0-9, A-Z, a-z, a few !"#&
> signs, an invisible line break, and EOF.. There seems to be no need for a
> null character.

Probably not, but this restriction makes binary files unuseable.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Extending the #read directive
Date: 9 May 2003 11:18:15
Message: <cjameshuff-9E56A4.11181709052003@netplex.aussie.org>
In article <3EBA5031.EDABF9C2@gmx.de>,
 Christoph Hormann <chr### [at] gmxde> wrote:

> No, i think he means if the file contains a '\0' this will result in a
> '\0' :-)
> 
> '\0' indicates the end of a string so this would mess up the whole thing.

Only on null-terminated strings. If you store the length separately, you 
don't need a null terminator and can have any byte value in the string.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

<<< Previous 5 Messages Goto Initial 10 Messages

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