POV-Ray : Newsgroups : povray.animations : scene language question Server Time
18 Jun 2024 08:19:00 EDT (-0400)
  scene language question (Message 1 to 4 of 4)  
From: Peter MacMurchy
Subject: scene language question
Date: 30 Jan 2004 15:56:56
Message: <401AD39D.6DBA11D3@cpsc.ucalgary.ca>
I am generating an animation which involves loading a different mesh
each frame.  The mesh is in an include file and i can compute the names
of the include file and the mesh object from the frame number.  

How can i instantiate an object from a string whose contents are the
text of the object's identifier?

ie

#declare OBJECTNAME = concat("mesh", str(frame_number,0,0));

and there's an included file with 
#declare MYMESH1 = mesh2 { ... }

(for the next frame, it'd be
#declare MYMESH2 = mesh2 { ... }
)

i'd like to say:
object { OBJECTNAME
...
}

but this doesn't work because OBJECTNAME is a string identifier... how
to achieve the effect of object{} reading the contents of the string as
the identifier?

thanks,
peter


Post a reply to this message

From: Warp
Subject: Re: scene language question
Date: 30 Jan 2004 19:02:24
Message: <401af090@news.povray.org>
You either put all the #declared mesh identifiers in an array and
you index that array with your frame number, or you can write the
meshes directly in the include files (and not as #declared identifiers)
and then #include that include file directly (perhaps inside an
object {} block if you want to eg. transform it).

-- 
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: Stephen McAvoy
Subject: Re: scene language question
Date: 31 Jan 2004 01:48:54
Message: <spjm10ta9mj463dm995nu00542895fvm4g@4ax.com>
On Fri, 30 Jan 2004 13:58:53 -0800, Peter MacMurchy <pet### [at] cpscucalgaryca>
wrote:

>How can i instantiate an object from a string whose contents are the
>text of the object's identifier?

It could be the extension, I often use incriminatingly named meshes generated by
Poser. Here is my method, please excuse the strange variable names, also there
is a bit of "logic" from when I used the clock variable and there was a problem
going from 9 to 10.

#declare Cycle01_Max = 120;                              //      Number of
frames in the cycle.

#declare F_Name = "nene_bal1303a_"       ;      //      incriminating mesh 1
#declare F_Name2 = "Suit_Bal1303a_"       ;     //      incriminating mesh 2


#if (frame_number < 1 )
                #declare Cycle01Pos = 0;     
                 #declare
Material_clock1=concat(F_Name,str(int(Cycle01Pos+0),-1,0),"_o.inc") 
                 #declare
Material_clock2=concat(F_Name2,str(int(Cycle01Pos+0),-1,0),"_o.inc") 
                #else 
                
                #declare Cycle01Pos =  mod (frame_number-1, Cycle01_Max); 
                #declare
Material_clock1=concat(F_Name,str(int(Cycle01Pos-0),-1,0),"_o.inc")
                #declare
Material_clock2=concat(F_Name2,str(int(Cycle01Pos-0),-1,0),"_o.inc")

                #end

//#include "nene_bal1303a_0_p.inc"	// This is the original line generated
by Moray.

#include "Nene_Bal1303a_0_moray_mat.inc" 
// This uses the same material map (UV mapping) for each mesh

#include Material_clock1        // This is the incriminating mesh

Regards
        Stephen


Post a reply to this message

From: Mike Williams
Subject: Re: scene language question
Date: 31 Jan 2004 02:24:14
Message: <x7l0yIAMf1GAFw+e@econym.demon.co.uk>
Wasn't it Warp who wrote:
>  You either put all the #declared mesh identifiers in an array and
>you index that array with your frame number, or you can write the
>meshes directly in the include files (and not as #declared identifiers)
>and then #include that include file directly (perhaps inside an
>object {} block if you want to eg. transform it).

Or you could be more clumsy and use Parse_String.

#include "strings.inc"
#declare OBJECTNAME = concat("MYMESH",str(frame_number,0,0))
object { Parse_String(OBJECTNAME) 
 ...
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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