POV-Ray : Newsgroups : povray.general : Object oriented Povray? (Modifying existing objects) : Re: Object oriented Povray? (Modifying existing objects) Server Time
2 Aug 2024 00:14:03 EDT (-0400)
  Re: Object oriented Povray? (Modifying existing objects)  
From: Alain
Date: 1 Mar 2005 17:11:15
Message: <4224e883$1@news.povray.org>
Mike Williams nous apporta ses lumieres en ce 2005-03-01 00:59:
> Wasn't it ekolis who wrote:
> 
>>Cool!
>>Basically what I wanted to do is have a set of base objects like a laser
>>cannon and a particle gun and such (I'm making images for a Space Empires
>>IV mod inspired by Master of Orion II ;-), but generate a bunch of
>>variations on each of them (for various enhancements that can be applied,
>>such as "heavy" or "armor piercing") by running through a loop and doing
>>modifications (like scaling up or adding coolant tubes)... it would take
>>forever to do all the possibilities, but if I could use a single script to
>>render all the images, and just include the actual models from exported
>>..ini files from KPovModeler... ;-)
>>And if you're a fan of MOO2, yes, there will be a heavy point defense shield
>>piercing armor piercing no range dissipation autofire continuous enveloping
>>ion pulse cannon image, even though MOO2 never allowed such a thing...
>>mwahahaha! :-D
> 
> 
> As mentioned above, you can apply object modifiers to copies of a
> declared object - that's things like textures, translations, scales and
> rotations.
> 
> You want to change the structure of the object, so I suggest making a
> macro to which you can pass parameters.
> 
> #macro Laser_cannon (Heaviness, Armour_Piercing, Coolant_Tubes)
>   object {
>     ...
>       code that uses the passed variables
>       to generate different varieties
>       of laser cannon
>     ...
>   }
> #end
> 
> Then you can invoke the macro and place the objects
> 
> object {Laser_cannon(5.25, false, 3) rotate y*30 translate <10,0,3>}
> object {Laser_cannon(2, true, 0) rotate y*55 translate <3,0,4>}
> 
You can extrapolate by including pigments, textures and even materials as parameters.
That way, you 
can have one with mate green tubing, end another with transparent, multicaloured,
glowing "plasma" 
filled tubes.

Alain


Post a reply to this message

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