Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: GETVERTEXCOUNT-SYNTAX OR PRECURSORS?  (Read 1716 times)
kwazai
Community Member
*
Posts: 173


« on: April 13, 2010, 07:39:11 AM »

I'm drawing a mesh from an imported csv file and all is wel till I try to get the vertex count- it keeps coming up zero for the mesh- any idea why? do I need to add a mesh to the parent before adding children?

Code:

MYMESH(I).AddFaceFromPoint(GLOB.GetTex("WallTexture"), X6, Y6, Z1, X1, Y1, Z1, X6, Y6, Z2, X1, Y1, Z2)

......


If InStr(TRUSSMESH(K).GetMeshName, MYMESH(I).Tag, CompareMethod.Text) Then TRUSSMESH(K).AddChild(MYMESH(I).DuplicateMesh)

.......


For j = STRT_IMP_MESHCNT To MESHCOUNT
            'Debug.Write(TRUSSMESH(j).GetMeshName & "-" & TRUSSMESH(j).Tag & vbCrLf)
            TRUSSMESH(j).Optimize()
            TRUSSMESH(j).ComputeBoundingVolumes()
            TRUSSMESH(j).ComputeNormals()
            TRUSSMESH(j).SetPosition(0, 0, CSng(TRUSSINITIALOFFSET))
            TRUSSINITIALOFFSET = TRUSSINITIALOFFSET + CSng(TRUSSMESH(j).Tag)
            'Debug.Write(TRUSSMESH(j).GetMeshIndex() & "-" & j & vbCrLf)
            TRUSSMESH(j).ForceMatrixUpdate()

            TRUSSMESH(j).Enable(True)
            TRUSSMESH(j).Render()
        Next j


.........

ROW3("FACECOUNT") = CStr(TRUSSMESH(I).GetTriangleCount())
            ROW3("VTXCNT") = CStr(TRUSSMESH(I).GetVertexCount())
            Debug.Write(TRUSSMESH(I).GetVertexCount())
           
Logged

murphys law-28th corollary- if there are five ways for something to go wrong and you circumvent all five , a sixth will promptly develop.
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #1 on: April 13, 2010, 08:02:11 AM »

Does it say anything in your debug file?
Also, I also see there is a TVMesh.GetVertexCountEx that has an overload with no arguments. Does that return 0?
Logged

JAbstract.....Don't just imagine, make it happen!
kwazai
Community Member
*
Posts: 173


« Reply #2 on: April 13, 2010, 09:03:33 AM »

only odd thing in the debug file is -

MESH BUILDER : Can't optimize the mesh '178494-65-86
04-13-2010 08:30:31 | MESH CLASS : Optimize the mesh in 16bits

what does it mean optimize the mesh in 16bits?

Mike
Logged

murphys law-28th corollary- if there are five ways for something to go wrong and you circumvent all five , a sixth will promptly develop.
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #3 on: April 13, 2010, 11:34:10 AM »

Not sure. That function has been removed in 6.5. But when I used it, I've never used it unless I was using TVMesh.SetGeometry. I don't see where you are using SetGeometry (looks like you are using AddTriangle/AddFace. Does anything change when you take the TVMesh.Optimize out?
Logged

JAbstract.....Don't just imagine, make it happen!
kwazai
Community Member
*
Posts: 173


« Reply #4 on: April 13, 2010, 01:59:48 PM »

The error msg in debug.txt goes away is about it. getvertexcount still reports zero.
I might need to go ahead and upgrade to 6.5
Wish I knew what the 16bits was about.

Mike
Logged

murphys law-28th corollary- if there are five ways for something to go wrong and you circumvent all five , a sixth will promptly develop.
SylvainTV
Administrator
Community Member
*****
Posts: 4946


WWW
« Reply #5 on: April 20, 2010, 06:05:17 AM »

How many vertices/faces is there in this model?
The 16bits thing is because the number of vertices is greater than 65536 if I remember well. If it's the case, you should divide the mesh in several smaller meshes.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
kwazai
Community Member
*
Posts: 173


« Reply #6 on: April 20, 2010, 06:36:58 AM »

Thanks,
I'm drawing boards and adding them to the truss mesh to make trusses, 35 trusses approx 380 faces each (all the boards). I may need to put in as many as 200 trusses with 3 to 15 boards each.
I changed the code to loop thru and .addfacefrompoint instead of addchild(duplicatemesh) and the problem went away.
I'm using .addchild elsewhere with the wheel part of a trailer mesh. It doesn't getvertexcount for the "wheel" vertices either (thats actually a plus). Is there something I would need to do differently with .addchild to get at the vertex points?
I use the vertex points to perform a location pick test to 'snap' to a particular location.
The snap routine causes it to lose a coupla frames per second.
Mike
Logged

murphys law-28th corollary- if there are five ways for something to go wrong and you circumvent all five , a sixth will promptly develop.
kwazai
Community Member
*
Posts: 173


« Reply #7 on: April 28, 2010, 07:28:30 AM »

jviper,

I was searching and ran across this-
http://www.truevision3d.com/forums/tv3d_sdk_63/getting_triangles_from_tvmesh_object_please-t8067.0.html;msg80721#msg80721

Quote
You must optimize the TvMesh when your done adding triangles. Also, note that the AddVertex automatically adds a face after adding 3 verticies. And the AddFace, beleive it or not, AddFace does not actually "Add a Face". It adds a group. So when you first do AddFace, a group is added, and all the faces added through AddVertex will use that group, untill AddFace is called again, then all the faces added after that will use that next group, and so on. A group is what you apply materails/textures to. The face count itself doesn't grow untill you call TVMesh.Optimize.


what I'm wondering is (now that I can actually get at the vertex info). if I save the vertex info to a file and bring it back into the program using addface (add group?), and then add all the vertex points for a mesh (group?)--will it create the mesh? After optimizing- will it report the correct faces and vertex counts?

Most of my meshes have twice the number of faces for a vertexcount.
tia
Mike
Logged

murphys law-28th corollary- if there are five ways for something to go wrong and you circumvent all five , a sixth will promptly develop.
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #8 on: April 28, 2010, 03:58:04 PM »

I think if you add all the groups first using AddFace, then add all your vertices to create the faces, all your faces will end up in the last group of your mesh. So you have to add your groups as you are adding the verticies. 3 verticies will automatically make a face and do not require a call to AddFace. Initially (before AddFace is ever called) all the faces go to group 0.

Also note this may also mean you can never have multiple faces shareing verticies. If you have this happening, you want to use SetGeometry, which requires not only a vertex list but an index list.

As far as the optimize, don'e know if that has been taken out in TV6.3. I know it's not in TV6.5
« Last Edit: April 28, 2010, 04:00:11 PM by jviper » Logged

JAbstract.....Don't just imagine, make it happen!
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks