POV-Ray : Newsgroups : povray.general : macro - without () Server Time
18 Nov 2024 07:19:39 EST (-0500)
  macro - without () (Message 1 to 10 of 34)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Rafal 'Raf256' Maj
Subject: macro - without ()
Date: 2 Oct 2002 04:51:55
Message: <Xns929B6E4B9C20Braf256com@204.213.191.226>
Would it be a big problem to allow syntax  :

#macro finWater1 reflection { .01 .2 } #end
finish { finWater1 }

instead of  finish { finWater1() }

this is a small change [probably] and shorten syntax is more comfortable

btw. this will make pov macros act more like C preprocesor macros

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: macro - without ()
Date: 2 Oct 2002 05:10:49
Message: <Xns929B717FF7B24raf256com@204.213.191.226>
"Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote in 
news:Xns### [at] 204213191226

> Would it be a big problem to allow syntax  :
[...]

and another request, in connection with previous post - keyword ignore
that can be added to any object. It will 'kill' the object.

Why ? 
Simple - it's very usefull while i.e. 'debugging' scene - if I have object 
long at 100 lines like :
difference { ... union { ... } merge { ... union { ... } 
  ...
  ignore
} 
addning / removing "ignore" is much faster then commenting all 100 lines or 
putting them into  #if (0) ... #end


Why connection with no "()" macros ? because creating ignore keyword can be 
done in POV already :
  #macro ignore() translate 1e50 #end
  (this will work for most objects)
But it must be used as :
  object { ... ignore() }   instead of :
  object { ... ignore }
(without no-()-macros syntax)


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Simon Adameit
Subject: Re: macro - without ()
Date: 2 Oct 2002 05:42:57
Message: <3d9abfa1@news.povray.org>
If you have such problems you should perhaps think about changing the way
you write your scenes and not about changing POV-Ray. One way would for
example be to declare your big objects in include files.


Post a reply to this message

From: Simon Adameit
Subject: Re: macro - without ()
Date: 2 Oct 2002 05:47:10
Message: <3d9ac09e@news.povray.org>
I dont like this suggestion because it makes the code less readable.
You cant tell from finish{finWater1} if it is a declared finish or a macro.


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: macro - without ()
Date: 2 Oct 2002 05:58:00
Message: <Xns929B797F92A0Braf256com@204.213.191.226>
"Simon Adameit" <gom### [at] gmxde> wrote in news:3d9abfa1@news.povray.org

> If you have such problems you should perhaps think about changing the way
> you write your scenes and not about changing POV-Ray. One way would for
> example be to declare your big objects in include files.

This is a good idea, and I do it already.

But, You have such big objct, (already in .inc file) like :

union { // my space ship - part of BIG scene
  difference {
    merge { // 30 lines... hull // }
    union {
      union { // 10 lines - hole for missiles }
      union { 
         // 30 lines - hole for gun 
      }
      union {
        // 30 lines - random spheres - damage from bullets
      }  
    }
  }
  object { #include "my_gun.inc" }
}

and You want fastly check how ship would like without random spheres 
damage.


This future isn't something realy important, it's just to have more 
comfortable syntax :) And it's look quite easy to code. Currently i'm happy 
with this ignore macro, but maybe keyword would be better ?
I.e. it is needed with infinite objects.


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: macro - without ()
Date: 2 Oct 2002 06:02:25
Message: <Xns929B7A3E964B6raf256com@204.213.191.226>
"Simon Adameit" <gom### [at] gmxde> wrote in news:3d9ac09e@news.povray.org

> I dont like this suggestion because it makes the code less readable.

same as using variables named 'a' 'd' 'asd' instead of shipSize, gunRadius 
etc... :) it's up to user how he would use tool.

> You cant tell from finish{finWater1} if it is a declared finish or a
> macro. 

macro is for users that use already finWater1() to have shorten syntax then 
finish{finWater1}. It realy matter if scene have i.e. 100 objects placed 
manualy (without loops / editors / etc)

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: macro - without ()
Date: 2 Oct 2002 06:08:21
Message: <Xns929B7B4097CB1raf256com@204.213.191.226>
"Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote in
news:Xns### [at] 204213191226 

>> You cant tell from finish{finWater1} if it is a declared finish or a
>> macro. 
> macro is for users that use already finWater1() to have shorten syntax
> then finish{finWater1}. It realy matter if scene have i.e. 100 objects
> placed manualy (without loops / editors / etc)

best exaple - if each of objects have realy complex textures - with many 
layers, and some layers use material maps, or color maps 

color_map {
  [0.0 colEye]
  [0.1 colEye]
  [0.11 colSkin]
  [0.5 colSkin]
  [1.0 colBlood]
}

// -----------

color_map {
  [0.0 color rgbft colEye]
  [0.1 color rgbft colEye]
  [0.11 color rgbft colSkin]
  [0.5 color rgbft colSkin]
  [1.0 color rgbft colBlood]
}


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Simon Adameit
Subject: Re: macro - without ()
Date: 2 Oct 2002 06:18:03
Message: <3d9ac7db@news.povray.org>
"Rafal 'Raf256' Maj" wrote:
> This future isn't something realy important, it's just to have more
> comfortable syntax :) And it's look quite easy to code. Currently i'm
happy
> with this ignore macro, but maybe keyword would be better ?
> I.e. it is needed with infinite objects.
>
For infinite objects you could make macro like this:
#macro _()
#declare _a213_9xyio0_23sd_f=
#end

It would be used this way:
_()object{....100 lines of csg}

But I prefer to write my scenes in a way so that such problems dont occur.


Post a reply to this message

From: Simon Adameit
Subject: Re: macro - without ()
Date: 2 Oct 2002 06:19:45
Message: <3d9ac841@news.povray.org>
"Rafal 'Raf256' Maj" wrote:
> best exaple - if each of objects have realy complex textures - with many
> layers, and some layers use material maps, or color maps
>
> color_map {
>   [0.0 colEye]
>   [0.1 colEye]
>   [0.11 colSkin]
>   [0.5 colSkin]
>   [1.0 colBlood]
> }

I dont see why one would want to use macros anyway in such a case.


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: macro - without ()
Date: 2 Oct 2002 06:45:45
Message: <Xns929B8197F681Craf256com@204.213.191.226>
"Simon Adameit" <gom### [at] gmxde> wrote in news:3d9ac7db@news.povray.org

> For infinite objects you could make macro like this:
> #macro _()
>   #declare _a213_9xyio0_23sd_f=
> #end
> _()object{....100 lines of csg}

thanks :)

> But I prefer to write my scenes in a way so that such problems dont
> occur. 

it's not a problem - ofcourse it is only needed in writting state, final 
version doesn't need it


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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