Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Editing Mesh  (Read 1965 times)
lui
Community Member
*
Posts: 6


« on: October 05, 2009, 05:17:16 PM »

Hi

I know it sounds odd but lets say i have created a mesh in TV3D using vertices (like explained here http://wiki.truevision3d.com/tutorialsarticlesandexamples/building_a_cylinder)

Now I don´t only want to create a mesh but also want to edit it.
Is there a way to get a vertex from a specific position and move it to another?
The only way a figured out is to delete the old mesh and create a new one with the updated position of the vertex ( this is the way i saw it in another engine because there was no other way). But this would be computationally intensive and would take some time when there are alot of vertices.
So is it possible to only move a certain vertex?

Additionally is it possible to delete a vertex?

greetz
Lui
Logged
Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #1 on: October 05, 2009, 05:48:10 PM »

You don't have to delete a mesh, just use .SetGeometry.

You can access any of the verts you have in the TV_SVERTEX array. Move them, and the mesh will change. You can also delete them, but then you will have to recreate the indices, and that is up to you to figure out really.
Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
sinisa1982
Community Member
*
Posts: 188

Siniša Abramović


WWW
« Reply #2 on: October 06, 2009, 12:12:58 AM »

So how can get position of the specific vertices ?
Logged

Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #3 on: October 06, 2009, 05:05:13 AM »

They are all in the TV_SVERTEX array you set in the first place, isn't that obvious? Loop through each one, they all have their x,y,z components.
Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
asia
Customers
Community Member
*****
Posts: 183


« Reply #4 on: October 06, 2009, 05:45:04 AM »

What about getvertex and setvertex methods for meshes?
I did use them for the manta example in the WIKI.
Fabio
« Last Edit: October 06, 2009, 07:33:03 AM by asia » Logged

Fabio Musmeci
ENEA
CR Casaccia
Via Anguillarese 301
00060 Rome
Italy
musmeci@enea.it
+39 3333934898
Learning to live better on a smaller footprint..
Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #5 on: October 06, 2009, 05:58:58 AM »

Yes, I was talking about using the arrays which work with SetGeometry for easy editing and applying the changes. At least I think that's the easiest method.
Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
asia
Customers
Community Member
*****
Posts: 183


« Reply #6 on: October 06, 2009, 07:30:11 AM »

Some time ago I tried to edit a mesh after I loaded it with the loadtvm method.
The sistem crushed if I tried to add something, like a vertex or a triangle. Do you have any idea?
Example:

 Mesh.LoadTVM TVMname
 Mesh.addface 0 ' does not crash

 Mesh.AddVertex fx, fy, fz, fnx, fny, fnz, t1u, t1v, t3u, t3v, c ' crash
 Mesh.AddTriangle 0, 1, 1, 1, 0, 0, 0, 1, 0, 1 ' crash

Look also at:
http://www.truevision3d.com/forums/printpage.html;topic=18602.0
The same does not happen if you create the mesh from scratch (scene.createmeshbuilder)
Any suggestion will be appreciated.
« Last Edit: October 06, 2009, 07:34:11 AM by asia » Logged

Fabio Musmeci
ENEA
CR Casaccia
Via Anguillarese 301
00060 Rome
Italy
musmeci@enea.it
+39 3333934898
Learning to live better on a smaller footprint..
lui
Community Member
*
Posts: 6


« Reply #7 on: October 12, 2009, 01:49:32 PM »

Thanks for the answere. This should do it somehow

@ asia:
This is explained also in the Doku(still 6.1 but seem to be still valid)
Code:
Remark:
You can't add a vertex to a loaded mesh or to a primitive mesh (made with CreateBox, CreateCylinder...)
You have to use the "point" primitive if you want to add points to this mesh

Got another, maybe stupid question:
when I e.g want to make a grid witch looks like this:


When i make this with trianglelist (like explained in the tutorial i linked to) I would only be able to make this grid row by row and the rown themselevs would be smooth but not among each other.
Also i would have to declare a vertex at the same position for more than one time, this would cost alot more memory usage.
So how could i just first store the vertices into to the TV_SVERTEX array without connecting them. And then connect e.g vertex[1] vertex[4] and vertex[23] to a polygon? When the polys would use the same vertex they should also be smooth...

Or does TV3D recognize that a vertex already exists at the position and uses this one for the new polygon?

greets lui
« Last Edit: October 12, 2009, 01:53:36 PM by lui » Logged
asia
Customers
Community Member
*****
Posts: 183


« Reply #8 on: October 12, 2009, 04:53:06 PM »

Unfortunately the setvertex method in the mesh class doesn't support the extra parameter for “add point” in TV 6.5.
But isn’t it strange that you can not edit a loaded mesh? And even a bloody teapot?
I must miss something!
Help!
Fabio
Logged

Fabio Musmeci
ENEA
CR Casaccia
Via Anguillarese 301
00060 Rome
Italy
musmeci@enea.it
+39 3333934898
Learning to live better on a smaller footprint..
Pages: [1]
  Print  
 
Jump to:  

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