POV-Ray : Newsgroups : povray.general : Object oriented Povray? (Modifying existing objects) Server Time
31 Oct 2024 23:26:59 EDT (-0400)
  Object oriented Povray? (Modifying existing objects) (Message 1 to 10 of 10)  
From: ekolis
Subject: Object oriented Povray? (Modifying existing objects)
Date: 28 Feb 2005 16:45:01
Message: <web.4223902ef4bf0e27820779d30@news.povray.org>
I know you can use #declare statements to create reusable objects, but is
there any way to modify individual instance once they've been instantiated?
Or is that not a feature of the language at this point? I'm thinking of
something like this:

#declare ball = sphere
{
 // basic ball attributes go here
}

ball ball1, ball2, ball3
ball1.translate<0,1,0>
ball2.pigment = rgb<1,0,0>
ball3.scale<10,10,10>

Apologies for the poor syntax; I haven't worked much with raw Povray code
lately!


Post a reply to this message

From: Ross
Subject: Re: Object oriented Povray? (Modifying existing objects)
Date: 28 Feb 2005 18:17:21
Message: <4223a681$1@news.povray.org>
"ekolis" <kol### [at] fusenet> wrote in message
news:web.4223902ef4bf0e27820779d30@news.povray.org...
> I know you can use #declare statements to create reusable objects, but is
> there any way to modify individual instance once they've been
instantiated?
> Or is that not a feature of the language at this point? I'm thinking of
> something like this:
>
> #declare ball = sphere
> {
>  // basic ball attributes go here
> }
>
> ball ball1, ball2, ball3
> ball1.translate<0,1,0>
> ball2.pigment = rgb<1,0,0>
> ball3.scale<10,10,10>
>
> Apologies for the poor syntax; I haven't worked much with raw Povray code
> lately!
>
>

#declare ball = sphere {
 1, <0, 1, 0>
 pigment {rgb <1, 0, 0>}
 //... and so on
}

object {
 ball
 translate <0, 1, 0>
}

object {
 ball
 pigment {rgb <1, 0, 0>} //not sure that this will override the pigment
statement in the #define'd ball
}

object {
 ball
 scale <10, 10, 10>
}


anyway, is that what you were asking?


Post a reply to this message

From: Ross
Subject: Re: Object oriented Povray? (Modifying existing objects)
Date: 28 Feb 2005 18:20:42
Message: <4223a74a$1@news.povray.org>
"Ross" <rli### [at] everestkcnet> wrote in message
news:4223a681$1@news.povray.org...
> "ekolis" <kol### [at] fusenet> wrote in message
> news:web.4223902ef4bf0e27820779d30@news.povray.org...
> > I know you can use #declare statements to create reusable objects, but
is
> > there any way to modify individual instance once they've been
> instantiated?
> > Or is that not a feature of the language at this point? I'm thinking of
> > something like this:
> >
> > #declare ball = sphere
> > {
> >  // basic ball attributes go here
> > }
> >
> > ball ball1, ball2, ball3
> > ball1.translate<0,1,0>
> > ball2.pigment = rgb<1,0,0>
> > ball3.scale<10,10,10>
> >
> > Apologies for the poor syntax; I haven't worked much with raw Povray
code
> > lately!
> >
> >
>
> #declare ball = sphere {
>  1, <0, 1, 0>

oops. that should be
sphere {
 <0, 1, 0>, 1
}

...


Post a reply to this message

From: ekolis
Subject: Re: Object oriented Povray? (Modifying existing objects)
Date: 28 Feb 2005 20:50:00
Message: <web.4223c982fd3c3a0b820779d30@news.povray.org>
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


Post a reply to this message

From: Mike Williams
Subject: Re: Object oriented Povray? (Modifying existing objects)
Date: 1 Mar 2005 01:06:15
Message: <S3fXiGAnSAJCFw73@econym.demon.co.uk>
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>}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Warp
Subject: Re: Object oriented Povray? (Modifying existing objects)
Date: 1 Mar 2005 05:26:51
Message: <4224436b@news.povray.org>
ekolis <kol### [at] fusenet> wrote:
> I know you can use #declare statements to create reusable objects, but is
> there any way to modify individual instance once they've been instantiated?

  You can instantiate the object and apply transformations to it.
If it didn't have a texture, you can also apply one. However, that's
about it. You can't access any of its other parameters (not in the
current SDL anyways).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Alain
Subject: Re: Object oriented Povray? (Modifying existing objects)
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

From: Nicolas Alvarez
Subject: Re: Object oriented Povray? (Modifying existing objects)
Date: 3 Mar 2005 13:48:32
Message: <42275c00@news.povray.org>

news:4223a681$1@news.povray.org...

>
> object {
> ball
> pigment {rgb <1, 0, 0>} //not sure that this will override the pigment
> statement in the #define'd ball
> }

No, it won't.

POV-Ray docs - section 3.4.6.2:

[...] The entire union can share a single texture but each object contained 
in the union may also have its own texture, which will override any texture 
statements in the parent object.


Post a reply to this message

From: Slime
Subject: Re: Object oriented Povray? (Modifying existing objects)
Date: 3 Mar 2005 13:55:36
Message: <42275da8$1@news.povray.org>
> [...] The entire union can share a single texture but each object
contained
> in the union may also have its own texture, which will override any
texture
> statements in the parent object.


I think that only applies to unions; when it's a direct copy of an object
that you're setting the texture on, I think it overrides the original
(though, if the object were a union, it wouldn't override the textures of
the subobjects of the union).

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Le Forgeron
Subject: Re: Object oriented Povray? (Modifying existing objects)
Date: 4 Mar 2005 05:29:54
Message: <Xns960F74F7BBE94jgrimbertmeandmyself@203.29.75.35>


>> [...] The entire union can share a single texture but each object
> contained
>> in the union may also have its own texture, which will override any
> texture
>> statements in the parent object.
> 
> 
> I think that only applies to unions; when it's a direct copy of an object
> that you're setting the texture on, I think it overrides the original
> (though, if the object were a union, it wouldn't override the textures of
> the subobjects of the union).
>
I think it does not override, it just apply an additional layer of texture.
No difference, until your new texture has some transparency or filtering.


-- 
This is an unauthorised cybernetic announcement.

When someone says "I want a programming language in which I need only
say what I wish done," give him a lollipop.


Post a reply to this message

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