POV-Ray : Newsgroups : povray.general : #local shapes Server Time
31 Oct 2024 21:22:54 EDT (-0400)
  #local shapes (Message 1 to 6 of 6)  
From: Steely
Subject: #local shapes
Date: 7 Apr 2005 16:05:01
Message: <web.425591b4f49c80836fd49c30@news.povray.org>
Hi there!

Just out of curiousity: while you are free to define nearly everything


#local my_shape =
sphere { ... }
// inside the my_shape.inc

and

#include "my_shape.inc"
object {my_shape}
// inside the main .pov-file


work?

Thanks

Steely


Post a reply to this message

From: Ross
Subject: Re: #local shapes
Date: 7 Apr 2005 16:11:16
Message: <425593e4$1@news.povray.org>
"Steely" <nomail@nomail> wrote in message
news:web.425591b4f49c80836fd49c30@news.povray.org...
> Hi there!
>
> Just out of curiousity: while you are free to define nearly everything

this:
>
> #local my_shape =
> sphere { ... }
> // inside the my_shape.inc
>
> and
>
> #include "my_shape.inc"
> object {my_shape}
> // inside the main .pov-file
>

> work?
>
> Thanks
>
> Steely
>

#local is for things that are only available in the file (or in the case of
a macro, available only in the macro) which they are defined in, to my
understanding. if you want it to be available from an included file, it has
to be #declared

3.1.2.2.2  #declare vs. #local

-ross


Post a reply to this message

From: Warp
Subject: Re: #local shapes
Date: 7 Apr 2005 21:44:05
Message: <4255e1e5@news.povray.org>
Steely <nomail@nomail> wrote:
> Just out of curiousity: while you are free to define nearly everything


> #local my_shape =
> sphere { ... }
> // inside the my_shape.inc

> and

> #include "my_shape.inc"
> object {my_shape}
> // inside the main .pov-file

  Well, that's exactly what #local is supposed to do. That's why it
exists in the first place. (Why would it even exist otherwise?)

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Steely
Subject: Re: #local shapes
Date: 8 Apr 2005 03:15:01
Message: <web.42562ec489f8af7c6fd49c30@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:

>   Well, that's exactly what #local is supposed to do. That's why it
> exists in the first place. (Why would it even exist otherwise?)
>





Steely


Post a reply to this message

From: Warp
Subject: Re: #local shapes
Date: 8 Apr 2005 07:08:40
Message: <42566638@news.povray.org>
Steely <nomail@nomail> wrote:



  I don't really understand what you are asking.

  #local is a special version of #declare which limits the visibility
of an identifier inside the include file or the macro in which it is
used. That is the precise purpose of #local. It helps to keep the
global namespace of identifiers cleaner (to avoid name collisions).
  If something has been declared #local in an include file then it is
something private to that include file, not intended to be seen from
the outside (and thus potentially collide with something having the
same name somewhere else).

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Steely
Subject: Re: #local shapes
Date: 12 Apr 2005 07:20:01
Message: <web.425bae2c89f8af7c420f83140@news.povray.org>
Yes, thanks for explaining. I know this, and still there are lots of cases I
can think of, where it would be nice to have different includes with
different shapes with the same identifier. But as I said in the first post,


S.


Post a reply to this message

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