Digital Art Zone

 
     
DzVertexMesh->addVertex
Posted: 09 November 2012 05:43 PM   [ Ignore ]
Power Member
Avatar
RankRankRank
Total Posts:  1259
Joined  2009-10-27

Any particular reason why the following code is crashing?
I’m trying to store some vertices into a DzVertexMesh…

DzVertexMesh *vMesh;
    
vMesh->beginEdit(false);
    
vMesh->addVertex(0.00.00.0);
    
vMesh->addVertex(0.01.00.0);
    
vMesh->addVertex(1.01.00.0);
    
vMesh->addVertex(1.00.00.0);
    
vMesh->finishEdit(); 
 Signature 

Real Plants Collection 1: Fallen Trees, Ivy and Vines”
Blog
LAMH FB

Profile
 
 
Posted: 09 November 2012 06:29 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRank
Total Posts:  331
Joined  2003-10-09

At a glance, it would appear that you have declared a DzVertexMesh pointer, but you haven’t defined it (i.e. = new DzVertexMesh).

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 10 November 2012 05:48 AM   [ Ignore ]   [ # 2 ]
Power Member
Avatar
RankRankRank
Total Posts:  1259
Joined  2009-10-27

Using:

#include "dzvertexmesh.h"
...
DzVertexMesh *vMesh=new DzVertexMesh

actually gives a “allocating an object of abstract class ‘DzVertexMesh’.

 Signature 

Real Plants Collection 1: Fallen Trees, Ivy and Vines”
Blog
LAMH FB

Profile
 
 
Posted: 10 November 2012 06:51 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  14064
Joined  2003-10-09

Shouldn’t there be parentheses at the end?

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 10 November 2012 09:33 AM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRank
Total Posts:  331
Joined  2003-10-09

@Alessandro: Yeah, sorry… I was on my tablet, on the way out the door to take my wife to dinner. I didn’t have anything other than your post in front of me at the time and the use of a declared but undefined pointer was an obvious issue that didn’t require me to look at headers/definitions for more context. That is why I started my response with “At a glance”. Now that I’ve had a chance to look at this when I’m not being rushed out the door… rather than DzVertexMesh, which you are correct is an abstract base class, use DzFacetMesh. You will obviously still need to define the pointer before you attempt to do anything with it, or you will cause a crash.

@Richard: Take a look at this. It may even answer some questions you didn’t even know you had.

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 10 November 2012 10:21 AM   [ Ignore ]   [ # 5 ]
Power Member
Avatar
RankRankRank
Total Posts:  1259
Joined  2009-10-27

Yep, thank you very much Rob, will use the DzFacetMesh

 Signature 

Real Plants Collection 1: Fallen Trees, Ivy and Vines”
Blog
LAMH FB

Profile
 
 
Posted: 10 November 2012 12:58 PM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  14064
Joined  2003-10-09

Thanks Rob, an interesting site.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile