|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
So, I was converting some code from c++ to SDL, and I made the first lines of a
macro plot 3 spheres to mark positions on a grid.
The problem is, the first sphere doesn't show up.
I made the sphere bigger, then bigger, then commented out the grid plane, and
then figured - what the heck - I'll instantiate it twice.
And lo and behold - the sphere showed up.
Commenting out the preceding duplicate sphere made it disappear again! :O
I've got a work-around going where I just precede everything with
sphere {0, 0}
but this has got to be one of the weirdest things I've come across.
- BW
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I also don't seem to be able to get the macro to pass a result out in the normal
manner.
I'm not sure if this is related to the multiple instances of my not being able
to get macros to function properly from inc files, etc.
Something's wrong, and I'm not sure where.
This small test scene doesn't render the first blue sphere, until the dummy
sphere gets uncommented.
#version 3.8;
global_settings {assumed_gamma 1.0}
default {finish {diffuse 1}}
#include "functions.inc"
camera {
location <0, 0, -30>
right x*image_width/image_height
up y
look_at <0, 0, 0>
}
light_source {<0, 0, -50> rgb 1.0}
sky_sphere {pigment {rgb 1}}
#macro Test (startX, startY, targetX, targetY)
//sphere {0, 0}
sphere {<startX, startY, 0> 0.1 pigment {rgb z}}
sphere {<targetX, targetY, 0> 0.1 pigment {rgb y}}
#declare Result = 1;
//Result
#end
#declare myResult = Test (1, 3, 4, 2);
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 9/8/23 16:16, Bald Eagle wrote:
> #macro Test (startX, startY, targetX, targetY)
> //sphere {0, 0}
> sphere {<startX, startY, 0> 0.1 pigment {rgb z}}
> sphere {<targetX, targetY, 0> 0.1 pigment {rgb y}}
>
> #declare Result = 1;
>
> //Result
>
> #end
>
> #declare myResult = Test (1, 3, 4, 2);
If we flatten the macro call, I believe what is showing up in the scene
at the top is:
//---
#declare myResult = sphere {0, 0}
sphere { <1, 3, 0>, 0.1 pigment rgb <0,0,1> }
sphere { <4, 2, 0>, 0.1 pigment rgb <0,1,0> }
$declare Result = 1;
//---
In other words, I think you need a union{} wrap of the spheres inside
that macro - or don't do the assignment to myResult. The additional
sphere prevents the assignment to the myResult identifier from eating
the first non-dummy sphere; it instead eats the dummy one.
Bill P.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
William F Pokorny <ano### [at] anonymousorg> wrote:
> In other words, I think you need a union{} wrap of the spheres inside
> that macro - or don't do the assignment to myResult. The additional
> sphere prevents the assignment to the myResult identifier from eating
> the first non-dummy sphere; it instead eats the dummy one.
Ugggggh.
So obvious, but I read straight through it.
I will proceed with what I'm doing with that in mind.
On a positive note, I was able to implement the A* pathfinding algorithm
successfully. (so far)
Thanks, Bill!
Post a reply to this message
Attachments:
Download 'a-star test.png' (76 KB)
Preview of image 'a-star test.png'
|
|
| |
| |
|
|
|
|
| |
|
|