POV-Ray : Newsgroups : povray.general : long syntax : long syntax Server Time
5 Aug 2024 22:19:16 EDT (-0400)
  long syntax  
From: Rafal 'Raf256' Maj
Date: 23 Jul 2002 20:45:42
Message: <Xns92551B829A3A9raf256com@204.213.191.226>
Hi,
I have a little suggeston / future-request.
Myself I like usign Pov without any editor (to type code "by hands" :)
but there are one thing that IMHO makes it unnesesarly uncomfortalbe -  
[too] long names.

Compare i.e.:

difference {
  sphere { ... }
  torus { ... }
  finish { roughness 1 brillaince 2 relfection { .2 .5 } metallic 9 diffuse  
  0.7 }
} superellipsoid { ... }

with :

@@diff {
  s { } tr { }
  fi { rou 1 bril 2 ref { .2 .5 } met 9 diff 0.7 }
} @sup { ... }


So the idea is to use aliases for important names, and to mark them with 
'@'.

Implementation imho would be quite easy - ther is probalby one function 
that reads next element, and tells is it an object, float, string, 
undeclared identyfier, etc...

So only we have to do something like
void interprate(char *s) {
  if (s[0]=='@') {
    char *x = // match alias name, "s","tr","fi" etc
    interprate(x);
  } 
}




The more advanced idea is :

if alias is marked by "@@" like @@diff { ... } then assume that every name 
in it can be an alias, even it it is not marked with "@" (or "@@")

example :
 @sp { @fi { @ref } }   // ok. sp=sphere fi=finish ref=reflection
 @sp {  fi {  ref { } } // errors, fi and ref must be marked by "@"
@@sp {  fi {  ref { } } // ok fi and ref are inside "@@" block
 @sp {@@fi {  ref { } } // ok ref is inside "@@" block

maybe alsow it will be a good idea to implement @! operator, that removes 
aliases from following block (i.e when we need names like "fi" in it)

#declare fi = 5.0;
@@sp {
  fi { }
  @!pig {
     fi // fi is here an 5.0 float
  }
}

this new syntax might look strange now, but it will shorten code about x3 
times ! x3 shorter code = x3 more writing, x3 more comfortable
x3 more code on ona page (or screen)




My suggestions :

@tex  texture
@mat  material
@fin  finish
@nor  normal
@int  interior

@cmap color_map
@nmap normal_map
@mmap material_map

@sp   sphere
@bo   box
@pl   plane
@to   torus

@sup  superellipsoid (that's a good example ;)
@blo  blob

@br   brilliance (only in finish block)
@di   diffuse    (only in finish block)


I want to *help* to implement aliases, but I can not do it my self (I do 
not understand Pov's souces enought)


what do You thing about it ? If You agree that this is usefull, and 
somebody also want's to implement it - I will help :)

-- 
#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

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