POV-Ray : Newsgroups : povray.general : My macro doesn't work with povray 3.6 : My macro doesn't work with povray 3.6 Server Time
31 Jul 2024 22:10:12 EDT (-0400)
  My macro doesn't work with povray 3.6  
From: saturn
Date: 17 Aug 2006 17:00:00
Message: <web.44e4d88ea0d9959b0be83f00@news.povray.org>
Hi guys, I wrote a very simple recursive tree macro that works with povray
3.5 but not 3.6. I'm completely stumped about what the problem is. With
some parameters it works fine on 3.6, but with other parameters it has a
syntax error! Am I doing something wrong or is this a bug in povray? Below
is the error message I get and the macro. I can provide a complete scene
that triggers the problem if that would help.

=== Error Message ===

File: rtree.inc  Line: 49
File Context (5 lines):
                                        0,
                                        (rand(RTreeRand)*90)-45
                                > * (1-BiasFactor)) - (BiasVector *
BiasFactor);
                                object { RTree(CB+1, BranchDepth, NextWidth,
Rot, BranchSpline)
Parse Error: Identifier expected, incomplete function call or spline call
found
 instead.

=== Macro ===

#include "colors.inc"
#include "functions.inc"
#include "math.inc"

#declare RTreeRand = seed(1);

#macro HalfRand ()
        (rand(RTreeRand)-0.5)*3
#end

#macro RTreeSeg (SplineStart, TrunkTop, SplineEnd, SizeStart, SizeEnd)
        sphere_sweep {
                cubic_spline 4,
                SplineStart, SizeStart
                <0, 0, 0>, SizeStart
                TrunkTop, SizeEnd
                SplineEnd, SizeEnd
                tolerance 0.1
        }
#end

#macro RTree (CB, BranchDepth, Width, BiasVector, BranchSpline)
        #local Length = BranchSpline(CB).x;
        #local BranchFactor = BranchSpline(CB).y;
        #local NextWidth = Width*BranchFactor;
        #local BiasFactor = BranchSpline(CB).z;

        #local TrunkTop = <0, Length*(rand(RTreeRand)*0.4+0.8), 0>;

        #local SplineEnd = TrunkTop +
                <HalfRand(), rand(RTreeRand)+1, HalfRand()>;

        #local SplineStart = <HalfRand(), rand(RTreeRand)-1, HalfRand()>;

        #if(CB < BranchDepth)
                union {
                        RTreeSeg(SplineStart, TrunkTop, SplineEnd, Width,
NextWidth)

                        #local BC = 2;
                        #while (BC > 0)
                                #local Rot=(<
                                        (rand(RTreeRand)*90)-45,
                                        0,
                                        (rand(RTreeRand)*90)-45
                                > * (1-BiasFactor)) - (BiasVector *
BiasFactor);
                                object { RTree(CB+1, BranchDepth, NextWidth,
Rot, BranchSpline)
                                        rotate Rot
                                        translate TrunkTop - y*(Width/2)
                                }
                                #local BC=BC-1;
                        #end
                }
        #else
                RTreeSeg(SplineStart, TrunkTop, SplineEnd, Width, NextWidth)
        #end
#end


Post a reply to this message

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