POV-Ray : Newsgroups : povray.general : Feature Request: Binary #write : Re: Feature Request: Binary #write Server Time
30 Jul 2024 10:14:11 EDT (-0400)
  Re: Feature Request: Binary #write  
From: Edouard
Date: 24 Mar 2009 00:05:00
Message: <web.49c85b406dca0b64eba2273d0@news.povray.org>
"clipka" <nomail@nomail> wrote:
> As it seems, POV can write *every* file format it can read (and more)... except
> that one file format which was specifically *designed* for POV: DF3.
>
> You just can't write that format with POV. No way. You need a 3rd party tool to
> create such files.
>
> That sucks.
>
> I therefore propose to extend the #write mechanism to allow for writing binary
> data.
>
> Well, actually I did already implement a patch, so it's more like a request for
> a "go/no-go" from the POV team to go ahead and integrate it into official POV.
>
> The mechanism is simple: The statement
>
>     #write (fOut, someVal, int16 fooBar, otherVal)
>
> will write fooBar in binary 16-bit unsigned integer format.
>
> That means, if it is a float, the value is rounded to the nearest integer
> (values outside the valid unsigned 16-bit integer range are "clipped" to 0 or
> 65535, respectively), and written to the file in 16-bit binary format
> (big-endian, i.e. matching the df3 format byte ordering).
>
> If fooBar is a vector, all components are written in this manner.
>
> A sequence of values can be written in binary format using either of the
> following syntax:
>
>     #write (fOut, int16 a, int16 b, int16 c, int16 d)
>     #write (fOut, int16 a b c d)
>
> (Note the absence of commata in the second variant)
>
> Well, that's it. Equipped with this tool, creating DF3 files still remains some
> bit of work, but now at least it's possible, and actually not too complicated.
>
> So far I have only implemented 16-bit because for now my main goal is creating
> DF3 files, which have 16-bit values in the header and come in a 16-bit voxel
> flavor (among other). However, adding support for 8-bit data isn't too
> difficult either.
>
> Anyone else who thinks this would be a neat idea?

Absolutely - I'd love that feature. Raw 8 bit support is critical though.

Cheers,
Edouard.


Post a reply to this message

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