[Bf-committers] derivedmesh iterators

Joe Eagar joeedh at gmail.com
Wed Jun 11 09:55:53 CEST 2008


This looks awesome.  Have any specific design goals in mind yet, other 
then I guess the memory savings and stuff inherent in an iterator approach?

Joe

Brecht Van Lommel wrote:
> Hi,
>
> I've been working a bit on an iterator interface for derivedmesh, and a derivedmesh wrapper for displists. I didn't intend to write anything about it yet because the design is a work in progress with incomplete code and bugs in it, but apparently it came up as at topic at the meeting so I'm posting a patch against the apricot branch here for people who want to look at it.
>
> http://users.pandora.be/blendix/derivedmesh_iterator_patch.txt
>
> And some example code from the patch:
>
> DMVertIterator v;
> DMIteratorData origlayer;
> int orig, count = 0;
>
> dm->getVertIterator(dm, &v);
> dm->getVertIteratorData(dm, &origlayer, CD_ORIGINDEX, NULL);
>
> /* get the average of all verts with (original index == nr) */
> for(v.begin(&v); v.valid; v.next(&v)) {
> 	orig= *((int*)v.data(&v, &origlayer));
>
> 	if(orig == nr) {
> 		VecAddf(vec, vec, v.co);
> 		count++;
> 	}
> }
>
> if (count==0) /* keep as 0,0,0 */
> 	memset(vec, 0, sizeof(float)*3);
> else
> 	VecMulf(vec, 1.0f/count);
>
> dm->freeVertIterator(dm, &v);
>
>
> Brecht.
>
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>
>   



More information about the Bf-committers mailing list