POV-Ray : Newsgroups : povray.beta-test : macro issue Server Time
10 Oct 2026 22:01:49 EDT (-0400)
  macro issue (Message 1 to 14 of 14)  
From: Scott Wasson
Subject: macro issue
Date: 16 Jun 2002 22:54:08
Message: <3d0d4f50$1@news.povray.org>
I'm trying to declare a macro that defines a layered texture.  Here's a
simplified example:

#macro fooTexture()
 texture {
     pigment { Red }
 }
 texture {
     pigment { Blue }
}
#end //macro fooTexture

Please ignore the fact there's no transmit in the Blue layer...   Now, if I
add a #-something to the second layer:

 texture {
    #declare fooBar=2;
     pigment { Blue }
}

or:

 texture {
 #if ( 0 )
     pigment { Blue }
 #else
     pigment { Green}
 #end
}

or add any #'whatevers at all within the second layer, I get a parsing
error: "No matching } in 'texture', # found instead".

But if I do:

#macro fooTexture()
 texture {
  #declare fooBar=2;
     pigment { Red }
 }
 texture {
     pigment { Blue }
}
#end //macro fooTexture


It doesn't complain about #declares in the 1st layer.  What up?

-Scott


Post a reply to this message

From: bob h
Subject: Re: macro issue
Date: 17 Jun 2002 00:12:55
Message: <3d0d61c7@news.povray.org>
Hi Scott, sorry I can't confirm (RC6, WinXP).

I did experience this kind of error back in v3.1g but that wasn't in macro
form, just the layered texture. I checked your trouble out the way you said,
and also with #declare and #if embedded within both 1st and 2nd layers. So I
don't know why it happens that way for you.

You didn't give your specs so it would be a good idea to let everyone know
which beta and system you are using.

bob h


Post a reply to this message

From: Scott Wasson
Subject: Re: macro issue
Date: 17 Jun 2002 08:46:40
Message: <3d0dda30$1@news.povray.org>
"bob h" <omn### [at] charternet> wrote in message
news:3d0d61c7@news.povray.org...
> Hi Scott, sorry I can't confirm (RC6, WinXP).
>
> I did experience this kind of error back in v3.1g but that wasn't in macro
> form, just the layered texture. I checked your trouble out the way you
said,
> and also with #declare and #if embedded within both 1st and 2nd layers. So
I
> don't know why it happens that way for you.
>
> You didn't give your specs so it would be a good idea to let everyone know
> which beta and system you are using.
>
> bob h

Sorry, W2K, RC6.  To put a wrapper around the example I provided, I tried
something like this:

object { sphere { < 0,0,0>, 1  fooTexture() } }

Even involking the fooTexture() macro in something as simple as this caused
the parsing error.

-Scott


Post a reply to this message

From:
Subject: Re: macro issue
Date: 17 Jun 2002 08:56:46
Message: <l1nrgu0f6llg8kpbhf52ft3v2vrjsl67ok@4ax.com>
On Sun, 16 Jun 2002 22:53:35 -0400, "Scott Wasson" <swa### [at] townispcom>
wrote:
> What up?

Have you noticed NOTE in '6.7.6 Layered Textures' chapter ?

ABX


Post a reply to this message

From: Scott Wasson
Subject: Re: macro issue
Date: 17 Jun 2002 09:22:05
Message: <3d0de27d$1@news.povray.org>
If you mean the last note about using macros inside layered textures, yes.
Except I have it the other way around -- multiple layers in a macro.

Outside of that, hold the phone for a little while, everyone.  In my
1100-line scene file I have the problem.  I just tried boiling it down to a
40-line test file, and of course it works just fine.  :-(   Let me start
whittling away huge chunks of my scene file, and I'll report back.  Sorry
for bothering everyone prematurely.

-Scott

"W³odzimierz ABX Skiba" <abx### [at] babilonorg> wrote in message
news:l1nrgu0f6llg8kpbhf52ft3v2vrjsl67ok@4ax.com...
> On Sun, 16 Jun 2002 22:53:35 -0400, "Scott Wasson" <swa### [at] townispcom>
> wrote:
> > What up?
>
> Have you noticed NOTE in '6.7.6 Layered Textures' chapter ?
>
> ABX


Post a reply to this message

From:
Subject: Re: macro issue
Date: 17 Jun 2002 09:42:18
Message: <grorgu8cfvsgidqgj80jjj2hl894ul0tnd@4ax.com>
On Mon, 17 Jun 2002 09:21:31 -0400, "Scott Wasson" <swa### [at] townispcom>
wrote:
> If you mean the last note about using macros inside layered textures, yes.

Yes. I mean that part.

> Except I have it the other way around -- multiple layers in a macro.

But you said: "if I add a #-something to the second layer".
Every #-something can lead to another #declaration of of layered texture. So
new # breaks previous declaration block and starts another. But previous one
is not finished so it reports an error about it. Sentence in pointed note
describes similiar situation: "macro would contain a declare the parser could
no longer guess that two or more texture identifiers are supposed to belong to
the layered texture and not some other declare." IIRC This behaviour was
explained many times.

ABX


Post a reply to this message

From: Alf Peake
Subject: Re: macro issue
Date: 17 Jun 2002 09:43:21
Message: <3d0de779$1@news.povray.org>
No problems with me.

Version 3.5.beta.RC6 win32 (.msvc)
Win98SE, 160MB, Celeron 500

Alf


Post a reply to this message

From:
Subject: Re: macro issue
Date: 17 Jun 2002 09:48:15
Message: <svprguk9vqhqqktr4hvlmjopj75pr379qf@4ax.com>
On Mon, 17 Jun 2002 09:21:31 -0400, "Scott Wasson" <swa### [at] townispcom>
wrote:
> If you mean the last note about using macros inside layered textures, yes.
> Except I have it the other way around -- multiple layers in a macro.

BTW, perhaps the reason why people can't confirm your problem is becouse you
are declaring layered texture while they put it directly to the object. If you
are not sure I'm right and You still think it is a bug you should post a short
part of your scene in two alternative versions.

ABX


Post a reply to this message

From: Scott Wasson
Subject: Re: macro issue
Date: 17 Jun 2002 10:18:24
Message: <3d0defb0@news.povray.org>
OK, I found the true culprit.  I'm using Chris Colefax's explode macros to
blow up a multi-textured object.  So I also have:

#declare particle_texture = fooTexture();
...
#include "Explode.inc"

If I comment out the #declare, or don't put #-something inside the 2nd
layer, it works fine.  I still don't see any syntax ambiguities.  Any clue?

-Scott

"Alf Peake" <alf### [at] peake42freeservecouk> wrote in message
news:3d0de779$1@news.povray.org...
> No problems with me.
>
> Version 3.5.beta.RC6 win32 (.msvc)
> Win98SE, 160MB, Celeron 500
>
> Alf
>
>
>


Post a reply to this message

From: Alf Peake
Subject: Re: macro issue
Date: 17 Jun 2002 11:09:26
Message: <3d0dfba6@news.povray.org>
Correction:

"Alf Peake" <alf### [at] peake42freeservecouk> wrote in message
news:3d0de779$1@news.povray.org...
> No problems with me.

Now I got one :/

#macro fooTexture()
 texture {
     pigment { Red }
 }
 texture {
     pigment { Blue }
     pigment { Green }
}

#end //macro fooTexture

//object {
sphere { < 0,0,0>, 1 fooTexture() } }
// }

Giving:

# } } <----ERROR

Parse Error: Expected 'object or directive', } found instead

Returned from renderer with error status

and sphere is highlighted.


Post a reply to this message

From: Alf Peake
Subject: Re: macro issue
Date: 17 Jun 2002 11:17:45
Message: <3d0dfd99@news.povray.org>
I didn't invoke your macro first time - just added it to a test file.
_Using_ it now gives me an error but I can't see anything wrong in the
script ( that pigment{ Green } in my post shouldn't be there).

Alf


Post a reply to this message

From: Alf Peake
Subject: No there isn't :(
Date: 17 Jun 2002 11:22:52
Message: <3d0dfecc@news.povray.org>
"Alf Peake" <alf### [at] peake42freeservecouk> wrote in message
news:3d0dfba6@news.povray.org...
> Correction:
>
> "Alf Peake" <alf### [at] peake42freeservecouk> wrote in message
> news:3d0de779$1@news.povray.org...
> > No problems with me.
>
> Now I got one :/
> sphere { < 0,0,0>, 1 fooTexture() } }

OK - there's an extra brace above. Sorry. No problems when corrected.


Post a reply to this message

From: Warp
Subject: Re: macro issue
Date: 17 Jun 2002 11:24:51
Message: <3d0dff43@news.povray.org>
The current form for layered textures is not very good, after all. It causes
too many ambiguities to both the parser and the user. IMHO it should be
redesigned for pov4.
  For example something like:

texture
{ layered texture_map
  { [1 texture1]
    [1 texture2]
  }
}

  'layered' could work like 'average', but layering the textures instead
of averaging them. The values could be used for some extra effect (don't
know if there's any useful thing, though).

-- 
#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: Christoph Hormann
Subject: Re: macro issue
Date: 17 Jun 2002 11:25:20
Message: <3D0DFF5F.53283978@gmx.de>
Scott Wasson wrote:
> 
> I'm trying to declare a macro that defines a layered texture.  Here's a
> simplified example:
> 
> [...]

This does not look like a POV-Ray 3.5 specific problem to me.  If it is,
please post a correct bug report with a sample scene showing the problem. 
It it is just a problem about POV-Ray in general that occured to you while
working you should post it in a different newsgroup.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 14 Jun. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

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