How to merge geometry of display objects ?

3 messages Options
Embed this post
Permalink
babeuf

How to merge geometry of display objects ?

Reply Threaded More More options
Print post
Permalink
Hi all !

I'm creating a do3D randomly by adding various coloured cubes to it.

My problem is triangle nubmer is growing fast this way, and i would like to create my mesh in a cleaner way :
 merging the cubes that can be merged into bigger rectangles

I can't find any easy way to merge do3ds in a single one in the package , so i think i ll have to do it myself.
I ve tried something with addGeometry + mergeVertices on a TRiangleMesh3D, but the addGeometry method seems to a be a replaceGeometry as it s only keeping the add i do.

Can i push more faces in a geometry without playing with vertices and faces array ?
Can a single geometry contains 2 cubes with no contact between each other ?


Any hints to help me would be ... helpful !  

babeuf

Re: How to merge geometry of display objects ?

Reply Threaded More More options
Print post
Permalink
As usually : i find a part of the solution just after sending a question
....

c is a little Cube
mesh is an empty TriangleMesh3D .

c.geometry.transformVertices(Matrix3D.translationMatrix(cx,cy,cz))  ;
           
mesh.geometry.vertices =
mesh.geometry.vertices.concat(c.geometry.vertices) ;
 mesh.geometry.faces = mesh.geometry.faces.concat(c.geometry.faces) ;
 mesh.mergeVertices() ;

now my problem is to merge faces that can be merged.


babeuf a écrit :

> Hi all !
>
> I'm creating a do3D randomly by adding various coloured cubes to it.
>
> My problem is triangle nubmer is growing fast this way, and i would like to
> create my mesh in a cleaner way :
>  merging the cubes that can be merged into bigger rectangles
>
> I can't find any easy way to merge do3ds in a single one in the package , so
> i think i ll have to do it myself.
> I ve tried something with addGeometry + mergeVertices on a TRiangleMesh3D,
> but the addGeometry method seems to a be a replaceGeometry as it s only
> keeping the add i do.
>
> Can i push more faces in a geometry without playing with vertices and faces
> array ?
> Can a single geometry contains 2 cubes with no contact between each other ?
>
>
> Any hints to help me would be ... helpful !  
>
>
>  


_______________________________________________
Papervision3D mailing list
[hidden email]
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
babeuf

Re: How to merge geometry of display objects ?

Reply Threaded More More options
Print post
Permalink
Hello again ,

my merging problems are getting solved one after the other but something
seems to be a little strange to me :

I m trying to combine my merge technique with a flatshadematerial and
here s my issue :

// i create an empty mesh :

mesh = new TriangleMesh3D(new ColorMaterial(), [], []) ;

if i do :

   var t : Sphere = new Sphere(new FlatShadeMaterial(light, 0xFF00FF)) ;
    mesh.addChild(s) ;  

everything if fine , the shader works properly

but if i do :

    var t : Sphere = new Sphere(new FlatShadeMaterial(light, 0xFF00FF)) ;
    mesh.geometry.vertices =
mesh.geometry.vertices.concat(t.geometry.vertices) ;
      mesh.geometry.faces = mesh.geometry.faces.concat(t.geometry.faces) ;

to copy the geometry directly into my container without a child relationship

only half of the sphere is visible. The rest is totally black

( i dont have this problem with a color or simple wireframe  material )


So maybe someone can tell me what am i doing wrog that brakes the shader  ?


( my sphere is Y rotating in loop )

Thank you !









Damien Pegoraro a écrit :

> As usually : i find a part of the solution just after sending a
> question ....
>
> c is a little Cube
> mesh is an empty TriangleMesh3D .
>
> c.geometry.transformVertices(Matrix3D.translationMatrix(cx,cy,cz))  ;
> mesh.geometry.vertices =
> mesh.geometry.vertices.concat(c.geometry.vertices) ;
> mesh.geometry.faces = mesh.geometry.faces.concat(c.geometry.faces) ;
> mesh.mergeVertices() ;
>
> now my problem is to merge faces that can be merged.
>
>
> babeuf a écrit :
>> Hi all !
>> I'm creating a do3D randomly by adding various coloured cubes to it.
>> My problem is triangle nubmer is growing fast this way, and i would
>> like to
>> create my mesh in a cleaner way :
>>  merging the cubes that can be merged into bigger rectangles
>> I can't find any easy way to merge do3ds in a single one in the
>> package , so
>> i think i ll have to do it myself.
>> I ve tried something with addGeometry + mergeVertices on a
>> TRiangleMesh3D,
>> but the addGeometry method seems to a be a replaceGeometry as it s only
>> keeping the add i do.
>> Can i push more faces in a geometry without playing with vertices and
>> faces
>> array ? Can a single geometry contains 2 cubes with no contact
>> between each other ?
>>
>> Any hints to help me would be ... helpful !
>>
>>  
>
>
> _______________________________________________
> Papervision3D mailing list
> [hidden email]
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>


_______________________________________________
Papervision3D mailing list
[hidden email]
http://osflash.org/mailman/listinfo/papervision3d_osflash.org