POV-Ray : Newsgroups : povray.general : Q: Can you #declare blob components? : Re: Q: Can you #declare blob components? Server Time
13 Aug 2024 05:47:26 EDT (-0400)
  Re: Q: Can you #declare blob components?  
From: Darius Davis
Date: 29 Oct 1998 00:36:39
Message: <3638FA9A.20AA@NO.SPAM.THANKS.acm.org>
Michael Andrews wrote:

>     Well I think the subject says it all; is it possible to #declare a
> blob component?

I've got some code to do this - I'm just giving it some final testing
and bug-fixing and then I'm going to send it to Chris Young for
inclusion in the next version.  I've already discussed this with him and
he's keen to add this feature as well.

My code allows you to do something like this:

#declare Blob1 =
blob {
	sphere {...}
	cylinder {...}
	... // more components, textures, transforms...
}

#declare Blob2 =
blob {
	sphere {...}
	cylinder {...}
	blob {Blob1} // incorporate blob1 here!!!
	... // etc...  more components or more 'included' blobs
}

It allows all textures and transformations in the same way as CSGs are
handled, and it handles multi-textured blobs in a simple, logical
fashion.  Textures can be specified either in Blob1, Blob2, both or
neither.  So this is legal...

#declare Blob1 =
blob {
	sphere {...}
	cylinder {...}
	...
}

#declare Blob2 =
blob {
	blob {Blob1 texture {...}} // incorporate blob1 here!!!
	blob {Blob1 texture {...} scale <-1, 1, 1>} // mirror blob1 here!!!
}

And it allows these sorts of constructs, just like CSG unions, to group
components and transform them collectively...

blob {
	sphere {...}
	cylinder {...}
	blob {
		sphere {...}
		cylinder {...}
		translate ...  scale ...
	}
	translate ... scale ...
}

Blobs can be 'nested' to whatever depth time and memory permit.

Although it doesn't actually allow you to #declare a single component
itself, you can always #declare a blob that contains just one component,
and then use that #declared component anywhere just like in the example
above.

And I thought I was the only person in the world who wanted to use such
a feature!

I'd like some feedback on whether the above syntax examples are
sufficient, and what sorts of deficiencies it might have... I guess it's
best to get this sorted out fully before it's merged into POV itself!

Cheers, and merry POVing to all,


Darius Davis


Post a reply to this message

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