Is there a way to free a surface to a mesh with out having to free the entire entity then rebuild it?
As fare as I can tell No.
My trouble with this ( if any one can help......)is in doing things this way , if the mesh you want to reduce the surface count with is in a parent/child hierarchy structure you lose the index order of that child to its parent.
Meaning if a Parent entity has 5 children and the child you want to remove the surface from is the 3rd child to the parent,when you free the entity then rebuild it,it now becomes the last child of the Hierarchy to the parent.
Here is an example if this helps or if you know of a way I can keep the childs Index order to the parent with out having to rebuild the whole hierarchy structure again.
Thanks for any Ideas you may have.
As fare as I can tell No.
My trouble with this ( if any one can help......)is in doing things this way , if the mesh you want to reduce the surface count with is in a parent/child hierarchy structure you lose the index order of that child to its parent.
Meaning if a Parent entity has 5 children and the child you want to remove the surface from is the 3rd child to the parent,when you free the entity then rebuild it,it now becomes the last child of the Hierarchy to the parent.
Here is an example if this helps or if you know of a way I can keep the childs Index order to the parent with out having to rebuild the whole hierarchy structure again.
;Remove Surface from a mesh. ;Demo V 1.00 ;Stickman Graphics3D 640,480,16,2 SetBuffer BackBuffer() ;Create A Parent Entity...... Parent=CreatePivot() NameEntity Parent,"Parent" ;Create 5 Children Meshes Grouped to the Parent Entity.... For C=1 To 5 Child=CreateMesh(Parent) NameEntity Child,"Child_"+C ;Create 3 surfaces for Each Mesh For S=1 To 3 surface=CreateSurface(Child) Next ; Normally you would Create your Vertices and Triangles somewhere ;here but for this Demo Im only concerned with the Meshes ;handels and Index order to the parent. Next ;Lets print out a list of all the meshes and there order to the parent. Color 255,255,0 Print "" Print " Entity Index to Parent Before removing Surface " Print "" Print " (Index) (Surfaces) " Color 0,0,255 Print "-------------------------------------------------------" Color 255,255,0 For a=1 To CountChildren(Parent) Print " " +( EntityName ( GetChild(Parent,a) ) ) +" "+( CountSurfaces( GetChild(Parent,a) ) ) Next Color 0,0,255 Print "-------------------------------------------------------" Print "" ;Now lets attempt to find and Remove all the surfaces from Child #(3) ;then rebuild the mesh with only 1 surface but keep its Index to the ;Parent entity the same with out having to rebuild all the meshes grouped ;to Parent entity. ;the selected child..... Child3=GetChild(parent,3) ;Select Surface Removal method. Color 255,0,255 Restore Text1 Read Line1$ Print Line1$ Read Line2$ Print Line2$ RemoveBy=Input( " Method # :" ) If Removeby>3 Removeby=3 RemoveSurfaceMethod=RemoveBy ;Lets count throught the childern and find the one we want ;to change or reduce its surface count. For b=1 To CountChildren(Parent) If GetChild(parent,3)=Child3 Origanalname$=EntityName(Child3) ;Remove the surface by..... Select RemoveSurfaceMethod Case 1 ;Freeing entity Method$="Freeing Entity" FreeEntity Child3 ;ReCreate the entity.... Child3=CreateMesh(Parent) NameEntity Child3,Origanalname$ ;then add only one serface... surface=CreateSurface(Child3) Case 2 ;Clearing its surfaces Method$="Clearing surfaces" ;Lets clear all the surfaces..... For S=1 To CountSurfaces(Child3) ClearSurface GetSurface(Child3,S) , True , True Next ;then rebuild a new one ( witch only adds one more to the surface count ;making the total surfaces for Child3 (4) No Good. surface=CreateSurface(Child3) Case 3 ;Blank.... Method$="Your Idea..." ;Add Your Own Ideas here....... End Select ;Now exit the loop as for we have found our entity and perfomed ;all the changes we needed. Exit End If Next Color 0,255,0 Print "" Print " Removed surfaces by..."+Method$ Color 255,255,0 ;Print out the new order of the entites to the Parent. Print "" Print " Entity Index to Parent after removing Child3 surfaces " Print "" Print " (Index) (Surfaces) " Color 0,0,255 Print "-------------------------------------------------------" Color 255,255,0 For a=1 To CountChildren(Parent) Print " " +( EntityName ( GetChild(Parent,a) ) ) +" "+( CountSurfaces( GetChild(Parent,a) ) ) Next Color 0,0,255 Print "-------------------------------------------------------" Color 255,0,0 Print "" Print " Press any key to Quit...... " WaitKey() ClearWorld End .Text1 Data " Select Removal Method : " Data " (1)=FreeEntity (2)=ClearSurface (3)=Your Idea : "
Thanks for any Ideas you may have.