Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r980 - in trunk: Model/Groups StandAlone fox/FManta fox/dm_demo
- Date: Thu, 9 Mar 2006 13:54:24 -0700 (MST)
Author: abe
Date: Thu Mar 9 13:54:23 2006
New Revision: 980
Modified:
trunk/Model/Groups/KDTree.h
trunk/StandAlone/v3c1_tools.cc
trunk/fox/FManta/FMantaWindow.cc
trunk/fox/dm_demo/dm_demo.cc
Log:
Fixed segfault on object selection.
M StandAlone/v3c1_tools.cc
M fox/dm_demo/dm_demo.cc
M fox/FManta/FMantaWindow.cc
M Model/Groups/KDTree.h
Modified: trunk/Model/Groups/KDTree.h
==============================================================================
--- trunk/Model/Groups/KDTree.h (original)
+++ trunk/Model/Groups/KDTree.h Thu Mar 9 13:54:23 2006
@@ -261,7 +261,12 @@
__pickingEnabled( true ),
pickingEnabled( false ),
pickedTri( -1 ),
- pickedFlag( PICK_HIGHLIGHT ) { }
+ pickedFlag( PICK_HIGHLIGHT ),
+
+ triToGroupMap( 0 ),
+ groupToNameMap( 0 ),
+ groupNames( 0 )
+ { }
KDTreeData( const KDTreeData *kdtree_ ) :
rootNode ( kdtree_->rootNode ),
@@ -269,10 +274,21 @@
tris ( kdtree_->tris ),
normals ( kdtree_->normals ),
texcoords ( kdtree_->texcoords ),
- pickedFlag ( kdtree_->pickedFlag ),
- __pickingEnabled( kdtree_->__pickingEnabled ),
- pickingEnabled ( kdtree_->pickingEnabled ),
- pickedTri ( kdtree_->pickedTri ),
+
+ __pickingEnabled ( kdtree_->__pickingEnabled ),
+ pickingEnabled ( kdtree_->pickingEnabled ),
+ pickedTri ( kdtree_->pickedTri ),
+ pickedBeginIndex ( kdtree_->pickedBeginIndex ),
+ pickedEndIndex ( kdtree_->pickedEndIndex ),
+ pickedSavedColors( kdtree_->pickedSavedColors ),
+ triFlags ( kdtree_->triFlags ),
+ pickedFlag ( kdtree_->pickedFlag ),
+
+
+ triToGroupMap( kdtree_->triToGroupMap ),
+ groupToNameMap( kdtree_->groupToNameMap ),
+ groupNames( kdtree_->groupNames ),
+
bbox ( kdtree_->bbox ) { }
/////////////////////////////////////////////////////////////////////////
Modified: trunk/StandAlone/v3c1_tools.cc
==============================================================================
--- trunk/StandAlone/v3c1_tools.cc (original)
+++ trunk/StandAlone/v3c1_tools.cc Thu Mar 9 13:54:23 2006
@@ -46,17 +46,22 @@
FILE *out_file = 0;
FILE *normal_out_file = 0;
FILE *texcoord_out_file = 0;
+FILE *group_out_file = 0;
+FILE *name_out_file = 0;
int total_faces = 0;
bool use_normals = false;
bool use_texcoords = false;
bool flip_face_winding = false;
+bool no_overwrite = true;
bool compute_vertex_normals = false;
float vertex_normals_angle = 90.0f;
+bool use_group_file = false;
bool loud = false;
+
// Output file name.
char *output_file_name = 0;
@@ -226,6 +231,12 @@
else if (arg == "-loud") {
loud = true;
}
+ else if (arg == "-groups") {
+ use_group_file = true;
+ }
+ else if (arg == "-overwrite") {
+ no_overwrite = false;
+ }
else if (arg == "-in") {
file_list_begin = ++i;
file_list_end = file_list_begin+1;
@@ -268,7 +279,9 @@
" -vertex_normals <d> -- Use glm to compute vertex
normals using\n"
" the specified angle threshold
(in degrees)\n"
" -texcoords -- Output a vertex texture
file.\n"
+ " -groups -- Output a .grp and .nam file.\n"
" -loud -- Print per group info.\n"
+ " -overwrite -- Required if output files
already exist.\n"
" v3c1_tools -m -in <file1.m ...> -color <r> <g> <b>
[-out <outfile.v3c1>]\n"
" Hughes Hoppe .m file format conversion.\n\n"
" v3c1_tools -info <infile.v3c1 ...>\n"
@@ -310,6 +323,13 @@
// Check to see if more then one output file should be used.
if (output_file_name) {
+
+ // Check to see if the output file already exists.
+ if (no_overwrite && (fopen( output_file_name, "r") != 0)) {
+ std::cout << "Error, output file exists and -overwrite was not
specified." << std::endl;
+ return 1;
+ }
+
// Open the output file.
if ((out_file = fopen( output_file_name, "w" )) == 0)
{
perror( "Could not open output file." );
@@ -335,6 +355,21 @@
<< file_name << std::endl;
}
}
+
+ if (use_group_file) {
+ char file_name[128];
+ sprintf( file_name, "%s.grp", output_file_name );
+ if ((group_out_file = fopen( file_name, "w" )) == 0) {
+ std::cout << "Error could not open group output file: "
+ << file_name << std::endl;
+ }
+
+ sprintf( file_name, "%s.nam", output_file_name );
+ if ((name_out_file = fopen( file_name, "w" )) == 0) {
+ std::cout << "Error could not open name output file: "
+ << file_name << std::endl;
+ }
+ }
}
for (int i=file_list_begin;i<file_list_end;++i) {
@@ -590,6 +625,9 @@
FILE *out;
FILE *normal_out = 0;
FILE *texcoord_out = 0;
+
+ FILE *group_out = 0;
+ FILE *name_out = 0;
int group_num = 0;
@@ -597,6 +635,8 @@
v3c1_face out_face;
Vector normal[3];
float texcoord[3][2] = { {0, 0}, {1, 1}, {2, 2} };
+
+ size_t group_name_offset = 0;
// Iterate over the groups.
GLMgroup *group = model->groups;
@@ -633,7 +673,7 @@
<< texcoord_file_name << std::endl;
}
}
-
+
printf( "Group: %d File: %s ", group_num, file_name );
}
else {
@@ -641,9 +681,15 @@
out = out_file;
normal_out = normal_out_file;
texcoord_out = texcoord_out_file;
+ group_out = group_out_file;
+ name_out = name_out_file;
}
-
+
+
///////////////////////////////////////////////////////////////////////////
+
///////////////////////////////////////////////////////////////////////////
// Output all of the triangles in the group.
+
///////////////////////////////////////////////////////////////////////////
+
///////////////////////////////////////////////////////////////////////////
for (int i=0;i<group->numtriangles;++i) {
int tri_index = group->triangles[i];
@@ -697,7 +743,7 @@
<< " number of texcoords: " << model->numtexcoords
<< std::endl;
}
- }
+ }
}
/////////////////////////////////////////////////////////////////////////
@@ -727,8 +773,20 @@
if (texcoord_out) {
fwrite( &texcoord, sizeof(float)*6, 1, texcoord_out );
}
+
+ if (group_out) {
+ fwrite( &group_name_offset, sizeof(int), 1, group_out );
+ }
}
+ // Output the group name and update the offset.
+ if (name_out) {
+ const size_t size = strlen(group->name)+1;
+
+ fwrite( group->name, size, 1, name_out );
+ group_name_offset += size;
+ }
+
// Close the file if we are using one per group.
if (out_file == 0) {
fclose( out );
Modified: trunk/fox/FManta/FMantaWindow.cc
==============================================================================
--- trunk/fox/FManta/FMantaWindow.cc (original)
+++ trunk/fox/FManta/FMantaWindow.cc Thu Mar 9 13:54:23 2006
@@ -622,7 +622,7 @@
// Check to see if the cutting plane should be snapped to an axis.
if (cutting_snap) {
- Real snap_data[] = { 1.0, 0.0, 0.0 ,
+ static const Real snap_data[] = { 1.0, 0.0, 0.0 ,
0.0, 1.0, 0.0 ,
0.0, 0.0, 1.0 ,
-1.0, 0.0, 0.0 ,
@@ -646,7 +646,10 @@
// Add a cutting plane at this point.
manta_interface->addTransaction("Add Cutting Plane",
Callback::create(this,&FMantaWindow::mantaAddCuttingPlane,point,normal));
-
+
+ // std::cerr << "Point: " << point << "\n";
+ // std::cerr << "Normal: " << normal << "\n";
+
// Enable the cutting plane slider.
cutting_slider->enable();
cutting_flip->enable();
Modified: trunk/fox/dm_demo/dm_demo.cc
==============================================================================
--- trunk/fox/dm_demo/dm_demo.cc (original)
+++ trunk/fox/dm_demo/dm_demo.cc Thu Mar 9 13:54:23 2006
@@ -151,7 +151,7 @@
// Construct Manta.
manta_interface = createManta();
- manta_interface->setScenePath (".");
+ manta_interface->setScenePath ("");
manta_interface->changeNumWorkers ( np );
manta_interface->selectImageType ( "rgb8" );
manta_interface->selectLoadBalancer ( "workqueue" );
- [MANTA] r980 - in trunk: Model/Groups StandAlone fox/FManta fox/dm_demo, abe, 03/09/2006
Archive powered by MHonArc 2.6.16.