|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I've got an object (a door) that I invoke as the result of a macro -
Door (Room, Open)
the door frame is labeled with the room number "Room", and the door is
rotated/opened around the hinge by the degrees defined in the Open variable.
This works smooth as butter in the include file.
I'm not sure about the syntax of invoking this macro in the scene
multiple times with translations
Door (Room, Open) translate <x,y,z> ?
I tried that, and it gives me an error,
" Parse Error: No matching } in 'union', object found instead "
brute-force pasting the guts of the macro (the frame object and the door
object plus the text of the door number) works just fine.
Fine meaning that the SDL runs, and I get a rendered scene, but I dunno
where my door is.
I have a big scene, a sub-scene included in it, and an include file with
objects I'm defining.
The door is grabbed from the include file (ideally. right now it's guts
are hard-pasted into the sub-scene) and then the subscene is "pasted"
into the big scene via
#declare subscene = union {#include "subscene.inc"}
object {subscene rotate y*90 translate <19*8*Feet, 0, 7*8*Feet>}
So I figure that my door ought to get translated by <19*8*Feet, 0,
7*8*Feet> just like everything else in the scene.
Knowing that I get lost in CSG-space without my Braille map, I took a
cylinder that stands up on the origin, which the door hinge rotates on,
defined it as an object, and figured I could send the x, y, and z of the
min_extent to the debug stream and find out where my door ended up.
So in my include file I have
#declare Ping = cylinder { <0, 0, 0>, <0, 100, 0>, 0.01 texture
{pigment {Yellow} finish {ambient 1}}};
in my subscene, I have
object {Ping}
#declare P = min_extent(Ping).x;
#declare Q = min_extent(Ping).y;
#declare R = min_extent(Ping).z;
#debug concat ( "Door Hinge origin = ", str (P, 0, 1), ", ", str (Q,
0, 1), ", ", str (R, 0, 1), ", ", "\n")
and then right after I actually call the subscene into the big scene, I
#debug concat ( "Door Hinge TRANSLATED = ", str (P, 0, 1), ", ", str (Q,
0, 1), ", ", str (R, 0, 1), ", ", "\n")
again.
I get all zeros. Actually, I get -0.0, 0.0, -0.0 .
I'm thinking I'm losing my Ping data because the location gets cleared
when the include file "exits" and min_extent doesn't give me what I'm
looking for...?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 22-3-2014 11:22, Bald Eagle wrote:
> I've got an object (a door) that I invoke as the result of a macro -
> Door (Room, Open)
> the door frame is labeled with the room number "Room", and the door is
> rotated/opened around the hinge by the degrees defined in the Open
> variable.
>
> This works smooth as butter in the include file.
> I'm not sure about the syntax of invoking this macro in the scene
> multiple times with translations
>
> Door (Room, Open) translate <x,y,z> ?
Not knowing how your macro is built, I assume that you should call it as:
object {Door (Room, Open) translate <x,y,z>}
>
> I tried that, and it gives me an error,
> " Parse Error: No matching } in 'union', object found instead "
>
> brute-force pasting the guts of the macro (the frame object and the door
> object plus the text of the door number) works just fine.
>
> Fine meaning that the SDL runs, and I get a rendered scene, but I dunno
> where my door is.
This suggests to me that the rotation of the Door is not done at the
origin and that some other transformation (another rotate? translate?)
is done /before/ the macro is called.
[snip]
> I'm thinking I'm losing my Ping data because the location gets cleared
> when the include file "exits" and min_extent doesn't give me what I'm
> looking for...?
Am not sure about that is exactly happening here. Could you provide a
simple scene reproducing this?
Thomas
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I've got an object (a door) that I invoke as the result of a macro -
> Door (Room, Open)
> the door frame is labeled with the room number "Room", and the door is
> rotated/opened around the hinge by the degrees defined in the Open
> variable.
>
My steps in a similar case would be:
Make double sure that the Door() macro is totaly self contained. By
that, I mean that there are no unmatched brace and not unmatched
parantesis. Also make absolutely sure that an #end realy terminate the
macro definition. If you forget that one, you are still in the
definition phase of the macro when you invoke it. This may explain the
error you get. A missing #end can REALY mess you up with realy hard to
locate errors sources.
In your sub-scene, you need to have an union binding all parts.
Otherwise, your translate and rotate will miss some, or most, elements.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> object {Door (Room, Open) translate <x,y,z>}
Aha. That makes sense. The macro stuff that gets invoked is in a sort
of wrapper like a union, so I call it as an object{ }.
That helps a lot.
> This suggests to me that the rotation of the Door is not done at the
> origin and that some other transformation (another rotate? translate?)
> is done /before/ the macro is called.
Well, that would be the obvious thing to check, but I'm certain that's
not the case. I originally just defined all the door elements however
their placement made sense in my mind at the time, and then did a big
face-palm when I realized that any hinged object ought to have the pivot
sitting atop the origin. So I had to go back and fix it so that it was.
And I used the cylinder as a reference object in the macro so i could
SEE where the origin in the macro definition was.
Plus, at the end of my include file, if the file is being run as a
standalone scene (ifdef) then it runs the macro and the door pops up
with the hinge right on the origin, so that's tested.
> Am not sure about that is exactly happening here. Could you provide a
> simple scene reproducing this?
Yes, I'll see what I can track down and debug, and let y'all know what
I'm mucking up. An error shared is a future error avoided. :)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The macro is clean. It's only 3 lines.
Object{frame}, text, and object {door}. Done.
Not much to keep track of.
> In your sub-scene, you need to have an union binding all parts.
> Otherwise, your translate and rotate will miss some, or most, elements.
Well, I essentially do just that: When the subscene gets invoked as an
included file, Povray should just act like the whole file was pasted
into the main scene in place of the include directive. So when I
#declare Subscene = union {#include "subscene.inc"}
Then essentially the whole subscene file is encapsulated in the union
directive.
Then this:
object {Subscene rotate y*90 translate <19*8*Feet, 0, 7*8*Feet>}
should give exactly the same results as what you're suggesting since the
entire subscene file is the object being rotated and translated. And it
works, because there's a LOT of stuff in that subscene file.
> Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Okay, so first I invoked the macro as an object, but the nested scene
still choked on the second line of the macro with the same no matching }
error.
So that gave me the idea of putting everything between #macro and #end
inside of a union {}.
THAT got things working with no errors, and voila, a door and a frame in
the right spot.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 23-3-2014 1:43, Bald Eagle wrote:
> Okay, so first I invoked the macro as an object, but the nested scene
> still choked on the second line of the macro with the same no matching }
> error.
>
> So that gave me the idea of putting everything between #macro and #end
> inside of a union {}.
>
> THAT got things working with no errors, and voila, a door and a frame in
> the right spot.
>
>
>
Excellent!
As said, all depends on the way your macro is written, i.e. what exactly
is defined inside it.
Thomas
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|