Update of /cvsroot/plib/plib/src/ssg
In directory sc8-pr-cvs1:/tmp/cvs-serv8787
Added Files:
ssgVertSplitter.cxx
Log Message:
Andy Ross's vertex splitter
--- NEW FILE: ssgVertSplitter.cxx ---
////////////////////////////////////////////////////////////////////////
//
// Copyright 2003, Andrew Ross
//
// Walk through an indexed triangle list, splitting vertices that
// share "sharp" edges, and calculate normals for the resulting mesh.
//
// This code should really live inside the OptVertexList class in
// ssgOptimizer.cxx, whose data model is almost 1:1 compatible with
// the indexed triangle representation here. It is a separate file
// because it comes from separate code that Andy Ross wrote for a
// different project, and this was the cleanest way to do the port.
//
////////////////////////////////////////////////////////////////////////
#include "ssgVertSplitter.h"
#include <math.h>
#include <plib/sg.h>
[...308 lines suppressed...]
if(_geomVerts[i] != i) sgCopyVec3(norm(i), norm(_geomVerts[i]));
// Now, if necessary, duplicate the vertices that got "condensed"
// earlier by creating a new vertex and cloning the normal.
expandDuplicates();
#if 0
static int allOrig = 0;
static int allFinal = 0;
allOrig += _origVerts;
allFinal += _nVerts;
fprintf(stderr, "%d -> %d (%d/%d)\n", _origVerts, _nVerts,
allOrig, allFinal);
#endif
delete[] vCounts;
delete[] vtspace;
delete[] vTris;
delete[] newNorms;
}
|